作者 tangxvhui

调整 任务列表排序

... ... @@ -659,7 +659,7 @@ and task.anomaly>0 `
type ListTask struct {
SortBy1 int `pg:"sort_by_1"`
CPlanCompletedAt int `pg:"c_plan_completed_at"`
LastStageDiff int `pg:"last_stage_diff"`
SortBy2 int `pg:"sort_by_2"`
TaskId int `pg:"task_id"`
Alias string `pg:"alias"`
LeaderName string `pg:"leader_name"`
... ... @@ -713,8 +713,12 @@ func (d *TaskDao) ListTaskByHrbpV2(param ListTaskCondition) ([]ListTask, error)
when t_task.c_plan_completed_at-now_time>0 then 0
else t_task.c_plan_completed_at-now_time
end) as sort_by_1,
(case
when t_task.l_plan_completed_at=0 then 1
when t_task.l_plan_completed_at-t_task.l_real_completed_at>0 then 0
else t_task.l_plan_completed_at-t_task.l_real_completed_at
end) as sort_by_2,
t_task.c_plan_completed_at ,
t_task.l_plan_completed_at-t_task.l_real_completed_at as last_stage_diff,
t_task.id as task_id,
t_task.alias ,
t_task.leader_name,
... ... @@ -730,7 +734,8 @@ func (d *TaskDao) ListTaskByHrbpV2(param ListTaskCondition) ([]ListTask, error)
where 1=1
)select *
from t_task_1
order by t_task_1.sort_by_1,t_task_1.last_stage_diff,
order by t_task_1.sort_by_1,
t_task_1.sort_by_2,t_task_1.anomaly desc,
t_task_1."level",t_task_1."created_at"
limit ? offset ?
`
... ... @@ -784,8 +789,12 @@ func (d *TaskDao) ListTaskNotHrbpV2(param ListTaskCondition) ([]ListTask, error)
when t_task.c_plan_completed_at-now_time>0 then 0
else t_task.c_plan_completed_at-now_time
end) as sort_by_1,
(case
when t_task.l_plan_completed_at=0 then 1
when t_task.l_plan_completed_at-t_task.l_real_completed_at>0 then 0
else t_task.l_plan_completed_at-t_task.l_real_completed_at
end) as sort_by_2,
t_task.c_plan_completed_at ,
t_task.l_plan_completed_at-t_task.l_real_completed_at as last_stage_diff,
t_task.id as task_id,
t_task.alias ,
t_task.leader_name,
... ... @@ -801,7 +810,8 @@ func (d *TaskDao) ListTaskNotHrbpV2(param ListTaskCondition) ([]ListTask, error)
where 1=1
)select *
from tt_task_1
order by tt_task_1.sort_by_1,tt_task_1.last_stage_diff,
order by tt_task_1.sort_by_1,
tt_task_1.sort_by_2,tt_task_1.anomaly desc,
tt_task_1."level",tt_task_1."created_at"
limit ? offset ?
`
... ...