|
@@ -26,6 +26,7 @@ import com.pig4cloud.pigx.admin.service.*;
|
|
|
import com.pig4cloud.pigx.common.core.constant.CacheConstants;
|
|
|
import com.pig4cloud.pigx.common.core.constant.CommonConstants;
|
|
|
import com.pig4cloud.pigx.common.core.util.SpringContextHolder;
|
|
|
+import com.pig4cloud.pigx.common.data.datascope.DataScopeTypeEnum;
|
|
|
import com.pig4cloud.pigx.common.data.resolver.ParamResolver;
|
|
|
import com.pig4cloud.pigx.common.data.tenant.TenantBroker;
|
|
|
import lombok.AllArgsConstructor;
|
|
@@ -128,8 +129,11 @@ public class SysTenantServiceImpl extends ServiceImpl<SysTenantMapper, SysTenant
|
|
|
dictIdList.addAll(dictList.stream().map(SysDict::getId).collect(Collectors.toList()));
|
|
|
dictItemList.addAll(
|
|
|
dictItemService.list(Wrappers.<SysDictItem>lambdaQuery().in(SysDictItem::getDictId, dictIdList)));
|
|
|
+ SysTenantMenu tenantMenu = sysTenantMenuService.getById(sysTenant.getMenuId());
|
|
|
+ String[] split = tenantMenu.getMenuIds().split(",");
|
|
|
+ List<SysMenu> newMenuList = menuService.list(Wrappers.<SysMenu>lambdaQuery().in(SysMenu::getMenuId, split));
|
|
|
// 查询当前租户菜单
|
|
|
- menuList.addAll(menuService.list());
|
|
|
+ menuList.addAll(newMenuList);
|
|
|
// 查询客户端配置
|
|
|
clientDetailsList.addAll(clientServices.list());
|
|
|
// 查询系统参数配置
|
|
@@ -157,12 +161,14 @@ public class SysTenantServiceImpl extends ServiceImpl<SysTenantMapper, SysTenant
|
|
|
SysRole roleDefault = new SysRole();
|
|
|
roleDefault.setRoleCode(userDefaultRoleCode);
|
|
|
roleDefault.setRoleName(userDefaultRoleName);
|
|
|
+ roleDefault.setDsType(DataScopeTypeEnum.SELF_LEVEL.getType());
|
|
|
roleService.save(roleDefault);
|
|
|
|
|
|
// 构造新角色 管理员角色
|
|
|
SysRole role = new SysRole();
|
|
|
role.setRoleCode(defaultRoleCode);
|
|
|
role.setRoleName(defaultRoleName);
|
|
|
+ role.setDsType(DataScopeTypeEnum.ALL.getType());
|
|
|
roleService.save(role);
|
|
|
// 用户角色关系
|
|
|
SysUserRole userRole = new SysUserRole();
|
|
@@ -172,19 +178,17 @@ public class SysTenantServiceImpl extends ServiceImpl<SysTenantMapper, SysTenant
|
|
|
// 插入新的菜单
|
|
|
saveTenantMenu(menuList, CommonConstants.MENU_TREE_ROOT_ID, CommonConstants.MENU_TREE_ROOT_ID);
|
|
|
|
|
|
- SysTenantMenu tenantMenu = sysTenantMenuService.getById(sysTenant.getMenuId());
|
|
|
-
|
|
|
- List<SysMenu> newMenuList = menuService
|
|
|
- .list(Wrappers.<SysMenu>lambdaQuery().in(SysMenu::getMenuId, tenantMenu.getMenuIds()));
|
|
|
+ // 重新查询出所有的菜单关联角色
|
|
|
+ List<SysMenu> list = menuService.list();
|
|
|
|
|
|
// 查询全部菜单,构造角色菜单关系
|
|
|
- List<SysRoleMenu> roleMenuList = newMenuList.stream().map(menu -> {
|
|
|
+ List<SysRoleMenu> roleMenuList = list.stream().map(menu -> {
|
|
|
SysRoleMenu roleMenu = new SysRoleMenu();
|
|
|
roleMenu.setRoleId(role.getRoleId());
|
|
|
roleMenu.setMenuId(menu.getMenuId());
|
|
|
return roleMenu;
|
|
|
}).collect(Collectors.toList());
|
|
|
- roleMenuList.forEach(ele -> roleMenuMapper.insert(ele));
|
|
|
+ roleMenuList.forEach(roleMenuMapper::insert);
|
|
|
// 插入系统字典
|
|
|
dictService.saveBatch(dictList.stream().peek(d -> d.setId(null)).collect(Collectors.toList()));
|
|
|
// 处理字典项最新关联的字典ID
|