TopSysRoleMapper.xml 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.zhongzheng.modules.top.user.mapper.TopSysRoleMapper">
  6. <resultMap type="com.zhongzheng.modules.top.user.domain.TopSysRole" id="TopSysRoleResult">
  7. <result property="roleId" column="role_id"/>
  8. <result property="roleName" column="role_name"/>
  9. <result property="roleKey" column="role_key"/>
  10. <result property="roleSort" column="role_sort"/>
  11. <result property="dataScope" column="data_scope"/>
  12. <result property="menuCheckStrictly" column="menu_check_strictly"/>
  13. <result property="deptCheckStrictly" column="dept_check_strictly"/>
  14. <result property="status" column="status"/>
  15. <result property="delFlag" column="del_flag"/>
  16. <result property="createBy" column="create_by"/>
  17. <result property="createTime" column="create_time"/>
  18. <result property="updateBy" column="update_by"/>
  19. <result property="updateTime" column="update_time"/>
  20. <result property="remark" column="remark"/>
  21. </resultMap>
  22. <sql id="selectRoleVo">
  23. select distinct r.role_id,
  24. r.role_name,
  25. r.role_key,
  26. r.role_sort,
  27. r.data_scope,
  28. r.menu_check_strictly,
  29. r.dept_check_strictly,
  30. r.status,
  31. r.del_flag,
  32. r.create_time,
  33. r.remark
  34. from top_sys_role r
  35. left join top_sys_user_role ur on ur.role_id = r.role_id
  36. left join top_sys_user u on u.user_id = ur.user_id
  37. left join top_sys_dept d on u.dept_id = d.dept_id
  38. </sql>
  39. <select id="selectRolePermissionByUserId" parameterType="Long" resultMap="TopSysRoleResult">
  40. <include refid="selectRoleVo"/>
  41. WHERE r.del_flag = '0' and ur.user_id = #{userId}
  42. </select>
  43. <select id="selectRoleListByUserId" parameterType="Long" resultType="Integer">
  44. select r.role_id
  45. from top_sys_role r
  46. left join top_sys_user_role ur on ur.role_id = r.role_id
  47. left join top_sys_user u on u.user_id = ur.user_id
  48. where u.user_id = #{userId}
  49. </select>
  50. <select id="selectRolesByUserName" parameterType="String" resultMap="TopSysRoleResult">
  51. <include refid="selectRoleVo"/>
  52. WHERE r.del_flag = '0' and u.user_name = #{userName}
  53. </select>
  54. </mapper>