| | |
| | | // @Tags 服务单管理 |
| | | // @Summary 获取服务单列表 |
| | | // @Produce application/json |
| | | // @Param object query request.GetServiceOrderList true "参数" |
| | | // @Param object body request.GetServiceOrderList true "参数" |
| | | // @Success 200 {object} response.ListResponse{data=[]model.ServiceOrder} |
| | | // @Router /api/serviceOrder/list [get] |
| | | // @Router /api/serviceOrder/list [post] |
| | | func (s *ServiceOrderApi) List(c *gin.Context) { |
| | | var params request.GetServiceOrderList |
| | | ctx, ok := contextx.NewContext(c, ¶ms) |
| | |
| | | } |
| | | }, |
| | | "/api/serviceOrder/list": { |
| | | "get": { |
| | | "post": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | |
| | | "summary": "获取服务单列表", |
| | | "parameters": [ |
| | | { |
| | | "type": "string", |
| | | "name": "keyword", |
| | | "in": "query" |
| | | }, |
| | | { |
| | | "enum": [ |
| | | "服务单编号", |
| | | "主题", |
| | | "客户名称", |
| | | "实际处理时间", |
| | | "服务人员", |
| | | "服务方式", |
| | | "产品类别", |
| | | "故障类别" |
| | | ], |
| | | "type": "string", |
| | | "x-enum-varnames": [ |
| | | "ServiceOrderKeywordOrderNumber", |
| | | "ServiceOrderKeywordSubject", |
| | | "ServiceOrderKeywordClientName", |
| | | "ServiceOrderKeywordRealProcessTime", |
| | | "ServiceOrderKeywordServiceMan", |
| | | "ServiceOrderKeywordServiceType", |
| | | "ServiceOrderKeywordProductType", |
| | | "ServiceOrderKeywordFaultType" |
| | | ], |
| | | "name": "keywordType", |
| | | "in": "query" |
| | | }, |
| | | { |
| | | "type": "integer", |
| | | "description": "页码", |
| | | "name": "page", |
| | | "in": "query" |
| | | }, |
| | | { |
| | | "type": "integer", |
| | | "description": "每页大小", |
| | | "name": "pageSize", |
| | | "in": "query" |
| | | }, |
| | | { |
| | | "enum": [ |
| | | "" |
| | | ], |
| | | "type": "string", |
| | | "x-enum-varnames": [ |
| | | "ServiceOrderQueryClassExpireLessThen60Days" |
| | | ], |
| | | "name": "queryClass", |
| | | "in": "query" |
| | | "description": "参数", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.GetServiceOrderList" |
| | | } |
| | | } |
| | | ], |
| | | "responses": { |
| | |
| | | "model.ServiceFollowup": { |
| | | "type": "object", |
| | | "properties": { |
| | | "client": { |
| | | "$ref": "#/definitions/model.Client" |
| | | }, |
| | | "clientId": { |
| | | "type": "integer" |
| | | }, |
| | | "contact": { |
| | | "$ref": "#/definitions/model.Contact" |
| | | }, |
| | | "contactId": { |
| | | "type": "integer" |
| | |
| | | } |
| | | } |
| | | }, |
| | | "request.GetServiceOrderList": { |
| | | "type": "object", |
| | | "properties": { |
| | | "keyword": { |
| | | "type": "string" |
| | | }, |
| | | "keywordType": { |
| | | "$ref": "#/definitions/constvar.ServiceOrderKeywordType" |
| | | }, |
| | | "page": { |
| | | "description": "页码", |
| | | "type": "integer" |
| | | }, |
| | | "pageSize": { |
| | | "description": "每页大小", |
| | | "type": "integer" |
| | | }, |
| | | "queryClass": { |
| | | "$ref": "#/definitions/constvar.ServiceOrderQueryClass" |
| | | } |
| | | } |
| | | }, |
| | | "request.GetSubOrderList": { |
| | | "type": "object", |
| | | "properties": { |
| | |
| | | } |
| | | }, |
| | | "/api/serviceOrder/list": { |
| | | "get": { |
| | | "post": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | |
| | | "summary": "获取服务单列表", |
| | | "parameters": [ |
| | | { |
| | | "type": "string", |
| | | "name": "keyword", |
| | | "in": "query" |
| | | }, |
| | | { |
| | | "enum": [ |
| | | "服务单编号", |
| | | "主题", |
| | | "客户名称", |
| | | "实际处理时间", |
| | | "服务人员", |
| | | "服务方式", |
| | | "产品类别", |
| | | "故障类别" |
| | | ], |
| | | "type": "string", |
| | | "x-enum-varnames": [ |
| | | "ServiceOrderKeywordOrderNumber", |
| | | "ServiceOrderKeywordSubject", |
| | | "ServiceOrderKeywordClientName", |
| | | "ServiceOrderKeywordRealProcessTime", |
| | | "ServiceOrderKeywordServiceMan", |
| | | "ServiceOrderKeywordServiceType", |
| | | "ServiceOrderKeywordProductType", |
| | | "ServiceOrderKeywordFaultType" |
| | | ], |
| | | "name": "keywordType", |
| | | "in": "query" |
| | | }, |
| | | { |
| | | "type": "integer", |
| | | "description": "页码", |
| | | "name": "page", |
| | | "in": "query" |
| | | }, |
| | | { |
| | | "type": "integer", |
| | | "description": "每页大小", |
| | | "name": "pageSize", |
| | | "in": "query" |
| | | }, |
| | | { |
| | | "enum": [ |
| | | "" |
| | | ], |
| | | "type": "string", |
| | | "x-enum-varnames": [ |
| | | "ServiceOrderQueryClassExpireLessThen60Days" |
| | | ], |
| | | "name": "queryClass", |
| | | "in": "query" |
| | | "description": "参数", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.GetServiceOrderList" |
| | | } |
| | | } |
| | | ], |
| | | "responses": { |
| | |
| | | "model.ServiceFollowup": { |
| | | "type": "object", |
| | | "properties": { |
| | | "client": { |
| | | "$ref": "#/definitions/model.Client" |
| | | }, |
| | | "clientId": { |
| | | "type": "integer" |
| | | }, |
| | | "contact": { |
| | | "$ref": "#/definitions/model.Contact" |
| | | }, |
| | | "contactId": { |
| | | "type": "integer" |
| | |
| | | } |
| | | } |
| | | }, |
| | | "request.GetServiceOrderList": { |
| | | "type": "object", |
| | | "properties": { |
| | | "keyword": { |
| | | "type": "string" |
| | | }, |
| | | "keywordType": { |
| | | "$ref": "#/definitions/constvar.ServiceOrderKeywordType" |
| | | }, |
| | | "page": { |
| | | "description": "页码", |
| | | "type": "integer" |
| | | }, |
| | | "pageSize": { |
| | | "description": "每页大小", |
| | | "type": "integer" |
| | | }, |
| | | "queryClass": { |
| | | "$ref": "#/definitions/constvar.ServiceOrderQueryClass" |
| | | } |
| | | } |
| | | }, |
| | | "request.GetSubOrderList": { |
| | | "type": "object", |
| | | "properties": { |
| | |
| | | type: object |
| | | model.ServiceFollowup: |
| | | properties: |
| | | client: |
| | | $ref: '#/definitions/model.Client' |
| | | clientId: |
| | | type: integer |
| | | contact: |
| | | $ref: '#/definitions/model.Contact' |
| | | contactId: |
| | | type: integer |
| | | customerServiceSheet: |
| | |
| | | pageSize: |
| | | description: 每页大小 |
| | | type: integer |
| | | type: object |
| | | request.GetServiceOrderList: |
| | | properties: |
| | | keyword: |
| | | type: string |
| | | keywordType: |
| | | $ref: '#/definitions/constvar.ServiceOrderKeywordType' |
| | | page: |
| | | description: 页码 |
| | | type: integer |
| | | pageSize: |
| | | description: 每页大小 |
| | | type: integer |
| | | queryClass: |
| | | $ref: '#/definitions/constvar.ServiceOrderQueryClass' |
| | | type: object |
| | | request.GetSubOrderList: |
| | | properties: |
| | |
| | | tags: |
| | | - 服务单管理 |
| | | /api/serviceOrder/list: |
| | | get: |
| | | post: |
| | | parameters: |
| | | - in: query |
| | | name: keyword |
| | | type: string |
| | | - enum: |
| | | - 服务单编号 |
| | | - 主题 |
| | | - 客户名称 |
| | | - 实际处理时间 |
| | | - 服务人员 |
| | | - 服务方式 |
| | | - 产品类别 |
| | | - 故障类别 |
| | | in: query |
| | | name: keywordType |
| | | type: string |
| | | x-enum-varnames: |
| | | - ServiceOrderKeywordOrderNumber |
| | | - ServiceOrderKeywordSubject |
| | | - ServiceOrderKeywordClientName |
| | | - ServiceOrderKeywordRealProcessTime |
| | | - ServiceOrderKeywordServiceMan |
| | | - ServiceOrderKeywordServiceType |
| | | - ServiceOrderKeywordProductType |
| | | - ServiceOrderKeywordFaultType |
| | | - description: 页码 |
| | | in: query |
| | | name: page |
| | | type: integer |
| | | - description: 每页大小 |
| | | in: query |
| | | name: pageSize |
| | | type: integer |
| | | - enum: |
| | | - "" |
| | | in: query |
| | | name: queryClass |
| | | type: string |
| | | x-enum-varnames: |
| | | - ServiceOrderQueryClassExpireLessThen60Days |
| | | - description: 参数 |
| | | in: body |
| | | name: object |
| | | required: true |
| | | schema: |
| | | $ref: '#/definitions/request.GetServiceOrderList' |
| | | produces: |
| | | - application/json |
| | | responses: |
| | |
| | | ServiceFollowup struct {
|
| | | Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"`
|
| | | ClientId int `json:"clientId" gorm:"column:client_id;type:int;comment:客户id"`
|
| | | Client Client `json:"client" gorm:"foreignKey:ClientId"` |
| | | Number string `json:"number" gorm:"column:number;type:varchar(255);comment:合同编号"`
|
| | | ContactId int `json:"contactId" gorm:"column:contact_id;type:int;comment:联系人id"`
|
| | | Contact Contact `json:"contact" gorm:"foreignKey:ContactId"` |
| | | ServiceId int `json:"serviceId" gorm:"column:service_id;type:int;comment:客户服务单id"`
|
| | | ServiceOrder ServiceOrder `gorm:"foreignKey:ServiceId"`
|
| | | CustomerServiceSheet CustomerServiceSheet `json:"customerServiceSheet" gorm:"foreignKey:ServiceId"`
|
| | |
| | | OrderBy string
|
| | | PageNum int
|
| | | PageSize int
|
| | | Preload bool |
| | | }
|
| | | )
|
| | |
|
| | |
| | | case constvar.ServiceFollowupKeywordSatisfactionDegree:
|
| | | db = db.Where("satisfaction_id = ?", slf.Keyword)
|
| | |
|
| | | } |
| | | |
| | | if slf.Preload { |
| | | db = db.Preload("CustomerServiceSheet"). |
| | | Preload("ServiceOrder"). |
| | | Preload("Client"). |
| | | Preload("Contact") |
| | | }
|
| | |
|
| | | return db
|
| | |
| | | db = db.Limit(slf.PageSize).Offset((slf.PageNum - 1) * slf.PageSize)
|
| | | }
|
| | |
|
| | | err := db.Preload("CustomerServiceSheet").Preload("ServiceOrder").Find(&records).Error
|
| | | err := db.Find(&records).Error |
| | | return records, total, err
|
| | | }
|
| | |
|
| | |
| | | return slf
|
| | | }
|
| | |
|
| | | func (slf *ServiceFollowupSearch) SetPreload(preload bool) *ServiceFollowupSearch { |
| | | slf.Preload = preload |
| | | return slf |
| | | } |
| | | |
| | | func (slf *ServiceFollowupSearch) SetKeywordType(keyword constvar.ServiceFollowupKeywordType) *ServiceFollowupSearch {
|
| | | slf.KeywordType = keyword
|
| | | return slf
|
| | |
| | | ServiceOrderRouter.POST("add", ServiceOrderApi.Add) // 添加服务单 |
| | | ServiceOrderRouter.DELETE("delete/:id", ServiceOrderApi.Delete) // 删除服务单 |
| | | ServiceOrderRouter.PUT("update", ServiceOrderApi.Update) // 更新服务单 |
| | | ServiceOrderRouter.GET("list", ServiceOrderApi.List) // 获取服务单列表 |
| | | ServiceOrderRouter.POST("list", ServiceOrderApi.List) // 获取服务单列表 |
| | | } |
| | | } |
| | |
| | | contacts, total, err := model.NewServiceFollowupSearch(). |
| | | SetKeywordType(keywordType). |
| | | SetKeyword(keyword). |
| | | SetPage(page, pageSize).FindAll() |
| | | SetPage(page, pageSize). |
| | | SetPreload(true). |
| | | FindAll() |
| | | if err != nil { |
| | | return nil, 0, ecode.ServiceFollowupListErr |
| | | } |