From 379af9bd87545e674a08316333a21e1fcaccf3a6 Mon Sep 17 00:00:00 2001
From: liuxm <liuxm_a@163.com>
Date: 星期二, 04 六月 2024 09:15:45 +0800
Subject: [PATCH] 安装运维生产计划;生产计划部分修改

---
 pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/DevOpsPlanCtrl.java |  105 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 103 insertions(+), 2 deletions(-)

diff --git a/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/DevOpsPlanCtrl.java b/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/DevOpsPlanCtrl.java
index 78c1e23..4be3c4b 100644
--- a/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/DevOpsPlanCtrl.java
+++ b/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/DevOpsPlanCtrl.java
@@ -1,8 +1,19 @@
 package com.dy.pmsProduct.taskPlan;
 
+import com.dy.common.aop.SsoPowerAop;
+import com.dy.common.webUtil.BaseResponse;
+import com.dy.common.webUtil.BaseResponseUtils;
+import com.dy.common.webUtil.QueryResultVo;
+import com.dy.pmsGlobal.aop.Log;
+import com.dy.pmsGlobal.pojoPr.PrDevOpsPlan;
+import jakarta.validation.Valid;
 import lombok.extern.slf4j.Slf4j;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+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;
 
 /**
  * 瀹夎杩愮淮浠诲姟璁″垝
@@ -11,4 +22,94 @@
 @RestController
 @RequestMapping(path="devOps")
 public class DevOpsPlanCtrl {
+    private DevOpsSv sv;
+    @Autowired
+    public void setSv(DevOpsSv sv) {
+        this.sv = sv;
+    }
+
+
+    @PostMapping(path="save")
+    @SsoPowerAop(power = "-1")
+    @Log("淇濆瓨缁勮浠诲姟璁″垝")
+    public BaseResponse<Boolean> save(@RequestBody @Valid PrDevOpsPlan plan, BindingResult bindingResult){
+        if (bindingResult != null && bindingResult.hasErrors()) {
+            return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
+        }
+        int count;
+        try {
+            count = sv.save(plan);
+        }catch (Exception e){
+            log.error("淇濆瓨缁勮浠诲姟璁″垝寮傚父", e);
+            return BaseResponseUtils.buildException(e.getMessage());
+        }
+        if (count <= 0) {
+            return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�");
+        } else {
+            return BaseResponseUtils.buildSuccess(true);
+        }
+    }
+
+    /**
+     * 鏇存柊
+     * @param plan
+     * @param bindingResult
+     * @return
+     */
+    @PostMapping(path="update")
+    @SsoPowerAop(power = "-1")
+    @Log("鏇存柊缁勮浠诲姟璁″垝")
+    public BaseResponse<Boolean> update(@RequestBody @Valid PrDevOpsPlan plan, BindingResult bindingResult){
+        int count;
+        try {
+            if (bindingResult != null && bindingResult.hasErrors()) {
+                return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
+            }
+            count = sv.update(plan);
+        }catch (Exception e){
+            log.error("鏇存柊缁勮浠诲姟璁″垝寮傚父", e);
+            return BaseResponseUtils.buildException(e.getMessage());
+        }
+        if (count <= 0) {
+            return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�");
+        } else {
+            return BaseResponseUtils.buildSuccess(true);
+        }
+    }
+
+    /**
+     * 鏍规嵁ID鏌ヨ
+     * @return
+     */
+    @GetMapping(path="one")
+    @SsoPowerAop(power = "-1")
+    @Log("鏍规嵁ID鏌ヨ缁勮浠诲姟璁″垝")
+    public BaseResponse<PrDevOpsPlan> one(Long id){
+        try{
+            PrDevOpsPlan plan=sv.selectById(id);
+            return BaseResponseUtils.buildSuccess(plan);
+        }catch (Exception e){
+            log.error("鏍规嵁ID鏌ヨ缁勮浠诲姟璁″垝寮傚父", e);
+            return BaseResponseUtils.buildException(e.getMessage());
+        }
+    }
+
+    /**
+     * 鍒嗛〉鏌ヨ
+     * @param vo
+     * @return
+     */
+    @PostMapping(path="some")
+    @SsoPowerAop(power = "-1")
+    @Log("鍒嗛〉鏌ヨ缁勮浠诲姟璁″垝")
+    public BaseResponse<QueryResultVo<List<PrDevOpsPlan>>> some(@RequestBody QueryVo vo){
+        try {
+            QueryResultVo<List<PrDevOpsPlan>> list = sv.selectSome(vo) ;
+            return BaseResponseUtils.buildSuccess(list);
+        }catch (Exception e){
+            log.error("鍒嗛〉鏌ヨ缁勮浠诲姟璁″垝寮傚父", e);
+            return BaseResponseUtils.buildException(e.getMessage());
+        }
+    }
+
 }

--
Gitblit v1.8.0