| | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.validation.BindingResult; |
| | | import org.springframework.validation.ObjectError; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | */ |
| | | @ApiOperation(value = "保存") |
| | | @PostMapping |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public ResultBody save(@Valid @RequestBody SysDepartment sysDepartment, BindingResult bindingResult) { |
| | | List<String> errMsg = new ArrayList<>(); |
| | | if (bindingResult.hasErrors()) { |
| | |
| | | Map<String, Object> checkDepartment = new HashMap<String, Object>(); |
| | | checkDepartment.put("page", 1); |
| | | checkDepartment.put("limit", 1); |
| | | checkDepartment.put("hospitalId", sysDepartment.getHospitalId()); |
| | | checkDepartment.put("departmentName", sysDepartment.getDepartmentName()); |
| | | if (sysDepartmentService.findList(checkDepartment).getData().size() > 0) { |
| | | return ResultBody.failed().msg(String.format("该医院下已经存在科室 %s", sysDepartment.getDepartmentName())); |