mirror of
https://github.com/dromara/RuoYi-Vue-Plus.git
synced 2025-09-24 07:19:46 +08:00
update 优化以逗号拼接元素
This commit is contained in:
@ -37,7 +37,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;
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user