From 2dd9790f5d7d27b350fec1412fc1e50d12280d7c Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期五, 15 八月 2025 14:40:14 +0800
Subject: [PATCH] 完善代码

---
 pipIrr-platform/pipIrr-web/pipIrr-web-model/src/main/java/com/dy/pipIrrModel/crops/CropsCtrl.java |   38 +++++++++++++++++++++++++++++++++-----
 1 files changed, 33 insertions(+), 5 deletions(-)

diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-model/src/main/java/com/dy/pipIrrModel/crops/CropsCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-model/src/main/java/com/dy/pipIrrModel/crops/CropsCtrl.java
index 39d892e..a5d2f82 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-model/src/main/java/com/dy/pipIrrModel/crops/CropsCtrl.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-model/src/main/java/com/dy/pipIrrModel/crops/CropsCtrl.java
@@ -20,6 +20,7 @@
 import org.springframework.validation.BindingResult;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.Date;
 import java.util.List;
 import java.util.Objects;
 
@@ -53,7 +54,7 @@
                             schema = @Schema(implementation = VoCrops.class))}
             )
     })
-    @GetMapping(path = "one", consumes = MediaType.TEXT_PLAIN_VALUE)
+    @GetMapping(path = "one")
     @SsoAop()
     public BaseResponse<VoCrops> one(Long id){
         return BaseResponseUtils.buildSuccess(this.sv.selectById(id));
@@ -71,9 +72,9 @@
                             schema = @Schema(implementation = VoCrops.class))}
             )
     })
-    @PostMapping(path = "some", consumes = MediaType.APPLICATION_JSON_VALUE)
+    @GetMapping(path = "some")
     @SsoAop()
-    public BaseResponse<QueryResultVo<List<VoCrops>>> some(@RequestBody CropsQo qo){
+    public BaseResponse<QueryResultVo<List<VoCrops>>> some(CropsQo qo){
         try {
             QueryResultVo<List<VoCrops>> res = this.sv.selectSome(qo) ;
             return BaseResponseUtils.buildSuccess(res);
@@ -82,7 +83,30 @@
             return BaseResponseUtils.buildException(e.getMessage()) ;
         }
     }
-
+    /**
+     * 瀹㈡埛绔姹傚緱鍒版墍鏈変綔鐗╂暟鎹�
+     * @return 鎵�鏈変綔鐗╂暟鎹�
+     */
+    @Operation(summary = "鑾峰緱鎵�鏈変綔鐗�", description = "杩斿洖鎵�鏈変綔鐗╂暟鎹�")
+    @ApiResponses(value = {
+            @ApiResponse(
+                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
+                    description = "杩斿洖鎵�鏈変綔鐗╂暟鎹紙BaseResponse.content:QueryResultVo[{}]锛�",
+                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
+                            schema = @Schema(implementation = VoCrops.class))}
+            )
+    })
+    @GetMapping(path = "all")
+    @SsoAop()
+    public BaseResponse<List<VoCrops>> all(){
+        try {
+            List<VoCrops> res = this.sv.selectAll() ;
+            return BaseResponseUtils.buildSuccess(res);
+        } catch (Exception e) {
+            log.error("鏌ヨ浣滅墿寮傚父", e);
+            return BaseResponseUtils.buildException(e.getMessage()) ;
+        }
+    }
     /**
      * 鏂板淇濆瓨浣滅墿
      * @param po 鏂板淇濆瓨浣滅墿form琛ㄥ崟瀵硅薄
@@ -104,6 +128,8 @@
             return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
         }
         po.id = null ;
+        po.createDt = new Date();
+        po.deleted = 0 ;
         int count;
         try {
             count = this.sv.save(po);
@@ -140,6 +166,8 @@
         if(po.id == null){
             return BaseResponseUtils.buildFail("鏃犳暟鎹疄浣揑D") ;
         }
+        po.createDt = null ;
+        po.deleted = null ;
         int count;
         try {
             count = this.sv.update(po);
@@ -169,7 +197,7 @@
                             schema = @Schema(implementation = Boolean.class))}
             )
     })
-    @GetMapping(path = "delete", consumes = MediaType.TEXT_PLAIN_VALUE)
+    @GetMapping(path = "delete")
     @SsoAop()
     public BaseResponse<Boolean> delete(Long id){
         if(id == null){

--
Gitblit v1.8.0