|
|
|
@ -127,6 +127,13 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptDao, SysDeptEntit |
|
|
|
throw new RenException("您输入的编码已存在"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
String areaCode = dto.getAreaCode(); |
|
|
|
if (StringUtils.isNotBlank(areaCode)) { |
|
|
|
if (getAreaCodeCount(dto) > 0) { |
|
|
|
throw new RenException("您输入的区域编码已存在"); |
|
|
|
} |
|
|
|
} |
|
|
|
SysDeptEntity entity = ConvertUtils.sourceToTarget(dto, SysDeptEntity.class); |
|
|
|
|
|
|
|
entity.setPids(getPidList(entity.getPid())); |
|
|
|
@ -149,6 +156,14 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptDao, SysDeptEntit |
|
|
|
throw new RenException("您输入的编码已存在"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
String areaCode = dto.getAreaCode(); |
|
|
|
if (StringUtils.isNotBlank(areaCode)) { |
|
|
|
if (getAreaCodeCount(dto) > 0) { |
|
|
|
throw new RenException("您输入的区域编码已存在"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
SysDeptEntity entity = ConvertUtils.sourceToTarget(dto, SysDeptEntity.class); |
|
|
|
|
|
|
|
//上级部门不能为自身
|
|
|
|
@ -321,6 +336,15 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptDao, SysDeptEntit |
|
|
|
return baseDao.selectCount(wrapper); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Integer getAreaCodeCount(SysDeptDTO dto) { |
|
|
|
QueryWrapper<SysDeptEntity> wrapper = new QueryWrapper<>(); |
|
|
|
wrapper.eq("area_code", dto.getAreaCode()); |
|
|
|
Long id = dto.getId(); |
|
|
|
wrapper.ne(id != null, "id", dto.getId()); |
|
|
|
return baseDao.selectCount(wrapper); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Result<String> getParentDeptIds(Long deptId) { |
|
|
|
return new Result<String>().ok(getPidList(deptId)); |
|
|
|
|