|
@@ -58,7 +58,7 @@ public class DepartmentServiceImpl implements DepartmentService {
|
|
|
return ApiResult.error(ApiCode.PARAMETER_ERROR);
|
|
|
}
|
|
|
Department oldDepartment = departmentRepository.findByName(department.getName());
|
|
|
- if(!Objects.equals(oldDepartment.getId(), department.getId())){
|
|
|
+ if(Objects.nonNull(oldDepartment) && !Objects.equals(oldDepartment.getId(), department.getId())){
|
|
|
return ApiResult.error(ApiCode.REPETITION_ERROR);
|
|
|
}
|
|
|
department = departmentRepository.update(department);
|