de/backend/src/main/java/io/dataease/ext/MobileDirMapper.xml
2022-04-15 16:08:33 +08:00

82 lines
2.4 KiB
XML

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="io.dataease.ext.MobileDirMapper">
<select id="query" resultType="io.dataease.mobile.entity.PanelEntity">
SELECT
id,
NAME AS text,
pid,
node_type AS `type`
FROM
panel_group g,
( SELECT GET_V_AUTH_MODEL_ID_P_USE_MOBILE ( #{userId}, 'panel' ) cids ) t
WHERE
g.pid = #{pid}
AND FIND_IN_SET( g.id, cids )
</select>
<select id="queryWithName" resultType="io.dataease.mobile.entity.PanelEntity">
SELECT
id,
NAME AS text,
pid,
node_type AS `type`
FROM
panel_group g,
( SELECT GET_V_AUTH_MODEL_ID_P_USE_MOBILE ( #{userId}, 'panel' ) cids ) t
WHERE
FIND_IN_SET( g.id, cids )
<if test="name != null">
and name like CONCAT('%', #{name, jdbcType=VARCHAR}, '%')
</if>
</select>
<select id="idsWithUser" resultType="java.lang.String">
select a.auth_source
from sys_auth a
left join sys_auth_detail d on a.id = d.auth_id
where
a.auth_target_type = 'user' and
a.auth_target = #{userId} and
a.auth_source_type = 'panel' and
d.privilege_type = 1 and
d.privilege_value = 1
</select>
<select id="idsWithDept" resultType="java.lang.String">
select a.auth_source
from sys_auth a
left join sys_auth_detail d on a.id = d.auth_id
where
a.auth_target_type = 'dept' and
a.auth_target = #{deptId} and
a.auth_source_type = 'panel' and
d.privilege_type = 1 and
d.privilege_value = 1
</select>
<select id="idsWithRoles" resultType="java.lang.String">
select a.auth_source
from sys_auth a
left join sys_auth_detail d on a.id = d.auth_id
where
a.auth_target_type = 'role' and
a.auth_target in
<foreach collection="roleIds" item="roleId" open='(' separator=',' close=')'>
#{roleId}
</foreach>
and
a.auth_source_type = 'panel' and
d.privilege_type = 1 and
d.privilege_value = 1
</select>
</mapper>