<?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.newfiber.api.pc.dao.Sys_MenusDao" > <resultMap type="com.newfiber.api.pc.model.entity.SysMenus" id="BaseResultMap"> <id column="serial" property="serial" jdbcType="BIGINT"/> <result column="menu_no" property="menuNo" jdbcType="VARCHAR"/> <result column="menu_name" property="menuName" jdbcType="NVARCHAR"/> <result column="menu_value" property="menuValue" jdbcType="VARCHAR"/> </resultMap> <sql id = "Menus1_sql"> FROM sys_menus <where> 1=1 <if test="fuzzyQuery!=null"> AND (menu_no like '%${fuzzyQuery}%' OR menu_name like '%${fuzzyQuery}%') </if> </where> </sql> <select id="GetMenusCount" parameterType="com.newfiber.api.pc.model.entity.SysMenus" resultType="int"> SELECT COUNT(DISTINCT serial) total <include refid="Menus1_sql"></include> </select> <sql id="op"> <choose> <when test="sort!=null and sort != ''"> ${sort} </when> <otherwise> serial </otherwise> </choose> </sql> <sql id="oc"> <choose> <when test="order !=null and order != ''"> ${order} </when> <otherwise> DESC </otherwise> </choose> </sql> <select id="selectMenusList" parameterType="com.newfiber.api.pc.model.entity.SysMenus" resultType="com.newfiber.api.pc.model.entity.SysMenus"> select * <include refid="Menus1_sql"></include> order by <include refid="op"></include> <include refid="oc"></include> limit #{pageNo}, #{pageSize} </select> <select id="selectMenuList" parameterType="com.newfiber.api.pc.model.request.MenuListRequest" resultType="com.newfiber.api.pc.model.response.MenuResponse"> SELECT `sys_menus`.`serial` serial, `sys_menus`.`menu_no` menuNo, `sys_menus`.`menu_name` menuName, `sys_menus`.`menu_value` menuValue, `sys_menus`.`menu_grade` menuGrade, `sys_menus`.`menu_grade_zn` menuGradeZn, `sys_menus`.`parent_menu_id` parentMenuId, `sys_menus`.`menu_state` menuState, `sys_menus`.`menu_state_zn` menuStateZn, `sys_menus`.`menu_type` menuType, `sys_menus`.`menu_type_zn` menuTypeZn, `sys_menus`.`order_sort` orderSort, `sys_menus`.`remark` remark, `sys_menus`.`menu_icons` menuIcons, `sys_menus`.`icons_name` iconsName FROM `sys_menus` where 1 = 1 <include refid="whereCondition"/> order by order_sort is null, order_sort asc </select> <sql id="whereCondition"> <if test="userNo != null and userNo != ''"> and exists (select 1 from sys_menus sm join sys_menu_jurisdiction smj on sm.menu_no = smj.menu_no join sys_role_jurisdiction srj on smj.jurisdiction_no = srj.jurisdiction_no join sys_role_org sro on srj.role_no = sro.role_no join sys_user_org suo on sro.org_no = suo.org_no where (sys_menus.menu_no = smj.menu_no or sys_menus.menu_no = sm.parent_menu_id) and suo.user_no = #{userNo}) </if> <if test="parentMenuId == null or parentMenuId == ''"> and `sys_menus`.`menu_grade` = 1 </if> <if test="parentMenuId != null and parentMenuId != ''"> and sys_menus.parent_menu_id =#{parentMenuId} </if> </sql> </mapper>