kongdeqiang
2023-03-27 172c5525cbdba1c3b32b47cb60bd35bed707101c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?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="cn.exrick.xboot.core.dao.mapper.UserRoleMapper">
 
    <select id="findByUserId" resultType="cn.exrick.xboot.core.entity.Role">
      SELECT r.id id, name, r.data_type
      FROM t_user_role ur
      LEFT JOIN t_role r
      ON ur.role_id = r.id
      WHERE user_Id = #{userId}
    </select>
 
    <select id="findDepIdsByUserId" resultType="java.lang.String">
        SELECT DISTINCT rd.department_id
        FROM t_role_department rd
        WHERE role_id IN
        ( SELECT ur.role_id FROM t_user_role ur WHERE ur.user_id = #{userId} )
    </select>
</mapper>