Browse Source

'开发平台管理菜单中增加移动端-权限列表展示和更新两个接口'

james 2 years ago
parent
commit
ccac530c31
18 changed files with 458 additions and 53 deletions
  1. 21 0
      base-modules/service-system/service-system-biz/src/main/java/com/usky/system/controller/web/SysMobilePlatformMenuController.java
  2. 36 2
      base-modules/service-system/service-system-biz/src/main/java/com/usky/system/controller/web/SysPlatformController.java
  3. 4 0
      base-modules/service-system/service-system-biz/src/main/java/com/usky/system/domain/SysMobileMenu.java
  4. 32 0
      base-modules/service-system/service-system-biz/src/main/java/com/usky/system/domain/SysMobilePlatformMenu.java
  5. 3 0
      base-modules/service-system/service-system-biz/src/main/java/com/usky/system/mapper/SysMenuMapper.java
  6. 16 0
      base-modules/service-system/service-system-biz/src/main/java/com/usky/system/mapper/SysMobilePlatformMenuMapper.java
  7. 6 0
      base-modules/service-system/service-system-biz/src/main/java/com/usky/system/mapper/SysPlatformMapper.java
  8. 2 0
      base-modules/service-system/service-system-biz/src/main/java/com/usky/system/service/ISysMenuService.java
  9. 16 0
      base-modules/service-system/service-system-biz/src/main/java/com/usky/system/service/SysMobilePlatformMenuService.java
  10. 5 0
      base-modules/service-system/service-system-biz/src/main/java/com/usky/system/service/SysPlatformService.java
  11. 8 0
      base-modules/service-system/service-system-biz/src/main/java/com/usky/system/service/impl/SysMenuServiceImpl.java
  12. 20 0
      base-modules/service-system/service-system-biz/src/main/java/com/usky/system/service/impl/SysMobilePlatformMenuServiceImpl.java
  13. 63 34
      base-modules/service-system/service-system-biz/src/main/java/com/usky/system/service/impl/SysPlatformMenuServiceImpl.java
  14. 126 17
      base-modules/service-system/service-system-biz/src/main/java/com/usky/system/service/impl/SysPlatformServiceImpl.java
  15. 39 0
      base-modules/service-system/service-system-biz/src/main/java/com/usky/system/service/vo/MobilePlatformMenuVO.java
  16. 29 0
      base-modules/service-system/service-system-biz/src/main/resources/mapper/system/SysMenuMapper.xml
  17. 11 0
      base-modules/service-system/service-system-biz/src/main/resources/mapper/system/SysMobilePlatformMenuMapper.xml
  18. 21 0
      base-modules/service-system/service-system-biz/src/main/resources/mapper/system/SysPlatformMapper.xml

+ 21 - 0
base-modules/service-system/service-system-biz/src/main/java/com/usky/system/controller/web/SysMobilePlatformMenuController.java

@@ -0,0 +1,21 @@
+package com.usky.system.controller.web;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.stereotype.Controller;
+
+/**
+ * <p>
+ * 移动端_平台和菜单关联表 前端控制器
+ * </p>
+ *
+ * @author JCB
+ * @since 2023-02-16
+ */
+@Controller
+@RequestMapping("/sysMobilePlatformMenu")
+public class SysMobilePlatformMenuController {
+
+}
+

+ 36 - 2
base-modules/service-system/service-system-biz/src/main/java/com/usky/system/controller/web/SysPlatformController.java

@@ -5,9 +5,12 @@ import com.usky.common.core.bean.ApiResult;
 import com.usky.common.core.bean.CommonPage;
 import com.usky.common.security.utils.SecurityUtils;
 import com.usky.system.domain.SysMenu;
+import com.usky.system.domain.SysMobileMenu;
+import com.usky.system.domain.SysMobilePlatformMenu;
 import com.usky.system.service.ISysMenuService;
 import com.usky.system.service.SysPlatformService;
 import com.usky.system.service.vo.PlatformMenuVo;
+import com.usky.system.service.vo.MobilePlatformMenuVO;
 import com.usky.system.service.vo.SysPlatformVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -53,7 +56,7 @@ public class SysPlatformController {
     }
 
     /**
-     * 平台管理-菜单查询
+     * PC平台管理-菜单查询
      *
      * @param platformId 平台ID
      * @return
@@ -69,9 +72,26 @@ public class SysPlatformController {
         return ApiResult.success(ajax);
     }
 
+    /**
+     * 移动端平台管理-菜单查询
+     *
+     * @param platformId 平台ID
+     * @return
+     */
+    @GetMapping("/getMobilePlatformMenu")
+    public ApiResult<Map<String, Object>> getMobilePlatformMenu(@RequestParam Long platformId) {
+
+        Long userId = SecurityUtils.getUserId();
+        List<SysMobileMenu> menus = menuService.selectMobileMenuListOne(userId);
+        Map<String,Object> ajax = new HashMap<>();
+        ajax.put("checkedKeys", sysPlatformService.getMobilePlatformMenu(platformId));
+        ajax.put("menus", menuService.buildMobileMenuTreeSelect(menus));
+        return ApiResult.success(ajax);
+    }
+
 
     /**
-     * 平台挂管理-菜单编辑
+     * PC平台管理-菜单编辑
      *
      * @param platformMenuVo
      * @return
@@ -82,5 +102,19 @@ public class SysPlatformController {
         sysPlatformService.updatePlatformMenu(platformMenuVo);
         return ApiResult.success();
     }
+
+
+    /**
+     * 移动端平台管理-菜单编辑
+     *
+     * @param mobilePlatformMenuVO
+     * @return
+     */
+//    @Log(title = "平台挂管理", businessType = BusinessType.INSERT)
+    @PostMapping("updateMobilePlatformMenu")
+    public ApiResult<Void> updateMobilePlatformMenu(@RequestBody MobilePlatformMenuVO mobilePlatformMenuVO) {
+        sysPlatformService.updateMobilePlatformMenu(mobilePlatformMenuVO);
+        return ApiResult.success();
+    }
 }
 

+ 4 - 0
base-modules/service-system/service-system-biz/src/main/java/com/usky/system/domain/SysMobileMenu.java

@@ -38,6 +38,10 @@ public class SysMobileMenu implements Serializable {
      */
     private String menuName;
 
+    /** 父菜单名称 */
+    @TableField(exist = false)
+    private String parentName;
+
     /**
      * 父菜单ID
      */

+ 32 - 0
base-modules/service-system/service-system-biz/src/main/java/com/usky/system/domain/SysMobilePlatformMenu.java

@@ -0,0 +1,32 @@
+package com.usky.system.domain;
+
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 移动端_平台和菜单关联表
+ * </p>
+ *
+ * @author JCB
+ * @since 2023-02-16
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class SysMobilePlatformMenu implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 平台ID
+     */
+    private Integer platformId;
+
+    /**
+     * 菜单ID
+     */
+    private Integer menuId;
+
+
+}

+ 3 - 0
base-modules/service-system/service-system-biz/src/main/java/com/usky/system/mapper/SysMenuMapper.java

@@ -3,6 +3,7 @@ package com.usky.system.mapper;
 
 import com.usky.common.mybatis.core.CrudMapper;
 import com.usky.system.domain.SysMenu;
+import com.usky.system.domain.SysMobileMenu;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
@@ -51,6 +52,8 @@ public interface SysMenuMapper extends CrudMapper<SysMenu> {
 
     public List<SysMenu> selectMenuListByUserIdOne(@Param("userId") Long userId);
 
+    public List<SysMobileMenu> selectMobileMenuListByUserIdOne(@Param("userId") Long userId);
+
     /**
      * 根据用户ID查询权限
      *

+ 16 - 0
base-modules/service-system/service-system-biz/src/main/java/com/usky/system/mapper/SysMobilePlatformMenuMapper.java

@@ -0,0 +1,16 @@
+package com.usky.system.mapper;
+
+import com.usky.system.domain.SysMobilePlatformMenu;
+import com.usky.common.mybatis.core.CrudMapper;
+
+/**
+ * <p>
+ * 移动端_平台和菜单关联表 Mapper 接口
+ * </p>
+ *
+ * @author JCB
+ * @since 2023-02-16
+ */
+public interface SysMobilePlatformMenuMapper extends CrudMapper<SysMobilePlatformMenu> {
+
+}

+ 6 - 0
base-modules/service-system/service-system-biz/src/main/java/com/usky/system/mapper/SysPlatformMapper.java

@@ -2,6 +2,7 @@ package com.usky.system.mapper;
 
 import com.usky.common.mybatis.core.CrudMapper;
 import com.usky.system.domain.SysMenu;
+import com.usky.system.domain.SysMobileMenu;
 import com.usky.system.domain.SysPlatform;
 import com.usky.system.domain.SysPlatformMenu;
 import com.usky.system.service.vo.SysPlatformVo;
@@ -29,8 +30,13 @@ public interface SysPlatformMapper extends CrudMapper<SysPlatform> {
     List<SysMenu> getMenuIdListOne(@Param("menuIds") Long[] menuIds,
                                    @Param("menuType") String menuType);
 
+    List<SysMobileMenu> getMobileMenuIdListOne(@Param("menuIds") Long[] menuIds,
+                                   @Param("menuType") String menuType);
+
     int deletePlatformMenuBy(@Param("platformId") Long platformId);
 
+    int deleteMobilePlatformMenuBy(@Param("platformId") Long platformId);
+
 
     List<SysPlatformMenu> getMenuListOne(@Param("platformId") Long platformId,
                                          @Param("menuType")  String menuType);

+ 2 - 0
base-modules/service-system/service-system-biz/src/main/java/com/usky/system/service/ISysMenuService.java

@@ -44,6 +44,8 @@ public interface ISysMenuService extends CrudService<SysMenu>
 
     List<SysMenu> selectMenuListOne(Long userId);
 
+    List<SysMobileMenu> selectMobileMenuListOne(Long userId);
+
     /**
      * 根据用户ID查询权限
      * 

+ 16 - 0
base-modules/service-system/service-system-biz/src/main/java/com/usky/system/service/SysMobilePlatformMenuService.java

@@ -0,0 +1,16 @@
+package com.usky.system.service;
+
+import com.usky.system.domain.SysMobilePlatformMenu;
+import com.usky.common.mybatis.core.CrudService;
+
+/**
+ * <p>
+ * 移动端_平台和菜单关联表 服务类
+ * </p>
+ *
+ * @author JCB
+ * @since 2023-02-16
+ */
+public interface SysMobilePlatformMenuService extends CrudService<SysMobilePlatformMenu> {
+
+}

+ 5 - 0
base-modules/service-system/service-system-biz/src/main/java/com/usky/system/service/SysPlatformService.java

@@ -4,6 +4,7 @@ import com.usky.common.core.bean.CommonPage;
 import com.usky.common.mybatis.core.CrudService;
 import com.usky.system.domain.SysPlatform;
 import com.usky.system.service.vo.PlatformMenuVo;
+import com.usky.system.service.vo.MobilePlatformMenuVO;
 import com.usky.system.service.vo.SysPlatformVo;
 
 import java.util.List;
@@ -24,5 +25,9 @@ public interface SysPlatformService extends CrudService<SysPlatform> {
 
     Long[] getPlatformMenu(Long platformId);
 
+    Long[] getMobilePlatformMenu(Long platformId);
+
     void updatePlatformMenu(PlatformMenuVo platformMenuVo);
+
+    void updateMobilePlatformMenu(MobilePlatformMenuVO mobilePlatformMenuV0);
 }

+ 8 - 0
base-modules/service-system/service-system-biz/src/main/java/com/usky/system/service/impl/SysMenuServiceImpl.java

@@ -93,6 +93,14 @@ public class SysMenuServiceImpl extends AbstractCrudService<SysMenuMapper, SysMe
         return menuList;
     }
 
+
+    @Override
+    public List<SysMobileMenu> selectMobileMenuListOne(Long userId)
+    {
+        List<SysMobileMenu> menuList = menuMapper.selectMobileMenuListByUserIdOne(userId);
+        return menuList;
+    }
+
     /**
      * 根据用户ID查询权限
      *

+ 20 - 0
base-modules/service-system/service-system-biz/src/main/java/com/usky/system/service/impl/SysMobilePlatformMenuServiceImpl.java

@@ -0,0 +1,20 @@
+package com.usky.system.service.impl;
+
+import com.usky.system.domain.SysMobilePlatformMenu;
+import com.usky.system.mapper.SysMobilePlatformMenuMapper;
+import com.usky.system.service.SysMobilePlatformMenuService;
+import com.usky.common.mybatis.core.AbstractCrudService;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 移动端_平台和菜单关联表 服务实现类
+ * </p>
+ *
+ * @author JCB
+ * @since 2023-02-16
+ */
+@Service
+public class SysMobilePlatformMenuServiceImpl extends AbstractCrudService<SysMobilePlatformMenuMapper, SysMobilePlatformMenu> implements SysMobilePlatformMenuService {
+
+}

+ 63 - 34
base-modules/service-system/service-system-biz/src/main/java/com/usky/system/service/impl/SysPlatformMenuServiceImpl.java

@@ -195,6 +195,7 @@ public class SysPlatformMenuServiceImpl extends AbstractCrudService<SysPlatformM
     @Override
     @Transactional
     public void updateMenu(TenantMenuVo tenantMenuVo) {
+        List arr3 = new ArrayList();
         Long[] arr = tenantMenuVo.getMenuIds();
         //菜单ID
         List<SysMenu> menuIdList = baseMapper.getMenuIdList(arr, "F");
@@ -203,25 +204,39 @@ public class SysPlatformMenuServiceImpl extends AbstractCrudService<SysPlatformM
             arr1[i] = menuIdList.get(i).getParentId();
         }
         //目录ID
-        List<SysMenu> menuIdListOne = baseMapper.getMenuIdList(arr1, "C");
-        Long arr2[] = new Long[menuIdListOne.size()];
-        for (int i = 0; i < menuIdListOne.size(); i++) {
-            arr2[i] = menuIdListOne.get(i).getParentId();
-        }
-        List<SysMenu> menuIdListTwo = baseMapper.getMenuIdList(arr, "C");
-        Long arr4[] = new Long[menuIdListTwo.size()];
-        for (int i = 0; i < menuIdListTwo.size(); i++) {
-            arr4[i] = menuIdListTwo.get(i).getParentId();
-        }
-        Long[] arr5 = arrayMerge(arr1, arr2);
-        Long[] arr6 = arrayMerge(arr5, arr4);
-        Long[] arr7 = arrayMerge(arr6, arr);
-        List arr3 = new ArrayList();
-        for (int i = 0; i < arr7.length; i++) {
-            if (!arr3.contains(arr7[i])) {
-                arr3.add(arr7[i]);
+        if(arr1.length > 0){
+            List<SysMenu> menuIdListOne = baseMapper.getMenuIdList(arr1, "C");
+            Long arr2[] = new Long[menuIdListOne.size()];
+            for (int i = 0; i < menuIdListOne.size(); i++) {
+                arr2[i] = menuIdListOne.get(i).getParentId();
+            }
+            List<SysMenu> menuIdListTwo = baseMapper.getMenuIdList(arr, "C");
+            Long arr4[] = new Long[menuIdListTwo.size()];
+            for (int i = 0; i < menuIdListTwo.size(); i++) {
+                arr4[i] = menuIdListTwo.get(i).getParentId();
+            }
+            Long[] arr5 = arrayMerge(arr1, arr2);
+            Long[] arr6 = arrayMerge(arr5, arr4);
+            Long[] arr7 = arrayMerge(arr6, arr);
+            for (int i = 0; i < arr7.length; i++) {
+                if (!arr3.contains(arr7[i])) {
+                    arr3.add(arr7[i]);
+                }
+            }
+        }else{
+            List<SysMenu> menuIdListTwo = baseMapper.getMenuIdList(arr, "C");
+            Long arr4[] = new Long[menuIdListTwo.size()];
+            for (int i = 0; i < menuIdListTwo.size(); i++) {
+                arr4[i] = menuIdListTwo.get(i).getParentId();
+            }
+            Long[] arr7 = arrayMerge(arr4, arr);
+            for (int i = 0; i < arr7.length; i++) {
+                if (!arr3.contains(arr7[i])) {
+                    arr3.add(arr7[i]);
+                }
             }
         }
+
 //        Long[] arr3 =ifRepeat2(arr6);
 //        Long arr3[] = new Long[arr1.length+arr2.length+arr.length];
 //        for (int i=0;i<arr1.length;i++){
@@ -249,6 +264,7 @@ public class SysPlatformMenuServiceImpl extends AbstractCrudService<SysPlatformM
 
     @Transactional
     public void updateMobileMenu(MobileTenantMenuVO mobileTenantMenuVO) {
+        List arr3 = new ArrayList();
         Long[] arr = mobileTenantMenuVO.getMenuIds();
         //菜单ID
         List<SysMobileMenu> menuIdList = baseMapper.getMobileMenuIdList(arr, "F");
@@ -257,23 +273,36 @@ public class SysPlatformMenuServiceImpl extends AbstractCrudService<SysPlatformM
             arr1[i] = menuIdList.get(i).getParentId();
         }
         //目录ID
-        List<SysMobileMenu> menuIdListOne = baseMapper.getMobileMenuIdList(arr1, "C");
-        Long arr2[] = new Long[menuIdListOne.size()];
-        for (int i = 0; i < menuIdListOne.size(); i++) {
-            arr2[i] = menuIdListOne.get(i).getParentId();
-        }
-        List<SysMobileMenu> menuIdListTwo = baseMapper.getMobileMenuIdList(arr, "C");
-        Long arr4[] = new Long[menuIdListTwo.size()];
-        for (int i = 0; i < menuIdListTwo.size(); i++) {
-            arr4[i] = menuIdListTwo.get(i).getParentId();
-        }
-        Long[] arr5 = arrayMerge(arr1, arr2);
-        Long[] arr6 = arrayMerge(arr5, arr4);
-        Long[] arr7 = arrayMerge(arr6, arr);
-        List arr3 = new ArrayList();
-        for (int i = 0; i < arr7.length; i++) {
-            if (!arr3.contains(arr7[i])) {
-                arr3.add(arr7[i]);
+        if(arr1.length > 0){
+            List<SysMobileMenu> menuIdListOne = baseMapper.getMobileMenuIdList(arr1, "C");
+            Long arr2[] = new Long[menuIdListOne.size()];
+            for (int i = 0; i < menuIdListOne.size(); i++) {
+                arr2[i] = menuIdListOne.get(i).getParentId();
+            }
+            List<SysMobileMenu> menuIdListTwo = baseMapper.getMobileMenuIdList(arr, "C");
+            Long arr4[] = new Long[menuIdListTwo.size()];
+            for (int i = 0; i < menuIdListTwo.size(); i++) {
+                arr4[i] = menuIdListTwo.get(i).getParentId();
+            }
+            Long[] arr5 = arrayMerge(arr1, arr2);
+            Long[] arr6 = arrayMerge(arr5, arr4);
+            Long[] arr7 = arrayMerge(arr6, arr);
+            for (int i = 0; i < arr7.length; i++) {
+                if (!arr3.contains(arr7[i])) {
+                    arr3.add(arr7[i]);
+                }
+            }
+        }else{
+            List<SysMobileMenu> menuIdListTwo = baseMapper.getMobileMenuIdList(arr, "C");
+            Long arr4[] = new Long[menuIdListTwo.size()];
+            for (int i = 0; i < menuIdListTwo.size(); i++) {
+                arr4[i] = menuIdListTwo.get(i).getParentId();
+            }
+            Long[] arr7 = arrayMerge(arr4, arr);
+            for (int i = 0; i < arr7.length; i++) {
+                if (!arr3.contains(arr7[i])) {
+                    arr3.add(arr7[i]);
+                }
             }
         }
 

+ 126 - 17
base-modules/service-system/service-system-biz/src/main/java/com/usky/system/service/impl/SysPlatformServiceImpl.java

@@ -6,10 +6,13 @@ import com.usky.common.security.utils.SecurityUtils;
 import com.usky.common.core.bean.CommonPage;
 import com.usky.common.mybatis.core.AbstractCrudService;
 import com.usky.system.domain.SysMenu;
+import com.usky.system.domain.SysMobileMenu;
 import com.usky.system.domain.SysPlatform;
 import com.usky.system.domain.SysPlatformMenu;
+import com.usky.system.domain.SysMobilePlatformMenu;
 import com.usky.system.mapper.SysMenuMapper;
 import com.usky.system.mapper.SysPlatformMapper;
+import com.usky.system.service.SysMobilePlatformMenuService;
 import com.usky.system.service.SysPlatformMenuService;
 import com.usky.system.service.SysPlatformService;
 import com.usky.system.service.vo.*;
@@ -38,6 +41,8 @@ public class SysPlatformServiceImpl extends AbstractCrudService<SysPlatformMappe
     private SysMenuMapper menuMapper;
     @Autowired
     private SysPlatformMenuService sysPlatformMenuService;
+    @Autowired
+    private SysMobilePlatformMenuService sysMobilePlatformMenuService;
 
     @Override
     public List<SysPlatform> getPlatformBoxList() {
@@ -75,6 +80,18 @@ public class SysPlatformServiceImpl extends AbstractCrudService<SysPlatformMappe
         return arr;
     }
 
+    @Override
+    public Long[] getMobilePlatformMenu(Long platformId) {
+        LambdaQueryWrapper<SysMobilePlatformMenu> queryWrapper = Wrappers.lambdaQuery();
+        queryWrapper.eq(SysMobilePlatformMenu::getPlatformId, platformId);
+        List<SysMobilePlatformMenu> menuList = sysMobilePlatformMenuService.list(queryWrapper);
+        Long[] arr = new Long[menuList.size()];
+        for (int i = 0; i < menuList.size(); i++) {
+            arr[i] = menuList.get(i).getMenuId().longValue();
+        }
+        return arr;
+    }
+
 
     @Override
     @Transactional
@@ -90,9 +107,12 @@ public class SysPlatformServiceImpl extends AbstractCrudService<SysPlatformMappe
         }else {
             sysPlatform.setId(platformMenuVo.getPlatformId().intValue());
             sysPlatform.setPlatformName(platformMenuVo.getPlatformName());
+            sysPlatform.setUpdateBy(SecurityUtils.getUsername());
+            sysPlatform.setUpdateTime(LocalDateTime.now());
             this.updateById(sysPlatform);
         }
 
+        List arr3 = new ArrayList();
         Long[] arr = platformMenuVo.getMenuIds();
         //菜单ID
         List<SysMenu> menuIdList = baseMapper.getMenuIdListOne(arr, "F");
@@ -101,24 +121,38 @@ public class SysPlatformServiceImpl extends AbstractCrudService<SysPlatformMappe
             arr1[i] = menuIdList.get(i).getParentId();
         }
         //目录ID
-        List<SysMenu> menuIdListOne = baseMapper.getMenuIdListOne(arr1, "C");
-        Long arr2[] = new Long[menuIdListOne.size()];
-        for (int i = 0; i < menuIdListOne.size(); i++) {
-            arr2[i] = menuIdListOne.get(i).getParentId();
-        }
-        List<SysMenu> menuIdListTwo = baseMapper.getMenuIdListOne(arr, "C");
-        Long arr4[] = new Long[menuIdListTwo.size()];
-        for (int i = 0; i < menuIdListTwo.size(); i++) {
-            arr4[i] = menuIdListTwo.get(i).getParentId();
-        }
+        if(arr1.length > 0){
+            List<SysMenu> menuIdListOne = baseMapper.getMenuIdListOne(arr1, "C");
+            Long arr2[] = new Long[menuIdListOne.size()];
+            for (int i = 0; i < menuIdListOne.size(); i++) {
+                arr2[i] = menuIdListOne.get(i).getParentId();
+            }
+            List<SysMenu> menuIdListTwo = baseMapper.getMenuIdListOne(arr, "C");
+            Long arr4[] = new Long[menuIdListTwo.size()];
+            for (int i = 0; i < menuIdListTwo.size(); i++) {
+                arr4[i] = menuIdListTwo.get(i).getParentId();
+            }
 
-        Long[] arr5 = arrayMerge(arr1, arr2);
-        Long[] arr6 = arrayMerge(arr5, arr4);
-        Long[] arr7 = arrayMerge(arr6, arr);
-        List arr3 = new ArrayList();
-        for (int i = 0; i < arr7.length; i++) {
-            if (!arr3.contains(arr7[i])) {
-                arr3.add(arr7[i]);
+            Long[] arr5 = arrayMerge(arr1, arr2);
+            Long[] arr6 = arrayMerge(arr5, arr4);
+            Long[] arr7 = arrayMerge(arr6, arr);
+            for (int i = 0; i < arr7.length; i++) {
+                if (!arr3.contains(arr7[i])) {
+                    arr3.add(arr7[i]);
+                }
+            }
+        }else{
+            List<SysMenu> menuIdListTwo = baseMapper.getMenuIdListOne(arr, "C");
+            Long arr4[] = new Long[menuIdListTwo.size()];
+            for (int i = 0; i < menuIdListTwo.size(); i++) {
+                arr4[i] = menuIdListTwo.get(i).getParentId();
+            }
+
+            Long[] arr7 = arrayMerge(arr4, arr);
+            for (int i = 0; i < arr7.length; i++) {
+                if (!arr3.contains(arr7[i])) {
+                    arr3.add(arr7[i]);
+                }
             }
         }
         // 删除租户菜单关联
@@ -135,6 +169,81 @@ public class SysPlatformServiceImpl extends AbstractCrudService<SysPlatformMappe
 
     }
 
+    @Transactional
+    public void updateMobilePlatformMenu(MobilePlatformMenuVO mobilePlatformMenuVO) {
+        SysPlatform sysPlatform = new SysPlatform();
+        if (mobilePlatformMenuVO.getPlatformId().intValue() == 0) {
+            sysPlatform.setPlatformName(mobilePlatformMenuVO.getPlatformName());
+            sysPlatform.setCreateBy(SecurityUtils.getUsername());
+            sysPlatform.setCreateTime(LocalDateTime.now());
+            this.save(sysPlatform);
+            Integer fid = sysPlatform.getId();
+            mobilePlatformMenuVO.setPlatformId(fid.longValue());
+        }else {
+            sysPlatform.setId(mobilePlatformMenuVO.getPlatformId().intValue());
+            sysPlatform.setPlatformName(mobilePlatformMenuVO.getPlatformName());
+            sysPlatform.setUpdateBy(SecurityUtils.getUsername());
+            sysPlatform.setUpdateTime(LocalDateTime.now());
+            this.updateById(sysPlatform);
+        }
+
+        List arr3 = new ArrayList();
+        Long[] arr = mobilePlatformMenuVO.getMenuIds();
+        //菜单ID
+        List<SysMobileMenu> menuIdList = baseMapper.getMobileMenuIdListOne(arr, "F");
+        Long arr1[] = new Long[menuIdList.size()];
+        for (int i = 0; i < menuIdList.size(); i++) {
+            arr1[i] = menuIdList.get(i).getParentId();
+        }
+        //目录ID
+        if(arr1.length > 0){
+            List<SysMobileMenu> menuIdListOne = baseMapper.getMobileMenuIdListOne(arr1, "C");
+            Long arr2[] = new Long[menuIdListOne.size()];
+            for (int i = 0; i < menuIdListOne.size(); i++) {
+                arr2[i] = menuIdListOne.get(i).getParentId();
+            }
+            List<SysMobileMenu> menuIdListTwo = baseMapper.getMobileMenuIdListOne(arr, "C");
+            Long arr4[] = new Long[menuIdListTwo.size()];
+            for (int i = 0; i < menuIdListTwo.size(); i++) {
+                arr4[i] = menuIdListTwo.get(i).getParentId();
+            }
+
+            Long[] arr5 = arrayMerge(arr1, arr2);
+            Long[] arr6 = arrayMerge(arr5, arr4);
+            Long[] arr7 = arrayMerge(arr6, arr);
+            for (int i = 0; i < arr7.length; i++) {
+                if (!arr3.contains(arr7[i])) {
+                    arr3.add(arr7[i]);
+                }
+            }
+        }else{
+            List<SysMobileMenu> menuIdListTwo = baseMapper.getMobileMenuIdListOne(arr, "C");
+            Long arr4[] = new Long[menuIdListTwo.size()];
+            for (int i = 0; i < menuIdListTwo.size(); i++) {
+                arr4[i] = menuIdListTwo.get(i).getParentId();
+            }
+            Long[] arr7 = arrayMerge(arr4, arr);
+            for (int i = 0; i < arr7.length; i++) {
+                if (!arr3.contains(arr7[i])) {
+                    arr3.add(arr7[i]);
+                }
+            }
+        }
+
+        // 删除租户菜单关联
+        baseMapper.deleteMobilePlatformMenuBy(mobilePlatformMenuVO.getPlatformId());
+        //新增菜单
+        if (arr3.size() > 0) {
+            for (int i = 0; i < arr3.size(); i++) {
+                SysMobilePlatformMenu sysMobilePlatformMenu = new SysMobilePlatformMenu();
+                sysMobilePlatformMenu.setMenuId(((Long) arr3.get(i)).intValue());
+                sysMobilePlatformMenu.setPlatformId(mobilePlatformMenuVO.getPlatformId().intValue());
+                sysMobilePlatformMenuService.save(sysMobilePlatformMenu);
+            }
+        }
+
+    }
+
     public Long[] arrayMerge(Long[] arr1, Long[] arr2) {
         Long arr3[] = new Long[arr1.length + arr2.length];
         for (int i = 0; i < arr1.length; i++) {

+ 39 - 0
base-modules/service-system/service-system-biz/src/main/java/com/usky/system/service/vo/MobilePlatformMenuVO.java

@@ -0,0 +1,39 @@
+package com.usky.system.service.vo;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 租户和菜单关联表
+ * </p>
+ *
+ * @author ya
+ * @since 2022-05-18
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class MobilePlatformMenuVO implements Serializable {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 平台ID
+     */
+    private Long platformId;
+
+    /**
+     * 平台名称
+     */
+    private String platformName;
+
+    /**
+     * 菜单ID
+     */
+    private Long[] menuIds;
+
+}

+ 29 - 0
base-modules/service-system/service-system-biz/src/main/resources/mapper/system/SysMenuMapper.xml

@@ -26,6 +26,28 @@
         <result property="remark" column="remark"/>
     </resultMap>
 
+    <resultMap type="com.usky.system.domain.SysMobileMenu" id="SysMobileMenuResult">
+        <id property="menuId" column="menu_id"/>
+        <result property="menuName" column="menu_name"/>
+        <result property="parentName" column="parent_name"/>
+        <result property="parentId" column="parent_id"/>
+        <result property="orderNum" column="order_num"/>
+        <result property="path" column="path"/>
+        <result property="component" column="component"/>
+        <result property="isFrame" column="is_frame"/>
+        <result property="isCache" column="is_cache"/>
+        <result property="menuType" column="menu_type"/>
+        <result property="visible" column="visible"/>
+        <result property="status" column="status"/>
+        <result property="perms" column="perms"/>
+        <result property="icon" column="icon"/>
+        <result property="createBy" column="create_by"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="remark" column="remark"/>
+    </resultMap>
+
     <sql id="selectMenuVo">
         select menu_id,
                menu_name,
@@ -138,6 +160,13 @@
         order by m.parent_id, m.order_num
     </select>
 
+    <select id="selectMobileMenuListByUserIdOne" resultMap="SysMobileMenuResult">
+        select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, 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_mobile_menu m
+        order by m.parent_id, m.order_num
+    </select>
+
 
     <select id="selectMenuTreeByUserId" parameterType="Long" resultMap="SysMenuResult">
         select distinct m.menu_id,

+ 11 - 0
base-modules/service-system/service-system-biz/src/main/resources/mapper/system/SysMobilePlatformMenuMapper.xml

@@ -0,0 +1,11 @@
+<?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.usky.system.mapper.SysMobilePlatformMenuMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.usky.system.domain.SysMobilePlatformMenu">
+        <id column="platform_id" property="platformId" />
+        <result column="menu_id" property="menuId" />
+    </resultMap>
+
+</mapper>

+ 21 - 0
base-modules/service-system/service-system-biz/src/main/resources/mapper/system/SysPlatformMapper.xml

@@ -55,10 +55,31 @@
         </foreach>
     </select>
 
+    <select id="getMobileMenuIdListOne" resultType="com.usky.system.domain.SysMobileMenu">
+        SELECT
+        *
+        FROM
+        sys_mobile_menu
+        WHERE
+        status = 0
+        AND visible = 0
+        AND menu_type = #{menuType}
+        <if test="menuIds != null and menuIds.length > 0">
+            AND menu_id IN
+            <foreach collection="menuIds" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+    </select>
+
     <delete id="deletePlatformMenuBy" parameterType="Long">
         delete from sys_platform_menu where platform_id=#{platformId}
     </delete>
 
+    <delete id="deleteMobilePlatformMenuBy" parameterType="Long">
+        delete from sys_mobile_platform_menu where platform_id=#{platformId}
+    </delete>
+
 
     <select id="getMenuListOne"  resultType="com.usky.system.domain.SysPlatformMenu" >
         SELECT