Nessuna descrizione

TLhzxRoleMapper.xml 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.yt.zhylplat.moduleLhzx.role.mapper.TLhzxRoleMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.yt.zhylplat.moduleLhzx.role.entity.TLhzxRole">
  6. <id column="id" property="id" />
  7. <result column="role_name" property="roleName" />
  8. <result column="role_key" property="roleKey" />
  9. <result column="role_sort" property="roleSort" />
  10. <result column="data_scope" property="dataScope" />
  11. <result column="menu_check_strictly" property="menuCheckStrictly" />
  12. <result column="dept_check_strictly" property="deptCheckStrictly" />
  13. <result column="status" property="status" />
  14. <result column="remark" property="remark" />
  15. <result column="create_user_id" property="createUserId" />
  16. <result column="create_date" property="createDate" />
  17. <result column="update_user_id" property="updateUserId" />
  18. <result column="update_date" property="updateDate" />
  19. <result column="del_flg" property="delFlg" />
  20. </resultMap>
  21. <!-- 通用查询结果列 -->
  22. <sql id="Base_Column_List">
  23. id, role_name, role_key, role_sort, data_scope, menu_check_strictly, dept_check_strictly, status, remark, create_user_id, create_date, update_user_id, update_date, del_flg
  24. </sql>
  25. <select id="selectRoleByUserId" resultType="com.yt.zhylplat.moduleLhzx.role.entity.TLhzxRole">
  26. select
  27. *
  28. from
  29. T_Lhzx_Role
  30. where
  31. del_flg = 0
  32. and
  33. id in (
  34. select
  35. role_id
  36. from
  37. T_Lhzx_User_Role
  38. where
  39. del_flg = 0
  40. and
  41. user_id = #{userId}
  42. )
  43. </select>
  44. <select id="selectMenuListByRoleId" resultType="java.lang.Integer">
  45. select
  46. m.id
  47. from
  48. T_Lhzx_Menu m
  49. left join
  50. T_Lhzx_Role_Menu rm on m.id = rm.menu_id
  51. where rm.role_id = #{roleId}
  52. and m.dept_type = #{deptType}
  53. <if test="menuCheckStrictly">
  54. and m.id not in (
  55. select
  56. m.parent_id
  57. from
  58. T_Lhzx_Menu m
  59. inner join
  60. T_Lhzx_Role_Menu rm on m.id = rm.menu_id and rm.role_id = #{roleId}
  61. )
  62. </if>
  63. order by m.parent_id, m.order_num
  64. </select>
  65. <select id="selectRolePermissionByUserId" resultType="com.yt.zhylplat.moduleLhzx.role.entity.TLhzxRole">
  66. select distinct
  67. r.id,
  68. r.role_name,
  69. r.role_key,
  70. r.role_sort,
  71. r.data_scope,
  72. r.menu_check_strictly,
  73. r.dept_check_strictly,
  74. r.status,
  75. r.del_flg,
  76. r.create_date,
  77. r.remark,
  78. r.id as roleId
  79. from
  80. T_Lhzx_Role r
  81. left join
  82. T_Lhzx_User_Role ur on ur.role_id = r.id
  83. left join
  84. T_Sys_UserAccount u on u.F_UserId = ur.user_id
  85. WHERE
  86. r.del_flg = 0
  87. and
  88. ur.user_id = #{userId}
  89. </select>
  90. </mapper>