mapper.core.SysMenuMapper.xml Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ape-core Show documentation
Show all versions of ape-core Show documentation
Ape low code platform core module
The newest version!
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.ape9527.core.mapper.SysMenuMapper"> <select id="selectMenuByRole" resultType="com.ape9527.core.entity.SysMenu"> with recursive temp_menu as ( select m1.* from sys_menu m1 where m1.menu_type = 1 and m1.menu_name = '查询' and m1.uuid in ( SELECT substring( SUBSTRING_INDEX( SUBSTRING_INDEX( substring( r.permissions, 2, length( r.permissions )-2 ), ',', b.help_topic_id + 1 ), ',', -1), 2, length( SUBSTRING_INDEX( SUBSTRING_INDEX( substring( r.permissions, 2, length( r.permissions )-2 ), ',', b.help_topic_id + 1 ), ',', -1) )-2 ) FROM sys_role r JOIN mysql.help_topic b ON b.help_topic_id < ( length( r.permissions ) - length( REPLACE ( r.permissions, ',', '' )) + 1 ) WHERE role_code IN ( <foreach collection="roles" item="role" separator=","> #{role} </foreach> ) ) union all select m2.* from sys_menu m2 inner join temp_menu m3 on m2.uuid = m3.parent_id ) select DISTINCT * from temp_menu where menu_type = 0 and del = 0 ORDER BY sort </select> <select id="getChildByMenuRouter" resultType="com.ape9527.core.entity.SysMenu"> SELECT DISTINCT * FROM sys_menu m1 INNER JOIN sys_menu m2 ON m1.parent_id = m2.uuid WHERE m1.del = 0 AND m1.menu_type = 1 AND m2.menu_router = #{menuRouter} AND m1.uuid in ( SELECT substring( SUBSTRING_INDEX( SUBSTRING_INDEX( substring( r.permissions, 2, length( r.permissions )-2 ), ',', b.help_topic_id + 1 ), ',', -1), 2, length( SUBSTRING_INDEX( SUBSTRING_INDEX( substring( r.permissions, 2, length( r.permissions )-2 ), ',', b.help_topic_id + 1 ), ',', -1) )-2 ) FROM sys_role r JOIN mysql.help_topic b ON b.help_topic_id < ( length( r.permissions ) - length( REPLACE ( r.permissions, ',', '' )) + 1 ) WHERE role_code IN ( <foreach collection="roles" item="role" separator=","> #{role} </foreach> ) ) </select> <select id="getChildByMenuRouterIsRoot" resultType="com.ape9527.core.entity.SysMenu"> SELECT DISTINCT * FROM sys_menu m1 INNER JOIN sys_menu m2 ON m1.parent_id = m2.uuid WHERE m1.del = 0 AND m1.menu_type = 1 AND m2.menu_router = #{menuRouter} </select> </mapper>