|
@@ -600,14 +600,33 @@ class TaskScheduler {
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- async listUserTasks(uuid) {
|
|
|
|
|
|
|
+ async listUserTasks(uuid, filters = {}) {
|
|
|
|
|
+ const where = ['t.create_user = ?']
|
|
|
|
|
+ const params = [uuid]
|
|
|
|
|
+ if (filters.status) {
|
|
|
|
|
+ where.push('t.status = ?')
|
|
|
|
|
+ params.push(filters.status)
|
|
|
|
|
+ }
|
|
|
|
|
+ if (filters.student_num) {
|
|
|
|
|
+ where.push('t.student_num LIKE ?')
|
|
|
|
|
+ params.push(`%${filters.student_num}%`)
|
|
|
|
|
+ }
|
|
|
|
|
+ if (filters.name) {
|
|
|
|
|
+ where.push('t.name LIKE ?')
|
|
|
|
|
+ params.push(`%${filters.name}%`)
|
|
|
|
|
+ }
|
|
|
|
|
+ if (filters.batch_id) {
|
|
|
|
|
+ where.push('t.batch_id = ?')
|
|
|
|
|
+ params.push(Number(filters.batch_id))
|
|
|
|
|
+ }
|
|
|
|
|
+ const whereSql = where.join(' AND ')
|
|
|
const rows = await db.query(
|
|
const rows = await db.query(
|
|
|
`SELECT t.*${this.taskBatchSelectSql('t')}
|
|
`SELECT t.*${this.taskBatchSelectSql('t')}
|
|
|
FROM qk_task t
|
|
FROM qk_task t
|
|
|
${this.taskBatchJoinSql('t')}
|
|
${this.taskBatchJoinSql('t')}
|
|
|
- WHERE t.create_user = ?
|
|
|
|
|
|
|
+ WHERE ${whereSql}
|
|
|
ORDER BY t.create_time DESC`,
|
|
ORDER BY t.create_time DESC`,
|
|
|
- [uuid]
|
|
|
|
|
|
|
+ params
|
|
|
)
|
|
)
|
|
|
return (rows || []).map(row => this.serializeTask(row))
|
|
return (rows || []).map(row => this.serializeTask(row))
|
|
|
}
|
|
}
|