MenuMapper.xml 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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.tofly.base.mapper.MenuMapper">
  4. <resultMap id="menuMap" type="com.tofly.base.entity.Menu">
  5. <id property="id" column="ID"/>
  6. <result property="name" column="NAME"/>
  7. <result property="permission" column="PERMISSION"/>
  8. <result property="path" column="PATH"/>
  9. <result property="parentId" column="PARENT_ID"/>
  10. <result property="icon" column="ICON"/>
  11. <result property="sort" column="SORT"/>
  12. <result property="keepAlive" column="KEEP_ALIVE"/>
  13. <result property="type" column="TYPE"/>
  14. <result property="createTime" column="CREATE_TIME"/>
  15. <result property="updateTime" column="UPDATE_TIME"/>
  16. <result property="statusFlag" column="STATUS_FLAG"/>
  17. <result property="code" column="CODE"/>
  18. <result property="mouseIcon" column="MOUSE_ICON"/>
  19. <result property="inpanel" column="INPANEL"/>
  20. <result property="panel" column="PANEL"/>
  21. <result property="autorun" column="AUTORUN"/>
  22. <result property="sysId" column="SYS_ID"/>
  23. <result property="createUser" column="CREATE_USER"/>
  24. <result property="component" column="COMPONENT"/>
  25. <result property="label" column="LABEL"/>
  26. <result property="meta" column="META"/>
  27. <result property="parentPathid" column="PARENT_PATHID"/>
  28. <result property="pathId" column="PATH_ID"/>
  29. <result property="redirect" column="REDIRECT"/>
  30. <result property="widgetid" column="WIDGETID"/>
  31. </resultMap>
  32. <!--通过角色查询菜单信息-->
  33. <select id="listMenusByRoleId" resultMap="menuMap">
  34. SELECT TF_SMPN_MENU_X.*
  35. FROM TF_SMPN_MENU_X
  36. LEFT JOIN TF_SMPN_ROLEMENU_X ON TF_SMPN_MENU_X.id = TF_SMPN_ROLEMENU_X.menu_id
  37. WHERE TF_SMPN_MENU_X.status_flag = 1
  38. AND TF_SMPN_ROLEMENU_X.role_id = #{roleId}
  39. ORDER BY TF_SMPN_MENU_X.sort
  40. </select>
  41. <select id="getMenuListByUser" resultMap="menuMap">
  42. select *
  43. from TF_SMPN_MENU_X m
  44. where m.status_flag = '1'
  45. and exists(select 1
  46. from TF_SMPN_USER_X u,
  47. TF_SMPN_USERROLE_X ur,
  48. TF_SMPN_ROLE_X r,
  49. TF_SMPN_ROLEMENU_X rm
  50. where u.id = ur.user_id
  51. and ur.role_id = r.id
  52. and rm.role_id = r.id
  53. and rm.menu_id = m.id
  54. and u.status_flag = '1'
  55. and r.status_flag = '1'
  56. and u.id = #{id})
  57. and exists(select 1 from TF_SMPN_SYSTEM_X s where m.sys_id = s.id and s.platform = #{platform,jdbcType=CHAR})
  58. order by sort
  59. </select>
  60. <select id="getMenuListByUserId" resultMap="menuMap">
  61. SELECT DISTINCT
  62. m.ID,m.NAME,m.PATH,m.PARENT_ID,m.ICON,m.SORT,m.KEEP_ALIVE,m.TYPE,m.SYS_ID,m.META,m.COMPONENT,m.LABEL,m.REDIRECT,m.WIDGETID,m.PATH_ID,m.PARENT_PATHID
  63. FROM
  64. TF_SMPN_MENU_X m LEFT JOIN TF_SMPN_ROLEMENU_X r ON ( m.ID = r.MENU_ID ) LEFT JOIN TF_SMPN_USERROLE_X u ON ( r.ROLE_ID = u.ROLE_ID )
  65. WHERE
  66. u.USER_ID = #{id}
  67. AND m.STATUS_FLAG = '1'
  68. -- AND m.TYPE IN ('sys','gis','app')
  69. ORDER BY m.ID
  70. </select>
  71. </mapper>