1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yifu.cloud.plus.v1.yifu.admin.mapper.SysRoleMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysRole">
<id column="role_id" property="roleId"/>
<result column="role_name" property="roleName"/>
<result column="role_code" property="roleCode"/>
<result column="role_desc" property="roleDesc"/>
<result column="system_flag" property="systemFlag"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="del_flag" property="delFlag"/>
<result column="create_by" property="createBy"/>
<result column="update_by" property="updateBy"/>
</resultMap>
<!-- 通过用户ID,查询角色信息-->
<select id="listRolesByUserId" resultMap="BaseResultMap">
SELECT r.role_id,
r.role_name,
r.role_code,
r.role_desc,
r.system_flag,
r.del_flag,
r.create_time,
r.update_time,
r.update_by,
r.create_by
FROM sys_role r,
sys_user_role ur
WHERE r.role_id = ur.role_id
AND r.del_flag = 0
and ur.user_id = #{userId}
</select>
</mapper>