| | |
| | | package service |
| | | |
| | | import ( |
| | | "aps_crm/constvar" |
| | | "aps_crm/model" |
| | | "aps_crm/model/request" |
| | | "aps_crm/pkg/ecode" |
| | |
| | | return ecode.OK |
| | | } |
| | | |
| | | func (ServiceOrderService) GetServiceOrderList() ([]*model.ServiceOrder, int64, int) { |
| | | list, total, err := model.NewServiceOrderSearch().SetPreload(true).Find() |
| | | func (ServiceOrderService) BatchDeleteServiceOrder(ids []int) int { |
| | | err := model.NewServiceOrderSearch().DeleteByIds(ids) |
| | | if err != nil { |
| | | return ecode.DBErr |
| | | } |
| | | return ecode.OK |
| | | } |
| | | |
| | | func (ServiceOrderService) GetServiceOrderList(page, pageSize int, queryClass constvar.ServiceOrderQueryClass, keywordType constvar.ServiceOrderKeywordType, keyword string, serviceContractId, salesDetailsId int, memberIds []int) ([]*model.ServiceOrder, int64, int) { |
| | | list, total, err := model.NewServiceOrderSearch(). |
| | | SetPage(page, pageSize). |
| | | SetKeyword(keyword). |
| | | SetKeywordType(keywordType). |
| | | SetQueryClass(queryClass). |
| | | SetPreload(true). |
| | | SetServiceContractId(serviceContractId). |
| | | SetSalesDetailsId(salesDetailsId). |
| | | SetMemberIds(memberIds). |
| | | SetOrder("created_at desc"). |
| | | Find() |
| | | if err != nil { |
| | | return nil, 0, ecode.DBErr |
| | | } |
| | |
| | | } |
| | | |
| | | func (ServiceOrderService) UpdateServiceOrder(serviceOrder *model.ServiceOrder) int { |
| | | err := model.NewServiceOrderSearch().SetId(serviceOrder.Id).Save(serviceOrder) |
| | | err := model.NewServiceOrderSearch().SetId(serviceOrder.Id).Updates(serviceOrder) |
| | | if err != nil { |
| | | return ecode.DBErr |
| | | } |