From 9f98932726cb41697fabccbbbd876205e7255c95 Mon Sep 17 00:00:00 2001
From: wangpengfei <274878379@qq.com>
Date: 星期五, 25 八月 2023 11:40:28 +0800
Subject: [PATCH] add
---
.gitignore | 1
api/v1/test/supplier.go | 24 ++++++++
service/test/supplier.go | 6 ++
docs/swagger.yaml | 30 ++++++++++
router/test/supplier.go | 1
docs/docs.go | 49 ++++++++++++++++
docs/swagger.json | 49 ++++++++++++++++
model/test/request/supplier.go | 5 +
8 files changed, 165 insertions(+), 0 deletions(-)
diff --git a/.gitignore b/.gitignore
index b0b5938..887c4a3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -52,3 +52,4 @@
/service/example/exa_file_upload_download.go
/log/2023-08-23/info.log
/log/2023-08-24/info.log
+/log/2023-08-25/info.log
diff --git a/api/v1/test/supplier.go b/api/v1/test/supplier.go
index 5b9df26..27943a5 100644
--- a/api/v1/test/supplier.go
+++ b/api/v1/test/supplier.go
@@ -181,3 +181,27 @@
}, "鑾峰彇鎴愬姛", c)
}
}
+
+// ChangeSupplierStatus 淇敼Supplier鐘舵��
+// @Tags Supplier
+// @Summary 淇敼Supplier鐘舵��
+// @Security ApiKeyAuth
+// @accept application/json
+// @Produce application/json
+// @Param data body testReq.SupplierStatus true "淇敼Supplier鐘舵��"
+// @Success 200 {string} string "{"success":true,"data":{},"msg":"淇敼鎴愬姛"}"
+// @Router /s/changeSupplierStatus [post]
+func (sApi *SupplierApi) ChangeSupplierStatus(c *gin.Context) {
+ var params testReq.SupplierStatus
+ err := c.ShouldBindJSON(¶ms)
+ if err != nil {
+ response.FailWithMessage(err.Error(), c)
+ return
+ }
+ if err := sService.ChangeStatus(params.Id, params.Status); err != nil {
+ global.GVA_LOG.Error("淇敼澶辫触!", zap.Error(err))
+ response.FailWithMessage("淇敼澶辫触", c)
+ } else {
+ response.OkWithMessage("淇敼鎴愬姛", c)
+ }
+}
diff --git a/docs/docs.go b/docs/docs.go
index 2ff80f6..835bc27 100644
--- a/docs/docs.go
+++ b/docs/docs.go
@@ -3253,6 +3253,44 @@
}
}
},
+ "/s/changeSupplierStatus": {
+ "post": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "Supplier"
+ ],
+ "summary": "淇敼Supplier鐘舵��",
+ "parameters": [
+ {
+ "description": "淇敼Supplier鐘舵��",
+ "name": "data",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/request.SupplierStatus"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "{\"success\":true,\"data\":{},\"msg\":\"淇敼鎴愬姛\"}",
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ },
"/s/createSupplier": {
"post": {
"security": [
@@ -6877,6 +6915,17 @@
}
}
},
+ "request.SupplierStatus": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "integer"
+ },
+ "status": {
+ "type": "integer"
+ }
+ }
+ },
"request.SysAuthorityBtnReq": {
"type": "object",
"properties": {
diff --git a/docs/swagger.json b/docs/swagger.json
index 2e36263..3a2aadb 100644
--- a/docs/swagger.json
+++ b/docs/swagger.json
@@ -3244,6 +3244,44 @@
}
}
},
+ "/s/changeSupplierStatus": {
+ "post": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "Supplier"
+ ],
+ "summary": "淇敼Supplier鐘舵��",
+ "parameters": [
+ {
+ "description": "淇敼Supplier鐘舵��",
+ "name": "data",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/request.SupplierStatus"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "{\"success\":true,\"data\":{},\"msg\":\"淇敼鎴愬姛\"}",
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ },
"/s/createSupplier": {
"post": {
"security": [
@@ -6868,6 +6906,17 @@
}
}
},
+ "request.SupplierStatus": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "integer"
+ },
+ "status": {
+ "type": "integer"
+ }
+ }
+ },
"request.SysAuthorityBtnReq": {
"type": "object",
"properties": {
diff --git a/docs/swagger.yaml b/docs/swagger.yaml
index 3c44c42..a847e17 100644
--- a/docs/swagger.yaml
+++ b/docs/swagger.yaml
@@ -883,6 +883,13 @@
id:
type: integer
type: object
+ request.SupplierStatus:
+ properties:
+ id:
+ type: integer
+ status:
+ type: integer
+ type: object
request.SysAuthorityBtnReq:
properties:
authorityId:
@@ -3366,6 +3373,29 @@
summary: 鏇存柊鑿滃崟
tags:
- Menu
+ /s/changeSupplierStatus:
+ post:
+ consumes:
+ - application/json
+ parameters:
+ - description: 淇敼Supplier鐘舵��
+ in: body
+ name: data
+ required: true
+ schema:
+ $ref: '#/definitions/request.SupplierStatus'
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: '{"success":true,"data":{},"msg":"淇敼鎴愬姛"}'
+ schema:
+ type: string
+ security:
+ - ApiKeyAuth: []
+ summary: 淇敼Supplier鐘舵��
+ tags:
+ - Supplier
/s/createSupplier:
post:
consumes:
diff --git a/model/test/request/supplier.go b/model/test/request/supplier.go
index f143a3a..c3d8d12 100644
--- a/model/test/request/supplier.go
+++ b/model/test/request/supplier.go
@@ -12,3 +12,8 @@
EndCreatedAt *time.Time `json:"endCreatedAt" form:"endCreatedAt"`
request.PageInfo
}
+
+type SupplierStatus struct {
+ Id uint `json:"id"`
+ Status int `json:"status"`
+}
diff --git a/router/test/supplier.go b/router/test/supplier.go
index fa8510e..6bfc2cb 100644
--- a/router/test/supplier.go
+++ b/router/test/supplier.go
@@ -18,6 +18,7 @@
sRouter.DELETE("deleteSupplier", sApi.DeleteSupplier) // 鍒犻櫎Supplier
sRouter.DELETE("deleteSupplierByIds", sApi.DeleteSupplierByIds) // 鎵归噺鍒犻櫎Supplier
sRouter.PUT("updateSupplier", sApi.UpdateSupplier) // 鏇存柊Supplier
+ sRouter.POST("changeSupplierStatus", sApi.ChangeSupplierStatus) // 鏇存柊Supplier鐘舵��
}
{
sRouterWithoutRecord.GET("findSupplier", sApi.FindSupplier) // 鏍规嵁ID鑾峰彇Supplier
diff --git a/service/test/supplier.go b/service/test/supplier.go
index 915190c..07110a2 100644
--- a/service/test/supplier.go
+++ b/service/test/supplier.go
@@ -68,3 +68,9 @@
err = db.Limit(limit).Offset(offset).Find(&ss).Error
return ss, total, err
}
+
+// ChangeStatus Change supplier status
+func (sService *SupplierService) ChangeStatus(id uint, status int) (err error) {
+ err = global.GVA_DB.Model(&test.Supplier{}).Where("id = ?", id).Update("status", status).Error
+ return err
+}
--
Gitblit v1.8.0