FROM (select get_grant_auths (#{modelType},#{createBy}) cids1) t1,
( SELECT * FROM v_auth_model
( SELECT * FROM (select get_grant_auths (#{modelType},#{createBy}) cids2) t2 ,v_auth_model
<where>
<where>
model_type = #{modelType}
model_type = #{modelType}
<iftest="createBy != null">
<iftest="1== withAuth">
and FIND_IN_SET(v_auth_model.id,GET_V_AUTH_MODEL_WITH_PARENT ( (select GROUP_CONCAT(id) from v_auth_model where model_type = #{modelType} and create_by =#{createBy}) ,#{modelType}))
and FIND_IN_SET(v_auth_model.id,GET_V_AUTH_MODEL_WITH_PARENT ( cids2 ,#{modelType}))
</if>
</if>
<iftest="pid !=null">
<iftest="pid !=null">
and v_auth_model.pid = #{pid}
and v_auth_model.pid = #{pid}
...
@@ -50,11 +50,11 @@
...
@@ -50,11 +50,11 @@
count( 1 ) AS `children_count`,
count( 1 ) AS `children_count`,
`authTemp`.`pid` AS `pid`
`authTemp`.`pid` AS `pid`
FROM
FROM
( SELECT * FROM v_auth_model
( SELECT * FROM (select get_grant_auths (#{modelType},#{createBy}) cids3) t3,v_auth_model
<where>
<where>
model_type = #{modelType}
model_type = #{modelType}
<iftest="createBy != null">
<iftest="1== withAuth">
and FIND_IN_SET(v_auth_model.id,GET_V_AUTH_MODEL_WITH_PARENT ( (select GROUP_CONCAT(id) from v_auth_model where model_type = #{modelType} and create_by =#{createBy}) ,#{modelType}))
and FIND_IN_SET(v_auth_model.id,GET_V_AUTH_MODEL_WITH_PARENT ( cids3 ,#{modelType}))
</if>
</if>
</where>
</where>
) authTemp
) authTemp
...
@@ -63,8 +63,8 @@
...
@@ -63,8 +63,8 @@
) authCount ON
) authCount ON
auth.id = authCount.pid
auth.id = authCount.pid
<where>
<where>
<iftest="createBy != null">
<iftest="1== withAuth">
(authCount.children_count>0 or auth.create_by = #{createBy})
(authCount.children_count>0 or FIND_IN_SET(auth.id,cids1) )