🔨 数据分组添加 userId.
This commit is contained in:
@@ -92,6 +92,5 @@ public class ExecTemplateController {
|
|||||||
return execTemplateService.deleteExecTemplateById(id);
|
return execTemplateService.deleteExecTemplateById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ import com.orion.ops.module.infra.api.DataExtraApi;
|
|||||||
import com.orion.ops.module.infra.api.DataGroupRelApi;
|
import com.orion.ops.module.infra.api.DataGroupRelApi;
|
||||||
import com.orion.ops.module.infra.api.FavoriteApi;
|
import com.orion.ops.module.infra.api.FavoriteApi;
|
||||||
import com.orion.ops.module.infra.api.TagRelApi;
|
import com.orion.ops.module.infra.api.TagRelApi;
|
||||||
import com.orion.ops.module.infra.entity.dto.data.DataGroupRelCreateDTO;
|
|
||||||
import com.orion.ops.module.infra.entity.dto.tag.TagDTO;
|
import com.orion.ops.module.infra.entity.dto.tag.TagDTO;
|
||||||
import com.orion.ops.module.infra.enums.DataExtraTypeEnum;
|
import com.orion.ops.module.infra.enums.DataExtraTypeEnum;
|
||||||
import com.orion.ops.module.infra.enums.DataGroupTypeEnum;
|
import com.orion.ops.module.infra.enums.DataGroupTypeEnum;
|
||||||
@@ -103,13 +102,7 @@ public class HostServiceImpl implements HostService {
|
|||||||
// 引用分组
|
// 引用分组
|
||||||
List<Long> groupIdList = request.getGroupIdList();
|
List<Long> groupIdList = request.getGroupIdList();
|
||||||
if (!Lists.isEmpty(groupIdList)) {
|
if (!Lists.isEmpty(groupIdList)) {
|
||||||
List<DataGroupRelCreateDTO> groupRelList = groupIdList.stream()
|
dataGroupRelApi.updateRelGroup(DataGroupTypeEnum.HOST, request.getGroupIdList(), id);
|
||||||
.map(s -> DataGroupRelCreateDTO.builder()
|
|
||||||
.groupId(s)
|
|
||||||
.relId(id)
|
|
||||||
.build())
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
dataGroupRelApi.addGroupRel(groupRelList);
|
|
||||||
}
|
}
|
||||||
// 创建配置
|
// 创建配置
|
||||||
hostConfigService.initHostConfig(id);
|
hostConfigService.initHostConfig(id);
|
||||||
@@ -134,7 +127,7 @@ public class HostServiceImpl implements HostService {
|
|||||||
int effect = hostDAO.updateById(updateRecord);
|
int effect = hostDAO.updateById(updateRecord);
|
||||||
log.info("HostService-updateHostById effect: {}", effect);
|
log.info("HostService-updateHostById effect: {}", effect);
|
||||||
// 引用分组
|
// 引用分组
|
||||||
dataGroupRelApi.updateGroupRel(DataGroupTypeEnum.HOST, request.getGroupIdList(), id);
|
dataGroupRelApi.updateRelGroup(DataGroupTypeEnum.HOST, request.getGroupIdList(), id);
|
||||||
// 更新 tag
|
// 更新 tag
|
||||||
tagRelApi.setTagRel(TagTypeEnum.HOST, id, request.getTags());
|
tagRelApi.setTagRel(TagTypeEnum.HOST, id, request.getTags());
|
||||||
// 删除缓存
|
// 删除缓存
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public interface DataGroupRelApi {
|
|||||||
* @param groupIdList groupIdList
|
* @param groupIdList groupIdList
|
||||||
* @param relId relId
|
* @param relId relId
|
||||||
*/
|
*/
|
||||||
void updateGroupRel(DataGroupTypeEnum type, List<Long> groupIdList, Long relId);
|
void updateRelGroup(DataGroupTypeEnum type, List<Long> groupIdList, Long relId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加关联
|
* 添加关联
|
||||||
@@ -40,14 +40,14 @@ public interface DataGroupRelApi {
|
|||||||
* @param groupId groupId
|
* @param groupId groupId
|
||||||
* @param relId relId
|
* @param relId relId
|
||||||
*/
|
*/
|
||||||
void addGroupRel(Long groupId, Long relId);
|
void addGroupRel(DataGroupTypeEnum type, Long groupId, Long relId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量添加关联
|
* 批量添加关联
|
||||||
*
|
*
|
||||||
* @param list list
|
* @param list list
|
||||||
*/
|
*/
|
||||||
void addGroupRel(List<DataGroupRelCreateDTO> list);
|
void addGroupRel(DataGroupTypeEnum type, List<DataGroupRelCreateDTO> list);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过 type 查询 relId 缓存
|
* 通过 type 查询 relId 缓存
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package com.orion.ops.module.infra.api;
|
||||||
|
|
||||||
|
import com.orion.ops.module.infra.entity.dto.data.DataGroupCreateDTO;
|
||||||
|
import com.orion.ops.module.infra.entity.dto.data.DataGroupDTO;
|
||||||
|
import com.orion.ops.module.infra.enums.DataGroupTypeEnum;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据分组用户 对外服务类
|
||||||
|
*
|
||||||
|
* @author Jiahang Li
|
||||||
|
* @version 1.0.0
|
||||||
|
* @since 2023-11-7 18:44
|
||||||
|
*/
|
||||||
|
public interface DataGroupUserApi {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建数据分组
|
||||||
|
*
|
||||||
|
* @param type type
|
||||||
|
* @param userId userId
|
||||||
|
* @param dto dto
|
||||||
|
* @return id
|
||||||
|
*/
|
||||||
|
Long createDataGroup(DataGroupTypeEnum type, Long userId, DataGroupCreateDTO dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过缓存查询数据分组
|
||||||
|
*
|
||||||
|
* @param type type
|
||||||
|
* @param userId userId
|
||||||
|
* @return rows
|
||||||
|
*/
|
||||||
|
List<DataGroupDTO> getDataGroupList(DataGroupTypeEnum type, Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过缓存查询数据分组
|
||||||
|
*
|
||||||
|
* @param type type
|
||||||
|
* @param userId userId
|
||||||
|
* @return rows
|
||||||
|
*/
|
||||||
|
List<DataGroupDTO> getDataGroupTree(DataGroupTypeEnum type, Long userId);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,109 @@
|
|||||||
|
package com.orion.ops.module.infra.api;
|
||||||
|
|
||||||
|
import com.orion.ops.module.infra.entity.dto.data.DataGroupRelCreateDTO;
|
||||||
|
import com.orion.ops.module.infra.enums.DataGroupTypeEnum;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.Future;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据分组用户关联 对外服务类
|
||||||
|
*
|
||||||
|
* @author Jiahang Li
|
||||||
|
* @version 1.0.0
|
||||||
|
* @since 2023-11-7 18:44
|
||||||
|
*/
|
||||||
|
public interface DataGroupUserRelApi {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置关联
|
||||||
|
*
|
||||||
|
* @param type type
|
||||||
|
* @param userId userId
|
||||||
|
* @param groupIdList groupIdList
|
||||||
|
* @param relId relId
|
||||||
|
*/
|
||||||
|
void updateGroupRel(DataGroupTypeEnum type, Long userId, List<Long> groupIdList, Long relId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加关联
|
||||||
|
*
|
||||||
|
* @param type type
|
||||||
|
* @param userId userId
|
||||||
|
* @param groupId groupId
|
||||||
|
* @param relId relId
|
||||||
|
*/
|
||||||
|
void addGroupRel(DataGroupTypeEnum type, Long userId, Long groupId, Long relId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量添加关联
|
||||||
|
*
|
||||||
|
* @param type type
|
||||||
|
* @param userId userId
|
||||||
|
* @param list list
|
||||||
|
*/
|
||||||
|
void addGroupRel(DataGroupTypeEnum type, Long userId, List<DataGroupRelCreateDTO> list);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过 type 查询 relId 缓存
|
||||||
|
* <p>
|
||||||
|
* groupId - relId
|
||||||
|
*
|
||||||
|
* @param type type
|
||||||
|
* @param userId userId
|
||||||
|
* @return rows
|
||||||
|
*/
|
||||||
|
Map<Long, Set<Long>> getGroupRelList(DataGroupTypeEnum type, Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过 groupId 查询 relId 缓存
|
||||||
|
*
|
||||||
|
* @param type type
|
||||||
|
* @param userId userId
|
||||||
|
* @param groupId groupId
|
||||||
|
* @return relId
|
||||||
|
*/
|
||||||
|
Set<Long> getGroupRelIdByGroupId(DataGroupTypeEnum type, Long userId, Long groupId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过 relId 查询 groupId
|
||||||
|
*
|
||||||
|
* @param type type
|
||||||
|
* @param relId relId
|
||||||
|
* @return groupId
|
||||||
|
*/
|
||||||
|
Future<Set<Long>> getGroupIdByRelIdAsync(DataGroupTypeEnum type, Long userId, Long relId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除数据分组关联
|
||||||
|
*
|
||||||
|
* @param type type
|
||||||
|
* @param userId userId
|
||||||
|
* @param relId relId
|
||||||
|
* @return effect
|
||||||
|
*/
|
||||||
|
Integer deleteByRelId(DataGroupTypeEnum type, Long userId, Long relId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除数据分组关联
|
||||||
|
*
|
||||||
|
* @param type type
|
||||||
|
* @param userId userId
|
||||||
|
* @param relIdList relIdList
|
||||||
|
* @return effect
|
||||||
|
*/
|
||||||
|
Integer deleteByRelIdList(DataGroupTypeEnum type, Long userId, List<Long> relIdList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除数据分组关联
|
||||||
|
*
|
||||||
|
* @param type type
|
||||||
|
* @param userId userId
|
||||||
|
* @param groupIdList groupIdList
|
||||||
|
* @return effect
|
||||||
|
*/
|
||||||
|
Integer deleteByGroupIdList(DataGroupTypeEnum type, Long userId, List<Long> groupIdList);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.orion.ops.module.infra.api.impl;
|
package com.orion.ops.module.infra.api.impl;
|
||||||
|
|
||||||
|
import com.orion.ops.framework.common.constant.Const;
|
||||||
import com.orion.ops.framework.common.utils.Valid;
|
import com.orion.ops.framework.common.utils.Valid;
|
||||||
import com.orion.ops.module.infra.api.DataGroupApi;
|
import com.orion.ops.module.infra.api.DataGroupApi;
|
||||||
import com.orion.ops.module.infra.convert.DataGroupProviderConvert;
|
import com.orion.ops.module.infra.convert.DataGroupProviderConvert;
|
||||||
@@ -44,6 +45,7 @@ public class DataGroupApiImpl implements DataGroupApi {
|
|||||||
Valid.valid(dto);
|
Valid.valid(dto);
|
||||||
DataGroupCreateRequest request = DataGroupProviderConvert.MAPPER.toRequest(dto);
|
DataGroupCreateRequest request = DataGroupProviderConvert.MAPPER.toRequest(dto);
|
||||||
request.setType(type.name());
|
request.setType(type.name());
|
||||||
|
request.setUserId(Const.SYSTEM_USER_ID);
|
||||||
return dataGroupService.createDataGroup(request);
|
return dataGroupService.createDataGroup(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,13 +65,13 @@ public class DataGroupApiImpl implements DataGroupApi {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DataGroupDTO> getDataGroupList(DataGroupTypeEnum type) {
|
public List<DataGroupDTO> getDataGroupList(DataGroupTypeEnum type) {
|
||||||
List<DataGroupCacheDTO> rows = dataGroupService.getDataGroupListByCache(type.name());
|
List<DataGroupCacheDTO> rows = dataGroupService.getDataGroupListByCache(type.name(), Const.SYSTEM_USER_ID);
|
||||||
return DataGroupProviderConvert.MAPPER.toList(rows);
|
return DataGroupProviderConvert.MAPPER.toList(rows);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DataGroupDTO> getDataGroupTree(DataGroupTypeEnum type) {
|
public List<DataGroupDTO> getDataGroupTree(DataGroupTypeEnum type) {
|
||||||
List<DataGroupCacheDTO> rows = dataGroupService.getDataGroupTreeByCache(type.name());
|
List<DataGroupCacheDTO> rows = dataGroupService.getDataGroupTreeByCache(type.name(), Const.SYSTEM_USER_ID);
|
||||||
return DataGroupProviderConvert.MAPPER.toList(rows);
|
return DataGroupProviderConvert.MAPPER.toList(rows);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.orion.ops.module.infra.api.impl;
|
package com.orion.ops.module.infra.api.impl;
|
||||||
|
|
||||||
|
import com.orion.ops.framework.common.constant.Const;
|
||||||
import com.orion.ops.framework.common.utils.Valid;
|
import com.orion.ops.framework.common.utils.Valid;
|
||||||
import com.orion.ops.module.infra.api.DataGroupRelApi;
|
import com.orion.ops.module.infra.api.DataGroupRelApi;
|
||||||
import com.orion.ops.module.infra.convert.DataGroupRelProviderConvert;
|
import com.orion.ops.module.infra.convert.DataGroupRelProviderConvert;
|
||||||
@@ -43,28 +44,28 @@ public class DataGroupRelApiImpl implements DataGroupRelApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateGroupRel(DataGroupTypeEnum type, List<Long> groupIdList, Long relId) {
|
public void updateRelGroup(DataGroupTypeEnum type, List<Long> groupIdList, Long relId) {
|
||||||
Valid.notNull(relId);
|
Valid.notNull(relId);
|
||||||
dataGroupRelService.updateGroupRel(type.name(), groupIdList, relId);
|
dataGroupRelService.updateRelGroup(type.name(), Const.SYSTEM_USER_ID, groupIdList, relId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addGroupRel(Long groupId, Long relId) {
|
public void addGroupRel(DataGroupTypeEnum type, Long groupId, Long relId) {
|
||||||
Valid.notNull(groupId);
|
Valid.notNull(groupId);
|
||||||
Valid.notNull(relId);
|
Valid.notNull(relId);
|
||||||
dataGroupRelService.addGroupRel(groupId, relId);
|
dataGroupRelService.addGroupRel(type.name(), groupId, Const.SYSTEM_USER_ID, relId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addGroupRel(List<DataGroupRelCreateDTO> list) {
|
public void addGroupRel(DataGroupTypeEnum type, List<DataGroupRelCreateDTO> list) {
|
||||||
Valid.valid(list);
|
Valid.valid(list);
|
||||||
List<DataGroupRelCreateRequest> rows = DataGroupRelProviderConvert.MAPPER.toList(list);
|
List<DataGroupRelCreateRequest> rows = DataGroupRelProviderConvert.MAPPER.toList(list);
|
||||||
dataGroupRelService.addGroupRel(rows);
|
dataGroupRelService.addGroupRel(type.name(), Const.SYSTEM_USER_ID, rows);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<Long, Set<Long>> getGroupRelList(DataGroupTypeEnum type) {
|
public Map<Long, Set<Long>> getGroupRelList(DataGroupTypeEnum type) {
|
||||||
List<DataGroupRelCacheDTO> rows = dataGroupRelService.getGroupRelListByCache(type.name());
|
List<DataGroupRelCacheDTO> rows = dataGroupRelService.getGroupRelListByCache(type.name(), Const.SYSTEM_USER_ID);
|
||||||
return rows.stream().collect(
|
return rows.stream().collect(
|
||||||
Collectors.groupingBy(
|
Collectors.groupingBy(
|
||||||
DataGroupRelCacheDTO::getGroupId,
|
DataGroupRelCacheDTO::getGroupId,
|
||||||
@@ -81,7 +82,7 @@ public class DataGroupRelApiImpl implements DataGroupRelApi {
|
|||||||
@Override
|
@Override
|
||||||
@Async("asyncExecutor")
|
@Async("asyncExecutor")
|
||||||
public Future<Set<Long>> getGroupIdByRelIdAsync(DataGroupTypeEnum type, Long relId) {
|
public Future<Set<Long>> getGroupIdByRelIdAsync(DataGroupTypeEnum type, Long relId) {
|
||||||
Set<Long> groupIdList = dataGroupRelService.getGroupRelByRelId(type.name(), relId)
|
Set<Long> groupIdList = dataGroupRelService.getGroupRelByRelId(type.name(), Const.SYSTEM_USER_ID, relId)
|
||||||
.stream()
|
.stream()
|
||||||
.map(DataGroupRelDO::getGroupId)
|
.map(DataGroupRelDO::getGroupId)
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
@@ -90,17 +91,17 @@ public class DataGroupRelApiImpl implements DataGroupRelApi {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer deleteByRelId(DataGroupTypeEnum type, Long relId) {
|
public Integer deleteByRelId(DataGroupTypeEnum type, Long relId) {
|
||||||
return dataGroupRelService.deleteByRelId(type.name(), relId);
|
return dataGroupRelService.deleteByRelId(type.name(), Const.SYSTEM_USER_ID, relId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer deleteByRelIdList(DataGroupTypeEnum type, List<Long> relIdList) {
|
public Integer deleteByRelIdList(DataGroupTypeEnum type, List<Long> relIdList) {
|
||||||
return dataGroupRelService.deleteByRelIdList(type.name(), relIdList);
|
return dataGroupRelService.deleteByRelIdList(type.name(), Const.SYSTEM_USER_ID, relIdList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer deleteByGroupIdList(DataGroupTypeEnum type, List<Long> groupIdList) {
|
public Integer deleteByGroupIdList(DataGroupTypeEnum type, List<Long> groupIdList) {
|
||||||
return dataGroupRelService.deleteByGroupIdList(type.name(), groupIdList);
|
return dataGroupRelService.deleteByGroupIdList(type.name(), Const.SYSTEM_USER_ID, groupIdList);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,53 @@
|
|||||||
|
package com.orion.ops.module.infra.api.impl;
|
||||||
|
|
||||||
|
import com.orion.ops.framework.common.utils.Valid;
|
||||||
|
import com.orion.ops.module.infra.api.DataGroupUserApi;
|
||||||
|
import com.orion.ops.module.infra.convert.DataGroupProviderConvert;
|
||||||
|
import com.orion.ops.module.infra.entity.dto.DataGroupCacheDTO;
|
||||||
|
import com.orion.ops.module.infra.entity.dto.data.DataGroupCreateDTO;
|
||||||
|
import com.orion.ops.module.infra.entity.dto.data.DataGroupDTO;
|
||||||
|
import com.orion.ops.module.infra.entity.request.data.DataGroupCreateRequest;
|
||||||
|
import com.orion.ops.module.infra.enums.DataGroupTypeEnum;
|
||||||
|
import com.orion.ops.module.infra.service.DataGroupService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据分组 对外服务实现类
|
||||||
|
*
|
||||||
|
* @author Jiahang Li
|
||||||
|
* @version 1.0.0
|
||||||
|
* @since 2023-11-7 18:44
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class DataGroupUserApiImpl implements DataGroupUserApi {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private DataGroupService dataGroupService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long createDataGroup(DataGroupTypeEnum type, Long userId, DataGroupCreateDTO dto) {
|
||||||
|
Valid.valid(dto);
|
||||||
|
DataGroupCreateRequest request = DataGroupProviderConvert.MAPPER.toRequest(dto);
|
||||||
|
request.setType(type.name());
|
||||||
|
request.setUserId(userId);
|
||||||
|
return dataGroupService.createDataGroup(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DataGroupDTO> getDataGroupList(DataGroupTypeEnum type, Long userId) {
|
||||||
|
List<DataGroupCacheDTO> rows = dataGroupService.getDataGroupListByCache(type.name(), userId);
|
||||||
|
return DataGroupProviderConvert.MAPPER.toList(rows);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DataGroupDTO> getDataGroupTree(DataGroupTypeEnum type, Long userId) {
|
||||||
|
List<DataGroupCacheDTO> rows = dataGroupService.getDataGroupTreeByCache(type.name(), userId);
|
||||||
|
return DataGroupProviderConvert.MAPPER.toList(rows);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,100 @@
|
|||||||
|
package com.orion.ops.module.infra.api.impl;
|
||||||
|
|
||||||
|
import com.orion.ops.framework.common.utils.Valid;
|
||||||
|
import com.orion.ops.module.infra.api.DataGroupUserRelApi;
|
||||||
|
import com.orion.ops.module.infra.convert.DataGroupRelProviderConvert;
|
||||||
|
import com.orion.ops.module.infra.entity.domain.DataGroupRelDO;
|
||||||
|
import com.orion.ops.module.infra.entity.dto.DataGroupRelCacheDTO;
|
||||||
|
import com.orion.ops.module.infra.entity.dto.data.DataGroupRelCreateDTO;
|
||||||
|
import com.orion.ops.module.infra.entity.request.data.DataGroupRelCreateRequest;
|
||||||
|
import com.orion.ops.module.infra.enums.DataGroupTypeEnum;
|
||||||
|
import com.orion.ops.module.infra.service.DataGroupRelService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.scheduling.annotation.Async;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
import java.util.concurrent.Future;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据分组关联 对外服务实现类
|
||||||
|
*
|
||||||
|
* @author Jiahang Li
|
||||||
|
* @version 1.0.0
|
||||||
|
* @since 2023-11-7 18:44
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class DataGroupUserRelApiImpl implements DataGroupUserRelApi {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private DataGroupRelService dataGroupRelService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateGroupRel(DataGroupTypeEnum type, Long userId, List<Long> groupIdList, Long relId) {
|
||||||
|
Valid.notNull(relId);
|
||||||
|
dataGroupRelService.updateRelGroup(type.name(), userId, groupIdList, relId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addGroupRel(DataGroupTypeEnum type, Long userId, Long groupId, Long relId) {
|
||||||
|
Valid.notNull(groupId);
|
||||||
|
Valid.notNull(relId);
|
||||||
|
dataGroupRelService.addGroupRel(type.name(), userId, groupId, relId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addGroupRel(DataGroupTypeEnum type, Long userId, List<DataGroupRelCreateDTO> list) {
|
||||||
|
Valid.valid(list);
|
||||||
|
List<DataGroupRelCreateRequest> rows = DataGroupRelProviderConvert.MAPPER.toList(list);
|
||||||
|
dataGroupRelService.addGroupRel(type.name(), userId, rows);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<Long, Set<Long>> getGroupRelList(DataGroupTypeEnum type, Long userId) {
|
||||||
|
List<DataGroupRelCacheDTO> rows = dataGroupRelService.getGroupRelListByCache(type.name(), userId);
|
||||||
|
return rows.stream().collect(
|
||||||
|
Collectors.groupingBy(
|
||||||
|
DataGroupRelCacheDTO::getGroupId,
|
||||||
|
Collectors.mapping(DataGroupRelCacheDTO::getRelId, Collectors.toSet())
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set<Long> getGroupRelIdByGroupId(DataGroupTypeEnum type, Long userId, Long groupId) {
|
||||||
|
List<Long> rows = dataGroupRelService.getGroupRelIdListByCache(type.name(), groupId);
|
||||||
|
return new HashSet<>(rows);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Async("asyncExecutor")
|
||||||
|
public Future<Set<Long>> getGroupIdByRelIdAsync(DataGroupTypeEnum type, Long userId, Long relId) {
|
||||||
|
Set<Long> groupIdList = dataGroupRelService.getGroupRelByRelId(type.name(), userId, relId)
|
||||||
|
.stream()
|
||||||
|
.map(DataGroupRelDO::getGroupId)
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
return CompletableFuture.completedFuture(groupIdList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer deleteByRelId(DataGroupTypeEnum type, Long userId, Long relId) {
|
||||||
|
return dataGroupRelService.deleteByRelId(type.name(), userId, relId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer deleteByRelIdList(DataGroupTypeEnum type, Long userId, List<Long> relIdList) {
|
||||||
|
return dataGroupRelService.deleteByRelIdList(type.name(), userId, relIdList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer deleteByGroupIdList(DataGroupTypeEnum type, Long userId, List<Long> groupIdList) {
|
||||||
|
return dataGroupRelService.deleteByGroupIdList(type.name(), userId, groupIdList);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -18,16 +18,16 @@ import java.util.concurrent.TimeUnit;
|
|||||||
public interface DataGroupCacheKeyDefine {
|
public interface DataGroupCacheKeyDefine {
|
||||||
|
|
||||||
CacheKeyDefine DATA_GROUP_LIST = new CacheKeyBuilder()
|
CacheKeyDefine DATA_GROUP_LIST = new CacheKeyBuilder()
|
||||||
.key("data:group-list:{}")
|
.key("data:group-list:{}:{}")
|
||||||
.desc("数据分组列表结构 ${type}")
|
.desc("数据分组列表结构 ${type} ${userId}")
|
||||||
.type(DataGroupCacheDTO.class)
|
.type(DataGroupCacheDTO.class)
|
||||||
.struct(RedisCacheStruct.STRING)
|
.struct(RedisCacheStruct.STRING)
|
||||||
.timeout(1, TimeUnit.DAYS)
|
.timeout(1, TimeUnit.DAYS)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
CacheKeyDefine DATA_GROUP_TREE = new CacheKeyBuilder()
|
CacheKeyDefine DATA_GROUP_TREE = new CacheKeyBuilder()
|
||||||
.key("data:group-tree:{}")
|
.key("data:group-tree:{}:{}")
|
||||||
.desc("数据分组树结构 ${type}")
|
.desc("数据分组树结构 ${type} ${userId}")
|
||||||
.type(DataGroupCacheDTO.class)
|
.type(DataGroupCacheDTO.class)
|
||||||
.struct(RedisCacheStruct.STRING)
|
.struct(RedisCacheStruct.STRING)
|
||||||
.timeout(1, TimeUnit.DAYS)
|
.timeout(1, TimeUnit.DAYS)
|
||||||
@@ -42,8 +42,8 @@ public interface DataGroupCacheKeyDefine {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
CacheKeyDefine DATA_GROUP_REL_TYPE = new CacheKeyBuilder()
|
CacheKeyDefine DATA_GROUP_REL_TYPE = new CacheKeyBuilder()
|
||||||
.key("data:group-rel:type:{}")
|
.key("data:group-rel:type:{}:{}")
|
||||||
.desc("数据分组数据关联-类型 ${type}")
|
.desc("数据分组数据关联-类型 ${type} ${userId}")
|
||||||
.type(DataGroupRelCacheDTO.class)
|
.type(DataGroupRelCacheDTO.class)
|
||||||
.struct(RedisCacheStruct.STRING)
|
.struct(RedisCacheStruct.STRING)
|
||||||
.timeout(1, TimeUnit.DAYS)
|
.timeout(1, TimeUnit.DAYS)
|
||||||
|
|||||||
@@ -42,6 +42,10 @@ public class DataGroupDO extends BaseDO {
|
|||||||
@TableField("type")
|
@TableField("type")
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
|
@Schema(description = "用户id")
|
||||||
|
@TableField("user_id")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
@Schema(description = "排序")
|
@Schema(description = "排序")
|
||||||
@TableField("sort")
|
@TableField("sort")
|
||||||
private Integer sort;
|
private Integer sort;
|
||||||
|
|||||||
@@ -42,4 +42,8 @@ public class DataGroupRelDO extends BaseDO {
|
|||||||
@TableField("type")
|
@TableField("type")
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
|
@Schema(description = "用户id")
|
||||||
|
@TableField("user_id")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,15 @@ import java.io.Serializable;
|
|||||||
@Schema(name = "DataGroupCreateRequest", description = "数据分组 创建请求对象")
|
@Schema(name = "DataGroupCreateRequest", description = "数据分组 创建请求对象")
|
||||||
public class DataGroupCreateRequest implements Serializable {
|
public class DataGroupCreateRequest implements Serializable {
|
||||||
|
|
||||||
|
@NotBlank
|
||||||
|
@Size(max = 16)
|
||||||
|
@Schema(description = "组类型")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Schema(description = "用户id")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Schema(description = "父id")
|
@Schema(description = "父id")
|
||||||
private Long parentId;
|
private Long parentId;
|
||||||
@@ -34,9 +43,4 @@ public class DataGroupCreateRequest implements Serializable {
|
|||||||
@Schema(description = "组名称")
|
@Schema(description = "组名称")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@NotBlank
|
|
||||||
@Size(max = 16)
|
|
||||||
@Schema(description = "组类型")
|
|
||||||
private String type;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import java.util.List;
|
|||||||
public interface DataGroupRelService {
|
public interface DataGroupRelService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置关联
|
* 设置分组关联
|
||||||
*
|
*
|
||||||
* @param groupId groupId
|
* @param groupId groupId
|
||||||
* @param relIdList relIdList
|
* @param relIdList relIdList
|
||||||
@@ -24,13 +24,14 @@ public interface DataGroupRelService {
|
|||||||
void updateGroupRel(Long groupId, List<Long> relIdList);
|
void updateGroupRel(Long groupId, List<Long> relIdList);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置关联
|
* 设置关联分组
|
||||||
*
|
*
|
||||||
* @param type type
|
* @param type type
|
||||||
|
* @param userId userId
|
||||||
* @param groupIdList groupIdList
|
* @param groupIdList groupIdList
|
||||||
* @param relId relId
|
* @param relId relId
|
||||||
*/
|
*/
|
||||||
void updateGroupRel(String type, List<Long> groupIdList, Long relId);
|
void updateRelGroup(String type, Long userId, List<Long> groupIdList, Long relId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加关联
|
* 添加关联
|
||||||
@@ -38,22 +39,23 @@ public interface DataGroupRelService {
|
|||||||
* @param groupId groupId
|
* @param groupId groupId
|
||||||
* @param relId relId
|
* @param relId relId
|
||||||
*/
|
*/
|
||||||
void addGroupRel(Long groupId, Long relId);
|
void addGroupRel(String type, Long userId, Long groupId, Long relId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加关联
|
* 添加关联
|
||||||
*
|
*
|
||||||
* @param list list
|
* @param list list
|
||||||
*/
|
*/
|
||||||
void addGroupRel(List<DataGroupRelCreateRequest> list);
|
void addGroupRel(String type, Long userId, List<DataGroupRelCreateRequest> list);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过 type 查询 relId 缓存
|
* 通过 type 查询 relId 缓存
|
||||||
*
|
*
|
||||||
* @param type type
|
* @param type type
|
||||||
|
* @param userId userId
|
||||||
* @return rows
|
* @return rows
|
||||||
*/
|
*/
|
||||||
List<DataGroupRelCacheDTO> getGroupRelListByCache(String type);
|
List<DataGroupRelCacheDTO> getGroupRelListByCache(String type, Long userId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过 groupId 查询 relId 缓存
|
* 通过 groupId 查询 relId 缓存
|
||||||
@@ -68,36 +70,40 @@ public interface DataGroupRelService {
|
|||||||
* 通过 relId 查询 groupRel
|
* 通过 relId 查询 groupRel
|
||||||
*
|
*
|
||||||
* @param type type
|
* @param type type
|
||||||
|
* @param userId userId
|
||||||
* @param relId relId
|
* @param relId relId
|
||||||
* @return rows
|
* @return rows
|
||||||
*/
|
*/
|
||||||
List<DataGroupRelDO> getGroupRelByRelId(String type, Long relId);
|
List<DataGroupRelDO> getGroupRelByRelId(String type, Long userId, Long relId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除数据分组关联
|
* 删除数据分组关联
|
||||||
*
|
*
|
||||||
* @param type type
|
* @param type type
|
||||||
|
* @param userId userId
|
||||||
* @param relId relId
|
* @param relId relId
|
||||||
* @return effect
|
* @return effect
|
||||||
*/
|
*/
|
||||||
Integer deleteByRelId(String type, Long relId);
|
Integer deleteByRelId(String type, Long userId, Long relId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除数据分组关联
|
* 批量删除数据分组关联
|
||||||
*
|
*
|
||||||
* @param type type
|
* @param type type
|
||||||
|
* @param userId userId
|
||||||
* @param relIdList relIdList
|
* @param relIdList relIdList
|
||||||
* @return effect
|
* @return effect
|
||||||
*/
|
*/
|
||||||
Integer deleteByRelIdList(String type, List<Long> relIdList);
|
Integer deleteByRelIdList(String type, Long userId, List<Long> relIdList);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除数据分组关联
|
* 批量删除数据分组关联
|
||||||
*
|
*
|
||||||
|
* @param userId userId
|
||||||
* @param type type
|
* @param type type
|
||||||
* @param groupIdList groupIdList
|
* @param groupIdList groupIdList
|
||||||
* @return effect
|
* @return effect
|
||||||
*/
|
*/
|
||||||
Integer deleteByGroupIdList(String type, List<Long> groupIdList);
|
Integer deleteByGroupIdList(String type, Long userId, List<Long> groupIdList);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,24 +44,34 @@ public interface DataGroupService {
|
|||||||
* 通过缓存查询数据分组 - 列表
|
* 通过缓存查询数据分组 - 列表
|
||||||
*
|
*
|
||||||
* @param type type
|
* @param type type
|
||||||
|
* @param userId userId
|
||||||
* @return rows
|
* @return rows
|
||||||
*/
|
*/
|
||||||
List<DataGroupCacheDTO> getDataGroupListByCache(String type);
|
List<DataGroupCacheDTO> getDataGroupListByCache(String type, Long userId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过缓存查询数据分组 - 树结构
|
* 通过缓存查询数据分组 - 树结构
|
||||||
*
|
*
|
||||||
* @param type type
|
* @param type type
|
||||||
|
* @param userId userId
|
||||||
* @return rows
|
* @return rows
|
||||||
*/
|
*/
|
||||||
List<DataGroupCacheDTO> getDataGroupTreeByCache(String type);
|
List<DataGroupCacheDTO> getDataGroupTreeByCache(String type, Long userId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除数据分组
|
* 通过 id 删除数据分组
|
||||||
*
|
*
|
||||||
* @param id id
|
* @param id id
|
||||||
* @return effect
|
* @return effect
|
||||||
*/
|
*/
|
||||||
Integer deleteDataGroupById(Long id);
|
Integer deleteDataGroupById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过 userId 删除数据分组
|
||||||
|
*
|
||||||
|
* @param userId userId
|
||||||
|
* @return effect
|
||||||
|
*/
|
||||||
|
Integer deleteDataGroupByUserId(Long userId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ public class DataGroupRelServiceImpl implements DataGroupRelService {
|
|||||||
DataGroupDO group = dataGroupDAO.selectById(groupId);
|
DataGroupDO group = dataGroupDAO.selectById(groupId);
|
||||||
Valid.notNull(group, ErrorMessage.GROUP_ABSENT);
|
Valid.notNull(group, ErrorMessage.GROUP_ABSENT);
|
||||||
String type = group.getType();
|
String type = group.getType();
|
||||||
|
Long userId = group.getUserId();
|
||||||
// 设置日志参数
|
// 设置日志参数
|
||||||
OperatorLogs.add(OperatorLogs.GROUP_NAME, group.getName());
|
OperatorLogs.add(OperatorLogs.GROUP_NAME, group.getName());
|
||||||
if (Lists.isEmpty(relIdList)) {
|
if (Lists.isEmpty(relIdList)) {
|
||||||
@@ -76,15 +77,16 @@ public class DataGroupRelServiceImpl implements DataGroupRelService {
|
|||||||
dataGroupRelDAO.deleteBatchIds(deleteIdList);
|
dataGroupRelDAO.deleteBatchIds(deleteIdList);
|
||||||
}
|
}
|
||||||
// 查询新增的部分
|
// 查询新增的部分
|
||||||
List<Long> persetRelIdList = records.stream()
|
List<Long> presentRelIdList = records.stream()
|
||||||
.map(DataGroupRelDO::getRelId)
|
.map(DataGroupRelDO::getRelId)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
relIdList.removeIf(persetRelIdList::contains);
|
relIdList.removeIf(presentRelIdList::contains);
|
||||||
if (!relIdList.isEmpty()) {
|
if (!relIdList.isEmpty()) {
|
||||||
List<DataGroupRelDO> insertRecords = relIdList.stream()
|
List<DataGroupRelDO> insertRecords = relIdList.stream()
|
||||||
.map(s -> DataGroupRelDO.builder()
|
.map(s -> DataGroupRelDO.builder()
|
||||||
.groupId(groupId)
|
|
||||||
.type(type)
|
.type(type)
|
||||||
|
.userId(userId)
|
||||||
|
.groupId(groupId)
|
||||||
.relId(s)
|
.relId(s)
|
||||||
.build())
|
.build())
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
@@ -92,45 +94,46 @@ public class DataGroupRelServiceImpl implements DataGroupRelService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 删除缓存
|
// 删除缓存
|
||||||
this.deleteCache(type, Lists.of(groupId));
|
this.deleteCache(type, userId, Lists.singleton(groupId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void updateGroupRel(String type, List<Long> groupIdList, Long relId) {
|
public void updateRelGroup(String type, Long userId, List<Long> groupIdList, Long relId) {
|
||||||
Valid.notNull(relId);
|
Valid.notNull(relId);
|
||||||
// 删除引用
|
// 删除引用
|
||||||
this.deleteByRelId(type, relId);
|
this.deleteByRelId(type, userId, relId);
|
||||||
// 插入引用
|
// 插入引用
|
||||||
if (!Lists.isEmpty(groupIdList)) {
|
if (!Lists.isEmpty(groupIdList)) {
|
||||||
List<DataGroupRelDO> relList = groupIdList.stream()
|
List<DataGroupRelDO> relList = groupIdList.stream()
|
||||||
.map(s -> DataGroupRelDO.builder()
|
.map(s -> DataGroupRelDO.builder()
|
||||||
.type(type)
|
.type(type)
|
||||||
|
.userId(userId)
|
||||||
.groupId(s)
|
.groupId(s)
|
||||||
.relId(relId)
|
.relId(relId)
|
||||||
.build())
|
.build())
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
dataGroupRelDAO.insertBatch(relList);
|
dataGroupRelDAO.insertBatch(relList);
|
||||||
// 删除缓存
|
// 删除缓存
|
||||||
this.deleteCache(type, groupIdList);
|
this.deleteCache(type, userId, groupIdList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void addGroupRel(Long groupId, Long relId) {
|
public void addGroupRel(String type, Long userId, Long groupId, Long relId) {
|
||||||
DataGroupRelCreateRequest record = DataGroupRelCreateRequest.builder()
|
DataGroupRelCreateRequest record = DataGroupRelCreateRequest.builder()
|
||||||
.groupId(Valid.notNull(groupId))
|
.groupId(Valid.notNull(groupId))
|
||||||
.relId(Valid.notNull(relId))
|
.relId(Valid.notNull(relId))
|
||||||
.build();
|
.build();
|
||||||
// 插入
|
// 插入
|
||||||
SpringHolder.getBean(DataGroupRelService.class)
|
SpringHolder.getBean(DataGroupRelService.class)
|
||||||
.addGroupRel(Lists.singleton(record));
|
.addGroupRel(type, userId, Lists.singleton(record));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void addGroupRel(List<DataGroupRelCreateRequest> list) {
|
public void addGroupRel(String type, Long userId, List<DataGroupRelCreateRequest> list) {
|
||||||
if (Lists.isEmpty(list)) {
|
if (Lists.isEmpty(list)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -140,7 +143,6 @@ public class DataGroupRelServiceImpl implements DataGroupRelService {
|
|||||||
// 查询分组信息
|
// 查询分组信息
|
||||||
List<DataGroupDO> groups = dataGroupDAO.selectBatchIds(groupMapping.keySet());
|
List<DataGroupDO> groups = dataGroupDAO.selectBatchIds(groupMapping.keySet());
|
||||||
Valid.eq(groups.size(), groupMapping.size(), ErrorMessage.GROUP_ABSENT);
|
Valid.eq(groups.size(), groupMapping.size(), ErrorMessage.GROUP_ABSENT);
|
||||||
String type = groups.get(0).getType();
|
|
||||||
// 查询关联是否存在
|
// 查询关联是否存在
|
||||||
groupMapping.forEach((k, v) -> {
|
groupMapping.forEach((k, v) -> {
|
||||||
List<Long> relIdList = v.stream()
|
List<Long> relIdList = v.stream()
|
||||||
@@ -167,18 +169,19 @@ public class DataGroupRelServiceImpl implements DataGroupRelService {
|
|||||||
v.forEach(s -> records.add(DataGroupRelDO.builder()
|
v.forEach(s -> records.add(DataGroupRelDO.builder()
|
||||||
.groupId(k)
|
.groupId(k)
|
||||||
.type(type)
|
.type(type)
|
||||||
|
.userId(userId)
|
||||||
.relId(s.getRelId())
|
.relId(s.getRelId())
|
||||||
.build()));
|
.build()));
|
||||||
});
|
});
|
||||||
// 插入
|
// 插入
|
||||||
dataGroupRelDAO.insertBatch(records);
|
dataGroupRelDAO.insertBatch(records);
|
||||||
// 删除缓存
|
// 删除缓存
|
||||||
this.deleteCache(type, groupMapping.keySet());
|
this.deleteCache(type, userId, groupMapping.keySet());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DataGroupRelCacheDTO> getGroupRelListByCache(String type) {
|
public List<DataGroupRelCacheDTO> getGroupRelListByCache(String type, Long userId) {
|
||||||
String key = DataGroupCacheKeyDefine.DATA_GROUP_REL_TYPE.format(type);
|
String key = DataGroupCacheKeyDefine.DATA_GROUP_REL_TYPE.format(type, userId);
|
||||||
// 查询缓存
|
// 查询缓存
|
||||||
List<DataGroupRelCacheDTO> list = RedisStrings.getJsonArray(key, DataGroupCacheKeyDefine.DATA_GROUP_REL_TYPE);
|
List<DataGroupRelCacheDTO> list = RedisStrings.getJsonArray(key, DataGroupCacheKeyDefine.DATA_GROUP_REL_TYPE);
|
||||||
if (Lists.isEmpty(list)) {
|
if (Lists.isEmpty(list)) {
|
||||||
@@ -186,6 +189,7 @@ public class DataGroupRelServiceImpl implements DataGroupRelService {
|
|||||||
list = dataGroupRelDAO.of()
|
list = dataGroupRelDAO.of()
|
||||||
.createWrapper()
|
.createWrapper()
|
||||||
.eq(DataGroupRelDO::getType, type)
|
.eq(DataGroupRelDO::getType, type)
|
||||||
|
.eq(DataGroupRelDO::getUserId, userId)
|
||||||
.then()
|
.then()
|
||||||
.list(DataGroupRelConvert.MAPPER::toCache);
|
.list(DataGroupRelConvert.MAPPER::toCache);
|
||||||
// 设置屏障 防止穿透
|
// 设置屏障 防止穿透
|
||||||
@@ -224,10 +228,11 @@ public class DataGroupRelServiceImpl implements DataGroupRelService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DataGroupRelDO> getGroupRelByRelId(String type, Long relId) {
|
public List<DataGroupRelDO> getGroupRelByRelId(String type, Long userId, Long relId) {
|
||||||
return dataGroupRelDAO.of()
|
return dataGroupRelDAO.of()
|
||||||
.createWrapper()
|
.createWrapper()
|
||||||
.eq(DataGroupRelDO::getType, type)
|
.eq(DataGroupRelDO::getType, type)
|
||||||
|
.eq(DataGroupRelDO::getUserId, userId)
|
||||||
.eq(DataGroupRelDO::getRelId, relId)
|
.eq(DataGroupRelDO::getRelId, relId)
|
||||||
.then()
|
.then()
|
||||||
.list();
|
.list();
|
||||||
@@ -235,14 +240,14 @@ public class DataGroupRelServiceImpl implements DataGroupRelService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Integer deleteByRelId(String type, Long relId) {
|
public Integer deleteByRelId(String type, Long userId, Long relId) {
|
||||||
return SpringHolder.getBean(DataGroupRelService.class)
|
return SpringHolder.getBean(DataGroupRelService.class)
|
||||||
.deleteByRelIdList(type, Lists.singleton(relId));
|
.deleteByRelIdList(type, userId, Lists.singleton(relId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Integer deleteByRelIdList(String type, List<Long> relIdList) {
|
public Integer deleteByRelIdList(String type, Long userId, List<Long> relIdList) {
|
||||||
if (Strings.isBlank(type) || Lists.isEmpty(relIdList)) {
|
if (Strings.isBlank(type) || Lists.isEmpty(relIdList)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -250,6 +255,7 @@ public class DataGroupRelServiceImpl implements DataGroupRelService {
|
|||||||
List<DataGroupRelDO> rows = dataGroupRelDAO.of()
|
List<DataGroupRelDO> rows = dataGroupRelDAO.of()
|
||||||
.createWrapper()
|
.createWrapper()
|
||||||
.eq(DataGroupRelDO::getType, type)
|
.eq(DataGroupRelDO::getType, type)
|
||||||
|
.eq(DataGroupRelDO::getUserId, userId)
|
||||||
.in(DataGroupRelDO::getRelId, relIdList)
|
.in(DataGroupRelDO::getRelId, relIdList)
|
||||||
.then()
|
.then()
|
||||||
.list();
|
.list();
|
||||||
@@ -268,17 +274,17 @@ public class DataGroupRelServiceImpl implements DataGroupRelService {
|
|||||||
// 删除数据库
|
// 删除数据库
|
||||||
int effect = dataGroupRelDAO.deleteBatchIds(idList);
|
int effect = dataGroupRelDAO.deleteBatchIds(idList);
|
||||||
// 删除缓存
|
// 删除缓存
|
||||||
this.deleteCache(type, groupIdList);
|
this.deleteCache(type, userId, groupIdList);
|
||||||
return effect;
|
return effect;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Integer deleteByGroupIdList(String type, List<Long> groupIdList) {
|
public Integer deleteByGroupIdList(String type, Long userId, List<Long> groupIdList) {
|
||||||
// 删除数据库
|
// 删除数据库
|
||||||
int effect = dataGroupRelDAO.deleteByGroupId(groupIdList);
|
int effect = dataGroupRelDAO.deleteByGroupId(groupIdList);
|
||||||
// 删除缓存
|
// 删除缓存
|
||||||
this.deleteCache(type, groupIdList);
|
this.deleteCache(type, userId, groupIdList);
|
||||||
return effect;
|
return effect;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -286,11 +292,12 @@ public class DataGroupRelServiceImpl implements DataGroupRelService {
|
|||||||
* 删除缓存
|
* 删除缓存
|
||||||
*
|
*
|
||||||
* @param type type
|
* @param type type
|
||||||
|
* @param userId userId
|
||||||
* @param groupIdList groupIdList
|
* @param groupIdList groupIdList
|
||||||
*/
|
*/
|
||||||
private void deleteCache(String type, Collection<Long> groupIdList) {
|
private void deleteCache(String type, Long userId, Collection<Long> groupIdList) {
|
||||||
// 类型缓存
|
// 类型缓存
|
||||||
List<String> keyList = Lists.of(DataGroupCacheKeyDefine.DATA_GROUP_REL_TYPE.format(type));
|
List<String> keyList = Lists.of(DataGroupCacheKeyDefine.DATA_GROUP_REL_TYPE.format(type, userId));
|
||||||
// 分组缓存
|
// 分组缓存
|
||||||
if (!Lists.isEmpty(groupIdList)) {
|
if (!Lists.isEmpty(groupIdList)) {
|
||||||
groupIdList.stream()
|
groupIdList.stream()
|
||||||
|
|||||||
@@ -13,8 +13,10 @@ import com.orion.ops.framework.redis.core.utils.RedisStrings;
|
|||||||
import com.orion.ops.framework.redis.core.utils.barrier.CacheBarriers;
|
import com.orion.ops.framework.redis.core.utils.barrier.CacheBarriers;
|
||||||
import com.orion.ops.module.infra.convert.DataGroupConvert;
|
import com.orion.ops.module.infra.convert.DataGroupConvert;
|
||||||
import com.orion.ops.module.infra.dao.DataGroupDAO;
|
import com.orion.ops.module.infra.dao.DataGroupDAO;
|
||||||
|
import com.orion.ops.module.infra.dao.DataGroupRelDAO;
|
||||||
import com.orion.ops.module.infra.define.cache.DataGroupCacheKeyDefine;
|
import com.orion.ops.module.infra.define.cache.DataGroupCacheKeyDefine;
|
||||||
import com.orion.ops.module.infra.entity.domain.DataGroupDO;
|
import com.orion.ops.module.infra.entity.domain.DataGroupDO;
|
||||||
|
import com.orion.ops.module.infra.entity.domain.DataGroupRelDO;
|
||||||
import com.orion.ops.module.infra.entity.dto.DataGroupCacheDTO;
|
import com.orion.ops.module.infra.entity.dto.DataGroupCacheDTO;
|
||||||
import com.orion.ops.module.infra.entity.request.data.DataGroupCreateRequest;
|
import com.orion.ops.module.infra.entity.request.data.DataGroupCreateRequest;
|
||||||
import com.orion.ops.module.infra.entity.request.data.DataGroupMoveRequest;
|
import com.orion.ops.module.infra.entity.request.data.DataGroupMoveRequest;
|
||||||
@@ -43,6 +45,9 @@ public class DataGroupServiceImpl implements DataGroupService {
|
|||||||
@Resource
|
@Resource
|
||||||
private DataGroupDAO dataGroupDAO;
|
private DataGroupDAO dataGroupDAO;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private DataGroupRelDAO dataGroupRelDAO;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private DataGroupRelService dataGroupRelService;
|
private DataGroupRelService dataGroupRelService;
|
||||||
|
|
||||||
@@ -61,7 +66,7 @@ public class DataGroupServiceImpl implements DataGroupService {
|
|||||||
Long id = record.getId();
|
Long id = record.getId();
|
||||||
log.info("DataGroupService-createDataGroup id: {}, effect: {}", id, effect);
|
log.info("DataGroupService-createDataGroup id: {}, effect: {}", id, effect);
|
||||||
// 删除缓存
|
// 删除缓存
|
||||||
this.deleteCache(request.getType());
|
this.deleteCache(record.getUserId(), request.getType());
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,7 +90,7 @@ public class DataGroupServiceImpl implements DataGroupService {
|
|||||||
// 更新
|
// 更新
|
||||||
int effect = dataGroupDAO.updateById(updateRecord);
|
int effect = dataGroupDAO.updateById(updateRecord);
|
||||||
// 删除缓存
|
// 删除缓存
|
||||||
this.deleteCache(record.getType());
|
this.deleteCache(record.getUserId(), record.getType());
|
||||||
return effect;
|
return effect;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,7 +144,7 @@ public class DataGroupServiceImpl implements DataGroupService {
|
|||||||
effect = dataGroupDAO.updateById(update);
|
effect = dataGroupDAO.updateById(update);
|
||||||
}
|
}
|
||||||
// 删除缓存
|
// 删除缓存
|
||||||
this.deleteCache(type);
|
this.deleteCache(moveRecord.getUserId(), type);
|
||||||
// 添加日志参数
|
// 添加日志参数
|
||||||
OperatorLogs.add(OperatorLogs.SOURCE, moveRecord.getName());
|
OperatorLogs.add(OperatorLogs.SOURCE, moveRecord.getName());
|
||||||
OperatorLogs.add(OperatorLogs.TARGET, targetRecord.getName());
|
OperatorLogs.add(OperatorLogs.TARGET, targetRecord.getName());
|
||||||
@@ -148,15 +153,16 @@ public class DataGroupServiceImpl implements DataGroupService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DataGroupCacheDTO> getDataGroupListByCache(String type) {
|
public List<DataGroupCacheDTO> getDataGroupListByCache(String type, Long userId) {
|
||||||
// 查询缓存
|
// 查询缓存
|
||||||
String key = DataGroupCacheKeyDefine.DATA_GROUP_LIST.format(type);
|
String key = DataGroupCacheKeyDefine.DATA_GROUP_LIST.format(type, userId);
|
||||||
List<DataGroupCacheDTO> list = RedisStrings.getJsonArray(key, DataGroupCacheKeyDefine.DATA_GROUP_LIST);
|
List<DataGroupCacheDTO> list = RedisStrings.getJsonArray(key, DataGroupCacheKeyDefine.DATA_GROUP_LIST);
|
||||||
if (Lists.isEmpty(list)) {
|
if (Lists.isEmpty(list)) {
|
||||||
// 查询数据库
|
// 查询数据库
|
||||||
list = dataGroupDAO.of()
|
list = dataGroupDAO.of()
|
||||||
.createWrapper()
|
.createWrapper()
|
||||||
.eq(DataGroupDO::getType, type)
|
.eq(DataGroupDO::getType, type)
|
||||||
|
.eq(DataGroupDO::getUserId, userId)
|
||||||
.then()
|
.then()
|
||||||
.list(DataGroupConvert.MAPPER::toCache);
|
.list(DataGroupConvert.MAPPER::toCache);
|
||||||
// 设置屏障 防止穿透
|
// 设置屏障 防止穿透
|
||||||
@@ -170,13 +176,13 @@ public class DataGroupServiceImpl implements DataGroupService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DataGroupCacheDTO> getDataGroupTreeByCache(String type) {
|
public List<DataGroupCacheDTO> getDataGroupTreeByCache(String type, Long userId) {
|
||||||
// 查询缓存
|
// 查询缓存
|
||||||
String key = DataGroupCacheKeyDefine.DATA_GROUP_TREE.format(type);
|
String key = DataGroupCacheKeyDefine.DATA_GROUP_TREE.format(type, userId);
|
||||||
List<DataGroupCacheDTO> treeData = RedisStrings.getJsonArray(key, DataGroupCacheKeyDefine.DATA_GROUP_TREE);
|
List<DataGroupCacheDTO> treeData = RedisStrings.getJsonArray(key, DataGroupCacheKeyDefine.DATA_GROUP_TREE);
|
||||||
if (Lists.isEmpty(treeData)) {
|
if (Lists.isEmpty(treeData)) {
|
||||||
// 查询列表缓存
|
// 查询列表缓存
|
||||||
List<DataGroupCacheDTO> rows = this.getDataGroupListByCache(type);
|
List<DataGroupCacheDTO> rows = this.getDataGroupListByCache(type, userId);
|
||||||
// 设置屏障 防止穿透
|
// 设置屏障 防止穿透
|
||||||
CacheBarriers.checkBarrier(rows, DataGroupCacheDTO::new);
|
CacheBarriers.checkBarrier(rows, DataGroupCacheDTO::new);
|
||||||
if (!Lists.isEmpty(rows)) {
|
if (!Lists.isEmpty(rows)) {
|
||||||
@@ -210,15 +216,29 @@ public class DataGroupServiceImpl implements DataGroupService {
|
|||||||
// 删除分组
|
// 删除分组
|
||||||
int effect = dataGroupDAO.deleteBatchIds(deleteIdList);
|
int effect = dataGroupDAO.deleteBatchIds(deleteIdList);
|
||||||
// 删除组内数据
|
// 删除组内数据
|
||||||
dataGroupRelService.deleteByGroupIdList(type, deleteIdList);
|
dataGroupRelService.deleteByGroupIdList(type, record.getUserId(), deleteIdList);
|
||||||
log.info("DataGroupService-deleteDataGroupById id: {}, effect: {}", id, effect);
|
log.info("DataGroupService-deleteDataGroupById id: {}, effect: {}", id, effect);
|
||||||
// 删除缓存
|
// 删除缓存
|
||||||
this.deleteCache(type);
|
this.deleteCache(record.getUserId(), type);
|
||||||
// 添加日志参数
|
// 添加日志参数
|
||||||
OperatorLogs.add(OperatorLogs.GROUP_NAME, record.getName());
|
OperatorLogs.add(OperatorLogs.GROUP_NAME, record.getName());
|
||||||
return effect;
|
return effect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer deleteDataGroupByUserId(Long userId) {
|
||||||
|
// 删除分组
|
||||||
|
LambdaQueryWrapper<DataGroupDO> deleteGroup = dataGroupDAO.wrapper()
|
||||||
|
.eq(DataGroupDO::getUserId, userId);
|
||||||
|
int effect = dataGroupDAO.delete(deleteGroup);
|
||||||
|
// 删除分组引用
|
||||||
|
LambdaQueryWrapper<DataGroupRelDO> deleteRel = dataGroupRelDAO.wrapper()
|
||||||
|
.eq(DataGroupRelDO::getUserId, userId);
|
||||||
|
effect += dataGroupRelDAO.delete(deleteRel);
|
||||||
|
// 不删除缓存 自动过期
|
||||||
|
return effect;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取所有子节点 id
|
* 获取所有子节点 id
|
||||||
*
|
*
|
||||||
@@ -252,8 +272,9 @@ public class DataGroupServiceImpl implements DataGroupService {
|
|||||||
.ne(DataGroupDO::getId, domain.getId())
|
.ne(DataGroupDO::getId, domain.getId())
|
||||||
// 用其他字段做重复校验
|
// 用其他字段做重复校验
|
||||||
.eq(DataGroupDO::getParentId, domain.getParentId())
|
.eq(DataGroupDO::getParentId, domain.getParentId())
|
||||||
.eq(DataGroupDO::getName, domain.getName())
|
.eq(DataGroupDO::getType, domain.getType())
|
||||||
.eq(DataGroupDO::getType, domain.getType());
|
.eq(DataGroupDO::getUserId, domain.getUserId())
|
||||||
|
.eq(DataGroupDO::getName, domain.getName());
|
||||||
// 检查是否存在
|
// 检查是否存在
|
||||||
boolean present = dataGroupDAO.of(wrapper).present();
|
boolean present = dataGroupDAO.of(wrapper).present();
|
||||||
Valid.isFalse(present, ErrorMessage.DATA_PRESENT);
|
Valid.isFalse(present, ErrorMessage.DATA_PRESENT);
|
||||||
@@ -262,11 +283,12 @@ public class DataGroupServiceImpl implements DataGroupService {
|
|||||||
/**
|
/**
|
||||||
* 删除缓存
|
* 删除缓存
|
||||||
*
|
*
|
||||||
|
* @param userId userId
|
||||||
* @param type type
|
* @param type type
|
||||||
*/
|
*/
|
||||||
private void deleteCache(String type) {
|
private void deleteCache(Long userId, String type) {
|
||||||
RedisStrings.delete(DataGroupCacheKeyDefine.DATA_GROUP_LIST.format(type),
|
RedisStrings.delete(DataGroupCacheKeyDefine.DATA_GROUP_LIST.format(type, userId),
|
||||||
DataGroupCacheKeyDefine.DATA_GROUP_TREE.format(type));
|
DataGroupCacheKeyDefine.DATA_GROUP_TREE.format(type, userId));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import com.orion.ops.framework.redis.core.utils.RedisStrings;
|
|||||||
import com.orion.ops.framework.redis.core.utils.RedisUtils;
|
import com.orion.ops.framework.redis.core.utils.RedisUtils;
|
||||||
import com.orion.ops.framework.redis.core.utils.barrier.CacheBarriers;
|
import com.orion.ops.framework.redis.core.utils.barrier.CacheBarriers;
|
||||||
import com.orion.ops.framework.security.core.utils.SecurityUtils;
|
import com.orion.ops.framework.security.core.utils.SecurityUtils;
|
||||||
import com.orion.ops.module.infra.define.config.AppAuthenticationConfig;
|
|
||||||
import com.orion.ops.module.infra.convert.SystemUserConvert;
|
import com.orion.ops.module.infra.convert.SystemUserConvert;
|
||||||
import com.orion.ops.module.infra.dao.OperatorLogDAO;
|
import com.orion.ops.module.infra.dao.OperatorLogDAO;
|
||||||
import com.orion.ops.module.infra.dao.SystemRoleDAO;
|
import com.orion.ops.module.infra.dao.SystemRoleDAO;
|
||||||
@@ -23,6 +22,7 @@ import com.orion.ops.module.infra.dao.SystemUserRoleDAO;
|
|||||||
import com.orion.ops.module.infra.define.RoleDefine;
|
import com.orion.ops.module.infra.define.RoleDefine;
|
||||||
import com.orion.ops.module.infra.define.cache.TipsCacheKeyDefine;
|
import com.orion.ops.module.infra.define.cache.TipsCacheKeyDefine;
|
||||||
import com.orion.ops.module.infra.define.cache.UserCacheKeyDefine;
|
import com.orion.ops.module.infra.define.cache.UserCacheKeyDefine;
|
||||||
|
import com.orion.ops.module.infra.define.config.AppAuthenticationConfig;
|
||||||
import com.orion.ops.module.infra.entity.domain.SystemUserDO;
|
import com.orion.ops.module.infra.entity.domain.SystemUserDO;
|
||||||
import com.orion.ops.module.infra.entity.dto.UserInfoDTO;
|
import com.orion.ops.module.infra.entity.dto.UserInfoDTO;
|
||||||
import com.orion.ops.module.infra.entity.request.user.*;
|
import com.orion.ops.module.infra.entity.request.user.*;
|
||||||
@@ -77,6 +77,9 @@ public class SystemUserServiceImpl implements SystemUserService {
|
|||||||
@Resource
|
@Resource
|
||||||
private DataExtraService dataExtraService;
|
private DataExtraService dataExtraService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private DataGroupService dataGroupService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long createSystemUser(SystemUserCreateRequest request) {
|
public Long createSystemUser(SystemUserCreateRequest request) {
|
||||||
// 转换
|
// 转换
|
||||||
@@ -253,6 +256,8 @@ public class SystemUserServiceImpl implements SystemUserService {
|
|||||||
dataPermissionService.deleteByUserId(id);
|
dataPermissionService.deleteByUserId(id);
|
||||||
// 删除用户拓展数据
|
// 删除用户拓展数据
|
||||||
dataExtraService.deleteByUserId(id);
|
dataExtraService.deleteByUserId(id);
|
||||||
|
// 删除分组数据
|
||||||
|
dataGroupService.deleteDataGroupByUserId(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -6,8 +6,9 @@
|
|||||||
<resultMap id="BaseResultMap" type="com.orion.ops.module.infra.entity.domain.DataGroupDO">
|
<resultMap id="BaseResultMap" type="com.orion.ops.module.infra.entity.domain.DataGroupDO">
|
||||||
<id column="id" property="id"/>
|
<id column="id" property="id"/>
|
||||||
<result column="parent_id" property="parentId"/>
|
<result column="parent_id" property="parentId"/>
|
||||||
<result column="name" property="name"/>
|
|
||||||
<result column="type" property="type"/>
|
<result column="type" property="type"/>
|
||||||
|
<result column="user_id" property="userId"/>
|
||||||
|
<result column="name" property="name"/>
|
||||||
<result column="sort" property="sort"/>
|
<result column="sort" property="sort"/>
|
||||||
<result column="create_time" property="createTime"/>
|
<result column="create_time" property="createTime"/>
|
||||||
<result column="update_time" property="updateTime"/>
|
<result column="update_time" property="updateTime"/>
|
||||||
@@ -18,7 +19,7 @@
|
|||||||
|
|
||||||
<!-- 通用查询结果列 -->
|
<!-- 通用查询结果列 -->
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
id, parent_id, name, type, sort, create_time, update_time, creator, updater, deleted
|
id, parent_id, type, user_id, name, sort, create_time, update_time, creator, updater, deleted
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<update id="updateSort">
|
<update id="updateSort">
|
||||||
|
|||||||
@@ -5,9 +5,10 @@
|
|||||||
<!-- 通用查询映射结果 -->
|
<!-- 通用查询映射结果 -->
|
||||||
<resultMap id="BaseResultMap" type="com.orion.ops.module.infra.entity.domain.DataGroupRelDO">
|
<resultMap id="BaseResultMap" type="com.orion.ops.module.infra.entity.domain.DataGroupRelDO">
|
||||||
<id column="id" property="id"/>
|
<id column="id" property="id"/>
|
||||||
|
<result column="type" property="type"/>
|
||||||
|
<result column="user_id" property="userId"/>
|
||||||
<result column="group_id" property="groupId"/>
|
<result column="group_id" property="groupId"/>
|
||||||
<result column="rel_id" property="relId"/>
|
<result column="rel_id" property="relId"/>
|
||||||
<result column="type" property="type"/>
|
|
||||||
<result column="create_time" property="createTime"/>
|
<result column="create_time" property="createTime"/>
|
||||||
<result column="update_time" property="updateTime"/>
|
<result column="update_time" property="updateTime"/>
|
||||||
<result column="creator" property="creator"/>
|
<result column="creator" property="creator"/>
|
||||||
@@ -17,7 +18,7 @@
|
|||||||
|
|
||||||
<!-- 通用查询结果列 -->
|
<!-- 通用查询结果列 -->
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
id, group_id, rel_id, type, create_time, update_time, creator, updater, deleted
|
id, type, user_id, group_id, rel_id, create_time, update_time, creator, updater, deleted
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -136,6 +136,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
node.editable = true;
|
node.editable = true;
|
||||||
|
node.originTitle = node.title;
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
renameInput.value?.focus();
|
renameInput.value?.focus();
|
||||||
});
|
});
|
||||||
@@ -267,10 +268,17 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// 修改为空则设置为之前的值
|
||||||
|
node.title = node.originTitle;
|
||||||
}
|
}
|
||||||
node.editable = false;
|
node.editable = false;
|
||||||
}
|
}
|
||||||
|
// 重置 modCount
|
||||||
|
setTimeout(() => {
|
||||||
node.modCount = 0;
|
node.modCount = 0;
|
||||||
|
node.originTitle = undefined;
|
||||||
|
}, 50);
|
||||||
};
|
};
|
||||||
|
|
||||||
// 移动分组
|
// 移动分组
|
||||||
|
|||||||
Reference in New Issue
Block a user