From d175d9c401fb97ebe6a580005a8c9ad5fedccb6b Mon Sep 17 00:00:00 2001
From: Fancy <Fancy.fx@outlook.com>
Date: 星期一, 29 七月 2024 17:02:41 +0800
Subject: [PATCH] add other method
---
pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proItems/ProItemsCtrl.java | 74 +++++++-----------------------------
1 files changed, 15 insertions(+), 59 deletions(-)
diff --git a/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proItems/ProItemsCtrl.java b/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proItems/ProItemsCtrl.java
index 8abe361..e52b152 100644
--- a/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proItems/ProItemsCtrl.java
+++ b/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proItems/ProItemsCtrl.java
@@ -6,18 +6,14 @@
import com.dy.common.webUtil.BaseResponseUtils;
import com.dy.common.webUtil.QueryResultVo;
import com.dy.pmsGlobal.aop.Log;
-import com.dy.pmsGlobal.pojoBa.BaRole;
-import com.dy.pmsGlobal.pojoPlt.PltProductParams;
import com.dy.pmsGlobal.pojoPlt.PltProductQualityInspectionItems;
import com.dy.pmsGlobal.pojoPlt.PltProductUnqualifiedReason;
import jakarta.validation.Valid;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import java.util.List;
-import java.util.Objects;
/**
* 浜у搧鍝佽川妫�鏌ラ」鐩�
@@ -36,25 +32,15 @@
/**
* 淇濆瓨浜у搧鍝佽川妫�鏌ラ」鐩�
* @param item
- * @param bindingResult
* @return
*/
@PostMapping(path="save")
@SsoPowerAop(power = "10300003")
@Log("淇濆瓨浜у搧鍝佽川妫�鏌ラ」鐩俊鎭�")
- public BaseResponse<Boolean> save(@RequestBody @Valid PltProductQualityInspectionItems item, BindingResult bindingResult){
- int count = 0;
- try {
- if (bindingResult != null && bindingResult.hasErrors()) {
- return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
- }
- item.deleted = false;
- item.disabled = false;
- count =sv.save(item);
- }catch (Exception e){
- log.error("淇濆瓨浜у搧鍝佽川妫�鏌ラ」鐩紓甯�", e);
- return BaseResponseUtils.buildException(e.getMessage());
- }
+ public BaseResponse<Boolean> save(@RequestBody @Valid PltProductQualityInspectionItems item){
+ item.deleted = false;
+ item.disabled = false;
+ int count =sv.save(item);
if (count <= 0) {
return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�");
} else {
@@ -66,23 +52,13 @@
/**
* 鏇存柊浜у搧鍝佽川妫�鏌ラ」鐩俊鎭�
* @param item
- * @param bindingResult
* @return
*/
@PostMapping(path="update")
@SsoPowerAop(power = "10300003")
@Log("鏇存柊浜у搧鍝佽川妫�鏌ラ」鐩俊鎭�")
- public BaseResponse<Boolean> update(@RequestBody @Valid PltProductQualityInspectionItems item,BindingResult bindingResult){
- int count ;
- try {
- if (bindingResult != null && bindingResult.hasErrors()) {
- return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
- }
- count = sv.update(item);
- }catch (Exception e){
- log.error("鏇存柊浜у搧鍝佽川妫�鏌ラ」鐩紓甯�", e);
- return BaseResponseUtils.buildException(e.getMessage());
- }
+ public BaseResponse<Boolean> update(@RequestBody @Valid PltProductQualityInspectionItems item){
+ int count = sv.update(item);
if (count <= 0) {
return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�");
} else {
@@ -99,13 +75,8 @@
@SsoPowerAop(power = "10300003")
@Log("鍒犻櫎浜у搧鍝佽川妫�鏌ラ」鐩俊鎭�")
public BaseResponse<Boolean> delete(String id){
- int count;
- try {
- count = sv.delete(Long.parseLong(id));
- }catch (Exception e){
- log.error("鍒犻櫎浜у搧鍝佽川妫�鏌ラ」鐩紓甯�", e);
- return BaseResponseUtils.buildException(e.getMessage());
- }
+ int count = sv.delete(Long.parseLong(id));
+
if (count <= 0) {
return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�");
} else {
@@ -123,13 +94,8 @@
@SsoPowerAop(power = "10300002") //鐧诲綍涓庢潈闄愬悓鏃堕獙璇�
@Log("鏍规嵁ID鏌ヨ浜у搧鍝佽川妫�鏌ラ」鐩俊鎭�")
public BaseResponse<PltProductQualityInspectionItems> one(String id){
- try{
- PltProductQualityInspectionItems item=sv.selectById(id);
- return BaseResponseUtils.buildSuccess(JSON.toJSON(item));
- }catch (Exception e){
- log.error("鏌ヨ浜у搧鍝佽川妫�鏌ラ」鐩紓甯�", e);
- return BaseResponseUtils.buildException(e.getMessage());
- }
+ PltProductQualityInspectionItems item=sv.selectById(id);
+ return BaseResponseUtils.buildSuccess(JSON.toJSON(item));
}
/**
@@ -141,13 +107,8 @@
@SsoPowerAop(power = "10300002")
@Log("鏌ヨ浜у搧鍝佽川妫�鏌ラ」鐩俊鎭�")
public BaseResponse<QueryResultVo<List<PltProductQualityInspectionItems>>> some(@RequestBody QueryVo vo){
- try {
- QueryResultVo<List<PltProductQualityInspectionItems>> list = sv.selectSome(vo) ;
- return BaseResponseUtils.buildSuccess(list);
- }catch (Exception e){
- log.error("鏌ヨ浜у搧鍝佽川妫�鏌ラ」鐩紓甯�", e);
- return BaseResponseUtils.buildException(e.getMessage());
- }
+ QueryResultVo<List<PltProductQualityInspectionItems>> list = sv.selectSome(vo) ;
+ return BaseResponseUtils.buildSuccess(list);
}
/**
* 绂佺敤鎴栧惎鐢�
@@ -157,14 +118,9 @@
@PostMapping(path="disabled")
@SsoPowerAop(power = "10100011")
@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());
- }
+ public BaseResponse<Boolean> disabled(@RequestBody PltProductQualityInspectionItems reason){
+ int count = sv.disabled(reason.id,reason.disabled);
+
if (count <= 0) {
return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�");
} else {
--
Gitblit v1.8.0