add
wangpengfei
2023-08-25 9f98932726cb41697fabccbbbd876205e7255c95
add

add changeStatus to supplier
8个文件已修改
165 ■■■■■ 已修改文件
.gitignore 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
api/v1/test/supplier.go 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/docs.go 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/swagger.json 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/swagger.yaml 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/test/request/supplier.go 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
router/test/supplier.go 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/test/supplier.go 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.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
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(&params)
    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)
    }
}
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": {
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": {
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:
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"`
}
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
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
}