|
|
@@ -46,7 +46,7 @@ public class DeptServiceImpl implements DeptService {
|
|
|
@Override
|
|
|
public Result<String> addOne(MiddleDeptParam param) {
|
|
|
YtMiddleDept old = deptMapper.selectByName(param.getDeptName());
|
|
|
- if (Objects.nonNull(old)) {
|
|
|
+ if(Objects.nonNull(old)){
|
|
|
return Result.resultErr(RepMessage.OBJECT_ALREADY_EXIST);
|
|
|
}
|
|
|
YtMiddleDept dept = new YtMiddleDept();
|
|
|
@@ -64,7 +64,7 @@ public class DeptServiceImpl implements DeptService {
|
|
|
List<DropDownVO> all = deptMapper.getAllDeptList();
|
|
|
DropDownVO parent = all.stream().filter(s -> Objects.isNull(s.getParentId())).collect(Collectors.toList()).get(0);
|
|
|
List<DropDownVO> next = all.stream().filter(s -> Objects.nonNull(s.getParentId())).collect(Collectors.toList());
|
|
|
- recursionChildOption(parent, next);
|
|
|
+ recursionChildOption(parent,next);
|
|
|
return Result.resultObjOk(parent);
|
|
|
}
|
|
|
|
|
|
@@ -74,8 +74,8 @@ public class DeptServiceImpl implements DeptService {
|
|
|
@Override
|
|
|
public Result<String> updateOne(MiddleDeptParam param) {
|
|
|
YtMiddleDept old = deptMapper.selectPrimary(param.getDeptId());
|
|
|
- if (Objects.nonNull(old)) {
|
|
|
- return Result.resultErr(RepMessage.OBJECT_ALREADY_EXIST);
|
|
|
+ if(Objects.isNull(old)){
|
|
|
+ return Result.resultErr(RepMessage.OBJECT_NOT_EXIST);
|
|
|
}
|
|
|
YtMiddleDept dept = new YtMiddleDept();
|
|
|
BeanUtils.copyProperties(param, dept);
|
|
|
@@ -115,10 +115,10 @@ public class DeptServiceImpl implements DeptService {
|
|
|
*/
|
|
|
private void recursionChildOption(DropDownVO parent, List<DropDownVO> next) {
|
|
|
List<DropDownVO> collect = next.stream().filter(s -> Objects.equals(s.getParentId(), parent.getOptionVal())).collect(Collectors.toList());
|
|
|
- if (CollUtil.isEmpty(collect)) return;
|
|
|
+ if(CollUtil.isEmpty(collect))return;
|
|
|
parent.setChildren(collect);
|
|
|
for (DropDownVO vo : next) {
|
|
|
- recursionChildOption(vo, next);
|
|
|
+ recursionChildOption(vo,next);
|
|
|
}
|
|
|
}
|
|
|
}
|