提交 a369b33b authored 作者: zjm's avatar zjm

fix(单位分组): 修改组名称的bug 编辑 不该改名称 提示名字重复

修改组名称的bug 编辑 不该改名称 提示名字重复
上级 bb12635f
...@@ -31,9 +31,18 @@ public class GroupServiceImpl implements GroupService { ...@@ -31,9 +31,18 @@ public class GroupServiceImpl implements GroupService {
UnitsService unitsService; UnitsService unitsService;
@Override @Override
public void saveGroup(Groups group) { public void saveGroup(Groups group) {
if (groupDao.existsByName(group.getName())){ if (group.getId()==null) {
if (groupDao.existsByName(group.getName())) {
throw new ApiException(ResponseEntity.status(20020).body("组名称重复")); throw new ApiException(ResponseEntity.status(20020).body("组名称重复"));
} }
}else {
Groups byId = findById(group.getId());
if (!byId.getName().equals(group.getName())){
if (groupDao.existsByName(group.getName())) {
throw new ApiException(ResponseEntity.status(20020).body("组名称重复"));
}
}
}
StringBuffer stringBuffer=new StringBuffer(); StringBuffer stringBuffer=new StringBuffer();
group.getMembers().forEach( group.getMembers().forEach(
integer -> stringBuffer.append(",").append(integer) integer -> stringBuffer.append(",").append(integer)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论