| | |
| | | WorkshopManage struct { |
| | | gorm.Model |
| | | WorkshopNumber string `json:"workshopNumber" gorm:"type:varchar(255);comment:车间编号"` |
| | | WorkshopName string `json:"workshopName" gorm:"type:varchar(255);comment:车间名称"` |
| | | GroupNumber int `json:"groupNumber" gorm:"type:int(11);comment:组别"` |
| | | StartCarNumber int `json:"startCarNumber" gorm:"type:int(11);comment:开始车号"` |
| | | EndCarNumber int `json:"endCarNumber" gorm:"type:int(11);comment:结束车号"` |
| | |
| | | ) |
| | | |
| | | func (slf WorkshopManage) TableName() string { |
| | | return "workshop_manage" |
| | | return "silk_workshop_manage" |
| | | } |
| | | |
| | | func NewWorkshopManageSearch() *WorkshopManageSearch { |
| | |
| | | return slf |
| | | } |
| | | |
| | | func (slf *WorkshopManageSearch) SetWorkshopName(workshopName string) *WorkshopManageSearch { |
| | | slf.WorkshopName = workshopName |
| | | return slf |
| | | } |
| | | |
| | | func (slf *WorkshopManageSearch) SetGroupNumber(groupNumber int) *WorkshopManageSearch { |
| | | slf.GroupNumber = groupNumber |
| | | return slf |
| | |
| | | |
| | | if slf.WorkshopNumber != "" { |
| | | db = db.Where("workshop_number = ?", slf.WorkshopNumber) |
| | | } |
| | | |
| | | if slf.WorkshopName != "" { |
| | | db = db.Where("workshop_name = ?", slf.WorkshopName) |
| | | } |
| | | |
| | | if slf.GroupNumber != 0 { |
| | |
| | | |
| | | return nil |
| | | } |
| | | |
| | | func (slf *WorkshopManageSearch) Count() (int64, error) { |
| | | var ( |
| | | total int64 |
| | | db = slf.build() |
| | | ) |
| | | |
| | | if err := db.Count(&total).Error; err != nil { |
| | | return total, fmt.Errorf("find count err: %v", err) |
| | | } |
| | | return total, nil |
| | | } |