SysRoleMapper.xml 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. ~
  4. ~ Copyright (c) 2018-2025, lengleng All rights reserved.
  5. ~
  6. ~ Redistribution and use in source and binary forms, with or without
  7. ~ modification, are permitted provided that the following conditions are met:
  8. ~
  9. ~ Redistributions of source code must retain the above copyright notice,
  10. ~ this list of conditions and the following disclaimer.
  11. ~ Redistributions in binary form must reproduce the above copyright
  12. ~ notice, this list of conditions and the following disclaimer in the
  13. ~ documentation and/or other materials provided with the distribution.
  14. ~ Neither the name of the pig4cloud.com developer nor the names of its
  15. ~ contributors may be used to endorse or promote products derived from
  16. ~ this software without specific prior written permission.
  17. ~ Author: lengleng (wangiegie@gmail.com)
  18. ~
  19. -->
  20. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  21. <mapper namespace="com.pig4cloud.pigx.admin.mapper.SysRoleMapper">
  22. <!-- 通用查询映射结果 -->
  23. <resultMap id="BaseResultMap" type="com.pig4cloud.pigx.admin.api.entity.SysRole">
  24. <id column="role_id" property="roleId"/>
  25. <result column="role_name" property="roleName"/>
  26. <result column="role_code" property="roleCode"/>
  27. <result column="role_desc" property="roleDesc"/>
  28. <result column="create_time" property="createTime"/>
  29. <result column="update_time" property="updateTime"/>
  30. <result column="del_flag" property="delFlag"/>
  31. </resultMap>
  32. <!-- 通过用户ID,查询角色信息-->
  33. <select id="listRolesByUserId" resultMap="BaseResultMap">
  34. SELECT
  35. r.*
  36. FROM
  37. sys_role r, sys_user_role ur WHERE r.role_id = ur.role_id AND r.del_flag = 0 and ur.user_id IN (#{userId})
  38. </select>
  39. </mapper>