SysRoleMapper.xml 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 ([email protected])
  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.pig.admin.mapper.SysRoleMapper">
  22. <!-- 通用查询映射结果 -->
  23. <resultMap id="BaseResultMap" type="com.pig4cloud.pig.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 sys_role.role_id,
  35. sys_role.role_name,
  36. sys_role.role_code,
  37. sys_role.role_desc,
  38. sys_role.create_time,
  39. sys_role.update_time,
  40. sys_role.del_flag
  41. FROM sys_role,
  42. sys_user_role
  43. WHERE sys_role.role_id = sys_user_role.role_id
  44. AND sys_role.del_flag = '0'
  45. and sys_user_role.user_id = #{userId}
  46. </select>
  47. </mapper>