From af6a08398e2bc22f3c8a3a615cbd9e23190be906 Mon Sep 17 00:00:00 2001
From: 疯狂的狮子li <15040126243@163.com>
Date: 星期四, 12 五月 2022 10:55:44 +0800
Subject: [PATCH] update 优化 文件与图片上传组件 使用id存储回显

---
 ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysMenuMapper.java |   86 ++++++++++--------------------------------
 1 files changed, 21 insertions(+), 65 deletions(-)

diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysMenuMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysMenuMapper.java
index d2c4638..8844f27 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysMenuMapper.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysMenuMapper.java
@@ -1,7 +1,11 @@
 package com.ruoyi.system.mapper;
 
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Constants;
+import com.ruoyi.common.constant.UserConstants;
 import com.ruoyi.common.core.domain.entity.SysMenu;
+import com.ruoyi.common.core.mapper.BaseMapperPlus;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
@@ -9,31 +13,24 @@
 /**
  * 鑿滃崟琛� 鏁版嵁灞�
  *
- * @author ruoyi
+ * @author Lion Li
  */
-public interface SysMenuMapper extends BaseMapper<SysMenu> {
-    /**
-     * 鏌ヨ绯荤粺鑿滃崟鍒楄〃
-     *
-     * @param menu 鑿滃崟淇℃伅
-     * @return 鑿滃崟鍒楄〃
-     */
-    public List<SysMenu> selectMenuList(SysMenu menu);
+public interface SysMenuMapper extends BaseMapperPlus<SysMenuMapper, SysMenu, SysMenu> {
 
     /**
      * 鏍规嵁鐢ㄦ埛鎵�鏈夋潈闄�
      *
      * @return 鏉冮檺鍒楄〃
      */
-    public List<String> selectMenuPerms();
+    List<String> selectMenuPerms();
 
     /**
      * 鏍规嵁鐢ㄦ埛鏌ヨ绯荤粺鑿滃崟鍒楄〃
      *
-     * @param menu 鑿滃崟淇℃伅
+     * @param queryWrapper 鏌ヨ鏉′欢
      * @return 鑿滃崟鍒楄〃
      */
-    public List<SysMenu> selectMenuListByUserId(SysMenu menu);
+    List<SysMenu> selectMenuListByUserId(@Param(Constants.WRAPPER) Wrapper<SysMenu> queryWrapper);
 
     /**
      * 鏍规嵁鐢ㄦ埛ID鏌ヨ鏉冮檺
@@ -41,14 +38,21 @@
      * @param userId 鐢ㄦ埛ID
      * @return 鏉冮檺鍒楄〃
      */
-    public List<String> selectMenuPermsByUserId(Long userId);
+    List<String> selectMenuPermsByUserId(Long userId);
 
     /**
      * 鏍规嵁鐢ㄦ埛ID鏌ヨ鑿滃崟
      *
      * @return 鑿滃崟鍒楄〃
      */
-    public List<SysMenu> selectMenuTreeAll();
+    default List<SysMenu> selectMenuTreeAll() {
+        LambdaQueryWrapper<SysMenu> lqw = new LambdaQueryWrapper<SysMenu>()
+            .in(SysMenu::getMenuType, UserConstants.TYPE_DIR, UserConstants.TYPE_MENU)
+            .eq(SysMenu::getStatus, UserConstants.MENU_NORMAL)
+            .orderByAsc(SysMenu::getParentId)
+            .orderByAsc(SysMenu::getOrderNum);
+        return this.selectList(lqw);
+    }
 
     /**
      * 鏍规嵁鐢ㄦ埛ID鏌ヨ鑿滃崟
@@ -56,7 +60,7 @@
      * @param userId 鐢ㄦ埛ID
      * @return 鑿滃崟鍒楄〃
      */
-    public List<SysMenu> selectMenuTreeByUserId(Long userId);
+    List<SysMenu> selectMenuTreeByUserId(Long userId);
 
     /**
      * 鏍规嵁瑙掕壊ID鏌ヨ鑿滃崟鏍戜俊鎭�
@@ -65,54 +69,6 @@
      * @param menuCheckStrictly 鑿滃崟鏍戦�夋嫨椤规槸鍚﹀叧鑱旀樉绀�
      * @return 閫変腑鑿滃崟鍒楄〃
      */
-    public List<Integer> selectMenuListByRoleId(@Param("roleId") Long roleId, @Param("menuCheckStrictly") boolean menuCheckStrictly);
+    List<Long> selectMenuListByRoleId(@Param("roleId") Long roleId, @Param("menuCheckStrictly") boolean menuCheckStrictly);
 
-    /**
-     * 鏍规嵁鑿滃崟ID鏌ヨ淇℃伅
-     *
-     * @param menuId 鑿滃崟ID
-     * @return 鑿滃崟淇℃伅
-     */
-    public SysMenu selectMenuById(Long menuId);
-
-    /**
-     * 鏄惁瀛樺湪鑿滃崟瀛愯妭鐐�
-     *
-     * @param menuId 鑿滃崟ID
-     * @return 缁撴灉
-     */
-    public int hasChildByMenuId(Long menuId);
-
-    /**
-     * 鏂板鑿滃崟淇℃伅
-     *
-     * @param menu 鑿滃崟淇℃伅
-     * @return 缁撴灉
-     */
-    public int insertMenu(SysMenu menu);
-
-    /**
-     * 淇敼鑿滃崟淇℃伅
-     *
-     * @param menu 鑿滃崟淇℃伅
-     * @return 缁撴灉
-     */
-    public int updateMenu(SysMenu menu);
-
-    /**
-     * 鍒犻櫎鑿滃崟绠$悊淇℃伅
-     *
-     * @param menuId 鑿滃崟ID
-     * @return 缁撴灉
-     */
-    public int deleteMenuById(Long menuId);
-
-    /**
-     * 鏍¢獙鑿滃崟鍚嶇О鏄惁鍞竴
-     *
-     * @param menuName 鑿滃崟鍚嶇О
-     * @param parentId 鐖惰彍鍗旾D
-     * @return 缁撴灉
-     */
-    public SysMenu checkMenuNameUnique(@Param("menuName") String menuName, @Param("parentId") Long parentId);
 }

--
Gitblit v1.9.3