|
@@ -4,15 +4,15 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.usky.common.mybatis.core.AbstractCrudService;
|
|
|
import com.usky.system.domain.SysMenu;
|
|
|
+import com.usky.system.domain.SysMobileMenu;
|
|
|
import com.usky.system.domain.SysPlatformMenu;
|
|
|
import com.usky.system.domain.SysTenantMenu;
|
|
|
+import com.usky.system.domain.SysMobileTenantMenu;
|
|
|
import com.usky.system.mapper.SysPlatformMenuMapper;
|
|
|
+import com.usky.system.service.SysMobileTenantMenuService;
|
|
|
import com.usky.system.service.SysPlatformMenuService;
|
|
|
import com.usky.system.service.SysTenantMenuService;
|
|
|
-import com.usky.system.service.vo.SysMenuOneVo;
|
|
|
-import com.usky.system.service.vo.SysMenuTwoVo;
|
|
|
-import com.usky.system.service.vo.SysMenuVo;
|
|
|
-import com.usky.system.service.vo.TenantMenuVo;
|
|
|
+import com.usky.system.service.vo.*;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -36,11 +36,17 @@ public class SysPlatformMenuServiceImpl extends AbstractCrudService<SysPlatformM
|
|
|
@Autowired
|
|
|
private SysTenantMenuService sysTenantMenuService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private SysMobileTenantMenuService sysMobileTenantMenuService;
|
|
|
|
|
|
public List<SysMenu> getPlatformMenuList(Integer platformId){
|
|
|
return baseMapper.getMenuList(platformId, null);
|
|
|
}
|
|
|
|
|
|
+ public List<SysMobileMenu> getMobilePlatformMenuList(Integer platformId){
|
|
|
+ return baseMapper.getMobileMenuList(platformId, null);
|
|
|
+ }
|
|
|
+
|
|
|
public Long[] selectPlatformMenu(Integer tenantId){
|
|
|
LambdaQueryWrapper<SysTenantMenu> queryWrapper = Wrappers.lambdaQuery();
|
|
|
queryWrapper.eq(SysTenantMenu::getTenantId, tenantId);
|
|
@@ -52,6 +58,17 @@ public class SysPlatformMenuServiceImpl extends AbstractCrudService<SysPlatformM
|
|
|
return arr;
|
|
|
}
|
|
|
|
|
|
+ public Long[] selectMobilePlatformMenu(Integer tenantId){
|
|
|
+ LambdaQueryWrapper<SysMobileTenantMenu> queryWrapper = Wrappers.lambdaQuery();
|
|
|
+ queryWrapper.eq(SysMobileTenantMenu::getTenantId, tenantId);
|
|
|
+ List<SysMobileTenantMenu> menuList = sysMobileTenantMenuService.list(queryWrapper);
|
|
|
+ Long[] arr = new Long[menuList.size()];
|
|
|
+ for (int i = 0; i < menuList.size(); i++) {
|
|
|
+ arr[i] = menuList.get(i).getMenuId();
|
|
|
+ }
|
|
|
+ return arr;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
public Map<String, Object> getMenuList(Integer platformId, Integer tenantId) {
|
|
|
//全部目录查询
|
|
@@ -230,6 +247,49 @@ public class SysPlatformMenuServiceImpl extends AbstractCrudService<SysPlatformM
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Transactional
|
|
|
+ public void updateMobileMenu(MobileTenantMenuVO mobileTenantMenuVO) {
|
|
|
+ Long[] arr = mobileTenantMenuVO.getMenuIds();
|
|
|
+ //菜单ID
|
|
|
+ List<SysMobileMenu> menuIdList = baseMapper.getMobileMenuIdList(arr, "F");
|
|
|
+ Long arr1[] = new Long[menuIdList.size()];
|
|
|
+ for (int i = 0; i < menuIdList.size(); i++) {
|
|
|
+ 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]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 删除租户菜单关联
|
|
|
+ baseMapper.deleteMobileTenantMenuBy(mobileTenantMenuVO.getTenantId());
|
|
|
+ //新增菜单
|
|
|
+ if (arr3.size() > 0) {
|
|
|
+ for (int i = 0; i < arr3.size(); i++) {
|
|
|
+ SysMobileTenantMenu sysMobileTenantMenu = new SysMobileTenantMenu();
|
|
|
+ sysMobileTenantMenu.setMenuId((Long) arr3.get(i));
|
|
|
+ sysMobileTenantMenu.setTenantId(mobileTenantMenuVO.getTenantId());
|
|
|
+ sysMobileTenantMenuService.save(sysMobileTenantMenu);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public Long[] arrayMerge(Long[] arr1, Long[] arr2) {
|
|
|
Long arr3[] = new Long[arr1.length + arr2.length];
|
|
|
for (int i = 0; i < arr1.length; i++) {
|