From 22899f74279a47f4ec79e1325f8489d948ced005 Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期五, 15 九月 2023 17:24:44 +0800
Subject: [PATCH] 修改2.0   9.15

---
 standard-server/src/main/java/com/yuanchu/mom/controller/TechnologyController.java |   90 +++++++++++++++++++++++++++++++++++++-------
 1 files changed, 75 insertions(+), 15 deletions(-)

diff --git a/standard-server/src/main/java/com/yuanchu/mom/controller/TechnologyController.java b/standard-server/src/main/java/com/yuanchu/mom/controller/TechnologyController.java
index d9f788f..4a94d01 100644
--- a/standard-server/src/main/java/com/yuanchu/mom/controller/TechnologyController.java
+++ b/standard-server/src/main/java/com/yuanchu/mom/controller/TechnologyController.java
@@ -1,6 +1,7 @@
 package com.yuanchu.mom.controller;
 
 
+import com.yuanchu.mom.pojo.dto.TechnologyDto;
 import com.yuanchu.mom.service.TechnologyService;
 import com.yuanchu.mom.vo.Result;
 import io.swagger.annotations.Api;
@@ -8,23 +9,19 @@
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
 
-import org.springframework.web.bind.annotation.RestController;
-
-import java.util.List;
-import java.util.Map;
 
 /**
  * <p>
- *  鍓嶇鎺у埗鍣�
+ * 鍓嶇鎺у埗鍣�
  * </p>
  *
  * @author 姹熻嫃榈烽洀缃戠粶绉戞妧鏈夐檺鍏徃
  * @since 2023-07-31
  */
-@Api(tags = "鎶�鏈鐞�-->鏍囧噯MOM-->宸ヨ壓璺嚎")
+@Api(tags = "鎶�鏈鐞�-->鏍囧噯BOM-->宸ヨ壓璺嚎")
 @RestController
 @RequestMapping("/technology")
 public class TechnologyController {
@@ -32,14 +29,77 @@
     @Autowired
     private TechnologyService technologyService;
 
-    @ApiOperation(value = "閫夋嫨宸ヨ壓璺嚎鍑虹幇鐨勮〃鏍兼煡璇�")
+    @ApiOperation("鍙充笂瑙掓柊澧�-->宸ヨ壓璺嚎-->閫夋嫨璁惧缁�")
+    @GetMapping("/chooseDevice")
+    public Result<?> chooseDevice() {
+        return Result.success(technologyService.chooseDevice());
+    }
+
+    @ApiOperation("鍙充笂瑙掓柊澧�-->宸ヨ壓璺嚎-->閫夋嫨宸ュ簭")
     @ApiImplicitParams(value = {
-            @ApiImplicitParam(name = "technologyName", value = "宸ヨ壓鍚嶇О", dataTypeClass = String.class),
-            @ApiImplicitParam(name = "specificationId", value = "瑙勬牸ID", dataTypeClass = String.class,required = true)
+            @ApiImplicitParam(name = "specificationsId", value = "鍨嬪彿id", dataTypeClass = Integer.class, required = true),
+            @ApiImplicitParam(name = "version", value = "鐗堟湰", dataTypeClass = Integer.class, required = true)
     })
-    @GetMapping("/select")
-    public Result<?> selectTechnology(String technologyName, String specificationId){
-        List<Map<String, Object>> map = technologyService.selectTechnology(technologyName);
-        return Result.success(map);
+    @GetMapping("/chooseFather")
+    public Result<?> chooseFather(Integer specificationsId,Integer version) {
+        return Result.success(technologyService.chooseFather(specificationsId,version));
+    }
+
+    @ApiOperation("鍙充笂瑙掓柊澧�-->宸ヨ壓璺嚎")
+    @PostMapping("/add")
+    public Result<?> addTechnology(@Validated @RequestBody TechnologyDto technologyDto) {
+        return Result.success(technologyService.addTechnology(technologyDto));
+    }
+
+    @ApiOperation("濉啓鐢熶骇瀹氶,榧犳爣绉诲紑淇濆瓨")
+    @ApiImplicitParams(value = {
+            @ApiImplicitParam(name = "id", value = "宸ヨ壓璺嚎id", dataTypeClass = Integer.class, required = true),
+            @ApiImplicitParam(name = "productionQuota", value = "鐢熶骇瀹氶(涓�/澶�)", dataTypeClass = Integer.class, required = true)
+
+    })
+    @PostMapping("/write")
+    public Result<?> write(Integer id, Integer productionQuota) {
+        Integer write = technologyService.write(id, productionQuota);
+        if (write >= 1) {
+            return Result.success("鏇存柊鎴愬姛");
+        }
+        return Result.fail("鏇存柊澶辫触");
+    }
+
+    @ApiOperation("閫夋嫨璁惧缁�,榧犳爣绉诲紑淇濆瓨")
+    @ApiImplicitParams(value = {
+            @ApiImplicitParam(name = "id", value = "宸ヨ壓璺嚎id", dataTypeClass = Integer.class, required = true),
+            @ApiImplicitParam(name = "deviceGroup", value = "璁惧缁�", dataTypeClass = String.class, required = true)
+
+    })
+    @PostMapping("/writeDevice")
+    public Result<?> writeDevice(Integer id, String deviceGroup) {
+        Integer write = technologyService.writeDevice(id, deviceGroup);
+        if (write >= 1) {
+            return Result.success("鏇存柊鎴愬姛");
+        }
+        return Result.fail("鏇存柊澶辫触");
+    }
+
+
+    @ApiOperation(value = "鍒犻櫎")
+    @ApiImplicitParams(value = {
+            @ApiImplicitParam(name = "id", value = "宸ヨ壓璺嚎id", dataTypeClass = Integer.class,required = true)
+    })
+    @PostMapping("/delTechById")
+    public Result delTechById(Integer id) {
+        technologyService.delTechById(id);
+        return Result.success("鍒犻櫎"+id+"鎴愬姛!");
+    }
+
+    @ApiOperation(value = "鎵归噺鍒犻櫎")
+    @ApiImplicitParams(value = {
+            @ApiImplicitParam(name = "ids", value = "宸ヨ壓璺嚎id", dataTypeClass = String.class,required = true)
+    })
+    @PostMapping("/delAllTech")
+    public Result delAllTech(String ids) {
+        technologyService.delAllTech(ids);
+        return Result.success("鎵归噺鍒犻櫎鎴愬姛!");
     }
 }
+

--
Gitblit v1.9.3