| | |
| | | ctx.Ok() |
| | | } |
| | | |
| | | // Delete |
| | | //// Delete |
| | | //// |
| | | //// @Tags ServiceContract |
| | | //// @Summary 删除服务合同 |
| | | //// @Produce application/json |
| | | //// @Param object body request.DeleteServiceContract true "查询参数" |
| | | //// @Success 200 {object} contextx.Response{} |
| | | //// @Router /api/serviceContract/delete [delete] |
| | | //func (s *ServiceContractApi) Delete(c *gin.Context) { |
| | | // var params request.DeleteServiceContract |
| | | // ctx, ok := contextx.NewContext(c, ¶ms) |
| | | // if !ok { |
| | | // return |
| | | // } |
| | | // |
| | | // @Tags ServiceContract |
| | | // @Summary 删除服务合同 |
| | | // @Produce application/json |
| | | // @Param object body request.DeleteServiceContract true "查询参数" |
| | | // @Success 200 {object} contextx.Response{} |
| | | // @Router /api/serviceContract/delete [delete] |
| | | func (s *ServiceContractApi) Delete(c *gin.Context) { |
| | | var params request.DeleteServiceContract |
| | | // errCode := serviceContractService.DeleteServiceContract(params.Ids) |
| | | // if errCode != ecode.OK { |
| | | // ctx.Fail(errCode) |
| | | // return |
| | | // } |
| | | // |
| | | // ctx.Ok() |
| | | //} |
| | | |
| | | // BatchDelete |
| | | // @Tags ServiceContract |
| | | // @Summary 批量删除服务合同 |
| | | // @Produce application/json |
| | | // @Param object body request.CommonIds true "参数" |
| | | // @Success 200 {object} contextx.Response{} |
| | | // @Router /api/serviceContract/delete [delete] |
| | | func (s *ServiceContractApi) BatchDelete(c *gin.Context) { |
| | | var params request.CommonIds |
| | | ctx, ok := contextx.NewContext(c, ¶ms) |
| | | if !ok { |
| | | return |
| | | } |
| | | |
| | | errCode := serviceContractService.DeleteServiceContract(params.Ids) |
| | | errCode := serviceContractService.BatchDeleteServiceContract(params.Ids) |
| | | if errCode != ecode.OK { |
| | | ctx.Fail(errCode) |
| | | return |
| | |
| | | } |
| | | |
| | | // BatchDelete |
| | | // @Tags 服务单管理 |
| | | // @Summary 批量删除服务单 |
| | | // @Tags 服务单 |
| | | // @Summary 批量删除服务单 |
| | | // @Produce application/json |
| | | // @Param object body request.CommonIds true "参数" |
| | | // @Param object body request.CommonIds true "参数" |
| | | // @Success 200 {object} contextx.Response{} |
| | | // @Router /api/serviceOrder/delete [delete] |
| | | func (s *ServiceOrderApi) BatchDelete(c *gin.Context) { |
| | |
| | | "tags": [ |
| | | "ServiceContract" |
| | | ], |
| | | "summary": "删除服务合同", |
| | | "summary": "批量删除服务合同", |
| | | "parameters": [ |
| | | { |
| | | "description": "查询参数", |
| | | "description": "参数", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.DeleteServiceContract" |
| | | "$ref": "#/definitions/request.CommonIds" |
| | | } |
| | | } |
| | | ], |
| | |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "服务单管理" |
| | | "服务单" |
| | | ], |
| | | "summary": "批量删除服务单", |
| | | "parameters": [ |
| | | { |
| | | "description": "查询参数", |
| | | "description": "参数", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | |
| | | } |
| | | }, |
| | | "request.DeleteSalesLeads": { |
| | | "type": "object", |
| | | "properties": { |
| | | "ids": { |
| | | "type": "array", |
| | | "items": { |
| | | "type": "integer" |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "request.DeleteServiceContract": { |
| | | "type": "object", |
| | | "properties": { |
| | | "ids": { |
| | |
| | | "tags": [ |
| | | "ServiceContract" |
| | | ], |
| | | "summary": "删除服务合同", |
| | | "summary": "批量删除服务合同", |
| | | "parameters": [ |
| | | { |
| | | "description": "查询参数", |
| | | "description": "参数", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.DeleteServiceContract" |
| | | "$ref": "#/definitions/request.CommonIds" |
| | | } |
| | | } |
| | | ], |
| | |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "服务单管理" |
| | | "服务单" |
| | | ], |
| | | "summary": "批量删除服务单", |
| | | "parameters": [ |
| | | { |
| | | "description": "查询参数", |
| | | "description": "参数", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | |
| | | } |
| | | }, |
| | | "request.DeleteSalesLeads": { |
| | | "type": "object", |
| | | "properties": { |
| | | "ids": { |
| | | "type": "array", |
| | | "items": { |
| | | "type": "integer" |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "request.DeleteServiceContract": { |
| | | "type": "object", |
| | | "properties": { |
| | | "ids": { |
| | |
| | | type: integer |
| | | type: array |
| | | type: object |
| | | request.DeleteServiceContract: |
| | | properties: |
| | | ids: |
| | | items: |
| | | type: integer |
| | | type: array |
| | | type: object |
| | | request.DeleteServiceFeeManage: |
| | | properties: |
| | | ids: |
| | |
| | | /api/serviceContract/delete: |
| | | delete: |
| | | parameters: |
| | | - description: 查询参数 |
| | | - description: 参数 |
| | | in: body |
| | | name: object |
| | | required: true |
| | | schema: |
| | | $ref: '#/definitions/request.DeleteServiceContract' |
| | | $ref: '#/definitions/request.CommonIds' |
| | | produces: |
| | | - application/json |
| | | responses: |
| | |
| | | description: OK |
| | | schema: |
| | | $ref: '#/definitions/contextx.Response' |
| | | summary: 删除服务合同 |
| | | summary: 批量删除服务合同 |
| | | tags: |
| | | - ServiceContract |
| | | /api/serviceContract/list: |
| | |
| | | /api/serviceOrder/delete: |
| | | delete: |
| | | parameters: |
| | | - description: 查询参数 |
| | | - description: 参数 |
| | | in: body |
| | | name: object |
| | | required: true |
| | |
| | | $ref: '#/definitions/contextx.Response' |
| | | summary: 批量删除服务单 |
| | | tags: |
| | | - 服务单管理 |
| | | - 服务单 |
| | | /api/serviceOrder/delete/{id}: |
| | | delete: |
| | | parameters: |
| | |
| | | return db.Delete(&ServiceContract{}).Error |
| | | } |
| | | |
| | | func (slf *ServiceContractSearch) DeleteByIds(ids []int) error { |
| | | var db = slf.build() |
| | | db = db.Where("id in ?", ids) |
| | | return db.Delete(&ServiceContract{}).Error |
| | | } |
| | | |
| | | func (slf *ServiceContractSearch) Find() ([]*ServiceContract, int64, error) { |
| | | var db = slf.build() |
| | | var records = make([]*ServiceContract, 0) |
| | |
| | | package router
|
| | |
|
| | | import (
|
| | | v1 "aps_crm/api/v1"
|
| | | "github.com/gin-gonic/gin"
|
| | | )
|
| | |
|
| | | type ServiceContractRouter struct{}
|
| | |
|
| | | func (s *ServiceContractRouter) InitServiceContractRouter(router *gin.RouterGroup) {
|
| | | serviceContractRouter := router.Group("serviceContract")
|
| | | serviceContractApi := v1.ApiGroup.ServiceContractApi
|
| | | {
|
| | | serviceContractRouter.POST("add", serviceContractApi.Add) // 添加服务合同
|
| | | serviceContractRouter.DELETE("delete", serviceContractApi.Delete) // 删除服务合同
|
| | | serviceContractRouter.PUT("update", serviceContractApi.Update) // 更新服务合同
|
| | | serviceContractRouter.POST("list", serviceContractApi.List) // 获取服务合同列表
|
| | | }
|
| | | } |
| | | package router |
| | | |
| | | import ( |
| | | v1 "aps_crm/api/v1" |
| | | "github.com/gin-gonic/gin" |
| | | ) |
| | | |
| | | type ServiceContractRouter struct{} |
| | | |
| | | func (s *ServiceContractRouter) InitServiceContractRouter(router *gin.RouterGroup) { |
| | | serviceContractRouter := router.Group("serviceContract") |
| | | serviceContractApi := v1.ApiGroup.ServiceContractApi |
| | | { |
| | | serviceContractRouter.POST("add", serviceContractApi.Add) // 添加服务合同 |
| | | serviceContractRouter.DELETE("delete", serviceContractApi.BatchDelete) // 删除服务合同 |
| | | serviceContractRouter.PUT("update", serviceContractApi.Update) // 更新服务合同 |
| | | serviceContractRouter.POST("list", serviceContractApi.List) // 获取服务合同列表 |
| | | } |
| | | } |
| | |
| | | return ecode.OK |
| | | } |
| | | |
| | | func (SContractService) BatchDeleteServiceContract(ids []int) int { |
| | | err := model.NewServiceContractSearch().DeleteByIds(ids) |
| | | if err != nil { |
| | | return ecode.DBErr |
| | | } |
| | | return ecode.OK |
| | | } |
| | | |
| | | func (SContractService) GetServiceContractList(page, pageSize int, queryClass constvar.ServiceContractQueryClass, keywordType constvar.ServiceContractKeywordType, keyword string) ([]*model.ServiceContract, int64, int) { |
| | | // get contact list |
| | | contacts, total, err := model.NewServiceContractSearch(). |