|
@@ -9,7 +9,6 @@ import cn.cslg.permission.domain.Department;
|
|
|
import cn.cslg.permission.domain.Personnel;
|
|
|
import cn.cslg.permission.domain.Role;
|
|
|
import cn.cslg.permission.domain.Tenant;
|
|
|
-import cn.cslg.permission.domain.associate.AssoTenantFunction;
|
|
|
import cn.cslg.permission.mapper.AssoTenantVipTypeFunctionMapper;
|
|
|
import cn.cslg.permission.mapper.TenantEntityMapper;
|
|
|
import cn.cslg.permission.service.associate.PersonRoleService;
|
|
@@ -57,7 +56,7 @@ public class TenantService extends ServiceImpl<TenantEntityMapper, Tenant> {
|
|
|
if (personnelList.size() != 0) {
|
|
|
return Response.error("用户名已存在");
|
|
|
}
|
|
|
- //保存租户
|
|
|
+ //租户表保存租户信息
|
|
|
Tenant tenant = new Tenant();
|
|
|
tenant
|
|
|
.setTenantName(tenantVO.getName())
|
|
@@ -88,19 +87,18 @@ public class TenantService extends ServiceImpl<TenantEntityMapper, Tenant> {
|
|
|
tenant.updateById();
|
|
|
}
|
|
|
|
|
|
- //租户功能关联表保存信息
|
|
|
+ //准备租户和功能关联表保存信息
|
|
|
Integer tenantVipTypeId = tenant.getTenantVipType();
|
|
|
- List<AssoTenantVipTypeAndFunctionVO> assoTenantVipTypeAndFunctionVOS = assoTenantVipTypeFunctionMapper.selectByTenantVipTypeId(tenant.getTenantVipType());
|
|
|
- List<String> functions = tenantVO.getFunctions();
|
|
|
- List<List<Integer>> functionIds = new ArrayList<>();
|
|
|
+ List<AssoTenantVipTypeAndFunctionVO> assoTenantVipTypeAndFunctionVOS = assoTenantVipTypeFunctionMapper.selectByTenantVipTypeId(tenantVipTypeId);
|
|
|
+ List<String> functions = new ArrayList<>();
|
|
|
for (AssoTenantVipTypeAndFunctionVO assoTenantVipTypeAndFunctionVO : assoTenantVipTypeAndFunctionVOS) {
|
|
|
String functionModifyPath = assoTenantVipTypeAndFunctionVO.getFunctionModifyPath();
|
|
|
functions.add(functionModifyPath);
|
|
|
//将以逗号分隔的功能组件树字符串路径转换为Integer集合
|
|
|
List<Integer> functionId = Arrays.stream(functionModifyPath.split(",")).map(Integer::parseInt).collect(Collectors.toList());
|
|
|
- functionIds.add(functionId);
|
|
|
}
|
|
|
- tenantVO.setFunction(functionIds);
|
|
|
+ tenantVO.setFunctions(functions);
|
|
|
+ //租户和功能关联表保存信息
|
|
|
tenantFunctionService.add(tenantVO, tenant);
|
|
|
|
|
|
//角色功能权限关联表,角色表保存信息
|
|
@@ -178,6 +176,7 @@ public class TenantService extends ServiceImpl<TenantEntityMapper, Tenant> {
|
|
|
.setTenantQuota((tenantVO.getNumber()))
|
|
|
.setTenantStatus(tenantVO.getState())
|
|
|
.setTenantType(tenantVO.getType())
|
|
|
+ .setTenantVipType(tenantVO.getTenantVipType())
|
|
|
.setPersonnelId(tenantVO.getPersonnelId())
|
|
|
.setId(tenantVO.getId());
|
|
|
tenant.updateById();
|
|
@@ -189,6 +188,13 @@ public class TenantService extends ServiceImpl<TenantEntityMapper, Tenant> {
|
|
|
personnelService.updatePersonnel(personnelVO1);
|
|
|
//修改关联
|
|
|
//修改租户和功能的关联信息
|
|
|
+ List<AssoTenantVipTypeAndFunctionVO> assoTenantVipTypeAndFunctionVOS = assoTenantVipTypeFunctionMapper.selectByTenantVipTypeId(tenant.getTenantVipType());
|
|
|
+ ArrayList<String> functions = new ArrayList<>();
|
|
|
+ for (AssoTenantVipTypeAndFunctionVO assoTenantVipTypeAndFunctionVO : assoTenantVipTypeAndFunctionVOS) {
|
|
|
+ String functionModifyPath = assoTenantVipTypeAndFunctionVO.getFunctionModifyPath();
|
|
|
+ functions.add(functionModifyPath);
|
|
|
+ }
|
|
|
+ tenantVO.setFunctions(functions);
|
|
|
tenantFunctionService.updateRoleFunctionData(tenantVO, tenant);
|
|
|
//修改部门表里的TenantName(租户名称)字段
|
|
|
LambdaQueryWrapper<Department> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|