mappers.system.DefaultSysMenuMapper.xml Maven / Gradle / Ivy
<?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.lframework.starter.mybatis.mappers.system.DefaultSysMenuMapper"> <sql id="SysMenuDto_sql"> SELECT * FROM sys_menu </sql> <select id="query" resultType="com.lframework.starter.mybatis.entity.DefaultSysMenu"> <include refid="SysMenuDto_sql"/> ORDER BY code </select> <select id="selector" resultType="com.lframework.starter.mybatis.entity.DefaultSysMenu"> <include refid="SysMenuDto_sql"/> <where> <if test="vo != null"> <if test="vo.display != null"> AND display = #{vo.display} </if> </if> AND display IN (0, 1) </where> ORDER BY code </select> <select id="findById" resultType="com.lframework.starter.mybatis.entity.DefaultSysMenu"> <include refid="SysMenuDto_sql"/> WHERE id = #{id} </select> <select id="getChildrenById" resultType="com.lframework.starter.mybatis.entity.DefaultSysMenu"> <include refid="SysMenuDto_sql"/> WHERE parent_id = #{id} </select> <select id="getByRoleId" resultType="com.lframework.starter.mybatis.entity.DefaultSysMenu"> <include refid="SysMenuDto_sql"/> WHERE id IN ( SELECT menu_id FROM sys_role_menu WHERE role_id = #{roleId} ) ORDER BY code </select> </mapper>