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/proLine/ProLineCtrl.java | 43 +++++++++++++++++++++++++++++++------------ 1 files changed, 31 insertions(+), 12 deletions(-) diff --git a/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proLine/ProLineCtrl.java b/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proLine/ProLineCtrl.java index 7aab925..f319e04 100644 --- a/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proLine/ProLineCtrl.java +++ b/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proLine/ProLineCtrl.java @@ -37,18 +37,25 @@ * @return */ @PostMapping(path="save") - @SsoPowerAop(power = "10300001") + @SsoPowerAop(power = "10300005") @Log("淇濆瓨鐢熶骇绾�") - public BaseResponse<PltProductionLine> save(@RequestBody @Valid PltProductionLine line,BindingResult bindingResult){ + public BaseResponse<Boolean> save(@RequestBody @Valid PltProductionLine line,BindingResult bindingResult){ + int count; try { if (bindingResult != null && bindingResult.hasErrors()) { return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); } + line.disabled = false; line.deleted = false; - return BaseResponseUtils.buildSuccess(sv.save(line)); + count = sv.save(line); }catch (Exception e){ log.error("淇濆瓨鐢熶骇绾垮紓甯�", e); return BaseResponseUtils.buildException(e.getMessage()); + } + if (count <= 0) { + return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�"); + } else { + return BaseResponseUtils.buildSuccess(true); } } @@ -60,17 +67,23 @@ * @return */ @PostMapping(path="update") - @SsoPowerAop(power = "10300001") + @SsoPowerAop(power = "10300005") @Log("鏇存柊鐢熶骇绾�") - public BaseResponse<PltProductionLine> update(@RequestBody @Valid PltProductionLine line,BindingResult bindingResult){ + public BaseResponse<Boolean> update(@RequestBody @Valid PltProductionLine line,BindingResult bindingResult){ + int count; try { if (bindingResult != null && bindingResult.hasErrors()) { return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); } - return BaseResponseUtils.buildSuccess(sv.update(line)); + count = sv.update(line); }catch (Exception e){ log.error("鏇存柊鐢熶骇绾垮紓甯�", e); return BaseResponseUtils.buildException(e.getMessage()); + } + if (count <= 0) { + return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�"); + } else { + return BaseResponseUtils.buildSuccess(true); } } @@ -80,14 +93,20 @@ * @return */ @GetMapping(path="delete") - @SsoPowerAop(power = "10300001") + @SsoPowerAop(power = "10300005") @Log("鍒犻櫎鐢熶骇绾�") - public BaseResponse<PltProductionLine> 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); } } @@ -98,7 +117,7 @@ * @return */ @GetMapping(path="one") - @SsoPowerAop(power = "10300000") //鐧诲綍涓庢潈闄愬悓鏃堕獙璇� + @SsoPowerAop(power = "10300004") //鐧诲綍涓庢潈闄愬悓鏃堕獙璇� @Log("鏍规嵁ID鏌ヨ鐢熶骇绾�") public BaseResponse<PltProductionLine> one(String id){ try{ @@ -116,7 +135,7 @@ * @return */ @PostMapping(path="some") - @SsoPowerAop(power = "10300000") + @SsoPowerAop(power = "10300004") @Log("鍒嗛〉鏌ヨ鐢熶骇绾�") public BaseResponse<QueryResultVo<List<PltProductionLine>>> some(@RequestBody QueryVo vo){ try { @@ -133,7 +152,7 @@ * @return */ @GetMapping(path="all") - @SsoPowerAop(power = "10300000") + @SsoPowerAop(power = "10300004") @Log("鏌ヨ鎵�鏈夌敓浜х嚎") public BaseResponse<List<PltProductionLine>> all(){ try { -- Gitblit v1.8.0