Browse Source

肉牛销售

523096025 2 năm trước cách đây
mục cha
commit
4b5aea35e6

+ 5 - 5
huimv-cattle/src/main/java/com/huimv/cattle/controller/PreventDetectionController.java

@@ -28,22 +28,22 @@ import java.util.Map;
  * @since 2022-12-14
  */
 @RestController
-@RequestMapping("/preventDetection")
+@RequestMapping("/v1.0.0/preventDetection")
 public class PreventDetectionController {
     @Autowired
     private PreventDetectionService preventDetectionService;
 
-    @PostMapping("/add")
+    @PostMapping("/savePreventDetection")
     public  Result add(@RequestBody PreventDetection preventDetection){
         preventDetectionService.save(preventDetection);
         return new Result(10000,"添加成功",true);
     }
-    @PostMapping("/update")
+    @PostMapping("/updatePreventDetection")
     public  Result update(@RequestBody PreventDetection preventDetection){
         preventDetectionService.updateById(preventDetection);
         return new Result(10000,"修改成功",true);
     }
-    @PostMapping("/delete")
+    @PostMapping("/deletePreventDetection")
     public  Result delete(@RequestBody Map<String,String> paramMap){
         String ids = paramMap.get("ids");
         String[] split = ids.split(",");
@@ -52,7 +52,7 @@ public class PreventDetectionController {
         }
         return new Result(10000,"删除成功",true);
     }
-    @PostMapping("/list")
+    @PostMapping("/getPreventDetection")
     public  Result list(@RequestBody PreventDetection preventDetection){
         List<PreventDetection> list = preventDetectionService.list(new QueryWrapper<PreventDetection>().orderByDesc("year").orderByDesc("month"));
         if (ObjectUtil.isEmpty(list)){

+ 43 - 1
huimv-cattle/src/main/java/com/huimv/cattle/controller/SalesCattleController.java

@@ -1,10 +1,23 @@
 package com.huimv.cattle.controller;
 
 
+import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.huimv.cattle.pojo.SalesCattle;
+import com.huimv.cattle.service.SalesCattleService;
+import com.huimv.common.utils.Result;
+import com.huimv.common.utils.ResultCode;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
 /**
  * <p>
  *  前端控制器
@@ -14,8 +27,37 @@ import org.springframework.web.bind.annotation.RestController;
  * @since 2022-12-15
  */
 @RestController
-@RequestMapping("/sales-cattle")
+@RequestMapping("/v1.0.0/salesCattle")
 public class SalesCattleController {
+    @Autowired
+    private SalesCattleService salesCattleService;
 
+    @PostMapping("/saveSalesCattle")
+    public Result add(@RequestBody SalesCattle salesCattle){
+        salesCattleService.save(salesCattle);
+        return new Result(10000,"添加成功",true);
+    }
+    @PostMapping("/updateSalesCattle")
+    public  Result update(@RequestBody SalesCattle salesCattle){
+        salesCattleService.updateById(salesCattle);
+        return new Result(10000,"修改成功",true);
+    }
+    @PostMapping("/deleteSalesCattle")
+    public  Result delete(@RequestBody Map<String,String> paramMap){
+        String ids = paramMap.get("ids");
+        String[] split = ids.split(",");
+        for (String s : split) {
+            salesCattleService.removeById(s);
+        }
+        return new Result(10000,"删除成功",true);
+    }
+    @PostMapping("/getSalesCattle")
+    public  Result list(@RequestBody SalesCattle salesCattle){
+        List<SalesCattle> list = salesCattleService.list(new QueryWrapper<SalesCattle>().orderByDesc("year").orderByDesc("quarter"));
+        if (ObjectUtil.isEmpty(list)){
+            return new Result(ResultCode.SUCCESS,new ArrayList<>());
+        }
+        return new Result(ResultCode.SUCCESS,list);
+    }
 }