<?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.doumee.dao.system.SystemRoleMapper">
|
|
<!-- 查询角色列表 -->
|
<resultMap id="SystemRoleListVO" type="com.doumee.dao.system.vo.SystemRoleListVO" autoMapping="true">
|
<id column="ID" property="id"/>
|
<association property="createUserInfo" javaType="com.doumee.dao.system.model.SystemUser">
|
<id column="CREATE_USER_ID" property="id"/>
|
<result column="CREATE_USER_NAME" property="username"/>
|
</association>
|
<association property="updateUserInfo" javaType="com.doumee.dao.system.model.SystemUser">
|
<id column="UPDATE_USER_ID" property="id"/>
|
<result column="UPDATE_USER_NAME" property="username"/>
|
</association>
|
</resultMap>
|
<select id="selectManageList" parameterType="com.doumee.dao.system.dto.QuerySystemUserDTO" resultMap="SystemRoleListVO">
|
SELECT
|
role.ID, role.`CODE`, role.`NAME`, role.`REMARK`, role.`FIXED`, role.`CREATE_TIME`, role.`UPDATE_TIME`,
|
create_user.ID CREATE_USER_ID, create_user.`USERNAME` CREATE_USER_NAME,
|
update_user.ID UPDETE_USER_ID, update_user.`USERNAME` UPDATE_USER_NAME
|
FROM SYSTEM_ROLE role
|
LEFT JOIN `SYSTEM_USER` create_user ON create_user.ID = role.CREATE_USER
|
LEFT JOIN `SYSTEM_USER` update_user ON update_user.ID = role.UPDATE_USER
|
<where>
|
role.DELETED = 0
|
<if test="dto.code != null and dto.code != ''">
|
AND role.`CODE` LIKE CONCAT('%', #{dto.code}, '%')
|
</if>
|
<if test="dto.name != null and dto.name != ''">
|
AND role.`NAME` LIKE CONCAT('%', #{dto.name}, '%')
|
</if>
|
</where>
|
${orderByClause}
|
</select>
|
|
<!-- 查询用户角色列表 -->
|
<select id="selectByUserId" parameterType="java.lang.Integer" resultType="com.doumee.dao.system.model.SystemRole">
|
SELECT
|
role.ID, role.`CODE`, role.`NAME`, role.`REMARK`, role.`CREATE_TIME`, role.`UPDATE_TIME`
|
FROM SYSTEM_ROLE role
|
INNER JOIN SYSTEM_USER_ROLE user_role ON user_role.ROLE_ID = role.ID AND user_role.DELETED = 0
|
<where>
|
role.DELETED = 0
|
AND user_role.USER_ID = #{userId}
|
</where>
|
</select>
|
|
</mapper>
|