add
add changeStatus to supplier
| | |
| | | /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 |
| | |
| | | }, "获取成功", 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) |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | }, |
| | | "/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": [ |
| | |
| | | } |
| | | } |
| | | }, |
| | | "request.SupplierStatus": { |
| | | "type": "object", |
| | | "properties": { |
| | | "id": { |
| | | "type": "integer" |
| | | }, |
| | | "status": { |
| | | "type": "integer" |
| | | } |
| | | } |
| | | }, |
| | | "request.SysAuthorityBtnReq": { |
| | | "type": "object", |
| | | "properties": { |
| | |
| | | } |
| | | } |
| | | }, |
| | | "/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": [ |
| | |
| | | } |
| | | } |
| | | }, |
| | | "request.SupplierStatus": { |
| | | "type": "object", |
| | | "properties": { |
| | | "id": { |
| | | "type": "integer" |
| | | }, |
| | | "status": { |
| | | "type": "integer" |
| | | } |
| | | } |
| | | }, |
| | | "request.SysAuthorityBtnReq": { |
| | | "type": "object", |
| | | "properties": { |
| | |
| | | id: |
| | | type: integer |
| | | type: object |
| | | request.SupplierStatus: |
| | | properties: |
| | | id: |
| | | type: integer |
| | | status: |
| | | type: integer |
| | | type: object |
| | | request.SysAuthorityBtnReq: |
| | | properties: |
| | | authorityId: |
| | |
| | | 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: |
| | |
| | | EndCreatedAt *time.Time `json:"endCreatedAt" form:"endCreatedAt"` |
| | | request.PageInfo |
| | | } |
| | | |
| | | type SupplierStatus struct { |
| | | Id uint `json:"id"` |
| | | Status int `json:"status"` |
| | | } |
| | |
| | | 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 |
| | |
| | | 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 |
| | | } |