From a55b77017e8763d0fe044a30b39f37dc9ebb9dbb Mon Sep 17 00:00:00 2001 From: liuxm <liuxm_a@163.com> Date: 星期二, 21 五月 2024 14:19:28 +0800 Subject: [PATCH] 返回文件原始名和扩展名 --- pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proUR/ProURCtrl.java | 65 ++++++++++++++++++++++++++------ 1 files changed, 53 insertions(+), 12 deletions(-) diff --git a/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proUR/ProURCtrl.java b/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proUR/ProURCtrl.java index 57493fa..6c3e6e8 100644 --- a/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proUR/ProURCtrl.java +++ b/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proUR/ProURCtrl.java @@ -6,7 +6,6 @@ import com.dy.common.webUtil.BaseResponseUtils; import com.dy.common.webUtil.QueryResultVo; import com.dy.pmsGlobal.aop.Log; -import com.dy.pmsGlobal.pojoPlt.PltProductParams; import com.dy.pmsGlobal.pojoPlt.PltProductUnqualifiedReason; import jakarta.validation.Valid; import lombok.extern.slf4j.Slf4j; @@ -38,18 +37,25 @@ * @return */ @PostMapping(path="save") - @SsoPowerAop(power = "10300001") + @SsoPowerAop(power = "10300009") @Log("淇濆瓨浜у搧鐢熶骇涓嶅悎鏍煎師鍥�") - public BaseResponse<PltProductParams> save(@RequestBody @Valid PltProductUnqualifiedReason reason,BindingResult bindingResult){ + public BaseResponse<Boolean> save(@RequestBody @Valid PltProductUnqualifiedReason reason,BindingResult bindingResult){ + int count; try { if (bindingResult != null && bindingResult.hasErrors()) { return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); } reason.deleted = false; - return BaseResponseUtils.buildSuccess(sv.save(reason)); + reason.disabled = false; + count = sv.save(reason); }catch (Exception e){ log.error("淇濆瓨浜у搧鐢熶骇涓嶅悎鏍煎師鍥犲紓甯�", e); return BaseResponseUtils.buildException(e.getMessage()); + } + if (count <= 0) { + return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�"); + } else { + return BaseResponseUtils.buildSuccess(true); } } @@ -61,17 +67,23 @@ * @return */ @PostMapping(path="update") - @SsoPowerAop(power = "10300001") + @SsoPowerAop(power = "10300009") @Log("鏇存柊浜у搧鐢熶骇涓嶅悎鏍煎師鍥�") - public BaseResponse<PltProductUnqualifiedReason> update(@RequestBody @Valid PltProductUnqualifiedReason reason,BindingResult bindingResult){ + public BaseResponse<Boolean> update(@RequestBody @Valid PltProductUnqualifiedReason reason,BindingResult bindingResult){ + int count; try { if (bindingResult != null && bindingResult.hasErrors()) { return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); } - return BaseResponseUtils.buildSuccess(sv.update(reason)); + count = sv.update(reason); }catch (Exception e){ log.error("鏇存柊浜у搧鐢熶骇涓嶅悎鏍煎師鍥犲紓甯�", e); return BaseResponseUtils.buildException(e.getMessage()); + } + if (count <= 0) { + return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�"); + } else { + return BaseResponseUtils.buildSuccess(true); } } @@ -81,14 +93,20 @@ * @return */ @GetMapping(path="delete") - @SsoPowerAop(power = "10300001") + @SsoPowerAop(power = "10300009") @Log("鍒犻櫎浜у搧鐢熶骇涓嶅悎鏍煎師鍥�") - public BaseResponse<PltProductUnqualifiedReason> delete(String id){ + public BaseResponse<Boolean> delete(String id){ + int count; try { - return BaseResponseUtils.buildSuccess(sv.delete(Long.parseLong(id))); + count = sv.delete(Long.parseLong(id)); }catch (Exception e){ log.error("鍒犻櫎浜у搧鐢熶骇涓嶅悎鏍煎師鍥犲紓甯�", e); return BaseResponseUtils.buildException(e.getMessage()); + } + if (count <= 0) { + return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�"); + } else { + return BaseResponseUtils.buildSuccess(true); } } @@ -99,7 +117,7 @@ * @return */ @GetMapping(path="one") - @SsoPowerAop(power = "10300000") //鐧诲綍涓庢潈闄愬悓鏃堕獙璇� + @SsoPowerAop(power = "10300008") //鐧诲綍涓庢潈闄愬悓鏃堕獙璇� @Log("鏍规嵁ID鏌ヨ浜у搧鐢熶骇涓嶅悎鏍煎師鍥�") public BaseResponse<PltProductUnqualifiedReason> one(String id){ try{ @@ -117,7 +135,7 @@ * @return */ @PostMapping(path="some") - @SsoPowerAop(power = "10300000") + @SsoPowerAop(power = "10300008") @Log("鏌ヨ浜у搧鐢熶骇涓嶅悎鏍煎師鍥�") public BaseResponse<QueryResultVo<List<PltProductUnqualifiedReason>>> some(@RequestBody QueryVo vo){ try { @@ -129,5 +147,28 @@ } } + /** + * 绂佺敤鎴栧惎鐢� + * @param reason + * @return + */ + @PostMapping(path="disabled") + @SsoPowerAop(power = "10300009") + @Log("绂佺敤鎴栧惎鐢ㄤ笉鍚堟牸鍘熷洜") + public BaseResponse<Boolean> disabled(@RequestBody PltProductUnqualifiedReason reason){ + int count; + try { + count = sv.disabled(reason.id,reason.disabled); + }catch (Exception e){ + log.error("绂佺敤鎴栧惎鐢ㄤ笉鍚堟牸鍘熷洜寮傚父", e); + return BaseResponseUtils.buildException(e.getMessage()); + } + if (count <= 0) { + return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�"); + } else { + return BaseResponseUtils.buildSuccess(true); + } + } + } -- Gitblit v1.8.0