| | |
| | | |
| | | // Add |
| | | // |
| | | // @Tags SalesReturn |
| | | // @Tags 销售退货单 |
| | | // @Summary 添加销售退货 |
| | | // @Produce application/json |
| | | // @Param object body request.AddSalesReturnRequest true "查询参数" |
| | |
| | | |
| | | // Delete |
| | | // |
| | | // @Tags SalesReturn |
| | | // @Tags 销售退货单 |
| | | // @Summary 删除销售退货 |
| | | // @Produce application/json |
| | | // @Param id path int true "查询参数" |
| | |
| | | ctx.Ok() |
| | | } |
| | | |
| | | // BatchDelete |
| | | // @Tags 销售退货单 |
| | | // @Summary 批量删除销售退货单 |
| | | // @Produce application/json |
| | | // @Param object body request.CommonIds true "参数" |
| | | // @Success 200 {object} contextx.Response{} |
| | | // @Router /api/salesReturn/delete [delete] |
| | | func (s *SalesReturnApi) BatchDelete(c *gin.Context) { |
| | | var params request.CommonIds |
| | | ctx, ok := contextx.NewContext(c, ¶ms) |
| | | if !ok { |
| | | return |
| | | } |
| | | |
| | | errCode := salesReturnService.BatchDeleteSalesReturn(params.Ids) |
| | | if errCode != ecode.OK { |
| | | ctx.Fail(errCode) |
| | | return |
| | | } |
| | | |
| | | ctx.Ok() |
| | | } |
| | | |
| | | // Update |
| | | // |
| | | // @Tags SalesReturn |
| | | // @Tags 销售退货单 |
| | | // @Summary 更新销售退货 |
| | | // @Produce application/json |
| | | // @Param object body request.UpdateSalesReturnRequest true "查询参数" |
| | |
| | | |
| | | // List |
| | | // |
| | | // @Tags SalesReturn |
| | | // @Tags 销售退货单 |
| | | // @Summary 销售退货单列表 |
| | | // @Produce application/json |
| | | // |
| | |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "SalesReturn" |
| | | "销售退货单" |
| | | ], |
| | | "summary": "添加销售退货", |
| | | "parameters": [ |
| | |
| | | } |
| | | } |
| | | }, |
| | | "/api/salesReturn/delete": { |
| | | "delete": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "销售退货单" |
| | | ], |
| | | "summary": "批量删除销售退货单", |
| | | "parameters": [ |
| | | { |
| | | "description": "参数", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.CommonIds" |
| | | } |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "OK", |
| | | "schema": { |
| | | "$ref": "#/definitions/contextx.Response" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api/salesReturn/delete/{id}": { |
| | | "delete": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "SalesReturn" |
| | | "销售退货单" |
| | | ], |
| | | "summary": "删除销售退货", |
| | | "parameters": [ |
| | |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "SalesReturn" |
| | | "销售退货单" |
| | | ], |
| | | "summary": "销售退货单列表", |
| | | "parameters": [ |
| | |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "SalesReturn" |
| | | "销售退货单" |
| | | ], |
| | | "summary": "更新销售退货", |
| | | "parameters": [ |
| | |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "SalesReturn" |
| | | "销售退货单" |
| | | ], |
| | | "summary": "添加销售退货", |
| | | "parameters": [ |
| | |
| | | } |
| | | } |
| | | }, |
| | | "/api/salesReturn/delete": { |
| | | "delete": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "销售退货单" |
| | | ], |
| | | "summary": "批量删除销售退货单", |
| | | "parameters": [ |
| | | { |
| | | "description": "参数", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.CommonIds" |
| | | } |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "OK", |
| | | "schema": { |
| | | "$ref": "#/definitions/contextx.Response" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api/salesReturn/delete/{id}": { |
| | | "delete": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "SalesReturn" |
| | | "销售退货单" |
| | | ], |
| | | "summary": "删除销售退货", |
| | | "parameters": [ |
| | |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "SalesReturn" |
| | | "销售退货单" |
| | | ], |
| | | "summary": "销售退货单列表", |
| | | "parameters": [ |
| | |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "SalesReturn" |
| | | "销售退货单" |
| | | ], |
| | | "summary": "更新销售退货", |
| | | "parameters": [ |
| | |
| | | $ref: '#/definitions/contextx.Response' |
| | | summary: 添加销售退货 |
| | | tags: |
| | | - SalesReturn |
| | | - 销售退货单 |
| | | /api/salesReturn/delete: |
| | | delete: |
| | | parameters: |
| | | - description: 参数 |
| | | in: body |
| | | name: object |
| | | required: true |
| | | schema: |
| | | $ref: '#/definitions/request.CommonIds' |
| | | produces: |
| | | - application/json |
| | | responses: |
| | | "200": |
| | | description: OK |
| | | schema: |
| | | $ref: '#/definitions/contextx.Response' |
| | | summary: 批量删除销售退货单 |
| | | tags: |
| | | - 销售退货单 |
| | | /api/salesReturn/delete/{id}: |
| | | delete: |
| | | parameters: |
| | |
| | | $ref: '#/definitions/contextx.Response' |
| | | summary: 删除销售退货 |
| | | tags: |
| | | - SalesReturn |
| | | - 销售退货单 |
| | | /api/salesReturn/list: |
| | | post: |
| | | parameters: |
| | |
| | | type: object |
| | | summary: 销售退货单列表 |
| | | tags: |
| | | - SalesReturn |
| | | - 销售退货单 |
| | | /api/salesReturn/update: |
| | | put: |
| | | parameters: |
| | |
| | | $ref: '#/definitions/contextx.Response' |
| | | summary: 更新销售退货 |
| | | tags: |
| | | - SalesReturn |
| | | - 销售退货单 |
| | | /api/salesReturnStatus/add: |
| | | post: |
| | | parameters: |
| | |
| | | return db.Delete(&SalesReturn{}).Error |
| | | } |
| | | |
| | | func (slf *SalesReturnSearch) DeleteByIds(ids []int) error { |
| | | var db = slf.build() |
| | | db = db.Where("id in ?", ids) |
| | | return db.Delete(&SalesReturn{}).Error |
| | | } |
| | | |
| | | func (slf *SalesReturnSearch) Update(record *SalesReturn) error { |
| | | var db = slf.build() |
| | | return db.Updates(record).Error |
| | |
| | | salesReturnRouter := router.Group("salesReturn") |
| | | salesReturnApi := v1.ApiGroup.SalesReturnApi |
| | | { |
| | | salesReturnRouter.POST("add", salesReturnApi.Add) // 添加销售退货 |
| | | salesReturnRouter.DELETE("delete/:id", salesReturnApi.Delete) // 删除销售退货 |
| | | salesReturnRouter.PUT("update", salesReturnApi.Update) // 更新销售退货 |
| | | salesReturnRouter.POST("add", salesReturnApi.Add) // 添加销售退货 |
| | | salesReturnRouter.DELETE("delete/:id", salesReturnApi.Delete) // 删除销售退货 |
| | | salesReturnRouter.DELETE("delete", salesReturnApi.BatchDelete) // 批量删除销售退货单 |
| | | salesReturnRouter.PUT("update", salesReturnApi.Update) // 更新销售退货 |
| | | salesReturnRouter.POST("list", salesReturnApi.List) // 获取销售退货单列表 |
| | | } |
| | | } |
| | | } |
| | |
| | | return ecode.OK |
| | | } |
| | | |
| | | func (SalesReturnService) BatchDeleteSalesReturn(ids []int) int { |
| | | err := model.NewSalesReturnSearch().DeleteByIds(ids) |
| | | if err != nil { |
| | | return ecode.DBErr |
| | | } |
| | | return ecode.OK |
| | | } |
| | | |
| | | func (SalesReturnService) UpdateSalesReturn(salesReturn *model.SalesReturn) int { |
| | | // check salesReturn exist |
| | | _, err := model.NewSalesReturnSearch().SetId(salesReturn.Id).Find() |