Jelajahi Sumber

提交630第二阶段菜单配置新增未选中按钮图标配置

chenxiaofei 1 Minggu lalu
induk
melakukan
23be19d9d5

+ 4 - 4
sckw-modules/sckw-product/src/main/resources/bootstrap-cxf.yml

@@ -3,16 +3,16 @@ spring:
     nacos:
       discovery:
         # 服务注册地址
-        server-addr: @nacos.server@
+        server-addr: 118.116.4.155:8848
         # 命名空间
-        namespace: @nacos.namespace@
+        namespace: sckw-ng-service-platform-xf
         # 共享配置
         group: sckw-ng-service-platform
       config:
         # 配置中心地址
-        server-addr: @nacos.server@
+        server-addr: 118.116.4.155:8848
         # 命名空间
-        namespace: @nacos.namespace@
+        namespace: sckw-ng-service-platform-xf
         # 共享配置
         group: sckw-ng-service-platform
         # 配置文件格式

+ 5 - 0
sckw-modules/sckw-system/pom.xml

@@ -111,6 +111,11 @@
             <groupId>com.sckw</groupId>
             <artifactId>sckw-order-api</artifactId>
         </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
 
     </dependencies>
     <build>

+ 2 - 2
sckw-modules/sckw-system/src/main/java/com/sckw/system/controller/KwsMenuController.java

@@ -66,7 +66,7 @@ public class KwsMenuController {
 
     /**
      * @param params {clientType:终端类型、parentId:父级id、name:菜单名称、url:跳转地址、perms:权限标识、
-     *               type:类型:0目录/1菜单/2按钮、icon:图标、sort:排序、level:层级、custom:是否定制、
+     *               type:类型:0目录/1菜单/2按钮、icon:图标、notSelectedIconPath:未选中菜单图标路径、sort:排序、level:层级、custom:是否定制、
      *               isMain:是否主账号、usingRoles:适用企业类型(1供应商,2采购商,34PL物流,43PL物流)}
      * @return
      * @description 新增
@@ -81,7 +81,7 @@ public class KwsMenuController {
 
     /**
      * @param params {id:主键,clientType:终端类型、parentId:父级id、name:菜单名称、url:跳转地址、perms:权限标识、
-     *               type:类型:0目录/1菜单/2按钮、icon:图标、sort:排序、level:层级、custom:是否定制、
+     *               type:类型:0目录/1菜单/2按钮、icon:图标、notSelectedIconPath:未选中菜单图标路径、sort:排序、level:层级、custom:是否定制、
      *               isMain:是否主账号、usingRoles:适用企业类型(1供应商,2采购商,34PL物流,43PL物流)}
      * @desc 更新
      * @author zk

+ 7 - 1
sckw-modules/sckw-system/src/main/java/com/sckw/system/model/KwsMenu.java

@@ -60,6 +60,12 @@ public class KwsMenu extends BaseModel {
      */
     private String icon;
 
+    /**
+     * 未选中菜单图标路径
+     */
+    @Size(max = 255, message = "未选中菜单图标路径长度不能超过255")
+    private String notSelectedIconPath;
+
     /**
      * 排序
      */
@@ -90,4 +96,4 @@ public class KwsMenu extends BaseModel {
      */
     private String usingRoles;
 
-}
+}

+ 3 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/res/AppMenuPermItemResVo.java

@@ -46,6 +46,9 @@ public class AppMenuPermItemResVo implements Serializable {
     @Schema(description = "菜单图标")
     private String icon;
 
+    @Schema(description = "未选中菜单图标路径")
+    private String notSelectedIconPath;
+
     @Schema(description = "排序")
     private Integer sort;
 

+ 5 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/res/FindMenuTreeResVo.java

@@ -105,6 +105,11 @@ public class FindMenuTreeResVo implements Serializable {
      */
     private String icon;
 
+    /**
+     * 未选中菜单图标路径
+     */
+    private String notSelectedIconPath;
+
     /**
      * 排序
      */

+ 5 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/res/MenuDetailResVo.java

@@ -102,6 +102,11 @@ public class MenuDetailResVo implements Serializable {
      */
     private String icon;
 
+    /**
+     * 未选中菜单图标路径
+     */
+    private String notSelectedIconPath;
+
     /**
      * 排序
      */

+ 3 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsMenuService.java

@@ -379,6 +379,9 @@ public class KwsMenuService {
         if (v.getIcon() == null) {
             v.setIcon("");
         }
+        if (v.getNotSelectedIconPath() == null) {
+            v.setNotSelectedIconPath("");
+        }
         if (v.getSort() == null) {
             v.setSort(0);
         }

+ 1 - 2
sckw-modules/sckw-system/src/main/resources/bootstrap.yml

@@ -5,8 +5,7 @@ spring:
   application:
     name: sckw-ng-system
   profiles:
-#    active: @profiles.active@
-    active: local
+    active: @profiles.active@
 #    active: test
   main:
     allow-bean-definition-overriding: true

+ 14 - 0
sckw-modules/sckw-system/src/main/resources/mapper/KwsMenuDao.xml

@@ -10,6 +10,7 @@
     <result column="perms" jdbcType="VARCHAR" property="perms" />
     <result column="type" jdbcType="INTEGER" property="type" />
     <result column="icon" jdbcType="VARCHAR" property="icon" />
+    <result column="not_selected_icon_path" jdbcType="VARCHAR" property="notSelectedIconPath" />
     <result column="sort" jdbcType="INTEGER" property="sort" />
     <result column="level" jdbcType="INTEGER" property="level" />
     <result column="custom" jdbcType="INTEGER" property="custom" />
@@ -34,6 +35,7 @@
         sm.perms,
         sm.type,
         sm.icon,
+        sm.not_selected_icon_path,
         sm.sort,
         sm.level,
         sm.custom,
@@ -86,6 +88,9 @@
       <if test="icon != null">
         icon,
       </if>
+      <if test="notSelectedIconPath != null">
+        not_selected_icon_path,
+      </if>
       <if test="sort != null">
         sort,
       </if>
@@ -154,6 +159,9 @@
       <if test="icon != null">
         #{icon,jdbcType=VARCHAR},
       </if>
+      <if test="notSelectedIconPath != null">
+        #{notSelectedIconPath,jdbcType=VARCHAR},
+      </if>
       <if test="sort != null">
         #{sort,jdbcType=INTEGER},
       </if>
@@ -220,6 +228,9 @@
       <if test="icon != null">
         icon = #{icon,jdbcType=VARCHAR},
       </if>
+      <if test="notSelectedIconPath != null">
+        not_selected_icon_path = #{notSelectedIconPath,jdbcType=VARCHAR},
+      </if>
       <if test="sort != null">
         sort = #{sort,jdbcType=INTEGER},
       </if>
@@ -378,6 +389,9 @@
     <if test="icon != null">
       and icon = #{icon,jdbcType=VARCHAR}
     </if>
+    <if test="notSelectedIconPath != null">
+      and not_selected_icon_path = #{notSelectedIconPath,jdbcType=VARCHAR}
+    </if>
     <if test="sort != null">
       and sort = #{sort,jdbcType=INTEGER}
     </if>

+ 57 - 0
sckw-modules/sckw-system/src/test/java/com/sckw/system/model/KwsMenuFieldMappingTest.java

@@ -0,0 +1,57 @@
+package com.sckw.system.model;
+
+import com.sckw.system.model.vo.res.AppMenuPermItemResVo;
+import org.junit.Test;
+
+import java.net.URL;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * 菜单未选中图标字段映射测试。
+ */
+public class KwsMenuFieldMappingTest {
+
+    /**
+     * 验证新增字段可在菜单实体和返回对象中正常读写。
+     */
+    @Test
+    public void shouldReadAndWriteNotSelectedIconPath() {
+        String notSelectedIconPath = "/static/menu/home-unselected.png";
+
+        KwsMenu kwsMenu = new KwsMenu();
+        kwsMenu.setNotSelectedIconPath(notSelectedIconPath);
+
+        AppMenuPermItemResVo resVo = new AppMenuPermItemResVo();
+        resVo.setNotSelectedIconPath(kwsMenu.getNotSelectedIconPath());
+
+        assertEquals(notSelectedIconPath, kwsMenu.getNotSelectedIconPath());
+        assertEquals(notSelectedIconPath, resVo.getNotSelectedIconPath());
+    }
+
+    /**
+     * 验证新增字段已配置到 MyBatis 新增、更新和查询映射中。
+     *
+     * @throws Exception 读取 XML 资源失败时抛出异常
+     */
+    @Test
+    public void shouldContainNotSelectedIconPathSqlMapping() throws Exception {
+        URL mapperUrl = Thread.currentThread()
+                .getContextClassLoader()
+                .getResource("mapper/KwsMenuDao.xml");
+        assertNotNull(mapperUrl);
+
+        String xml = Files.readString(Paths.get(mapperUrl.toURI()), StandardCharsets.UTF_8);
+
+        assertTrue(xml.contains("property=\"notSelectedIconPath\""));
+        assertTrue(xml.contains("sm.not_selected_icon_path"));
+        assertTrue(xml.contains("not_selected_icon_path,"));
+        assertTrue(xml.contains("#{notSelectedIconPath,jdbcType=VARCHAR}"));
+        assertTrue(xml.contains("not_selected_icon_path = #{notSelectedIconPath,jdbcType=VARCHAR}"));
+    }
+}

+ 2 - 0
sql/2026/06/2026_06_09_add_kws_menu_not_selected_icon_path.sql

@@ -0,0 +1,2 @@
+ALTER TABLE `kws_menu`
+    ADD COLUMN `not_selected_icon_path` varchar(255) NOT NULL DEFAULT  '' COMMENT '未选中菜单图标路径' AFTER `icon`;