77 lines
3.0 KiB
XML
77 lines
3.0 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="com.tiesheng.role.mapper.CoreRoleUserMapper">
|
|
<resultMap id="BaseResultMap" type="com.tiesheng.role.pojos.dao.CoreRoleUser">
|
|
<!--@mbg.generated-->
|
|
<!--@Table core_role_user-->
|
|
<id column="id" jdbcType="VARCHAR" property="id" />
|
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
|
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
|
<result column="is_deleted" jdbcType="INTEGER" property="isDeleted" />
|
|
<result column="user_id" jdbcType="VARCHAR" property="userId" />
|
|
<result column="type" jdbcType="VARCHAR" property="type" />
|
|
<result column="type_id" jdbcType="VARCHAR" property="typeId" />
|
|
<result column="remark" jdbcType="VARCHAR" property="remark" />
|
|
<result column="expire_time" jdbcType="TIMESTAMP" property="expireTime" />
|
|
<result column="ext1" jdbcType="VARCHAR" property="ext1" />
|
|
<result column="ext2" jdbcType="VARCHAR" property="ext2" />
|
|
<result column="ext3" jdbcType="VARCHAR" property="ext3" />
|
|
</resultMap>
|
|
<sql id="Base_Column_List">
|
|
<!--@mbg.generated-->
|
|
id, create_time, update_time, is_deleted, user_id, `type`, type_id, remark, expire_time,
|
|
ext1, ext2, ext3
|
|
</sql>
|
|
|
|
<select id="page" resultType="com.tiesheng.role.pojos.vo.RoleUserPageVO">
|
|
select *,
|
|
(case cru.type
|
|
when 'menu' then (select name from core_role_authority where id = cru.type_id and is_deleted = 0)
|
|
when 'job' then (select name from core_role_group where id = cru.type_id and is_deleted = 0)
|
|
else '' end) type_name
|
|
from core_role_user cru
|
|
${ew.customSqlSegment}
|
|
</select>
|
|
|
|
<select id="getOwnerAuthorityLeafList" resultType="com.tiesheng.role.pojos.dao.CoreRoleAuthority">
|
|
select *
|
|
from core_role_authority
|
|
where is_open = 1
|
|
and is_deleted = 0
|
|
and
|
|
id in (select type_id
|
|
from core_role_user
|
|
where type = 'menu'
|
|
and user_id = #{userId}
|
|
and is_deleted = 0
|
|
and (expire_time is null or expire_time > now())
|
|
|
|
union
|
|
|
|
select crgr.menu_id
|
|
from core_role_user cru
|
|
left join core_role_group_rx crgr on crgr.group_id = cru.type_id
|
|
where cru.type = 'job'
|
|
and cru.user_id = #{userId}
|
|
and cru.is_deleted = 0
|
|
and (cru.expire_time is null or cru.expire_time > now())
|
|
<if test="type != null and type != ''">
|
|
and crgr.type=#{type}
|
|
</if>
|
|
|
|
<if test="roleId != null and roleId != ''">
|
|
union
|
|
|
|
select menu_id
|
|
from core_role_group_rx
|
|
where group_id = #{roleId}
|
|
<if test="type != null and type != ''">
|
|
and type=#{type}
|
|
</if>
|
|
</if>
|
|
)
|
|
order by sort
|
|
</select>
|
|
|
|
</mapper>
|