Нет описания

TLhzxMenuMapper.xml 5.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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.TLhzxMenuMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.yt.zhylplat.moduleLhzx.role.entity.TLhzxMenu">
  6. <id column="id" property="id" />
  7. <result column="menu_name" property="menuName" />
  8. <result column="parent_id" property="parentId" />
  9. <result column="parent_name" property="parentName" />
  10. <result column="order_num" property="orderNum" />
  11. <result column="path" property="path" />
  12. <result column="component" property="component" />
  13. <result column="is_frame" property="isFrame" />
  14. <result column="is_cache" property="isCache" />
  15. <result column="menu_type" property="menuType" />
  16. <result column="visible" property="visible" />
  17. <result column="status" property="status" />
  18. <result column="perms" property="perms" />
  19. <result column="icon" property="icon" />
  20. <result column="remark" property="remark" />
  21. <result column="create_user_id" property="createUserId" />
  22. <result column="create_date" property="createDate" />
  23. <result column="update_user_id" property="updateUserId" />
  24. <result column="update_date" property="updateDate" />
  25. <result column="del_flg" property="delFlg" />
  26. </resultMap>
  27. <!-- 通用查询结果列 -->
  28. <sql id="Base_Column_List">
  29. id, menu_name, parent_id, parent_name, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, remark, create_user_id, create_date, update_user_id, update_date, del_flg
  30. </sql>
  31. <select id="selectMenuByUserId" resultType="com.yt.zhylplat.moduleLhzx.role.entity.TLhzxMenu">
  32. select
  33. *,
  34. id as menuId
  35. from
  36. T_Lhzx_Menu
  37. where
  38. del_flg = 0
  39. and
  40. menu_type in ('M', 'C')
  41. and
  42. status = 0
  43. and
  44. id in (
  45. select
  46. rm.menu_id
  47. from
  48. T_Lhzx_User_Role ur
  49. left join
  50. T_Lhzx_Role_Menu rm on ur.role_id = rm.role_id
  51. where
  52. ur.del_flg = 0
  53. and
  54. rm.del_flg = 0
  55. and
  56. ur.user_id = #{userId}
  57. )
  58. <if test="deptType != null">
  59. and dept_type = #{deptType}
  60. </if>
  61. order by
  62. parent_id, order_num
  63. </select>
  64. <select id="selectMenuList" resultType="com.yt.zhylplat.moduleLhzx.role.entity.TLhzxMenu">
  65. select
  66. *,
  67. id as menuId
  68. from
  69. T_Lhzx_Menu
  70. <where>
  71. <if test="menuName != null and menuName != ''">
  72. AND menu_name like concat('%', #{menuName}, '%')
  73. </if>
  74. <if test="visible != null and visible != ''">
  75. AND visible = #{visible}
  76. </if>
  77. <if test="status != null and status != ''">
  78. AND status = #{status}
  79. </if>
  80. <if test="deptType != null">
  81. AND dept_type = #{deptType}
  82. </if>
  83. and del_flg = 0
  84. </where>
  85. order by parent_id, order_num
  86. </select>
  87. <select id="selectMenuListByUserId" resultType="com.yt.zhylplat.moduleLhzx.role.entity.TLhzxMenu">
  88. select distinct
  89. m.id,
  90. m.parent_id,
  91. m.menu_name,
  92. m.path,
  93. m.component,
  94. m.visible,
  95. m.status,
  96. ifnull(m.perms,'') as perms,
  97. m.is_frame,
  98. m.is_cache,
  99. m.menu_type,
  100. m.icon,
  101. m.order_num,
  102. m.create_date
  103. from T_Lhzx_Menu m
  104. left join T_Lhzx_Role_Menu rm on m.id = rm.menu_id
  105. left join T_Lhzx_User_Role ur on rm.role_id = ur.role_id
  106. left join T_Lhzx_Role ro on ur.role_id = ro.id
  107. where ur.user_id = #{params.userId}
  108. <if test="menuName != null and menuName != ''">
  109. AND m.menu_name like concat('%', #{menuName}, '%')
  110. </if>
  111. <if test="visible != null and visible != ''">
  112. AND m.visible = #{visible}
  113. </if>
  114. <if test="status != null and status != ''">
  115. AND m.status = #{status}
  116. </if>
  117. order by m.parent_id, m.order_num
  118. </select>
  119. <select id="selectMenuPermsByUserId" resultType="java.lang.String">
  120. select distinct
  121. m.perms
  122. from
  123. T_Lhzx_Menu m
  124. left join
  125. T_Lhzx_Role_Menu rm on m.id = rm.menu_id
  126. left join
  127. T_Lhzx_User_Role ur on rm.role_id = ur.role_id
  128. left join
  129. T_Lhzx_Role r on r.id = ur.role_id
  130. where
  131. m.status = 0
  132. and
  133. r.status = 0
  134. and
  135. ur.user_id = #{userId}
  136. </select>
  137. </mapper>