EAS版本:8.5
问题操作:授权权用户 和 administrator 分别对某单个用户做批量分配角色操作,选择业务组织-选择合并范围
授权权用户操作的关键查询条件:
1、当前登录的授权权用户 有合并范围 所属管理单元的管辖范围
2、被选择的用户 需要有 合并范围中 的业务组织的所属管理单元 的业务组织范围
administrator该操作的关键查询条件:
1、administrator 有合并范围 所属管理单元的管辖范围
疑问:此处查询逻辑为什么administrator没有第2点的限制? 第2点的限制是否合理?
录制的sql举例如下:
授权权用户(见以下sql标红那一段):
FROM
"T_ORG_STRUCTURE" "T0"
INNER JOIN
"T_ORG_TREE" "T1"
ON "T0"."FTREEID" = "T1"."FID"
INNER JOIN
"T_ORG_BASEUNIT" "T3"
ON "T0"."FUNITID" = "T3"."FID"
WHERE
"T1"."FTYPE" = 8
AND "T3"."FISUNION" = 1
AND (
"T1"."FSTATUS" = 1
OR "T1"."FSTATUS" = 2
)
AND (
"T1"."FCONTROLUNITID" IN (
SELECT
unit.fcontrolunitid
FROM
t_pm_orgrange RANGE
INNER JOIN
t_org_baseunit UNIT
ON range.forgid = unit.fid
WHERE
fuserid = '256c221a-0106-1000-e000-10d7c0a813f413B7DE7F'
AND ftype = 30
)
OR "T3"."FMAINTAINCUID" IN (
SELECT
unit.fcontrolunitid
FROM
t_pm_orgrange RANGE
INNER JOIN
t_org_baseunit UNIT
ON range.forgid = unit.fid
WHERE
fuserid = '256c221a-0106-1000-e000-10d7c0a813f413B7DE7F'
AND ftype = 30
)
AND "T1"."FCONTROLUNITID" NOT IN (
SELECT
unit.fcontrolunitid
FROM
t_pm_orgrange RANGE
INNER JOIN
t_org_baseunit UNIT
ON range.forgid = unit.fid
WHERE
fuserid = '256c221a-0106-1000-e000-10d7c0a813f413B7DE7F'
AND ftype = 30
)
)
AND "T3"."FCONTROLUNITID" IN (
SELECT
fid
FROM
t_org_baseunit
WHERE
fid IN (
SELECT
forgid
FROM
t_pm_orgrange
WHERE
fuserid IN (
'iOTBpy4UQ9Wc7TzfGbPcghO33n8='
)
AND ftype = 10
)
AND (
fcontrolunitid IN (
SELECT
forgid
FROM
t_pm_orgrange
WHERE
fuserid = '256c221a-0106-1000-e000-10d7c0a813f413B7DE7F'
AND ftype = 30
)
OR fisunion = 1
AND fmaintaincuid IN (
SELECT
forgid
FROM
t_pm_orgrange
WHERE
fuserid = '256c221a-0106-1000-e000-10d7c0a813f413B7DE7F'
AND ftype = 30
)
)
)
ORDER BY
"T1"."FNUMBER" ASC,
"T1.STARTDATE" ASC
administrator:
FROM "T_ORG_STRUCTURE" "T0" INNER JOIN "T_ORG_TREE" "T1" ON "T0"."FTREEID" = "T1"."FID" INNER JOIN "T_ORG_BASEUNIT" "T3" ON "T0"."FUNITID" = "T3"."FID" WHERE "T1"."FTYPE" = 8 AND "T3"."FISUNION" = 1 AND ( "T1"."FSTATUS" = 1 OR "T1"."FSTATUS" = 2 ) AND ( "T1"."FCONTROLUNITID" IN ( SELECT forgid FROM t_pm_orgrange WHERE fuserid = '00000000-0000-0000-0000-00000000000013B7DE7F' AND ftype = 10 ) OR "T3"."FMAINTAINCUID" IN ( SELECT forgid FROM t_pm_orgrange WHERE fuserid = '00000000-0000-0000-0000-00000000000013B7DE7F' AND ftype = 10 ) AND "T1"."FCONTROLUNITID" NOT IN ( SELECT forgid FROM t_pm_orgrange WHERE fuserid = '00000000-0000-0000-0000-00000000000013B7DE7F' AND ftype = 10 ) ) ORDER BY "T1"."FNUMBER" ASC, "T1.STARTDATE" ASC
推荐阅读