mirror of
https://gitee.com/dromara/RuoYi-Cloud-Plus.git
synced 2025-10-14 14:10:24 +00:00
update 优化 以逗号拼接元素
This commit is contained in:
@@ -115,7 +115,7 @@ public class ServletUtils extends JakartaServletUtil {
|
||||
public static Map<String, String> getParamMap(ServletRequest request) {
|
||||
Map<String, String> params = new HashMap<>();
|
||||
for (Map.Entry<String, String[]> entry : getParams(request).entrySet()) {
|
||||
params.put(entry.getKey(), StringUtils.join(entry.getValue(), StringUtils.SEPARATOR));
|
||||
params.put(entry.getKey(), StringUtils.joinComma(entry.getValue()));
|
||||
}
|
||||
return params;
|
||||
}
|
||||
|
@@ -362,4 +362,24 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 将可迭代对象中的元素使用逗号拼接成字符串
|
||||
*
|
||||
* @param iterable 可迭代对象,如 List、Set 等
|
||||
* @return 拼接后的字符串
|
||||
*/
|
||||
public static String joinComma(Iterable<?> iterable) {
|
||||
return StringUtils.join(iterable, SEPARATOR);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将数组中的元素使用逗号拼接成字符串
|
||||
*
|
||||
* @param array 任意类型的数组
|
||||
* @return 拼接后的字符串
|
||||
*/
|
||||
public static String joinComma(Object[] array) {
|
||||
return StringUtils.join(array, SEPARATOR);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -113,7 +113,7 @@ public class SysOssServiceImpl implements ISysOssService {
|
||||
}
|
||||
}
|
||||
}
|
||||
return String.join(StringUtils.SEPARATOR, list);
|
||||
return StringUtils.joinComma(list);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<SysOss> buildQueryWrapper(SysOssBo bo) {
|
||||
|
@@ -38,7 +38,7 @@ public class SysTenantPackageBo extends BaseEntity {
|
||||
/**
|
||||
* 关联菜单id
|
||||
*/
|
||||
@AutoMapping(target = "menuIds", expression = "java(org.dromara.common.core.utils.StringUtils.join(source.getMenuIds(), \",\"))")
|
||||
@AutoMapping(target = "menuIds", expression = "java(org.dromara.common.core.utils.StringUtils.joinComma(source.getMenuIds()))")
|
||||
private Long[] menuIds;
|
||||
|
||||
/**
|
||||
|
@@ -111,7 +111,7 @@ public class SysClientServiceImpl implements ISysClientService {
|
||||
@Override
|
||||
public Boolean updateByBo(SysClientBo bo) {
|
||||
SysClient update = MapstructUtils.convert(bo, SysClient.class);
|
||||
update.setGrantType(String.join(",", bo.getGrantTypeList()));
|
||||
update.setGrantType(StringUtils.joinComma(bo.getGrantTypeList()));
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
|
@@ -198,7 +198,7 @@ public class SysDeptServiceImpl implements ISysDeptService {
|
||||
list.add(vo.getDeptName());
|
||||
}
|
||||
}
|
||||
return String.join(StringUtils.SEPARATOR, list);
|
||||
return StringUtils.joinComma(list);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -88,11 +88,7 @@ public class SysTenantPackageServiceImpl implements ISysTenantPackageService {
|
||||
SysTenantPackage add = MapstructUtils.convert(bo, SysTenantPackage.class);
|
||||
// 保存菜单id
|
||||
List<Long> menuIds = Arrays.asList(bo.getMenuIds());
|
||||
if (CollUtil.isNotEmpty(menuIds)) {
|
||||
add.setMenuIds(StringUtils.join(menuIds, ", "));
|
||||
} else {
|
||||
add.setMenuIds("");
|
||||
}
|
||||
add.setMenuIds(CollUtil.isNotEmpty(menuIds) ? StringUtils.joinComma(menuIds) : "");
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setPackageId(add.getPackageId());
|
||||
@@ -109,11 +105,7 @@ public class SysTenantPackageServiceImpl implements ISysTenantPackageService {
|
||||
SysTenantPackage update = MapstructUtils.convert(bo, SysTenantPackage.class);
|
||||
// 保存菜单id
|
||||
List<Long> menuIds = Arrays.asList(bo.getMenuIds());
|
||||
if (CollUtil.isNotEmpty(menuIds)) {
|
||||
update.setMenuIds(StringUtils.join(menuIds, ", "));
|
||||
} else {
|
||||
update.setMenuIds("");
|
||||
}
|
||||
update.setMenuIds(CollUtil.isNotEmpty(menuIds) ? StringUtils.joinComma(menuIds) : "");
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
|
@@ -622,7 +622,7 @@ public class SysUserServiceImpl implements ISysUserService {
|
||||
list.add(nickname);
|
||||
}
|
||||
}
|
||||
return String.join(StringUtils.SEPARATOR, list);
|
||||
return StringUtils.joinComma(list);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -130,7 +130,7 @@ public class FlwDefinitionServiceImpl implements IFlwDefinitionService {
|
||||
}
|
||||
}
|
||||
if (CollUtil.isNotEmpty(errorMsg)) {
|
||||
throw new ServiceException("节点【{}】未配置办理人!", StringUtils.join(errorMsg, ","));
|
||||
throw new ServiceException("节点【{}】未配置办理人!", StringUtils.joinComma(errorMsg));
|
||||
}
|
||||
}
|
||||
return defService.publish(id);
|
||||
|
@@ -261,7 +261,7 @@ public class FlwTaskServiceImpl implements IFlwTaskService {
|
||||
List<String> variableUserIds = Arrays.asList(userIds.split(StringUtils.SEPARATOR));
|
||||
hashSet.addAll(popUserIds);
|
||||
hashSet.addAll(variableUserIds);
|
||||
map.put(entry.getKey(), String.join(StringUtils.SEPARATOR, hashSet));
|
||||
map.put(entry.getKey(), StringUtils.joinComma(hashSet));
|
||||
}
|
||||
} else {
|
||||
map.put(entry.getKey(), entry.getValue());
|
||||
@@ -588,7 +588,7 @@ public class FlwTaskServiceImpl implements IFlwTaskService {
|
||||
for (FlowNode flowNode : nextFlowNodes) {
|
||||
Task first = StreamUtils.findFirst(buildNextTaskList, t -> t.getNodeCode().equals(flowNode.getNodeCode()));
|
||||
if (ObjectUtil.isNotNull(first) && CollUtil.isNotEmpty(first.getPermissionList())) {
|
||||
List<RemoteUserVo> users = flwTaskAssigneeService.fetchUsersByStorageIds(String.join(StringUtils.SEPARATOR, first.getPermissionList()));
|
||||
List<RemoteUserVo> users = flwTaskAssigneeService.fetchUsersByStorageIds(StringUtils.joinComma(first.getPermissionList()));
|
||||
if (CollUtil.isNotEmpty(users)) {
|
||||
flowNode.setPermissionFlag(StreamUtils.join(users, e -> String.valueOf(e.getUserId())));
|
||||
}
|
||||
|
Reference in New Issue
Block a user