13693261870
2025-04-07 d12129642190fd3af26112b8d21f0d07f50c6657
se-modules/se-system/src/main/resources/mapper/system/SysMenuMapper.xml
@@ -2,7 +2,7 @@
<!DOCTYPE mapper
      PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
      "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.SysMenuMapper">
<mapper namespace="com.se.system.mapper.SysMenuMapper">
   <resultMap type="SysMenu" id="SysMenuResult">
      <id     property="menuId"         column="menu_id"        />
@@ -26,10 +26,11 @@
      <result property="updateTime"     column="update_time"    />
      <result property="updateBy"       column="update_by"      />
      <result property="remark"         column="remark"         />
      <result property="mark"           column="mark"         />
   </resultMap>
   <sql id="selectMenuVo">
        select menu_id, menu_name, parent_id, order_num, path, component, `query`, route_name, is_frame, is_cache, menu_type, visible, status, ifnull(perms,'') as perms, icon, create_time
        select menu_id, menu_name, parent_id, order_num, path, component, `query`, route_name, is_frame, is_cache, menu_type, visible, status, ifnull(perms,'') as perms, icon, create_time, mark
      from sys_menu
    </sql>
    
@@ -45,46 +46,81 @@
         <if test="status != null and status != ''">
            AND status = #{status}
         </if>
         <if test="mark != null and mark != ''">
            and mark = #{mark}
         </if>
      </where>
      order by parent_id, order_num
   </select>
   
   <select id="selectMenuTreeAll" resultMap="SysMenuResult">
      select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.`query`, m.route_name, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time
      from sys_menu m where m.menu_type in ('M', 'C') and m.status = 0
      select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.`query`, m.route_name, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time, m.mark
      from sys_menu m
      where m.menu_type in ('M', 'C') and m.status = 0
      <if test="mark != null and mark != ''">
         and m.mark = #{mark}
      </if>
      order by m.parent_id, m.order_num
   </select>
   
   <select id="selectMenuListByUserId" parameterType="SysMenu" resultMap="SysMenuResult">
      select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.`query`, m.route_name, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time
      select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.`query`, m.route_name, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time, m.mark
      from sys_menu m
      left join sys_role_menu rm on m.menu_id = rm.menu_id
      left join sys_user_role ur on rm.role_id = ur.role_id
      left join sys_role ro on ur.role_id = ro.role_id
      where ur.user_id = #{params.userId}
      <if test="menuName != null and menuName != ''">
            AND m.menu_name like concat('%', #{menuName}, '%')
      </if>
      <if test="visible != null and visible != ''">
            AND m.visible = #{visible}
      </if>
      <if test="status != null and status != ''">
            AND m.status = #{status}
      </if>
         left join sys_role_menu rm on m.menu_id = rm.menu_id
         left join sys_user_role ur on rm.role_id = ur.role_id
         left join sys_role ro on ur.role_id = ro.role_id
      <where>
         ur.user_id = #{params.userId}
         <if test="menuName != null and menuName != ''">
            AND m.menu_name like concat('%', #{menuName}, '%')
         </if>
         <if test="visible != null and visible != ''">
            AND m.visible = #{visible}
         </if>
         <if test="status != null and status != ''">
            AND m.status = #{status}
         </if>
         <if test="mark != null and mark != ''">
            AND m.mark = #{mark}
         </if>
      </where>
      order by m.parent_id, m.order_num
   </select>
    <select id="selectMenuTreeByUserId" parameterType="Long" resultMap="SysMenuResult">
      select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.`query`, m.route_name, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time
    <select id="selectMenuTreeByUserId" resultMap="SysMenuResult">
      select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.`query`, m.route_name, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time, m.mark
      from sys_menu m
          left join sys_role_menu rm on m.menu_id = rm.menu_id
          left join sys_user_role ur on rm.role_id = ur.role_id
          left join sys_role ro on ur.role_id = ro.role_id
          left join sys_user u on ur.user_id = u.user_id
      where u.user_id = #{userId} and m.menu_type in ('M', 'C') and m.status = 0  AND ro.status = 0
      where m.menu_type in ('M', 'C') and m.status = 0 and ro.status = 0
         <if test="userId != null">
            and u.user_id = #{userId}
         </if>
         <if test="mark != null and mark != ''">
            and m.mark = #{mark}
         </if>
      order by m.parent_id, m.order_num
   </select>
   <select id="selectMenusByUserIdAndMark" resultMap="SysMenuResult">
      select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.`query`, m.route_name, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time, m.mark
      from sys_menu m
         left join sys_role_menu rm on m.menu_id = rm.menu_id
         left join sys_user_role ur on rm.role_id = ur.role_id
         left join sys_role ro on ur.role_id = ro.role_id
         left join sys_user u on ur.user_id = u.user_id
      where m.menu_type in ('M', 'C', 'F') and m.status = 0 and ro.status = 0
         <if test="userId != null and userId != ''">
            and u.user_id = #{userId}
         </if>
         <if test="mark != null and mark != ''">
            and m.mark = #{mark}
         </if>
      order by m.parent_id, m.order_num
   </select>
   <select id="selectMenuListByRoleId" resultType="Long">
      select m.menu_id
      from sys_menu m
@@ -152,6 +188,7 @@
         <if test="icon !=null and icon != ''">icon = #{icon},</if>
         <if test="remark != null and remark != ''">remark = #{remark},</if>
         <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
         <if test="mark != null and mark != ''">mark = #{mark},</if>
         update_time = sysdate()
      </set>
      where menu_id = #{menuId}
@@ -176,6 +213,7 @@
      <if test="icon != null and icon != ''">icon,</if>
      <if test="remark != null and remark != ''">remark,</if>
      <if test="createBy != null and createBy != ''">create_by,</if>
      <if test="mark != null and mark != ''">mark,</if>
      create_time
      )values(
      <if test="menuId != null and menuId != 0">#{menuId},</if>
@@ -195,6 +233,7 @@
      <if test="icon != null and icon != ''">#{icon},</if>
      <if test="remark != null and remark != ''">#{remark},</if>
      <if test="createBy != null and createBy != ''">#{createBy},</if>
      <if test="mark != null and mark != ''">#{mark},</if>
      sysdate()
      )
   </insert>