SysMenuMapper.xml 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. ~
  4. ~ Copyright (c) 2018-2025, lengleng All rights reserved.
  5. ~
  6. ~ Redistribution and use in source and binary forms, with or without
  7. ~ modification, are permitted provided that the following conditions are met:
  8. ~
  9. ~ Redistributions of source code must retain the above copyright notice,
  10. ~ this list of conditions and the following disclaimer.
  11. ~ Redistributions in binary form must reproduce the above copyright
  12. ~ notice, this list of conditions and the following disclaimer in the
  13. ~ documentation and/or other materials provided with the distribution.
  14. ~ Neither the name of the pig4cloud.com developer nor the names of its
  15. ~ contributors may be used to endorse or promote products derived from
  16. ~ this software without specific prior written permission.
  17. ~ Author: lengleng ([email protected])
  18. ~
  19. -->
  20. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  21. <mapper namespace="com.pig4cloud.pig.admin.mapper.SysMenuMapper">
  22. <!-- 通用查询映射结果 -->
  23. <resultMap id="BaseResultMap" type="com.pig4cloud.pig.admin.api.entity.SysMenu">
  24. <id column="menu_id" property="menuId"/>
  25. <result column="name" property="name"/>
  26. <result column="en_name" property="enName"/>
  27. <result column="permission" property="permission"/>
  28. <result column="path" property="path"/>
  29. <result column="parent_id" property="parentId"/>
  30. <result column="icon" property="icon"/>
  31. <result column="sort_order" property="sortOrder"/>
  32. <result column="menu_type" property="menuType"/>
  33. <result column="keep_alive" property="keepAlive"/>
  34. <result column="visible" property="visible"/>
  35. <result column="create_time" property="createTime"/>
  36. <result column="update_time" property="updateTime"/>
  37. <result column="del_flag" property="delFlag"/>
  38. <result column="embedded" property="embedded"/>
  39. <result column="visible" property="visible"/>
  40. </resultMap>
  41. <!--通过角色查询菜单信息-->
  42. <select id="listMenusByRoleId" resultMap="BaseResultMap">
  43. SELECT sys_menu.menu_id,
  44. sys_menu.name,
  45. sys_menu.en_name,
  46. sys_menu.permission,
  47. sys_menu.path,
  48. sys_menu.parent_id,
  49. sys_menu.icon,
  50. sys_menu.sort_order,
  51. sys_menu.keep_alive,
  52. sys_menu.menu_type,
  53. sys_menu.create_time,
  54. sys_menu.update_time,
  55. sys_menu.del_flag,
  56. sys_menu.embedded,
  57. sys_menu.visible
  58. FROM sys_menu
  59. LEFT JOIN sys_role_menu ON sys_menu.menu_id = sys_role_menu.menu_id
  60. WHERE sys_menu.del_flag = '0'
  61. AND sys_role_menu.role_id = #{roleId}
  62. ORDER BY sys_menu.sort_order DESC
  63. </select>
  64. <!--通过角色ID 查询权限-->
  65. <select id="listPermissionsByRoleIds" resultType="java.lang.String">
  66. SELECT m.permission
  67. FROM sys_menu m,
  68. sys_role_menu rm
  69. WHERE m.menu_id = rm.menu_id
  70. AND m.del_flag = '0'
  71. AND rm.role_id IN (#{roleIds})
  72. </select>
  73. </mapper>