| | |
| | | package model |
| | | |
| | | import "gorm.io/gorm" |
| | | import ( |
| | | "aps_crm/pkg/mysqlx" |
| | | "gorm.io/gorm" |
| | | ) |
| | | |
| | | type ( |
| | | CustomerServiceSheet struct { |
| | | Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` |
| | | MemberId int `json:"memberId" gorm:"column:member_id;type:int;comment:服务人员id"` |
| | | Number string `json:"number" gorm:"column:number;type:varchar(255);comment:服务单号"` |
| | | ServiceMode int `json:"serviceMode" gorm:"column:service_mode;type:int;comment:服务方式"` |
| | | Priority int `json:"priority" gorm:"column:priority;type:int;comment:优先级"` |
| | | HandleStatus int `json:"handleStatus" gorm:"column:handle_status;type:int;comment:处理状态"` |
| | | gorm.Model `json:"-"` |
| | | Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` |
| | | MemberId int `json:"memberId" gorm:"column:member_id;type:int;comment:服务人员id"` |
| | | Number string `json:"number" gorm:"column:number;type:varchar(255);comment:服务单号"` |
| | | ServiceMode int `json:"serviceMode" gorm:"column:service_mode;type:int;comment:服务方式"` |
| | | Priority int `json:"priority" gorm:"column:priority;type:int;comment:优先级"` |
| | | HandleStatus int `json:"handleStatus" gorm:"column:handle_status;type:int;comment:处理状态"` |
| | | ServiceFollowupId int `json:"serviceFollowupId" gorm:"column:service_followup_id;type:int;comment:服务跟进id"` |
| | | gorm.Model `json:"-"` |
| | | } |
| | | |
| | | CustomerServiceSheetSearch struct { |
| | |
| | | Orm *gorm.DB |
| | | } |
| | | ) |
| | | |
| | | func (CustomerServiceSheet) TableName() string { |
| | | return "customer_service_sheet" |
| | | } |
| | | |
| | | func NewCustomerServiceSheetSearch() *CustomerServiceSheetSearch { |
| | | return &CustomerServiceSheetSearch{ |
| | | Orm: mysqlx.GetDB(), |
| | | } |
| | | } |
| | | |
| | | func (css *CustomerServiceSheetSearch) build() *gorm.DB { |
| | | var db = css.Orm.Model(&CustomerServiceSheet{}) |
| | | if css.Id != 0 { |
| | | db = db.Where("id = ?", css.Id) |
| | | } |
| | | |
| | | return db |
| | | } |
| | | |
| | | func (css *CustomerServiceSheetSearch) Create(record *CustomerServiceSheet) error { |
| | | var db = css.build() |
| | | return db.Create(record).Error |
| | | } |
| | | |
| | | func (css *CustomerServiceSheetSearch) Update(record *CustomerServiceSheet) error { |
| | | var db = css.build() |
| | | return db.Updates(record).Error |
| | | } |
| | | |
| | | func (css *CustomerServiceSheetSearch) Delete() error { |
| | | var db = css.build() |
| | | return db.Delete(&CustomerServiceSheet{}).Error |
| | | } |
| | | |
| | | func (css *CustomerServiceSheetSearch) Find() (*CustomerServiceSheet, error) { |
| | | var db = css.build() |
| | | var record = &CustomerServiceSheet{} |
| | | err := db.First(record).Error |
| | | return record, err |
| | | } |
| | | |
| | | func (css *CustomerServiceSheetSearch) FindAll() ([]*CustomerServiceSheet, error) { |
| | | var db = css.build() |
| | | var records = make([]*CustomerServiceSheet, 0) |
| | | err := db.Find(&records).Error |
| | | return records, err |
| | | } |
| | | |
| | | func (css *CustomerServiceSheetSearch) SetId(id int) *CustomerServiceSheetSearch { |
| | | css.Id = id |
| | | return css |
| | | } |