<?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> <resultMap id="HcmRoleMap" type="com.yifu.cloud.plus.v1.yifu.admin.api.vo.HcmRoleInfoVo"> <result column="role_id" property="roleId"/> <result column="role_name" property="roleName"/> </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, r.client_id 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> <select id="getRoleAndMenu" resultType="com.yifu.cloud.plus.v1.yifu.admin.api.vo.BusinessRoleMenuVo"> SELECT a.role_id, a.role_name, c.menu_id, c.name, c.sort_order FROM sys_role a, sys_role_menu b LEFT JOIN sys_menu c on b.menu_id =c.menu_id where a.client_id = "hrCustomer" and a.del_flag = '0' <if test="null != type"> and c.type = #{type} </if> and c.del_flag = "0" and a.role_id =b.role_id ; </select> <select id="getRoleByUserIdAndClient" resultType="java.lang.String"> select a.role_id from sys_user_role a left join sys_role b on a.role_id = b.role_id where a.user_id = #{userId} and b.client_id = #{clientId} and b.del_flag = '0' </select> <select id="getRoleList" resultMap="HcmRoleMap"> SELECT a.role_id, a.role_name FROM sys_role a where a.client_id = 'yifu-mvp' and a.del_flag = '0' </select> </mapper>