|
|
|
@ -313,35 +313,37 @@
|
|
|
|
|
|
|
|
|
|
<select id="grantDataScopeTreeByRole" resultMap="treeNodeResultMap"> |
|
|
|
|
SELECT |
|
|
|
|
* |
|
|
|
|
* |
|
|
|
|
FROM |
|
|
|
|
( |
|
|
|
|
SELECT |
|
|
|
|
id, |
|
|
|
|
parent_id, |
|
|
|
|
NAME AS title, |
|
|
|
|
id AS "value", |
|
|
|
|
id AS "key" |
|
|
|
|
FROM |
|
|
|
|
blade_menu |
|
|
|
|
WHERE |
|
|
|
|
category = 1 |
|
|
|
|
AND is_deleted = 0 |
|
|
|
|
AND id IN ( SELECT menu_id FROM blade_scope_data WHERE is_deleted = 0 AND menu_id IS NOT NULL ) |
|
|
|
|
AND id IN ( select menu_id from blade_role_menu where role_id in |
|
|
|
|
( |
|
|
|
|
SELECT |
|
|
|
|
id, |
|
|
|
|
parent_id, |
|
|
|
|
NAME AS title, |
|
|
|
|
id AS "value", |
|
|
|
|
id AS "key" |
|
|
|
|
FROM |
|
|
|
|
blade_menu |
|
|
|
|
WHERE |
|
|
|
|
category = 1 |
|
|
|
|
AND is_deleted = 0 |
|
|
|
|
AND id IN ( SELECT menu_id FROM blade_scope_data WHERE is_deleted = 0 AND menu_id IS NOT NULL ) |
|
|
|
|
AND ( |
|
|
|
|
id IN ( |
|
|
|
|
select menu_id from blade_role_menu where role_id in |
|
|
|
|
<foreach collection="list" index="index" item="item" open="(" separator="," close=")"> |
|
|
|
|
#{item} |
|
|
|
|
</foreach> ) |
|
|
|
|
OR id IN ( |
|
|
|
|
</foreach> |
|
|
|
|
) |
|
|
|
|
OR id IN ( |
|
|
|
|
select parent_id from blade_menu where is_deleted = 0 |
|
|
|
|
and id in ( select menu_id from blade_role_menu where role_id in |
|
|
|
|
<foreach collection="list" index="index" item="item" open="(" separator="," close=")"> |
|
|
|
|
#{item} |
|
|
|
|
</foreach> ) |
|
|
|
|
) |
|
|
|
|
ORDER BY |
|
|
|
|
sort |
|
|
|
|
) menu |
|
|
|
|
) |
|
|
|
|
) |
|
|
|
|
) menu |
|
|
|
|
|
|
|
|
|
UNION ALL |
|
|
|
|
|
|
|
|
@ -352,21 +354,25 @@
|
|
|
|
|
id AS "value", |
|
|
|
|
id AS "key" |
|
|
|
|
FROM |
|
|
|
|
blade_scope_data |
|
|
|
|
blade_scope_data |
|
|
|
|
WHERE |
|
|
|
|
is_deleted = 0 |
|
|
|
|
AND menu_id IN ( select menu_id from blade_role_menu where role_id in |
|
|
|
|
<foreach collection="list" index="index" item="item" open="(" separator="," close=")"> |
|
|
|
|
#{item} |
|
|
|
|
</foreach> ) |
|
|
|
|
AND ( |
|
|
|
|
menu_id IN ( |
|
|
|
|
select menu_id from blade_role_menu where role_id in |
|
|
|
|
<foreach collection="list" index="index" item="item" open="(" separator="," close=")"> |
|
|
|
|
#{item} |
|
|
|
|
</foreach> |
|
|
|
|
) |
|
|
|
|
OR menu_id IN ( |
|
|
|
|
select parent_id from blade_menu where is_deleted = 0 |
|
|
|
|
and id in ( select menu_id from blade_role_menu where role_id in |
|
|
|
|
<foreach collection="list" index="index" item="item" open="(" separator="," close=")"> |
|
|
|
|
#{item} |
|
|
|
|
</foreach> ) |
|
|
|
|
select parent_id from blade_menu where is_deleted = 0 |
|
|
|
|
and id in ( select menu_id from blade_role_menu where role_id in |
|
|
|
|
<foreach collection="list" index="index" item="item" open="(" separator="," close=")"> |
|
|
|
|
#{item} |
|
|
|
|
</foreach> ) |
|
|
|
|
) |
|
|
|
|
AND menu_id IS NOT NULL |
|
|
|
|
) |
|
|
|
|
AND menu_id IS NOT NULL |
|
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
<select id="grantApiScopeTreeByRole" resultMap="treeNodeResultMap"> |
|
|
|
@ -374,55 +380,63 @@
|
|
|
|
|
* |
|
|
|
|
FROM |
|
|
|
|
( |
|
|
|
|
SELECT |
|
|
|
|
id, |
|
|
|
|
parent_id, |
|
|
|
|
NAME AS title, |
|
|
|
|
id AS "value", |
|
|
|
|
id AS "key" |
|
|
|
|
FROM |
|
|
|
|
blade_menu |
|
|
|
|
WHERE |
|
|
|
|
category = 1 |
|
|
|
|
AND is_deleted = 0 |
|
|
|
|
AND id IN ( SELECT menu_id FROM blade_scope_api WHERE is_deleted = 0 AND menu_id IS NOT NULL ) |
|
|
|
|
AND id IN ( select menu_id from blade_role_menu where role_id in |
|
|
|
|
<foreach collection="list" index="index" item="item" open="(" separator="," close=")"> |
|
|
|
|
#{item} |
|
|
|
|
</foreach> ) |
|
|
|
|
OR id IN ( |
|
|
|
|
select parent_id from blade_menu where is_deleted = 0 |
|
|
|
|
and id in ( select menu_id from blade_role_menu where role_id in |
|
|
|
|
<foreach collection="list" index="index" item="item" open="(" separator="," close=")"> |
|
|
|
|
#{item} |
|
|
|
|
</foreach> ) |
|
|
|
|
) |
|
|
|
|
ORDER BY |
|
|
|
|
sort |
|
|
|
|
SELECT |
|
|
|
|
id, |
|
|
|
|
parent_id, |
|
|
|
|
NAME AS title, |
|
|
|
|
id AS "value", |
|
|
|
|
id AS "key" |
|
|
|
|
FROM |
|
|
|
|
blade_menu |
|
|
|
|
WHERE |
|
|
|
|
category = 1 |
|
|
|
|
AND is_deleted = 0 |
|
|
|
|
AND id IN ( SELECT menu_id FROM blade_scope_api WHERE is_deleted = 0 AND menu_id IS NOT NULL ) |
|
|
|
|
AND ( |
|
|
|
|
id IN ( |
|
|
|
|
select menu_id from blade_role_menu where role_id in |
|
|
|
|
<foreach collection="list" index="index" item="item" open="(" separator="," close=")"> |
|
|
|
|
#{item} |
|
|
|
|
</foreach> |
|
|
|
|
) |
|
|
|
|
OR id IN ( |
|
|
|
|
select parent_id from blade_menu where is_deleted = 0 |
|
|
|
|
and id in ( |
|
|
|
|
select menu_id from blade_role_menu where role_id in |
|
|
|
|
<foreach collection="list" index="index" item="item" open="(" separator="," close=")"> |
|
|
|
|
#{item} |
|
|
|
|
</foreach> ) |
|
|
|
|
) |
|
|
|
|
) |
|
|
|
|
) menu |
|
|
|
|
|
|
|
|
|
UNION ALL |
|
|
|
|
|
|
|
|
|
SELECT |
|
|
|
|
id, |
|
|
|
|
menu_id AS parent_id, |
|
|
|
|
scope_name AS title, |
|
|
|
|
id AS "value", |
|
|
|
|
id AS "key" |
|
|
|
|
id, |
|
|
|
|
menu_id AS parent_id, |
|
|
|
|
scope_name AS title, |
|
|
|
|
id AS "value", |
|
|
|
|
id AS "key" |
|
|
|
|
FROM |
|
|
|
|
blade_scope_api |
|
|
|
|
blade_scope_api |
|
|
|
|
WHERE |
|
|
|
|
is_deleted = 0 |
|
|
|
|
AND menu_id IN ( select menu_id from blade_role_menu where role_id in |
|
|
|
|
<foreach collection="list" index="index" item="item" open="(" separator="," close=")"> |
|
|
|
|
#{item} |
|
|
|
|
</foreach> ) |
|
|
|
|
OR menu_id IN ( |
|
|
|
|
select parent_id from blade_menu where is_deleted = 0 |
|
|
|
|
and id in ( select menu_id from blade_role_menu where role_id in |
|
|
|
|
<foreach collection="list" index="index" item="item" open="(" separator="," close=")"> |
|
|
|
|
#{item} |
|
|
|
|
</foreach> ) |
|
|
|
|
is_deleted = 0 |
|
|
|
|
AND |
|
|
|
|
( |
|
|
|
|
menu_id IN ( |
|
|
|
|
select menu_id from blade_role_menu where role_id in |
|
|
|
|
<foreach collection="list" index="index" item="item" open="(" separator="," close=")"> |
|
|
|
|
#{item} |
|
|
|
|
</foreach> |
|
|
|
|
) |
|
|
|
|
OR menu_id IN ( |
|
|
|
|
select parent_id from blade_menu where is_deleted = 0 |
|
|
|
|
and id in ( select menu_id from blade_role_menu where role_id in |
|
|
|
|
<foreach collection="list" index="index" item="item" open="(" separator="," close=")"> |
|
|
|
|
#{item} |
|
|
|
|
</foreach> ) |
|
|
|
|
) |
|
|
|
|
) |
|
|
|
|
AND menu_id IS NOT NULL |
|
|
|
|
</select> |
|
|
|
|