From 5193dcb9336e853502baf8a539d3f45efebe2f86 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期六, 26 八月 2023 21:55:56 +0800
Subject: [PATCH] 采购单增删改查
---
model/purchase/purchase.go | 17
model/purchase/request/purchase.go | 18
model/purchase/purchase_products.go | 16
go.mod | 1
docs/swagger.yaml | 287 +++++++++
docs/docs.go | 472 +++++++++++++++
docs/swagger.json | 472 +++++++++++++++
api/v1/purchase/purchase.go | 164 +++++
go.sum | 13
router/purchase/purchase.go | 19
log/2023-08-26/info.log | 188 ++++++
model/purchase/response/purchase.go | 8
initialize/router.go | 3
service/purchase/purchase.go | 124 ++++
initialize/gorm.go | 2
15 files changed, 1,804 insertions(+), 0 deletions(-)
diff --git a/api/v1/purchase/purchase.go b/api/v1/purchase/purchase.go
new file mode 100644
index 0000000..4151621
--- /dev/null
+++ b/api/v1/purchase/purchase.go
@@ -0,0 +1,164 @@
+package purchase
+
+import (
+ "github.com/gin-gonic/gin"
+ "go.uber.org/zap"
+ "srm/global"
+ "srm/model/common/request"
+ "srm/model/common/response"
+ purchaserequest "srm/model/purchase/request"
+ "strconv"
+
+ //"srm/model/purchase"
+
+ //"srm/model/purchase"
+ purchaseRes "srm/model/purchase/response"
+ service "srm/service/purchase"
+ "srm/utils"
+)
+
+type PurchaseApi struct{}
+
+// CreatePurchase
+// @Tags Purchase
+// @Summary 鍒涘缓閲囪喘鍗�
+// @Security ApiKeyAuth
+// @accept application/json
+// @Produce application/json
+// @Param data body purchaserequest.AddPurchase true "閲囪喘鍗曠敤鎴峰悕, 閲囪喘鍗曟墜鏈哄彿鐮�"
+// @Success 200 {object} response.Response{msg=string} "鍒涘缓閲囪喘鍗�"
+// @Router /purchase/purchase [post]
+func (e *PurchaseApi) CreatePurchase(c *gin.Context) {
+ var params purchaserequest.AddPurchase
+ err := c.ShouldBindJSON(¶ms)
+ if err != nil {
+ response.FailWithMessage(err.Error(), c)
+ return
+ }
+ err = service.NewPurchaseService().CreatePurchase(params)
+ if err != nil {
+ global.GVA_LOG.Error("鍒涘缓澶辫触!", zap.Error(err))
+ response.FailWithMessage("鍒涘缓澶辫触", c)
+ return
+ }
+ response.OkWithMessage("鍒涘缓鎴愬姛", c)
+}
+
+// DeletePurchase
+// @Tags Purchase
+// @Summary 鍒犻櫎閲囪喘鍗�
+// @Security ApiKeyAuth
+// @accept application/json
+// @Produce application/json
+// @Param id path int true "閲囪喘鍗旾D"
+// @Success 200 {object} response.Response{msg=string} "鍒犻櫎閲囪喘鍗�"
+// @Router /purchase/purchase/{id} [delete]
+func (e *PurchaseApi) DeletePurchase(c *gin.Context) {
+ id, _ := strconv.Atoi(c.Param("id"))
+ if id == 0 {
+ response.FailWithMessage("鍙傛暟缂哄け", c)
+ return
+ }
+ err := service.NewPurchaseService().DeletePurchase(uint(id))
+ if err != nil {
+ global.GVA_LOG.Error("鍒犻櫎澶辫触!", zap.Error(err))
+ response.FailWithMessage("鍒犻櫎澶辫触", c)
+ return
+ }
+ response.OkWithMessage("鍒犻櫎鎴愬姛", c)
+}
+
+// UpdatePurchase
+// @Tags Purchase
+// @Summary 鏇存柊閲囪喘鍗曚俊鎭�
+// @Security ApiKeyAuth
+// @accept application/json
+// @Produce application/json
+// @Param data body purchaserequest.AddPurchase true "閲囪喘鍗旾D, 閲囪喘鍗曚俊鎭�"
+// @Success 200 {object} response.Response{msg=string} "鏇存柊閲囪喘鍗曚俊鎭�"
+// @Router /purchase/purchase [put]
+func (e *PurchaseApi) UpdatePurchase(c *gin.Context) {
+ var params purchaserequest.AddPurchase
+ err := c.ShouldBindJSON(¶ms)
+ if err != nil {
+ response.FailWithMessage(err.Error(), c)
+ return
+ }
+ err = utils.Verify(params.Purchase.GVA_MODEL, utils.IdVerify)
+ if err != nil {
+ response.FailWithMessage(err.Error(), c)
+ return
+ }
+ err = service.NewPurchaseService().UpdatePurchase(¶ms)
+ if err != nil {
+ global.GVA_LOG.Error("鏇存柊澶辫触!", zap.Error(err))
+ response.FailWithMessage("鏇存柊澶辫触", c)
+ return
+ }
+ response.OkWithMessage("鏇存柊鎴愬姛", c)
+}
+
+// GetPurchase
+// @Tags Purchase
+// @Summary 鑾峰彇鍗曚竴閲囪喘鍗曚俊鎭�
+// @Security ApiKeyAuth
+// @accept application/json
+// @Produce application/json
+// @Param id path int true "閲囪喘鍗旾D" true "閲囪喘鍗旾D"
+// @Success 200 {object} response.Response{data=purchaseRes.PurchaseResponse,msg=string} "鑾峰彇鍗曚竴閲囪喘鍗曚俊鎭�,杩斿洖鍖呮嫭閲囪喘鍗曡鎯�"
+// @Router /purchase/purchase/{id} [get]
+func (e *PurchaseApi) GetPurchase(c *gin.Context) {
+ id, _ := strconv.Atoi(c.Param("id"))
+ if id == 0 {
+ response.FailWithMessage("鍙傛暟缂哄け", c)
+ return
+ }
+ data, err := service.NewPurchaseService().GetPurchase(uint(id))
+ if err != nil {
+ global.GVA_LOG.Error("鑾峰彇澶辫触!", zap.Error(err))
+ response.FailWithMessage("鑾峰彇澶辫触", c)
+ return
+ }
+ productList, err := service.NewPurchaseService().GetPurchaseProductList(uint(id))
+ if err != nil {
+ global.GVA_LOG.Error("鑾峰彇澶辫触!", zap.Error(err))
+ response.FailWithMessage("鑾峰彇澶辫触", c)
+ return
+ }
+ response.OkWithDetailed(purchaseRes.PurchaseResponse{Purchase: data, ProductList: productList}, "鑾峰彇鎴愬姛", c)
+}
+
+// GetPurchaseList
+// @Tags Purchase
+// @Summary 鍒嗛〉鑾峰彇鏉冮檺閲囪喘鍗曞垪琛�
+// @Security ApiKeyAuth
+// @accept application/json
+// @Produce application/json
+// @Param data query request.PageInfo true "椤电爜, 姣忛〉澶у皬"
+// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "鍒嗛〉鑾峰彇鏉冮檺閲囪喘鍗曞垪琛�,杩斿洖鍖呮嫭鍒楄〃,鎬绘暟,椤电爜,姣忛〉鏁伴噺"
+// @Router /purchase/purchaseList [get]
+func (e *PurchaseApi) GetPurchaseList(c *gin.Context) {
+ var pageInfo request.PageInfo
+ err := c.ShouldBindQuery(&pageInfo)
+ if err != nil {
+ response.FailWithMessage(err.Error(), c)
+ return
+ }
+ err = utils.Verify(pageInfo, utils.PageInfoVerify)
+ if err != nil {
+ response.FailWithMessage(err.Error(), c)
+ return
+ }
+ PurchaseList, total, err := service.NewPurchaseService().GetPurchaseList(pageInfo)
+ if err != nil {
+ global.GVA_LOG.Error("鑾峰彇澶辫触!", zap.Error(err))
+ response.FailWithMessage("鑾峰彇澶辫触"+err.Error(), c)
+ return
+ }
+ response.OkWithDetailed(response.PageResult{
+ List: PurchaseList,
+ Total: total,
+ Page: pageInfo.Page,
+ PageSize: pageInfo.PageSize,
+ }, "鑾峰彇鎴愬姛", c)
+}
diff --git a/docs/docs.go b/docs/docs.go
index 6290ec0..7a8ba8b 100644
--- a/docs/docs.go
+++ b/docs/docs.go
@@ -3912,6 +3912,119 @@
}
}
},
+ "/p/getProductListFromGrpc": {
+ "get": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "Product"
+ ],
+ "summary": "鍒嗛〉鑾峰彇Product鍒楄〃",
+ "parameters": [
+ {
+ "type": "integer",
+ "name": "deliveryTime",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "name": "endCreatedAt",
+ "in": "query"
+ },
+ {
+ "type": "integer",
+ "description": "涓婚敭ID",
+ "name": "id",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "鍏抽敭瀛�",
+ "name": "keyword",
+ "in": "query"
+ },
+ {
+ "type": "integer",
+ "name": "maximumStock",
+ "in": "query"
+ },
+ {
+ "type": "integer",
+ "name": "minimumStock",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "name": "name",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "name": "number",
+ "in": "query"
+ },
+ {
+ "type": "integer",
+ "description": "椤电爜",
+ "name": "page",
+ "in": "query"
+ },
+ {
+ "type": "integer",
+ "description": "姣忛〉澶у皬",
+ "name": "pageSize",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "name": "productType",
+ "in": "query"
+ },
+ {
+ "type": "number",
+ "name": "purchasePrice",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "name": "remark",
+ "in": "query"
+ },
+ {
+ "type": "integer",
+ "name": "shippingDuration",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "name": "startCreatedAt",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "name": "unit",
+ "in": "query"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "{\"success\":true,\"data\":{},\"msg\":\"鑾峰彇鎴愬姛\"}",
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ },
"/p/updateProduct": {
"put": {
"security": [
@@ -3945,6 +4058,263 @@
"description": "{\"success\":true,\"data\":{},\"msg\":\"鏇存柊鎴愬姛\"}",
"schema": {
"type": "string"
+ }
+ }
+ }
+ }
+ },
+ "/purchase/purchase": {
+ "put": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "Purchase"
+ ],
+ "summary": "鏇存柊閲囪喘鍗曚俊鎭�",
+ "parameters": [
+ {
+ "description": "閲囪喘鍗旾D, 閲囪喘鍗曚俊鎭�",
+ "name": "data",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/purchaserequest.AddPurchase"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "鏇存柊閲囪喘鍗曚俊鎭�",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/response.Response"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "msg": {
+ "type": "string"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ },
+ "post": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "Purchase"
+ ],
+ "summary": "鍒涘缓閲囪喘鍗�",
+ "parameters": [
+ {
+ "description": "閲囪喘鍗曠敤鎴峰悕, 閲囪喘鍗曟墜鏈哄彿鐮�",
+ "name": "data",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/purchaserequest.AddPurchase"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "鍒涘缓閲囪喘鍗�",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/response.Response"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "msg": {
+ "type": "string"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ },
+ "/purchase/purchase/{id}": {
+ "get": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "Purchase"
+ ],
+ "summary": "鑾峰彇鍗曚竴閲囪喘鍗曚俊鎭�",
+ "parameters": [
+ {
+ "type": "integer",
+ "description": "閲囪喘鍗旾D",
+ "name": "id",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "鑾峰彇鍗曚竴閲囪喘鍗曚俊鎭�,杩斿洖鍖呮嫭閲囪喘鍗曡鎯�",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/response.Response"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "$ref": "#/definitions/response.PurchaseResponse"
+ },
+ "msg": {
+ "type": "string"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ },
+ "delete": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "Purchase"
+ ],
+ "summary": "鍒犻櫎閲囪喘鍗�",
+ "parameters": [
+ {
+ "type": "integer",
+ "description": "閲囪喘鍗旾D",
+ "name": "id",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "鍒犻櫎閲囪喘鍗�",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/response.Response"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "msg": {
+ "type": "string"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ },
+ "/purchase/purchaseList": {
+ "get": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "Purchase"
+ ],
+ "summary": "鍒嗛〉鑾峰彇鏉冮檺閲囪喘鍗曞垪琛�",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "鍏抽敭瀛�",
+ "name": "keyword",
+ "in": "query"
+ },
+ {
+ "type": "integer",
+ "description": "椤电爜",
+ "name": "page",
+ "in": "query"
+ },
+ {
+ "type": "integer",
+ "description": "姣忛〉澶у皬",
+ "name": "pageSize",
+ "in": "query"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "鍒嗛〉鑾峰彇鏉冮檺閲囪喘鍗曞垪琛�,杩斿洖鍖呮嫭鍒楄〃,鎬绘暟,椤电爜,姣忛〉鏁伴噺",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/response.Response"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "$ref": "#/definitions/response.PageResult"
+ },
+ "msg": {
+ "type": "string"
+ }
+ }
+ }
+ ]
}
}
}
@@ -7294,6 +7664,94 @@
}
}
},
+ "purchase.Purchase": {
+ "type": "object",
+ "properties": {
+ "contact": {
+ "description": "鑱旂郴浜�",
+ "type": "string"
+ },
+ "deliveryDate": {
+ "description": "浜や粯鏃ユ湡",
+ "type": "string"
+ },
+ "id": {
+ "description": "涓婚敭ID",
+ "type": "integer"
+ },
+ "name": {
+ "description": "閲囪喘鍚嶇О",
+ "type": "string"
+ },
+ "phone": {
+ "description": "鑱旂郴浜虹數璇�",
+ "type": "string"
+ },
+ "purchaseTypeId": {
+ "description": "閲囪喘绫诲瀷id",
+ "type": "integer"
+ },
+ "remark": {
+ "description": "澶囨敞",
+ "type": "string"
+ },
+ "signingDate": {
+ "description": "绛剧害鏃ユ湡",
+ "type": "string"
+ },
+ "supplierId": {
+ "description": "渚涘簲鍟唅d",
+ "type": "integer"
+ }
+ }
+ },
+ "purchase.PurchaseProducts": {
+ "type": "object",
+ "properties": {
+ "amount": {
+ "description": "閲囪喘鏁伴噺",
+ "type": "number"
+ },
+ "id": {
+ "description": "涓婚敭ID",
+ "type": "integer"
+ },
+ "price": {
+ "description": "閲囪喘鍗曚环",
+ "type": "number"
+ },
+ "productId": {
+ "description": "浜у搧id",
+ "type": "integer"
+ },
+ "purchaseId": {
+ "description": "閲囪喘id",
+ "type": "integer"
+ },
+ "remark": {
+ "description": "鎻忚堪",
+ "type": "string"
+ },
+ "total": {
+ "description": "閲囪喘鎬讳环",
+ "type": "number"
+ }
+ }
+ },
+ "purchaserequest.AddPurchase": {
+ "type": "object",
+ "properties": {
+ "productList": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/purchase.PurchaseProducts"
+ }
+ },
+ "purchase": {
+ "$ref": "#/definitions/purchase.Purchase"
+ }
+ }
+ },
"request.AddMenuAuthorityInfo": {
"type": "object",
"properties": {
@@ -7735,6 +8193,20 @@
}
}
},
+ "response.PurchaseResponse": {
+ "type": "object",
+ "properties": {
+ "productList": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/purchase.PurchaseProducts"
+ }
+ },
+ "purchase": {
+ "$ref": "#/definitions/purchase.Purchase"
+ }
+ }
+ },
"response.Response": {
"type": "object",
"properties": {
diff --git a/docs/swagger.json b/docs/swagger.json
index b0e64f4..a09aee6 100644
--- a/docs/swagger.json
+++ b/docs/swagger.json
@@ -3903,6 +3903,119 @@
}
}
},
+ "/p/getProductListFromGrpc": {
+ "get": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "Product"
+ ],
+ "summary": "鍒嗛〉鑾峰彇Product鍒楄〃",
+ "parameters": [
+ {
+ "type": "integer",
+ "name": "deliveryTime",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "name": "endCreatedAt",
+ "in": "query"
+ },
+ {
+ "type": "integer",
+ "description": "涓婚敭ID",
+ "name": "id",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "鍏抽敭瀛�",
+ "name": "keyword",
+ "in": "query"
+ },
+ {
+ "type": "integer",
+ "name": "maximumStock",
+ "in": "query"
+ },
+ {
+ "type": "integer",
+ "name": "minimumStock",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "name": "name",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "name": "number",
+ "in": "query"
+ },
+ {
+ "type": "integer",
+ "description": "椤电爜",
+ "name": "page",
+ "in": "query"
+ },
+ {
+ "type": "integer",
+ "description": "姣忛〉澶у皬",
+ "name": "pageSize",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "name": "productType",
+ "in": "query"
+ },
+ {
+ "type": "number",
+ "name": "purchasePrice",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "name": "remark",
+ "in": "query"
+ },
+ {
+ "type": "integer",
+ "name": "shippingDuration",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "name": "startCreatedAt",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "name": "unit",
+ "in": "query"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "{\"success\":true,\"data\":{},\"msg\":\"鑾峰彇鎴愬姛\"}",
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ },
"/p/updateProduct": {
"put": {
"security": [
@@ -3936,6 +4049,263 @@
"description": "{\"success\":true,\"data\":{},\"msg\":\"鏇存柊鎴愬姛\"}",
"schema": {
"type": "string"
+ }
+ }
+ }
+ }
+ },
+ "/purchase/purchase": {
+ "put": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "Purchase"
+ ],
+ "summary": "鏇存柊閲囪喘鍗曚俊鎭�",
+ "parameters": [
+ {
+ "description": "閲囪喘鍗旾D, 閲囪喘鍗曚俊鎭�",
+ "name": "data",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/purchaserequest.AddPurchase"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "鏇存柊閲囪喘鍗曚俊鎭�",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/response.Response"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "msg": {
+ "type": "string"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ },
+ "post": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "Purchase"
+ ],
+ "summary": "鍒涘缓閲囪喘鍗�",
+ "parameters": [
+ {
+ "description": "閲囪喘鍗曠敤鎴峰悕, 閲囪喘鍗曟墜鏈哄彿鐮�",
+ "name": "data",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/purchaserequest.AddPurchase"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "鍒涘缓閲囪喘鍗�",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/response.Response"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "msg": {
+ "type": "string"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ },
+ "/purchase/purchase/{id}": {
+ "get": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "Purchase"
+ ],
+ "summary": "鑾峰彇鍗曚竴閲囪喘鍗曚俊鎭�",
+ "parameters": [
+ {
+ "type": "integer",
+ "description": "閲囪喘鍗旾D",
+ "name": "id",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "鑾峰彇鍗曚竴閲囪喘鍗曚俊鎭�,杩斿洖鍖呮嫭閲囪喘鍗曡鎯�",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/response.Response"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "$ref": "#/definitions/response.PurchaseResponse"
+ },
+ "msg": {
+ "type": "string"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ },
+ "delete": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "Purchase"
+ ],
+ "summary": "鍒犻櫎閲囪喘鍗�",
+ "parameters": [
+ {
+ "type": "integer",
+ "description": "閲囪喘鍗旾D",
+ "name": "id",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "鍒犻櫎閲囪喘鍗�",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/response.Response"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "msg": {
+ "type": "string"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ },
+ "/purchase/purchaseList": {
+ "get": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "Purchase"
+ ],
+ "summary": "鍒嗛〉鑾峰彇鏉冮檺閲囪喘鍗曞垪琛�",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "鍏抽敭瀛�",
+ "name": "keyword",
+ "in": "query"
+ },
+ {
+ "type": "integer",
+ "description": "椤电爜",
+ "name": "page",
+ "in": "query"
+ },
+ {
+ "type": "integer",
+ "description": "姣忛〉澶у皬",
+ "name": "pageSize",
+ "in": "query"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "鍒嗛〉鑾峰彇鏉冮檺閲囪喘鍗曞垪琛�,杩斿洖鍖呮嫭鍒楄〃,鎬绘暟,椤电爜,姣忛〉鏁伴噺",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/response.Response"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "$ref": "#/definitions/response.PageResult"
+ },
+ "msg": {
+ "type": "string"
+ }
+ }
+ }
+ ]
}
}
}
@@ -7285,6 +7655,94 @@
}
}
},
+ "purchase.Purchase": {
+ "type": "object",
+ "properties": {
+ "contact": {
+ "description": "鑱旂郴浜�",
+ "type": "string"
+ },
+ "deliveryDate": {
+ "description": "浜や粯鏃ユ湡",
+ "type": "string"
+ },
+ "id": {
+ "description": "涓婚敭ID",
+ "type": "integer"
+ },
+ "name": {
+ "description": "閲囪喘鍚嶇О",
+ "type": "string"
+ },
+ "phone": {
+ "description": "鑱旂郴浜虹數璇�",
+ "type": "string"
+ },
+ "purchaseTypeId": {
+ "description": "閲囪喘绫诲瀷id",
+ "type": "integer"
+ },
+ "remark": {
+ "description": "澶囨敞",
+ "type": "string"
+ },
+ "signingDate": {
+ "description": "绛剧害鏃ユ湡",
+ "type": "string"
+ },
+ "supplierId": {
+ "description": "渚涘簲鍟唅d",
+ "type": "integer"
+ }
+ }
+ },
+ "purchase.PurchaseProducts": {
+ "type": "object",
+ "properties": {
+ "amount": {
+ "description": "閲囪喘鏁伴噺",
+ "type": "number"
+ },
+ "id": {
+ "description": "涓婚敭ID",
+ "type": "integer"
+ },
+ "price": {
+ "description": "閲囪喘鍗曚环",
+ "type": "number"
+ },
+ "productId": {
+ "description": "浜у搧id",
+ "type": "integer"
+ },
+ "purchaseId": {
+ "description": "閲囪喘id",
+ "type": "integer"
+ },
+ "remark": {
+ "description": "鎻忚堪",
+ "type": "string"
+ },
+ "total": {
+ "description": "閲囪喘鎬讳环",
+ "type": "number"
+ }
+ }
+ },
+ "purchaserequest.AddPurchase": {
+ "type": "object",
+ "properties": {
+ "productList": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/purchase.PurchaseProducts"
+ }
+ },
+ "purchase": {
+ "$ref": "#/definitions/purchase.Purchase"
+ }
+ }
+ },
"request.AddMenuAuthorityInfo": {
"type": "object",
"properties": {
@@ -7726,6 +8184,20 @@
}
}
},
+ "response.PurchaseResponse": {
+ "type": "object",
+ "properties": {
+ "productList": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/purchase.PurchaseProducts"
+ }
+ },
+ "purchase": {
+ "$ref": "#/definitions/purchase.Purchase"
+ }
+ }
+ },
"response.Response": {
"type": "object",
"properties": {
diff --git a/docs/swagger.yaml b/docs/swagger.yaml
index 477fa41..8c24038 100644
--- a/docs/swagger.yaml
+++ b/docs/swagger.yaml
@@ -659,6 +659,69 @@
description: 鏂囦欢鍦板潃
type: string
type: object
+ purchase.Purchase:
+ properties:
+ contact:
+ description: 鑱旂郴浜�
+ type: string
+ deliveryDate:
+ description: 浜や粯鏃ユ湡
+ type: string
+ id:
+ description: 涓婚敭ID
+ type: integer
+ name:
+ description: 閲囪喘鍚嶇О
+ type: string
+ phone:
+ description: 鑱旂郴浜虹數璇�
+ type: string
+ purchaseTypeId:
+ description: 閲囪喘绫诲瀷id
+ type: integer
+ remark:
+ description: 澶囨敞
+ type: string
+ signingDate:
+ description: 绛剧害鏃ユ湡
+ type: string
+ supplierId:
+ description: 渚涘簲鍟唅d
+ type: integer
+ type: object
+ purchase.PurchaseProducts:
+ properties:
+ amount:
+ description: 閲囪喘鏁伴噺
+ type: number
+ id:
+ description: 涓婚敭ID
+ type: integer
+ price:
+ description: 閲囪喘鍗曚环
+ type: number
+ productId:
+ description: 浜у搧id
+ type: integer
+ purchaseId:
+ description: 閲囪喘id
+ type: integer
+ remark:
+ description: 鎻忚堪
+ type: string
+ total:
+ description: 閲囪喘鎬讳环
+ type: number
+ type: object
+ purchaserequest.AddPurchase:
+ properties:
+ productList:
+ items:
+ $ref: '#/definitions/purchase.PurchaseProducts'
+ type: array
+ purchase:
+ $ref: '#/definitions/purchase.Purchase'
+ type: object
request.AddMenuAuthorityInfo:
properties:
authorityId:
@@ -960,6 +1023,15 @@
items:
$ref: '#/definitions/request.CasbinInfo'
type: array
+ type: object
+ response.PurchaseResponse:
+ properties:
+ productList:
+ items:
+ $ref: '#/definitions/purchase.PurchaseProducts'
+ type: array
+ purchase:
+ $ref: '#/definitions/purchase.Purchase'
type: object
response.Response:
properties:
@@ -3829,6 +3901,75 @@
summary: 鍒嗛〉鑾峰彇Product鍒楄〃
tags:
- Product
+ /p/getProductListFromGrpc:
+ get:
+ consumes:
+ - application/json
+ parameters:
+ - in: query
+ name: deliveryTime
+ type: integer
+ - in: query
+ name: endCreatedAt
+ type: string
+ - description: 涓婚敭ID
+ in: query
+ name: id
+ type: integer
+ - description: 鍏抽敭瀛�
+ in: query
+ name: keyword
+ type: string
+ - in: query
+ name: maximumStock
+ type: integer
+ - in: query
+ name: minimumStock
+ type: integer
+ - in: query
+ name: name
+ type: string
+ - in: query
+ name: number
+ type: string
+ - description: 椤电爜
+ in: query
+ name: page
+ type: integer
+ - description: 姣忛〉澶у皬
+ in: query
+ name: pageSize
+ type: integer
+ - in: query
+ name: productType
+ type: string
+ - in: query
+ name: purchasePrice
+ type: number
+ - in: query
+ name: remark
+ type: string
+ - in: query
+ name: shippingDuration
+ type: integer
+ - in: query
+ name: startCreatedAt
+ type: string
+ - in: query
+ name: unit
+ type: string
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: '{"success":true,"data":{},"msg":"鑾峰彇鎴愬姛"}'
+ schema:
+ type: string
+ security:
+ - ApiKeyAuth: []
+ summary: 鍒嗛〉鑾峰彇Product鍒楄〃
+ tags:
+ - Product
/p/updateProduct:
put:
consumes:
@@ -3852,6 +3993,152 @@
summary: 鏇存柊Product
tags:
- Product
+ /purchase/purchase:
+ post:
+ consumes:
+ - application/json
+ parameters:
+ - description: 閲囪喘鍗曠敤鎴峰悕, 閲囪喘鍗曟墜鏈哄彿鐮�
+ in: body
+ name: data
+ required: true
+ schema:
+ $ref: '#/definitions/purchaserequest.AddPurchase'
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: 鍒涘缓閲囪喘鍗�
+ schema:
+ allOf:
+ - $ref: '#/definitions/response.Response'
+ - properties:
+ msg:
+ type: string
+ type: object
+ security:
+ - ApiKeyAuth: []
+ summary: 鍒涘缓閲囪喘鍗�
+ tags:
+ - Purchase
+ put:
+ consumes:
+ - application/json
+ parameters:
+ - description: 閲囪喘鍗旾D, 閲囪喘鍗曚俊鎭�
+ in: body
+ name: data
+ required: true
+ schema:
+ $ref: '#/definitions/purchaserequest.AddPurchase'
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: 鏇存柊閲囪喘鍗曚俊鎭�
+ schema:
+ allOf:
+ - $ref: '#/definitions/response.Response'
+ - properties:
+ msg:
+ type: string
+ type: object
+ security:
+ - ApiKeyAuth: []
+ summary: 鏇存柊閲囪喘鍗曚俊鎭�
+ tags:
+ - Purchase
+ /purchase/purchase/{id}:
+ delete:
+ consumes:
+ - application/json
+ parameters:
+ - description: 閲囪喘鍗旾D
+ in: path
+ name: id
+ required: true
+ type: integer
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: 鍒犻櫎閲囪喘鍗�
+ schema:
+ allOf:
+ - $ref: '#/definitions/response.Response'
+ - properties:
+ msg:
+ type: string
+ type: object
+ security:
+ - ApiKeyAuth: []
+ summary: 鍒犻櫎閲囪喘鍗�
+ tags:
+ - Purchase
+ get:
+ consumes:
+ - application/json
+ parameters:
+ - description: 閲囪喘鍗旾D
+ in: path
+ name: id
+ required: true
+ type: integer
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: 鑾峰彇鍗曚竴閲囪喘鍗曚俊鎭�,杩斿洖鍖呮嫭閲囪喘鍗曡鎯�
+ schema:
+ allOf:
+ - $ref: '#/definitions/response.Response'
+ - properties:
+ data:
+ $ref: '#/definitions/response.PurchaseResponse'
+ msg:
+ type: string
+ type: object
+ security:
+ - ApiKeyAuth: []
+ summary: 鑾峰彇鍗曚竴閲囪喘鍗曚俊鎭�
+ tags:
+ - Purchase
+ /purchase/purchaseList:
+ get:
+ consumes:
+ - application/json
+ parameters:
+ - description: 鍏抽敭瀛�
+ in: query
+ name: keyword
+ type: string
+ - description: 椤电爜
+ in: query
+ name: page
+ type: integer
+ - description: 姣忛〉澶у皬
+ in: query
+ name: pageSize
+ type: integer
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: 鍒嗛〉鑾峰彇鏉冮檺閲囪喘鍗曞垪琛�,杩斿洖鍖呮嫭鍒楄〃,鎬绘暟,椤电爜,姣忛〉鏁伴噺
+ schema:
+ allOf:
+ - $ref: '#/definitions/response.Response'
+ - properties:
+ data:
+ $ref: '#/definitions/response.PageResult'
+ msg:
+ type: string
+ type: object
+ security:
+ - ApiKeyAuth: []
+ summary: 鍒嗛〉鑾峰彇鏉冮檺閲囪喘鍗曞垪琛�
+ tags:
+ - Purchase
/s/changeSupplierStatus:
post:
consumes:
diff --git a/go.mod b/go.mod
index 304e5ba..7f42f24 100644
--- a/go.mod
+++ b/go.mod
@@ -105,6 +105,7 @@
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
github.com/rogpeppe/go-internal v1.11.0 // indirect
github.com/shoenig/go-m1cpu v0.1.6 // indirect
+ github.com/shopspring/decimal v1.3.1 // indirect
github.com/spf13/afero v1.9.5 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
diff --git a/go.sum b/go.sum
index d17cab9..49b0577 100644
--- a/go.sum
+++ b/go.sum
@@ -47,6 +47,7 @@
github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc=
github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE=
github.com/PuerkitoBio/purell v1.1.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
+github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
github.com/QcloudApi/qcloud_sign_golang v0.0.0-20141224014652-e4130a326409/go.mod h1:1pk82RBxDY/JZnPQrtqHlUFfCctgdorsd9M06fMynOM=
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 h1:JYp7IbQjafoB+tBA3gMyHYHrpOtNuDiK/uB5uXxq5wM=
@@ -56,6 +57,7 @@
github.com/aws/aws-sdk-go v1.44.307 h1:2R0/EPgpZcFSUwZhYImq/srjaOrOfLv5MNRzrFyAM38=
github.com/aws/aws-sdk-go v1.44.307/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=
+github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
github.com/bsm/ginkgo/v2 v2.7.0 h1:ItPMPH90RbmZJt5GtkcNvIRuGEdwlBItdNVoyzaNQao=
github.com/bsm/gomega v1.26.0 h1:LhQm+AFcgV2M0WyKroMASzAzCAJVpAxQXv4SaI9a69Y=
github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM=
@@ -159,6 +161,7 @@
github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
github.com/go-sql-driver/mysql v1.7.1 h1:lUIinVbN1DY0xBg0eMOzmmtGoHwWBbvnWubQUrtU8EI=
github.com/go-sql-driver/mysql v1.7.1/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
+github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee h1:s+21KNqlpePfkah2I+gwHF8xmJWRjooY+5248k6m4A0=
github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo=
github.com/gobwas/pool v0.2.0 h1:QEmUOlnSjWtnpRGHF3SauEiOsy82Cup83Vf2LcMlnc8=
@@ -263,10 +266,16 @@
github.com/huaweicloud/huaweicloud-sdk-go-obs v3.21.8+incompatible/go.mod h1:l7VUhRbTKCzdOacdT4oWCwATKyvZqUOlOqr0Ous3k4s=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
+github.com/jackc/chunkreader/v2 v2.0.1/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk=
+github.com/jackc/pgconn v1.13.0/go.mod h1:AnowpAqO4CMIIJNZl2VJp+KrkAZciAkhEl0W0JIobpI=
+github.com/jackc/pgio v1.0.0/go.mod h1:oP+2QK2wFfUWgr+gxjoBH9KGBb31Eio69xUb0w5bYf8=
github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
+github.com/jackc/pgproto3/v2 v2.3.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA=
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a h1:bbPeKD0xmW/Y25WS6cokEszi5g+S0QxI/d45PkRi7Nk=
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM=
+github.com/jackc/pgtype v1.12.0/go.mod h1:LUMuVrfsFfdKGLw+AFFVv6KtHOFMwRgDDzBt76IqCA4=
+github.com/jackc/pgx/v4 v4.17.2/go.mod h1:lcxIZN44yMIrWI78a5CpucdD14hX0SBDbNRvjDBItsw=
github.com/jackc/pgx/v5 v5.3.1 h1:Fcr8QJ1ZeLi5zsPZqQeUZhNhxfkkKBOgJuYkJHoBOtU=
github.com/jackc/pgx/v5 v5.3.1/go.mod h1:t3JDKnCBlYIc0ewLF0Q7B8MXmoIaBOZj/ic7iHozM/8=
github.com/jcmturner/aescts/v2 v2.0.0/go.mod h1:AiaICIRyfYg35RUkr8yESTqvSy7csK90qZ5xfvvsoNs=
@@ -323,6 +332,7 @@
github.com/lestrrat-go/strftime v1.0.6 h1:CFGsDEt1pOpFNU+TJB0nhz9jl+K0hZSLE205AhTIGQQ=
github.com/lestrrat-go/strftime v1.0.6/go.mod h1:f7jQKgV5nnJpYgdEasS+/y7EsTb8ykN2z68n3TtcTaw=
github.com/lib/pq v1.10.2 h1:AqzbZs4ZoCBp+GtejcpCpcxM3zlSMx29dXbUSeVtJb8=
+github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4=
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I=
github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY=
@@ -397,6 +407,8 @@
github.com/shoenig/go-m1cpu v0.1.6/go.mod h1:1JJMcUBvfNwpq05QDQVAnx3gUHr9IYF7GNg9SUEw2VQ=
github.com/shoenig/test v0.6.4 h1:kVTaSd7WLz5WZ2IaoM0RSzRsUD+m8wRR+5qvntpn4LU=
github.com/shoenig/test v0.6.4/go.mod h1:byHiCGXqrVaflBLAMq/srcZIHynQPQgeyvkvXnjqq0k=
+github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8=
+github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
github.com/songzhibin97/gkit v1.2.11 h1:O8+l6eLMrZ2yNbT6Vohc6ggWnH5zt4P8/3ZEkf8jUL4=
github.com/songzhibin97/gkit v1.2.11/go.mod h1:axjYsiJWnn/kf/uGiUr9JPHRlt2CQrqfq/fPZ3xIY+M=
github.com/spf13/afero v1.9.5 h1:stMpOSZFs//0Lv29HduCmli3GUfpFoF3Y1Q/aXj/wVM=
@@ -474,6 +486,7 @@
go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE=
go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/goleak v1.1.11 h1:wy28qYRKZgnJTxGxvye5/wgWr1EKjmUDGYox5mGlRlI=
+go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ=
go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU=
go.uber.org/multierr v1.8.0 h1:dg6GjLku4EH+249NNmoIciG9N/jURbDG+pFlTkhzIC8=
go.uber.org/multierr v1.8.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak=
diff --git a/initialize/gorm.go b/initialize/gorm.go
index e273877..d8f9c06 100644
--- a/initialize/gorm.go
+++ b/initialize/gorm.go
@@ -2,6 +2,7 @@
import (
"os"
+ "srm/model/purchase"
"srm/global"
"srm/model/example"
@@ -52,6 +53,7 @@
example.ExaCustomer{},
example.ExaFileChunk{},
example.ExaFileUploadAndDownload{}, test.Industry{}, test.SupplierType{}, test.Supplier{}, test.Contract{},
+ purchase.Purchase{}, purchase.PurchaseProducts{},
)
if err != nil {
global.GVA_LOG.Error("register table failed", zap.Error(err))
diff --git a/initialize/router.go b/initialize/router.go
index fda059b..c7e7845 100644
--- a/initialize/router.go
+++ b/initialize/router.go
@@ -2,6 +2,7 @@
import (
"net/http"
+ "srm/router/purchase"
"github.com/gin-gonic/gin"
ginSwagger "github.com/swaggo/gin-swagger"
@@ -70,6 +71,8 @@
exampleRouter.InitCustomerRouter(PrivateGroup) // 瀹㈡埛璺敱
exampleRouter.InitFileUploadAndDownloadRouter(PrivateGroup) // 鏂囦欢涓婁紶涓嬭浇鍔熻兘璺敱
+ purchase.InitPurchaseRouter(PrivateGroup) //閲囪喘鍗曡矾鐢�
+
}
{
testRouter := router.RouterGroupApp.Test
diff --git a/log/2023-08-26/info.log b/log/2023-08-26/info.log
index fb3d226..56bc723 100644
--- a/log/2023-08-26/info.log
+++ b/log/2023-08-26/info.log
@@ -10,3 +10,191 @@
[srm]2023/08/26 - 13:44:25.708 [34minfo[0m D:/basic.com/srm/initialize/router.go:37 register swagger handler
[srm]2023/08/26 - 13:44:25.729 [34minfo[0m D:/basic.com/srm/initialize/router.go:83 router register success
[srm]2023/08/26 - 13:44:25.742 [34minfo[0m D:/basic.com/srm/core/server.go:36 server run success on {"address": ":8889"}
+[srm]2023/08/26 - 16:49:58.217 [34minfo[0m C:/code/SRM/initialize/gorm.go:60 register table success
+[srm]2023/08/26 - 16:49:58.222 [34minfo[0m C:/code/SRM/initialize/router.go:37 register swagger handler
+[srm]2023/08/26 - 16:49:58.251 [34minfo[0m C:/code/SRM/initialize/router.go:83 router register success
+[srm]2023/08/26 - 16:49:58.253 [34minfo[0m C:/code/SRM/core/server.go:36 server run success on {"address": ":8889"}
+[srm]2023/08/26 - 17:10:06.472 [34minfo[0m C:/code/SRM/initialize/gorm.go:62 register table success
+[srm]2023/08/26 - 17:10:06.476 [34minfo[0m C:/code/SRM/initialize/router.go:38 register swagger handler
+[srm]2023/08/26 - 17:10:06.512 [34minfo[0m C:/code/SRM/initialize/router.go:86 router register success
+[srm]2023/08/26 - 17:10:06.515 [34minfo[0m C:/code/SRM/core/server.go:36 server run success on {"address": ":8889"}
+[srm]2023/08/26 - 17:11:06.776 [34minfo[0m C:/code/SRM/initialize/gorm.go:62 register table success
+[srm]2023/08/26 - 17:11:06.780 [34minfo[0m C:/code/SRM/initialize/router.go:38 register swagger handler
+[srm]2023/08/26 - 17:11:06.818 [34minfo[0m C:/code/SRM/initialize/router.go:86 router register success
+[srm]2023/08/26 - 17:11:06.820 [34minfo[0m C:/code/SRM/core/server.go:36 server run success on {"address": ":8889"}
+[srm]2023/08/26 - 17:15:59.775 [34minfo[0m C:/code/SRM/initialize/gorm.go:62 register table success
+[srm]2023/08/26 - 17:15:59.779 [34minfo[0m C:/code/SRM/initialize/router.go:38 register swagger handler
+[srm]2023/08/26 - 17:15:59.813 [34minfo[0m C:/code/SRM/initialize/router.go:86 router register success
+[srm]2023/08/26 - 17:15:59.815 [34minfo[0m C:/code/SRM/core/server.go:36 server run success on {"address": ":8889"}
+[srm]2023/08/26 - 17:30:05.661 [34minfo[0m C:/code/SRM/initialize/gorm.go:62 register table success
+[srm]2023/08/26 - 17:30:05.667 [34minfo[0m C:/code/SRM/initialize/router.go:38 register swagger handler
+[srm]2023/08/26 - 17:30:05.708 [34minfo[0m C:/code/SRM/initialize/router.go:86 router register success
+[srm]2023/08/26 - 17:30:05.712 [34minfo[0m C:/code/SRM/core/server.go:36 server run success on {"address": ":8889"}
+[srm]2023/08/26 - 17:36:16.975 [34minfo[0m C:/code/SRM/initialize/gorm.go:62 register table success
+[srm]2023/08/26 - 17:36:16.990 [34minfo[0m C:/code/SRM/initialize/router.go:38 register swagger handler
+[srm]2023/08/26 - 17:36:17.035 [34minfo[0m C:/code/SRM/initialize/router.go:86 router register success
+[srm]2023/08/26 - 17:36:17.037 [34minfo[0m C:/code/SRM/core/server.go:36 server run success on {"address": ":8889"}
+[srm]2023/08/26 - 17:38:59.423 [34minfo[0m C:/code/SRM/initialize/gorm.go:62 register table success
+[srm]2023/08/26 - 17:38:59.428 [34minfo[0m C:/code/SRM/initialize/router.go:38 register swagger handler
+[srm]2023/08/26 - 17:38:59.474 [34minfo[0m C:/code/SRM/initialize/router.go:86 router register success
+[srm]2023/08/26 - 17:38:59.482 [34minfo[0m C:/code/SRM/core/server.go:36 server run success on {"address": ":8889"}
+[srm]2023/08/26 - 17:40:16.251 [34minfo[0m C:/code/SRM/initialize/gorm.go:62 register table success
+[srm]2023/08/26 - 17:40:16.256 [34minfo[0m C:/code/SRM/initialize/router.go:38 register swagger handler
+[srm]2023/08/26 - 17:40:16.292 [34minfo[0m C:/code/SRM/initialize/router.go:86 router register success
+[srm]2023/08/26 - 17:40:16.294 [34minfo[0m C:/code/SRM/core/server.go:36 server run success on {"address": ":8889"}
+[srm]2023/08/26 - 17:40:31.564 [34minfo[0m C:/code/SRM/initialize/gorm.go:62 register table success
+[srm]2023/08/26 - 17:40:31.567 [34minfo[0m C:/code/SRM/initialize/router.go:38 register swagger handler
+[srm]2023/08/26 - 17:40:31.600 [34minfo[0m C:/code/SRM/initialize/router.go:86 router register success
+[srm]2023/08/26 - 17:40:31.602 [34minfo[0m C:/code/SRM/core/server.go:36 server run success on {"address": ":8889"}
+[srm]2023/08/26 - 17:42:51.356 [34minfo[0m C:/code/SRM/initialize/gorm.go:62 register table success
+[srm]2023/08/26 - 17:42:51.361 [34minfo[0m C:/code/SRM/initialize/router.go:38 register swagger handler
+[srm]2023/08/26 - 17:42:51.400 [34minfo[0m C:/code/SRM/initialize/router.go:86 router register success
+[srm]2023/08/26 - 17:42:51.402 [34minfo[0m C:/code/SRM/core/server.go:36 server run success on {"address": ":8889"}
+[srm]2023/08/26 - 18:39:02.597 [34minfo[0m C:/code/SRM/initialize/gorm.go:62 register table success
+[srm]2023/08/26 - 18:39:02.602 [34minfo[0m C:/code/SRM/initialize/router.go:38 register swagger handler
+[srm]2023/08/26 - 18:39:02.645 [34minfo[0m C:/code/SRM/initialize/router.go:86 router register success
+[srm]2023/08/26 - 18:39:02.648 [34minfo[0m C:/code/SRM/core/server.go:36 server run success on {"address": ":8889"}
+[srm]2023/08/26 - 18:40:17.619 [34minfo[0m C:/code/SRM/initialize/gorm.go:62 register table success
+[srm]2023/08/26 - 18:40:17.623 [34minfo[0m C:/code/SRM/initialize/router.go:38 register swagger handler
+[srm]2023/08/26 - 18:40:17.657 [34minfo[0m C:/code/SRM/initialize/router.go:86 router register success
+[srm]2023/08/26 - 18:40:17.658 [34minfo[0m C:/code/SRM/core/server.go:36 server run success on {"address": ":8889"}
+[srm]2023/08/26 - 18:49:21.505 [34minfo[0m C:/code/SRM/initialize/gorm.go:62 register table success
+[srm]2023/08/26 - 18:49:21.509 [34minfo[0m C:/code/SRM/initialize/router.go:38 register swagger handler
+[srm]2023/08/26 - 18:49:21.563 [34minfo[0m C:/code/SRM/initialize/router.go:86 router register success
+[srm]2023/08/26 - 18:49:21.566 [34minfo[0m C:/code/SRM/core/server.go:36 server run success on {"address": ":8889"}
+[srm]2023/08/26 - 18:50:33.209 [34minfo[0m C:/code/SRM/initialize/gorm.go:62 register table success
+[srm]2023/08/26 - 18:50:33.215 [34minfo[0m C:/code/SRM/initialize/router.go:38 register swagger handler
+[srm]2023/08/26 - 18:50:33.243 [34minfo[0m C:/code/SRM/initialize/router.go:86 router register success
+[srm]2023/08/26 - 18:50:33.246 [34minfo[0m C:/code/SRM/core/server.go:36 server run success on {"address": ":8889"}
+[srm]2023/08/26 - 19:22:26.287 [34minfo[0m C:/code/SRM/initialize/gorm.go:62 register table success
+[srm]2023/08/26 - 19:22:26.291 [34minfo[0m C:/code/SRM/initialize/router.go:38 register swagger handler
+[srm]2023/08/26 - 19:22:26.326 [34minfo[0m C:/code/SRM/initialize/router.go:86 router register success
+[srm]2023/08/26 - 19:22:26.329 [34minfo[0m C:/code/SRM/core/server.go:36 server run success on {"address": ":8889"}
+[srm]2023/08/26 - 19:23:55.076 [34minfo[0m C:/code/SRM/initialize/gorm.go:62 register table success
+[srm]2023/08/26 - 19:23:55.099 [34minfo[0m C:/code/SRM/initialize/router.go:38 register swagger handler
+[srm]2023/08/26 - 19:23:55.145 [34minfo[0m C:/code/SRM/initialize/router.go:86 router register success
+[srm]2023/08/26 - 19:23:55.146 [34minfo[0m C:/code/SRM/core/server.go:36 server run success on {"address": ":8889"}
+[srm]2023/08/26 - 19:24:34.239 [34minfo[0m C:/code/SRM/initialize/gorm.go:62 register table success
+[srm]2023/08/26 - 19:24:34.245 [34minfo[0m C:/code/SRM/initialize/router.go:38 register swagger handler
+[srm]2023/08/26 - 19:24:34.280 [34minfo[0m C:/code/SRM/initialize/router.go:86 router register success
+[srm]2023/08/26 - 19:24:34.282 [34minfo[0m C:/code/SRM/core/server.go:36 server run success on {"address": ":8889"}
+[srm]2023/08/26 - 20:21:34.289 [34minfo[0m C:/code/SRM/initialize/gorm.go:62 register table success
+[srm]2023/08/26 - 20:21:34.293 [34minfo[0m C:/code/SRM/initialize/router.go:38 register swagger handler
+[srm]2023/08/26 - 20:21:34.328 [34minfo[0m C:/code/SRM/initialize/router.go:86 router register success
+[srm]2023/08/26 - 20:21:34.331 [34minfo[0m C:/code/SRM/core/server.go:36 server run success on {"address": ":8889"}
+[srm]2023/08/26 - 20:27:34.758 [34minfo[0m C:/code/SRM/initialize/gorm.go:62 register table success
+[srm]2023/08/26 - 20:27:34.762 [34minfo[0m C:/code/SRM/initialize/router.go:38 register swagger handler
+[srm]2023/08/26 - 20:27:34.795 [34minfo[0m C:/code/SRM/initialize/router.go:86 router register success
+[srm]2023/08/26 - 20:27:34.798 [34minfo[0m C:/code/SRM/core/server.go:36 server run success on {"address": ":8889"}
+[srm]2023/08/26 - 20:30:26.442 [34minfo[0m C:/code/SRM/initialize/gorm.go:62 register table success
+[srm]2023/08/26 - 20:30:26.447 [34minfo[0m C:/code/SRM/initialize/router.go:38 register swagger handler
+[srm]2023/08/26 - 20:30:26.483 [34minfo[0m C:/code/SRM/initialize/router.go:86 router register success
+[srm]2023/08/26 - 20:30:26.485 [34minfo[0m C:/code/SRM/core/server.go:36 server run success on {"address": ":8889"}
+[srm]2023/08/26 - 20:32:15.119 [34minfo[0m C:/code/SRM/initialize/gorm.go:62 register table success
+[srm]2023/08/26 - 20:32:15.123 [34minfo[0m C:/code/SRM/initialize/router.go:38 register swagger handler
+[srm]2023/08/26 - 20:32:15.156 [34minfo[0m C:/code/SRM/initialize/router.go:86 router register success
+[srm]2023/08/26 - 20:32:15.158 [34minfo[0m C:/code/SRM/core/server.go:36 server run success on {"address": ":8889"}
+[srm]2023/08/26 - 20:33:28.660 [34minfo[0m C:/code/SRM/initialize/gorm.go:62 register table success
+[srm]2023/08/26 - 20:33:28.665 [34minfo[0m C:/code/SRM/initialize/router.go:38 register swagger handler
+[srm]2023/08/26 - 20:33:28.701 [34minfo[0m C:/code/SRM/initialize/router.go:86 router register success
+[srm]2023/08/26 - 20:33:28.702 [34minfo[0m C:/code/SRM/core/server.go:36 server run success on {"address": ":8889"}
+[srm]2023/08/26 - 20:38:53.908 [34minfo[0m C:/code/SRM/initialize/gorm.go:62 register table success
+[srm]2023/08/26 - 20:38:53.914 [34minfo[0m C:/code/SRM/initialize/router.go:38 register swagger handler
+[srm]2023/08/26 - 20:38:53.960 [34minfo[0m C:/code/SRM/initialize/router.go:86 router register success
+[srm]2023/08/26 - 20:38:53.963 [34minfo[0m C:/code/SRM/core/server.go:36 server run success on {"address": ":8889"}
+[srm]2023/08/26 - 20:42:35.822 [34minfo[0m C:/code/SRM/initialize/gorm.go:62 register table success
+[srm]2023/08/26 - 20:42:35.828 [34minfo[0m C:/code/SRM/initialize/router.go:38 register swagger handler
+[srm]2023/08/26 - 20:42:35.864 [34minfo[0m C:/code/SRM/initialize/router.go:86 router register success
+[srm]2023/08/26 - 20:42:35.866 [34minfo[0m C:/code/SRM/core/server.go:36 server run success on {"address": ":8889"}
+[srm]2023/08/26 - 20:53:05.924 [34minfo[0m C:/code/SRM/initialize/gorm.go:62 register table success
+[srm]2023/08/26 - 20:53:05.931 [34minfo[0m C:/code/SRM/initialize/router.go:38 register swagger handler
+[srm]2023/08/26 - 20:53:05.970 [34minfo[0m C:/code/SRM/initialize/router.go:86 router register success
+[srm]2023/08/26 - 20:53:05.973 [34minfo[0m C:/code/SRM/core/server.go:36 server run success on {"address": ":8889"}
+[srm]2023/08/26 - 20:54:29.870 [34minfo[0m C:/code/SRM/initialize/gorm.go:62 register table success
+[srm]2023/08/26 - 20:54:29.875 [34minfo[0m C:/code/SRM/initialize/router.go:38 register swagger handler
+[srm]2023/08/26 - 20:54:29.913 [34minfo[0m C:/code/SRM/initialize/router.go:86 router register success
+[srm]2023/08/26 - 20:54:29.915 [34minfo[0m C:/code/SRM/core/server.go:36 server run success on {"address": ":8889"}
+[srm]2023/08/26 - 20:57:07.314 [34minfo[0m C:/code/SRM/initialize/gorm.go:62 register table success
+[srm]2023/08/26 - 20:57:07.320 [34minfo[0m C:/code/SRM/initialize/router.go:38 register swagger handler
+[srm]2023/08/26 - 20:57:07.357 [34minfo[0m C:/code/SRM/initialize/router.go:86 router register success
+[srm]2023/08/26 - 20:57:07.359 [34minfo[0m C:/code/SRM/core/server.go:36 server run success on {"address": ":8889"}
+[srm]2023/08/26 - 20:57:33.410 [34minfo[0m C:/code/SRM/initialize/gorm.go:62 register table success
+[srm]2023/08/26 - 20:57:33.415 [34minfo[0m C:/code/SRM/initialize/router.go:38 register swagger handler
+[srm]2023/08/26 - 20:57:33.451 [34minfo[0m C:/code/SRM/initialize/router.go:86 router register success
+[srm]2023/08/26 - 20:57:33.453 [34minfo[0m C:/code/SRM/core/server.go:36 server run success on {"address": ":8889"}
+[srm]2023/08/26 - 21:14:07.779 [34minfo[0m C:/code/SRM/initialize/gorm.go:62 register table success
+[srm]2023/08/26 - 21:14:07.785 [34minfo[0m C:/code/SRM/initialize/router.go:38 register swagger handler
+[srm]2023/08/26 - 21:14:07.822 [34minfo[0m C:/code/SRM/initialize/router.go:86 router register success
+[srm]2023/08/26 - 21:14:07.824 [34minfo[0m C:/code/SRM/core/server.go:36 server run success on {"address": ":8889"}
+[srm]2023/08/26 - 21:16:31.088 [34minfo[0m C:/code/SRM/initialize/gorm.go:62 register table success
+[srm]2023/08/26 - 21:16:31.096 [34minfo[0m C:/code/SRM/initialize/router.go:38 register swagger handler
+[srm]2023/08/26 - 21:16:31.134 [34minfo[0m C:/code/SRM/initialize/router.go:86 router register success
+[srm]2023/08/26 - 21:16:31.136 [34minfo[0m C:/code/SRM/core/server.go:36 server run success on {"address": ":8889"}
+[srm]2023/08/26 - 21:16:52.392 [34minfo[0m C:/code/SRM/initialize/gorm.go:62 register table success
+[srm]2023/08/26 - 21:16:52.398 [34minfo[0m C:/code/SRM/initialize/router.go:38 register swagger handler
+[srm]2023/08/26 - 21:16:52.435 [34minfo[0m C:/code/SRM/initialize/router.go:86 router register success
+[srm]2023/08/26 - 21:16:52.437 [34minfo[0m C:/code/SRM/core/server.go:36 server run success on {"address": ":8889"}
+[srm]2023/08/26 - 21:17:51.062 [34minfo[0m C:/code/SRM/initialize/gorm.go:62 register table success
+[srm]2023/08/26 - 21:17:51.068 [34minfo[0m C:/code/SRM/initialize/router.go:38 register swagger handler
+[srm]2023/08/26 - 21:17:51.101 [34minfo[0m C:/code/SRM/initialize/router.go:86 router register success
+[srm]2023/08/26 - 21:17:51.104 [34minfo[0m C:/code/SRM/core/server.go:36 server run success on {"address": ":8889"}
+[srm]2023/08/26 - 21:19:02.264 [34minfo[0m C:/code/SRM/initialize/gorm.go:62 register table success
+[srm]2023/08/26 - 21:19:02.270 [34minfo[0m C:/code/SRM/initialize/router.go:38 register swagger handler
+[srm]2023/08/26 - 21:19:02.307 [34minfo[0m C:/code/SRM/initialize/router.go:86 router register success
+[srm]2023/08/26 - 21:19:02.309 [34minfo[0m C:/code/SRM/core/server.go:36 server run success on {"address": ":8889"}
+[srm]2023/08/26 - 21:33:26.368 [34minfo[0m C:/code/SRM/initialize/gorm.go:62 register table success
+[srm]2023/08/26 - 21:33:26.374 [34minfo[0m C:/code/SRM/initialize/router.go:38 register swagger handler
+[srm]2023/08/26 - 21:33:26.408 [34minfo[0m C:/code/SRM/initialize/router.go:86 router register success
+[srm]2023/08/26 - 21:33:26.410 [34minfo[0m C:/code/SRM/core/server.go:36 server run success on {"address": ":8889"}
+[srm]2023/08/26 - 21:35:27.609 [34minfo[0m C:/code/SRM/initialize/gorm.go:62 register table success
+[srm]2023/08/26 - 21:35:27.614 [34minfo[0m C:/code/SRM/initialize/router.go:38 register swagger handler
+[srm]2023/08/26 - 21:35:27.646 [34minfo[0m C:/code/SRM/initialize/router.go:86 router register success
+[srm]2023/08/26 - 21:35:27.648 [34minfo[0m C:/code/SRM/core/server.go:36 server run success on {"address": ":8889"}
+[srm]2023/08/26 - 21:36:56.927 [34minfo[0m C:/code/SRM/initialize/gorm.go:62 register table success
+[srm]2023/08/26 - 21:36:56.933 [34minfo[0m C:/code/SRM/initialize/router.go:38 register swagger handler
+[srm]2023/08/26 - 21:36:56.971 [34minfo[0m C:/code/SRM/initialize/router.go:86 router register success
+[srm]2023/08/26 - 21:36:56.972 [34minfo[0m C:/code/SRM/core/server.go:36 server run success on {"address": ":8889"}
+[srm]2023/08/26 - 21:37:11.352 [34minfo[0m C:/code/SRM/initialize/gorm.go:62 register table success
+[srm]2023/08/26 - 21:37:11.357 [34minfo[0m C:/code/SRM/initialize/router.go:38 register swagger handler
+[srm]2023/08/26 - 21:37:11.392 [34minfo[0m C:/code/SRM/initialize/router.go:86 router register success
+[srm]2023/08/26 - 21:37:11.394 [34minfo[0m C:/code/SRM/core/server.go:36 server run success on {"address": ":8889"}
+[srm]2023/08/26 - 21:39:03.593 [34minfo[0m C:/code/SRM/initialize/gorm.go:62 register table success
+[srm]2023/08/26 - 21:39:03.600 [34minfo[0m C:/code/SRM/initialize/router.go:38 register swagger handler
+[srm]2023/08/26 - 21:39:03.645 [34minfo[0m C:/code/SRM/initialize/router.go:86 router register success
+[srm]2023/08/26 - 21:39:03.647 [34minfo[0m C:/code/SRM/core/server.go:36 server run success on {"address": ":8889"}
+[srm]2023/08/26 - 21:43:07.633 [34minfo[0m C:/code/SRM/initialize/gorm.go:62 register table success
+[srm]2023/08/26 - 21:43:07.640 [34minfo[0m C:/code/SRM/initialize/router.go:38 register swagger handler
+[srm]2023/08/26 - 21:43:07.671 [34minfo[0m C:/code/SRM/initialize/router.go:86 router register success
+[srm]2023/08/26 - 21:43:07.673 [34minfo[0m C:/code/SRM/core/server.go:36 server run success on {"address": ":8889"}
+[srm]2023/08/26 - 21:44:30.508 [34minfo[0m C:/code/SRM/initialize/gorm.go:62 register table success
+[srm]2023/08/26 - 21:44:30.514 [34minfo[0m C:/code/SRM/initialize/router.go:38 register swagger handler
+[srm]2023/08/26 - 21:44:30.555 [34minfo[0m C:/code/SRM/initialize/router.go:86 router register success
+[srm]2023/08/26 - 21:44:30.558 [34minfo[0m C:/code/SRM/core/server.go:36 server run success on {"address": ":8889"}
+[srm]2023/08/26 - 21:44:59.082 [34minfo[0m C:/code/SRM/initialize/gorm.go:62 register table success
+[srm]2023/08/26 - 21:44:59.087 [34minfo[0m C:/code/SRM/initialize/router.go:38 register swagger handler
+[srm]2023/08/26 - 21:44:59.120 [34minfo[0m C:/code/SRM/initialize/router.go:86 router register success
+[srm]2023/08/26 - 21:44:59.122 [34minfo[0m C:/code/SRM/core/server.go:36 server run success on {"address": ":8889"}
+[srm]2023/08/26 - 21:45:58.412 [34minfo[0m C:/code/SRM/initialize/gorm.go:62 register table success
+[srm]2023/08/26 - 21:45:58.419 [34minfo[0m C:/code/SRM/initialize/router.go:38 register swagger handler
+[srm]2023/08/26 - 21:45:58.460 [34minfo[0m C:/code/SRM/initialize/router.go:86 router register success
+[srm]2023/08/26 - 21:45:58.461 [34minfo[0m C:/code/SRM/core/server.go:36 server run success on {"address": ":8889"}
+[srm]2023/08/26 - 21:46:24.396 [34minfo[0m C:/code/SRM/initialize/gorm.go:62 register table success
+[srm]2023/08/26 - 21:46:24.402 [34minfo[0m C:/code/SRM/initialize/router.go:38 register swagger handler
+[srm]2023/08/26 - 21:46:24.437 [34minfo[0m C:/code/SRM/initialize/router.go:86 router register success
+[srm]2023/08/26 - 21:46:24.440 [34minfo[0m C:/code/SRM/core/server.go:36 server run success on {"address": ":8889"}
+[srm]2023/08/26 - 21:47:42.992 [34minfo[0m C:/code/SRM/initialize/gorm.go:62 register table success
+[srm]2023/08/26 - 21:47:42.998 [34minfo[0m C:/code/SRM/initialize/router.go:38 register swagger handler
+[srm]2023/08/26 - 21:47:43.032 [34minfo[0m C:/code/SRM/initialize/router.go:86 router register success
+[srm]2023/08/26 - 21:47:43.034 [34minfo[0m C:/code/SRM/core/server.go:36 server run success on {"address": ":8889"}
+[srm]2023/08/26 - 21:54:05.501 [34minfo[0m C:/code/SRM/initialize/gorm.go:62 register table success
+[srm]2023/08/26 - 21:54:05.506 [34minfo[0m C:/code/SRM/initialize/router.go:38 register swagger handler
+[srm]2023/08/26 - 21:54:05.546 [34minfo[0m C:/code/SRM/initialize/router.go:86 router register success
+[srm]2023/08/26 - 21:54:05.547 [34minfo[0m C:/code/SRM/core/server.go:36 server run success on {"address": ":8889"}
+[srm]2023/08/26 - 21:54:31.449 [34minfo[0m C:/code/SRM/initialize/gorm.go:62 register table success
+[srm]2023/08/26 - 21:54:31.453 [34minfo[0m C:/code/SRM/initialize/router.go:38 register swagger handler
+[srm]2023/08/26 - 21:54:31.489 [34minfo[0m C:/code/SRM/initialize/router.go:86 router register success
+[srm]2023/08/26 - 21:54:31.491 [34minfo[0m C:/code/SRM/core/server.go:36 server run success on {"address": ":8889"}
+[srm]2023/08/26 - 21:55:01.173 [34minfo[0m C:/code/SRM/initialize/gorm.go:62 register table success
+[srm]2023/08/26 - 21:55:01.178 [34minfo[0m C:/code/SRM/initialize/router.go:38 register swagger handler
+[srm]2023/08/26 - 21:55:01.224 [34minfo[0m C:/code/SRM/initialize/router.go:86 router register success
+[srm]2023/08/26 - 21:55:01.226 [34minfo[0m C:/code/SRM/core/server.go:36 server run success on {"address": ":8889"}
diff --git a/model/purchase/purchase.go b/model/purchase/purchase.go
new file mode 100644
index 0000000..fb16d80
--- /dev/null
+++ b/model/purchase/purchase.go
@@ -0,0 +1,17 @@
+package purchase
+
+import (
+ "srm/global"
+)
+
+type Purchase struct {
+ global.GVA_MODEL
+ PurchaseTypeId int `json:"purchaseTypeId" form:"purchaseType" gorm:"type:int(11);not null;default 0;comment:閲囪喘绫诲瀷id"` // 閲囪喘绫诲瀷id
+ SupplierId int `json:"supplierId" form:"supplierId" gorm:"type:int(11);not null;default 0;comment:渚涘簲鍟唅d"` // 渚涘簲鍟唅d
+ Name string `json:"name" form:"name" gorm:"type:varchar(255);not null;default '';comment:閲囪喘鍚嶇О"` // 閲囪喘鍚嶇О
+ Contact string `json:"contact" form:"contact" gorm:"type:varchar(255);not null;default '';comment:鑱旂郴浜�"` // 鑱旂郴浜�
+ Phone string `json:"phone" form:"phone" gorm:"type:varchar(255);not null;default '';comment:鑱旂郴浜虹數璇�"` // 鑱旂郴浜虹數璇�
+ SigningDate string `json:"signingDate" form:"signingDate" gorm:"type:varchar(255);not null;default '';comment:绛剧害鏃ユ湡"` // 绛剧害鏃ユ湡
+ DeliveryDate string `json:"deliveryDate" form:"deliveryDate" gorm:"type:varchar(255);not null;default '';comment:浜や粯鏃ユ湡"` //浜や粯鏃ユ湡
+ Remark string `json:"remark" form:"remark" gorm:"type:varchar(1000);not null;default '';comment:澶囨敞"` //澶囨敞
+}
diff --git a/model/purchase/purchase_products.go b/model/purchase/purchase_products.go
new file mode 100644
index 0000000..53aa43d
--- /dev/null
+++ b/model/purchase/purchase_products.go
@@ -0,0 +1,16 @@
+package purchase
+
+import (
+ "github.com/shopspring/decimal"
+ "srm/global"
+)
+
+type PurchaseProducts struct {
+ global.GVA_MODEL
+ PurchaseId int `json:"purchaseId" form:"purchaseType" gorm:"type:int(11);not null;default 0;comment:閲囪喘绫诲瀷id"` // 閲囪喘id
+ ProductId int `json:"productId" form:"supplierId" gorm:"type:int(11);not null;default 0;comment:渚涘簲鍟唅d"` // 浜у搧id
+ Amount decimal.Decimal `json:"amount" form:"amount" gorm:"type:decimal(12,2);not null;default 0;comment:閲囪喘鏁伴噺"` // 閲囪喘鏁伴噺
+ Price decimal.Decimal `json:"price" form:"price" gorm:"type:decimal(12,2);not null;default 0.00;comment:閲囪喘鍗曚环"` // 閲囪喘鍗曚环
+ Total decimal.Decimal `json:"total" form:"total" gorm:"type:decimal(12,2);not null;default 0.00;comment:閲囪喘鎬讳环"` // 閲囪喘鎬讳环
+ Remark string `json:"remark" form:"remark" gorm:"type:varchar(1000);not null; default '';comment:鎻忚堪"` //鎻忚堪
+}
diff --git a/model/purchase/request/purchase.go b/model/purchase/request/purchase.go
new file mode 100644
index 0000000..d0dad8c
--- /dev/null
+++ b/model/purchase/request/purchase.go
@@ -0,0 +1,18 @@
+package purchaserequest
+
+import (
+ "srm/model/common/request"
+ "srm/model/purchase"
+ "time"
+)
+
+type PurchaseSearch struct {
+ StartCreatedAt *time.Time `json:"startCreatedAt" form:"startCreatedAt"`
+ EndCreatedAt *time.Time `json:"endCreatedAt" form:"endCreatedAt"`
+ request.PageInfo
+}
+
+type AddPurchase struct {
+ Purchase purchase.Purchase
+ ProductList []*purchase.PurchaseProducts `json:"productList"`
+}
diff --git a/model/purchase/response/purchase.go b/model/purchase/response/purchase.go
new file mode 100644
index 0000000..dad6b28
--- /dev/null
+++ b/model/purchase/response/purchase.go
@@ -0,0 +1,8 @@
+package response
+
+import "srm/model/purchase"
+
+type PurchaseResponse struct {
+ Purchase purchase.Purchase `json:"purchase"`
+ ProductList []*purchase.PurchaseProducts `json:"productList"`
+}
diff --git a/router/purchase/purchase.go b/router/purchase/purchase.go
new file mode 100644
index 0000000..aa59419
--- /dev/null
+++ b/router/purchase/purchase.go
@@ -0,0 +1,19 @@
+package purchase
+
+import (
+ "github.com/gin-gonic/gin"
+ "srm/api/v1/purchase"
+)
+
+func InitPurchaseRouter(Router *gin.RouterGroup) {
+ purchaseRouter := Router.Group("purchase")
+ purchaseRouterWithoutRecord := Router.Group("purchase")
+ PurchaseApi := purchase.PurchaseApi{}
+ {
+ purchaseRouter.POST("purchase", PurchaseApi.CreatePurchase) // 鍒涘缓閲囪喘鍗�
+ purchaseRouter.PUT("purchase", PurchaseApi.UpdatePurchase) // 鏇存柊閲囪喘鍗�
+ purchaseRouter.DELETE("purchase/:id", PurchaseApi.DeletePurchase) // 鍒犻櫎閲囪喘鍗�
+ purchaseRouterWithoutRecord.GET("purchase/:id", PurchaseApi.GetPurchase) // 鑾峰彇鍗曚竴閲囪喘鍗曚俊鎭�
+ purchaseRouterWithoutRecord.GET("purchaseList", PurchaseApi.GetPurchaseList) // 鑾峰彇閲囪喘鍗曞垪琛�
+ }
+}
diff --git a/service/purchase/purchase.go b/service/purchase/purchase.go
new file mode 100644
index 0000000..b643f2f
--- /dev/null
+++ b/service/purchase/purchase.go
@@ -0,0 +1,124 @@
+package purchase
+
+import (
+ "github.com/spf13/cast"
+ "gorm.io/gorm"
+ "srm/global"
+ "srm/model/common/request"
+ "srm/model/purchase"
+ purchaserequest "srm/model/purchase/request"
+)
+
+type PurchaseService struct{}
+
+func NewPurchaseService() *PurchaseService {
+ return &PurchaseService{}
+}
+
+//@function: CreatePurchase
+//@description: 鍒涘缓閲囪喘鍗�
+//@param: e model.Purchase
+//@return: err error
+
+func (exa *PurchaseService) CreatePurchase(params purchaserequest.AddPurchase) (err error) {
+ err = global.GVA_DB.Transaction(func(tx *gorm.DB) error {
+ err = global.GVA_DB.Create(¶ms.Purchase).Error
+ if err != nil {
+ return err
+ }
+ for _, product := range params.ProductList {
+ product.PurchaseId = cast.ToInt(params.Purchase.ID)
+ }
+ return global.GVA_DB.Create(params.ProductList).Error
+ })
+
+ return err
+}
+
+//@function: DeleteFileChunk
+//@description: 鍒犻櫎閲囪喘鍗�
+//@param: e model.Purchase
+//@return: err error
+
+func (exa *PurchaseService) DeletePurchase(id uint) (err error) {
+ err = global.GVA_DB.Transaction(func(tx *gorm.DB) error {
+ err = global.GVA_DB.Where("id = ?", id).Delete(&purchase.Purchase{}).Error
+ if err != nil {
+ return err
+ }
+ return global.GVA_DB.Where("purchase_id = ?", id).Delete(&purchase.PurchaseProducts{}).Error
+ })
+ return err
+}
+
+//@function: UpdatePurchase
+//@description: 鏇存柊閲囪喘鍗�
+//@param: e *model.Purchase
+//@return: err error
+
+func (exa *PurchaseService) UpdatePurchase(params *purchaserequest.AddPurchase) (err error) {
+ err = global.GVA_DB.Transaction(func(tx *gorm.DB) error {
+ err = global.GVA_DB.Updates(params.Purchase).Error
+ if err != nil {
+ return err
+ }
+ err = global.GVA_DB.Where("purchase_id = ?", params.Purchase.ID).Delete(&purchase.PurchaseProducts{}).Error
+ if err != nil {
+ return err
+ }
+ for _, product := range params.ProductList {
+ product.ID = 0
+ product.PurchaseId = cast.ToInt(params.Purchase.ID)
+ }
+ return global.GVA_DB.Create(params.ProductList).Error
+ })
+ return err
+}
+
+//@function: GetPurchase
+//@description: 鑾峰彇閲囪喘鍗曚俊鎭�
+//@param: id uint
+//@return: purchase model.Purchase, err error
+
+func (exa *PurchaseService) GetPurchase(id uint) (purchase purchase.Purchase, err error) {
+ err = global.GVA_DB.Where("id = ?", id).First(&purchase).Error
+ return
+}
+
+//@function: GetPurchaseList
+//@description: 鍒嗛〉鑾峰彇閲囪喘鍗曞垪琛�
+//@param: info request.PageInfo
+//@return: list interface{}, total int64, err error
+
+func (exa *PurchaseService) GetPurchaseList(info request.PageInfo) (list interface{}, total int64, err error) {
+ limit := info.PageSize
+ offset := info.PageSize * (info.Page - 1)
+ db := global.GVA_DB.Model(&purchase.Purchase{})
+ if info.Keyword != "" {
+ db.Distinct("purchases.id").Joins("left join purchase_products on purchase_products.purchase_id = purchases.id").
+ Joins("left join Product on Product.Id = purchase_products.product_id").
+ Joins("left join supplier on supplier.Id = purchases.supplier_id").
+ Where("purchases.name like ?", "%"+info.Keyword+"%").
+ Or("Product.name like ?", "%"+info.Keyword+"%").
+ Or("supplier.name like ?", "%"+info.Keyword+"%")
+ }
+ var purchaseList []purchase.Purchase
+ err = db.Count(&total).Error
+ if err != nil {
+ return purchaseList, total, err
+ }
+ err = db.Limit(limit).Offset(offset).Find(&purchaseList).Error
+ return purchaseList, total, err
+}
+
+//@function: GetPurchaseProductList
+//@description: 鍒嗛〉鑾峰彇閲囪喘鍗曚骇鍝佸垪琛�
+//@param: sysUserAuthorityID string
+//@return: list interface{}, err error
+
+func (exa *PurchaseService) GetPurchaseProductList(purchaseId uint) (list []*purchase.PurchaseProducts, err error) {
+ db := global.GVA_DB.Model(&purchase.PurchaseProducts{})
+ list = make([]*purchase.PurchaseProducts, 0)
+ err = db.Where("purchase_id = ?", purchaseId).Find(&list).Error
+ return list, err
+}
--
Gitblit v1.8.0