| | |
| | | } |
| | | WorkerPositionSearch struct { |
| | | WorkerPosition |
| | | Order string |
| | | PageNum int |
| | | PageSize int |
| | | Orm *gorm.DB |
| | | Preload bool |
| | | Keyword string |
| | | Order string |
| | | PageNum int |
| | | PageSize int |
| | | Orm *gorm.DB |
| | | Preload bool |
| | | Keyword string |
| | | OverlappingDateStart string |
| | | OverlappingDateEnd string |
| | | } |
| | | ) |
| | | |
| | |
| | | return slf |
| | | } |
| | | |
| | | func (slf *WorkerPositionSearch) SetOverlappingDate(startDate string, endDate string) *WorkerPositionSearch { |
| | | slf.OverlappingDateStart = startDate |
| | | slf.OverlappingDateEnd = endDate |
| | | return slf |
| | | } |
| | | |
| | | func (slf *WorkerPositionSearch) build() *gorm.DB { |
| | | var db = slf.Orm.Table(slf.TableName()) |
| | | |
| | |
| | | db = db.Model(&WorkerPosition{}).Preload("Worker") |
| | | } |
| | | |
| | | if slf.OverlappingDateStart != "" && slf.OverlappingDateEnd != "" { |
| | | db = db.Where("start_date <= ? and end_date >= ?", slf.OverlappingDateEnd, slf.OverlappingDateStart) |
| | | } |
| | | |
| | | return db |
| | | } |
| | | |