This commit is contained in:
suyl
2021-08-10 14:57:10 +08:00
parent 60ae59f801
commit 05936783de
3 changed files with 89 additions and 4 deletions

View File

@@ -161,7 +161,7 @@ func GetJobs(db *DaoDB, userIDs []string, categoryIDs, statuss, vendorIDs, types
}
func GetJob(db *DaoDB, userIDs []string, categoryIDs, statuss, types []int, fromTime, toTime time.Time, includeStep bool) (job *model.Job, err error) {
jobs, err := GetJobsNoPage(db, userIDs, categoryIDs, statuss, types, fromTime, toTime, 0, includeStep)
jobs, err := GetJobsNoPage(db, userIDs, nil, categoryIDs, statuss, types, fromTime, toTime, 0, includeStep)
if err != nil {
return job, err
}
@@ -183,7 +183,7 @@ func GetJobWithTitle(db *DaoDB, title string) (job *model.Job, err error) {
return job, err
}
func GetJobsNoPage(db *DaoDB, userIDs []string, categoryIDs, statuss, types []int, fromTime, toTime time.Time, span int, includeStep bool) (jobs []*GetJobsResult, err error) {
func GetJobsNoPage(db *DaoDB, userIDs []string, vendorIDs, categoryIDs, statuss, types []int, fromTime, toTime time.Time, span int, includeStep bool) (jobs []*GetJobsResult, err error) {
sql := `
SELECT a.*, b.name
FROM job a
@@ -195,6 +195,10 @@ func GetJobsNoPage(db *DaoDB, userIDs []string, categoryIDs, statuss, types []in
sql += ` AND a.user_id IN (` + GenQuestionMarks(len(userIDs)) + `)`
sqlParams = append(sqlParams, userIDs)
}
if len(vendorIDs) > 0 {
sql += ` AND a.vendor_id IN (` + GenQuestionMarks(len(vendorIDs)) + `)`
sqlParams = append(sqlParams, vendorIDs)
}
if len(categoryIDs) > 0 {
sql += ` AND a.job_category_id IN (` + GenQuestionMarks(len(categoryIDs)) + `)`
sqlParams = append(sqlParams, categoryIDs)