| | |
| | | Month string `json:"month" gorm:"type:varchar(255);comment:月份"` |
| | | IssueSalary decimal.Decimal `json:"issueSalary" gorm:"type:decimal(20,3);comment:应发工资"` |
| | | Remark string `json:"remark" gorm:"type:varchar(255);comment:备注"` |
| | | Details []SalaryDetails `json:"details" gorm:"foreignKey:SalaryReportFormId;references:Id"` |
| | | Details []*SalaryDetails `json:"details" gorm:"foreignKey:SalaryReportFormId"` |
| | | } |
| | | SalaryReportFormSearch struct { |
| | | SalaryReportForm |
| | | PageNum int |
| | | PageSize int |
| | | Preload bool |
| | | Keyword string |
| | | Orm *gorm.DB |
| | | } |
| | | ) |
| | | |
| | | func (slf SalaryReportForm) TableName() string { |
| | | return "salary_report_form" |
| | | return "silk_salary_report_form" |
| | | } |
| | | |
| | | func NewSalaryReportFormSearch() *SalaryReportFormSearch { |
| | |
| | | return slf |
| | | } |
| | | |
| | | func (slf *SalaryReportFormSearch) SetKeyword(keyword string) *SalaryReportFormSearch { |
| | | slf.Keyword = keyword |
| | | return slf |
| | | } |
| | | |
| | | func (slf *SalaryReportFormSearch) build() *gorm.DB { |
| | | var db = slf.Orm.Table(slf.TableName()) |
| | | |
| | | if slf.Preload { |
| | | db = db.Model(SalaryReportForm{}).Preload("Details").Preload("WorkType") |
| | | } |
| | | if slf.Keyword != "" { |
| | | db = db.Where("worker_name like ? or worker_id like ?", "%"+slf.Keyword+"%", "%"+slf.Keyword+"%") |
| | | } |
| | | |
| | | return db |
| | | } |