1、修改组信息不能修改的问题

2、组下拉列表显示中文名
This commit is contained in:
SGK\17962 2025-11-06 16:32:12 +08:00
parent f9fa6f0c91
commit 06a35caa92

View File

@ -71,6 +71,7 @@ public class GroupConfigServiceImpl implements GroupConfigService {
private final JobMapper jobMapper;
private final WorkflowMapper workflowMapper;
private final SystemUserPermissionMapper systemUserPermissionMapper;
private final GroupConfigMapper groupConfigMapper;
@Override
@Transactional
@ -92,12 +93,6 @@ public class GroupConfigServiceImpl implements GroupConfigService {
@Override
@Transactional
public Boolean updateGroup(GroupConfigRequestVO groupConfigRequestVO) {
List<Integer> tablePartitionList = getTablePartitionList();
if (CollUtil.isEmpty(tablePartitionList)) {
return Boolean.FALSE;
}
String groupName = groupConfigRequestVO.getGroupName();
String namespaceId = UserSessionUtils.currentUserSession().getNamespaceId();
@ -111,16 +106,12 @@ public class GroupConfigServiceImpl implements GroupConfigService {
}
GroupConfig groupConfig = GroupConfigConverter.INSTANCE.toGroupConfig(groupConfigRequestVO);
//描述
groupConfig.setDescription(Optional.ofNullable(groupConfigRequestVO.getDescription()).orElse(StrUtil.EMPTY));
// 使用@TableField(value = "version", update= "%s+1") 进行更新version, 这里必须初始化一个值
groupConfig.setVersion(1);
// 不允许更新token
groupConfig.setToken(null);
Assert.isTrue(tablePartitionList.contains(groupConfigRequestVO.getGroupPartition()),
() -> new SnailJobServerException("Partition does not exist. [{}]", tablePartitionList));
Assert.isTrue(groupConfigRequestVO.getGroupPartition() >= 0,
() -> new SnailJobServerException("Partition cannot be negative."));
// 不允许更新组
groupConfig.setGroupName(null);
Assert.isTrue(1 == groupConfigAccess.update(groupConfig,
@ -267,15 +258,24 @@ public class GroupConfigServiceImpl implements GroupConfigService {
UserSessionVO userSessionVO = UserSessionUtils.currentUserSession();
if (userSessionVO.isUser()) {
return userSessionVO.getGroupNames();
List<String> groupNames = userSessionVO.getGroupNames();
ConfigAccess<GroupConfig> groupConfigAccess = accessTemplate.getGroupConfigAccess();
if (CollUtil.isEmpty(groupNames)) {
return Collections.emptyList();
}
List<GroupConfig> groupConfigs = groupConfigAccess.list(
new LambdaQueryWrapper<GroupConfig>()
.in(CollUtil.isNotEmpty(groupNames), GroupConfig::getGroupName, groupNames)
.eq(GroupConfig::getNamespaceId, userSessionVO.getNamespaceId()));
return StreamUtils.toList(groupConfigs, GroupConfig::getGroupNameCn);
}
ConfigAccess<GroupConfig> groupConfigAccess = accessTemplate.getGroupConfigAccess();
List<GroupConfig> groupConfigs = groupConfigAccess.list(new LambdaQueryWrapper<GroupConfig>()
.eq(GroupConfig::getNamespaceId, userSessionVO.getNamespaceId())
.select(GroupConfig::getGroupName));
.select(GroupConfig::getGroupNameCn));
//TODO ?
return StreamUtils.toList(groupConfigs, GroupConfig::getGroupName);
return StreamUtils.toList(groupConfigs, GroupConfig::getGroupNameCn);
}
@Override