feat: 统一 Admin 主列表分页 (#64)
This commit is contained in:
@@ -329,7 +329,7 @@ func taskFilterClause(filter TaskFilter) (string, []any) {
|
||||
// 「目标」列更好读;join 条件里的 `deleted_at IS NULL` 让"join 不到"和
|
||||
// "商品已软删除"这两种情况都自然落到 PddTitle 为空,service 层退回显示
|
||||
// PddGoodsID 即可,不用在 service 里再判断一次已删除。
|
||||
func ListTasks(q Execer, filter TaskFilter) ([]TaskListRow, error) {
|
||||
func ListTasks(q Execer, filter TaskFilter, limit, offset int) ([]TaskListRow, error) {
|
||||
where, args := taskFilterClause(filter)
|
||||
sqlText := `
|
||||
SELECT t.task_id, t.task_type, t.status, t.assigned_client,
|
||||
@@ -338,7 +338,8 @@ func ListTasks(q Execer, filter TaskFilter) ([]TaskListRow, error) {
|
||||
FROM tasks t
|
||||
LEFT JOIN pdd_products p
|
||||
ON p.goods_id = t.pdd_goods_id AND p.deleted_at IS NULL` +
|
||||
where + ` ORDER BY t.updated_at DESC, t.task_id DESC`
|
||||
where + ` ORDER BY t.updated_at DESC, t.task_id DESC LIMIT ? OFFSET ?`
|
||||
args = append(args, limit, offset)
|
||||
|
||||
rows, err := q.Query(sqlText, args...)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user