From 55798c815327639fdc8f1874acf2ec543c596aa1 Mon Sep 17 00:00:00 2001 From: wuzeyu <1223318623@qq.com> Date: 星期三, 28 八月 2024 17:22:45 +0800 Subject: [PATCH] 优化代码 --- pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/divide/DivideCtrl.java | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/divide/DivideCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/divide/DivideCtrl.java index 4619a22..3b1096a 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/divide/DivideCtrl.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/divide/DivideCtrl.java @@ -101,7 +101,7 @@ if(res != null) { return BaseResponseUtils.buildSuccess(res); }else { - return BaseResponseUtils.buildFail(ProjectResultCode.NO_DIVIDES.getMessage()); + return BaseResponseUtils.buildErrorMsg(ProjectResultCode.NO_DIVIDES.getMessage()); } } catch (Exception e) { log.error("鏌ヨ鍐滄埛寮傚父", e); @@ -129,7 +129,7 @@ @SsoAop() public BaseResponse<Boolean> add(@RequestBody @Valid DtoDivide po, BindingResult bindingResult){ if(bindingResult != null && bindingResult.hasErrors()){ - return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); + return BaseResponseUtils.buildErrorMsg(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); } // 鎺ユ敹鏉戠紪鍙凤紙涓婚敭锛� Long villageId = po.getVillageId(); @@ -142,7 +142,7 @@ */ Map map_districts = Optional.ofNullable(divideSv.getDistrictsByVillageId(villageId)).orElse(new HashMap()); if(map_districts.size() <= 0) { - return BaseResponseUtils.buildFail("鍖哄垝淇℃伅鏈夎"); + return BaseResponseUtils.buildErrorMsg("鍖哄垝淇℃伅鏈夎"); } Long countryId = Long.parseLong(map_districts.get("countryId").toString()); Long townId = Long.parseLong(map_districts.get("townId").toString()); @@ -155,7 +155,7 @@ prDivide.setDeleted((byte)0); Integer rec = Optional.ofNullable(divideSv.addDivide(prDivide)).orElse(0); if(rec == 0) { - return BaseResponseUtils.buildFail(ProjectResultCode.DIVIDE_FAIL.getMessage()); + return BaseResponseUtils.buildErrorMsg(ProjectResultCode.DIVIDE_FAIL.getMessage()); } return BaseResponseUtils.buildSuccess(true) ; } @@ -186,7 +186,7 @@ try { Integer res = Optional.ofNullable(divideSv.deleteDivideById(id)).orElse(0); if(res == 0) - return BaseResponseUtils.buildFail(ProjectResultCode.DELETE_DIVIDE_FAIL.getMessage()); + return BaseResponseUtils.buildErrorMsg(ProjectResultCode.DELETE_DIVIDE_FAIL.getMessage()); return BaseResponseUtils.buildSuccess(true); } catch (Exception e) { @@ -215,7 +215,7 @@ @SsoAop() public BaseResponse<Boolean> update(@RequestBody @Valid DtoDivide po, BindingResult bindingResult){ if(bindingResult != null && bindingResult.hasErrors()){ - return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); + return BaseResponseUtils.buildErrorMsg(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); } // 鎺ユ敹鏉戠紪鍙凤紙涓婚敭锛� @@ -229,7 +229,7 @@ */ Map map_districts = Optional.ofNullable(divideSv.getDistrictsByVillageId(villageId)).orElse(new HashMap()); if(map_districts.size() <= 0) { - return BaseResponseUtils.buildFail("鍖哄垝淇℃伅鏈夎"); + return BaseResponseUtils.buildErrorMsg("鍖哄垝淇℃伅鏈夎"); } Long countryId = Long.parseLong(map_districts.get("countryId").toString()); Long townId = Long.parseLong(map_districts.get("townId").toString()); @@ -242,7 +242,7 @@ Integer rec = Optional.ofNullable(divideSv.updateByPrimaryKey(prDivide)).orElse(0); if(rec == 0) { - return BaseResponseUtils.buildFail("鍒嗘按鎴夸慨鏀瑰け璐�"); + return BaseResponseUtils.buildErrorMsg("鍒嗘按鎴夸慨鏀瑰け璐�"); } return BaseResponseUtils.buildSuccess(true) ; } -- Gitblit v1.8.0