MenuMapper.xml 1.4 KB

123456789101112131415161718192021222324252627282930
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  3. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  4. <mapper namespace="com.diagbot.mapper.MenuMapper">
  5. <!-- 通用查询映射结果 -->
  6. <resultMap id="BaseResultMap" type="com.diagbot.entity.wrapper.MenuWrapper">
  7. <id column="id" property="id"/>
  8. <result column="is_deleted" property="isDeleted"/>
  9. <result column="gmt_create" property="gmtCreate"/>
  10. <result column="gmt_modified" property="gmtModified"/>
  11. <result column="creator" property="creator"/>
  12. <result column="name" property="name"/>
  13. <result column="parent_id" property="parentId"/>
  14. <result column="code" property="code"/>
  15. <result column="order_no" property="orderNo"/>
  16. <result column="remark" property="remark"/>
  17. </resultMap>
  18. <select id="getByRole" resultMap="BaseResultMap">
  19. select distinct a.* from sys_menu a, sys_role_menu b, sys_user_role c
  20. where a.id = b.menu_id and b.role_id and b.role_id = c.role_id and c.user_id = #{userId}
  21. and a.is_deleted = 'N' and b.is_deleted = 'N' and c.is_deleted = 'N'
  22. ORDER BY a.parent_id , a.order_no
  23. </select>
  24. <select id="getSubMenuById" resultMap="BaseResultMap">
  25. select a.* from sys_menu a where a.is_deleted = 'N' and parent_id = #{id} ORDER BY order_no
  26. </select>
  27. </mapper>