| | |
| | | if (bindingResult != null && bindingResult.hasErrors()) { |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | |
| | | // 先判断表内是否存在相同的 groupCode |
| | | if (irrigateGroupSv.existsByGroupCode(po.getGroupCode())) { |
| | | return BaseResponseUtils.buildFail(IrrigateResultCode.GROUP_CODE_ALREADY_EXISTS.getMessage()); |
| | | } |
| | | |
| | | Map map_result = irrigateGroupSv.addIrrigateGroup(po); |
| | | if(map_result.get("success").equals(false)) { |
| | |
| | | if(po.getGroupId() == null) { |
| | | return BaseResponseUtils.buildErrorMsg("轮灌组ID不能为空"); |
| | | } |
| | | |
| | | // 先判断表内是否存在相同的 groupCode(排除当前正在修改的记录) |
| | | if (irrigateGroupSv.existsByGroupCodeExcludeId(po.getGroupCode(), po.getGroupId())) { |
| | | return BaseResponseUtils.buildFail(IrrigateResultCode.GROUP_CODE_ALREADY_EXISTS.getMessage()); |
| | | } |
| | | |
| | | Map map_result = irrigateGroupSv.updateIrrigateGroup(po); |
| | | if(map_result.get("success").equals(false)) { |