From 780416dd70d9c863ddf8121b5c017db7a0801956 Mon Sep 17 00:00:00 2001
From: liujiandao <274878379@qq.com>
Date: 星期四, 23 十一月 2023 18:41:37 +0800
Subject: [PATCH] 供应商修改

---
 docs/swagger.yaml            |  118 +++++-----
 docs/docs.go                 |  220 +++++++++++-----------
 service/purchase/purchase.go |    8 
 docs/swagger.json            |  220 +++++++++++-----------
 4 files changed, 282 insertions(+), 284 deletions(-)

diff --git a/docs/docs.go b/docs/docs.go
index c4d2aff..240e3be 100644
--- a/docs/docs.go
+++ b/docs/docs.go
@@ -135,61 +135,6 @@
                 }
             }
         },
-        "/con/downloadContract": {
-            "get": {
-                "security": [
-                    {
-                        "ApiKeyAuth": []
-                    }
-                ],
-                "consumes": [
-                    "application/json"
-                ],
-                "produces": [
-                    "application/json"
-                ],
-                "tags": [
-                    "Contract"
-                ],
-                "summary": "涓嬭浇Contract",
-                "parameters": [
-                    {
-                        "type": "string",
-                        "name": "created_at",
-                        "in": "query"
-                    },
-                    {
-                        "type": "string",
-                        "name": "fileName",
-                        "in": "query"
-                    },
-                    {
-                        "type": "integer",
-                        "description": "涓婚敭ID",
-                        "name": "id",
-                        "in": "query"
-                    },
-                    {
-                        "type": "integer",
-                        "name": "supplierID",
-                        "in": "query"
-                    },
-                    {
-                        "type": "string",
-                        "name": "updated_at",
-                        "in": "query"
-                    }
-                ],
-                "responses": {
-                    "200": {
-                        "description": "{\"success\":true,\"data\":{},\"msg\":\"涓嬭浇鎴愬姛\"}",
-                        "schema": {
-                            "type": "string"
-                        }
-                    }
-                }
-            }
-        },
         "/con/findContract": {
             "get": {
                 "security": [
@@ -328,61 +273,6 @@
                 }
             }
         },
-        "/con/previewContract": {
-            "get": {
-                "security": [
-                    {
-                        "ApiKeyAuth": []
-                    }
-                ],
-                "consumes": [
-                    "application/json"
-                ],
-                "produces": [
-                    "application/json"
-                ],
-                "tags": [
-                    "Contract"
-                ],
-                "summary": "棰勮Contract",
-                "parameters": [
-                    {
-                        "type": "string",
-                        "name": "created_at",
-                        "in": "query"
-                    },
-                    {
-                        "type": "string",
-                        "name": "fileName",
-                        "in": "query"
-                    },
-                    {
-                        "type": "integer",
-                        "description": "涓婚敭ID",
-                        "name": "id",
-                        "in": "query"
-                    },
-                    {
-                        "type": "integer",
-                        "name": "supplierID",
-                        "in": "query"
-                    },
-                    {
-                        "type": "string",
-                        "name": "updated_at",
-                        "in": "query"
-                    }
-                ],
-                "responses": {
-                    "200": {
-                        "description": "{\"success\":true,\"data\":{},\"msg\":\"棰勮鎴愬姛\"}",
-                        "schema": {
-                            "type": "string"
-                        }
-                    }
-                }
-            }
-        },
         "/con/updateContract": {
             "put": {
                 "security": [
@@ -414,6 +304,61 @@
                 "responses": {
                     "200": {
                         "description": "{\"success\":true,\"data\":{},\"msg\":\"鏇存柊鎴愬姛\"}",
+                        "schema": {
+                            "type": "string"
+                        }
+                    }
+                }
+            }
+        },
+        "/downloadContract": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "consumes": [
+                    "application/json"
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "Contract"
+                ],
+                "summary": "涓嬭浇Contract",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "name": "created_at",
+                        "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "name": "fileName",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "涓婚敭ID",
+                        "name": "id",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "name": "supplierID",
+                        "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "name": "updated_at",
+                        "in": "query"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "{\"success\":true,\"data\":{},\"msg\":\"涓嬭浇鎴愬姛\"}",
                         "schema": {
                             "type": "string"
                         }
@@ -1500,6 +1445,61 @@
                 }
             }
         },
+        "/previewContract": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "consumes": [
+                    "application/json"
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "Contract"
+                ],
+                "summary": "棰勮Contract",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "name": "created_at",
+                        "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "name": "fileName",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "涓婚敭ID",
+                        "name": "id",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "name": "supplierID",
+                        "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "name": "updated_at",
+                        "in": "query"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "{\"success\":true,\"data\":{},\"msg\":\"棰勮鎴愬姛\"}",
+                        "schema": {
+                            "type": "string"
+                        }
+                    }
+                }
+            }
+        },
         "/purchase/purchase": {
             "put": {
                 "security": [
diff --git a/docs/swagger.json b/docs/swagger.json
index 8f180df..c34b2f1 100644
--- a/docs/swagger.json
+++ b/docs/swagger.json
@@ -126,61 +126,6 @@
                 }
             }
         },
-        "/con/downloadContract": {
-            "get": {
-                "security": [
-                    {
-                        "ApiKeyAuth": []
-                    }
-                ],
-                "consumes": [
-                    "application/json"
-                ],
-                "produces": [
-                    "application/json"
-                ],
-                "tags": [
-                    "Contract"
-                ],
-                "summary": "涓嬭浇Contract",
-                "parameters": [
-                    {
-                        "type": "string",
-                        "name": "created_at",
-                        "in": "query"
-                    },
-                    {
-                        "type": "string",
-                        "name": "fileName",
-                        "in": "query"
-                    },
-                    {
-                        "type": "integer",
-                        "description": "涓婚敭ID",
-                        "name": "id",
-                        "in": "query"
-                    },
-                    {
-                        "type": "integer",
-                        "name": "supplierID",
-                        "in": "query"
-                    },
-                    {
-                        "type": "string",
-                        "name": "updated_at",
-                        "in": "query"
-                    }
-                ],
-                "responses": {
-                    "200": {
-                        "description": "{\"success\":true,\"data\":{},\"msg\":\"涓嬭浇鎴愬姛\"}",
-                        "schema": {
-                            "type": "string"
-                        }
-                    }
-                }
-            }
-        },
         "/con/findContract": {
             "get": {
                 "security": [
@@ -319,61 +264,6 @@
                 }
             }
         },
-        "/con/previewContract": {
-            "get": {
-                "security": [
-                    {
-                        "ApiKeyAuth": []
-                    }
-                ],
-                "consumes": [
-                    "application/json"
-                ],
-                "produces": [
-                    "application/json"
-                ],
-                "tags": [
-                    "Contract"
-                ],
-                "summary": "棰勮Contract",
-                "parameters": [
-                    {
-                        "type": "string",
-                        "name": "created_at",
-                        "in": "query"
-                    },
-                    {
-                        "type": "string",
-                        "name": "fileName",
-                        "in": "query"
-                    },
-                    {
-                        "type": "integer",
-                        "description": "涓婚敭ID",
-                        "name": "id",
-                        "in": "query"
-                    },
-                    {
-                        "type": "integer",
-                        "name": "supplierID",
-                        "in": "query"
-                    },
-                    {
-                        "type": "string",
-                        "name": "updated_at",
-                        "in": "query"
-                    }
-                ],
-                "responses": {
-                    "200": {
-                        "description": "{\"success\":true,\"data\":{},\"msg\":\"棰勮鎴愬姛\"}",
-                        "schema": {
-                            "type": "string"
-                        }
-                    }
-                }
-            }
-        },
         "/con/updateContract": {
             "put": {
                 "security": [
@@ -405,6 +295,61 @@
                 "responses": {
                     "200": {
                         "description": "{\"success\":true,\"data\":{},\"msg\":\"鏇存柊鎴愬姛\"}",
+                        "schema": {
+                            "type": "string"
+                        }
+                    }
+                }
+            }
+        },
+        "/downloadContract": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "consumes": [
+                    "application/json"
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "Contract"
+                ],
+                "summary": "涓嬭浇Contract",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "name": "created_at",
+                        "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "name": "fileName",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "涓婚敭ID",
+                        "name": "id",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "name": "supplierID",
+                        "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "name": "updated_at",
+                        "in": "query"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "{\"success\":true,\"data\":{},\"msg\":\"涓嬭浇鎴愬姛\"}",
                         "schema": {
                             "type": "string"
                         }
@@ -1491,6 +1436,61 @@
                 }
             }
         },
+        "/previewContract": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "consumes": [
+                    "application/json"
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "Contract"
+                ],
+                "summary": "棰勮Contract",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "name": "created_at",
+                        "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "name": "fileName",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "涓婚敭ID",
+                        "name": "id",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "name": "supplierID",
+                        "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "name": "updated_at",
+                        "in": "query"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "{\"success\":true,\"data\":{},\"msg\":\"棰勮鎴愬姛\"}",
+                        "schema": {
+                            "type": "string"
+                        }
+                    }
+                }
+            }
+        },
         "/purchase/purchase": {
             "put": {
                 "security": [
diff --git a/docs/swagger.yaml b/docs/swagger.yaml
index 4520db0..53b4e11 100644
--- a/docs/swagger.yaml
+++ b/docs/swagger.yaml
@@ -984,39 +984,6 @@
       summary: 鎵归噺鍒犻櫎Contract
       tags:
       - Contract
-  /con/downloadContract:
-    get:
-      consumes:
-      - application/json
-      parameters:
-      - in: query
-        name: created_at
-        type: string
-      - in: query
-        name: fileName
-        type: string
-      - description: 涓婚敭ID
-        in: query
-        name: id
-        type: integer
-      - in: query
-        name: supplierID
-        type: integer
-      - in: query
-        name: updated_at
-        type: string
-      produces:
-      - application/json
-      responses:
-        "200":
-          description: '{"success":true,"data":{},"msg":"涓嬭浇鎴愬姛"}'
-          schema:
-            type: string
-      security:
-      - ApiKeyAuth: []
-      summary: 涓嬭浇Contract
-      tags:
-      - Contract
   /con/findContract:
     get:
       consumes:
@@ -1101,7 +1068,30 @@
       summary: 鍒嗛〉鑾峰彇Contract鍒楄〃
       tags:
       - Contract
-  /con/previewContract:
+  /con/updateContract:
+    put:
+      consumes:
+      - application/json
+      parameters:
+      - description: 鏇存柊Contract
+        in: body
+        name: data
+        required: true
+        schema:
+          $ref: '#/definitions/test.Contract'
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: '{"success":true,"data":{},"msg":"鏇存柊鎴愬姛"}'
+          schema:
+            type: string
+      security:
+      - ApiKeyAuth: []
+      summary: 鏇存柊Contract
+      tags:
+      - Contract
+  /downloadContract:
     get:
       consumes:
       - application/json
@@ -1126,35 +1116,12 @@
       - application/json
       responses:
         "200":
-          description: '{"success":true,"data":{},"msg":"棰勮鎴愬姛"}'
+          description: '{"success":true,"data":{},"msg":"涓嬭浇鎴愬姛"}'
           schema:
             type: string
       security:
       - ApiKeyAuth: []
-      summary: 棰勮Contract
-      tags:
-      - Contract
-  /con/updateContract:
-    put:
-      consumes:
-      - application/json
-      parameters:
-      - description: 鏇存柊Contract
-        in: body
-        name: data
-        required: true
-        schema:
-          $ref: '#/definitions/test.Contract'
-      produces:
-      - application/json
-      responses:
-        "200":
-          description: '{"success":true,"data":{},"msg":"鏇存柊鎴愬姛"}'
-          schema:
-            type: string
-      security:
-      - ApiKeyAuth: []
-      summary: 鏇存柊Contract
+      summary: 涓嬭浇Contract
       tags:
       - Contract
   /i/createIndustry:
@@ -1812,6 +1779,39 @@
       summary: 鏇存柊Product
       tags:
       - Product
+  /previewContract:
+    get:
+      consumes:
+      - application/json
+      parameters:
+      - in: query
+        name: created_at
+        type: string
+      - in: query
+        name: fileName
+        type: string
+      - description: 涓婚敭ID
+        in: query
+        name: id
+        type: integer
+      - in: query
+        name: supplierID
+        type: integer
+      - in: query
+        name: updated_at
+        type: string
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: '{"success":true,"data":{},"msg":"棰勮鎴愬姛"}'
+          schema:
+            type: string
+      security:
+      - ApiKeyAuth: []
+      summary: 棰勮Contract
+      tags:
+      - Contract
   /purchase/purchase:
     post:
       consumes:
diff --git a/service/purchase/purchase.go b/service/purchase/purchase.go
index ab378ab..7771ac8 100644
--- a/service/purchase/purchase.go
+++ b/service/purchase/purchase.go
@@ -140,20 +140,18 @@
 		if err != nil {
 			return purchaseList, total, err
 		}
-	}
-
-	if info.SupplierId != 0 {
+	} else if info.SupplierId != 0 {
 		db = db.Where("supplier_id = ?", info.SupplierId)
 	}
 	err = db.Count(&total).Error
-	if err != nil {
+	if err != nil || total == 0 {
 		return purchaseList, total, err
 	}
 	if len(ids) != 0 {
 		db = global.GVA_DB.Model(&purchase.Purchase{})
 		err = db.Where("id in (?)", ids).Preload("Supplier").Order("updated_at desc").Find(&purchaseList).Error
 	} else {
-		db = global.GVA_DB.Model(&purchase.Purchase{})
+		//db = global.GVA_DB.Model(&purchase.Purchase{})
 		err = db.Limit(limit).Offset(offset).Preload("Supplier").Order("updated_at desc").Find(&purchaseList).Error
 	}
 

--
Gitblit v1.8.0