作者 tangxvhui

更新

... ... @@ -314,16 +314,18 @@ func (d *TaskDao) CountTaskStageByHrbp(param ListTaskCondition) (int, error) {
// 统计里程碑异常的数量,以非hrbp角色统计
func (d *TaskDao) CountTaskStageAnomalyNotHrbp(param ListTaskCondition) (int, error) {
task1 := d.catchTaskIdByPermission(param.UserId)
withSql := task1 + ` select count(*)
from task_stage
join task on task_stage.task_id =task.id
withSql := task1 + ` select count(*)
from task
join t_task_1 on task.id =t_task_1.id
where 1=1 and task.company_id=?
and(
(task_stage.plan_completed_at <task_stage.real_completed_at)
or
(task_stage.real_completed_at=0 and task_stage.plan_completed_at<extract(epoch from now()))
) `
where 1=1
and task.company_id =?
and t_task_ignore.id isnull
and (
cast(COALESCE(task.current_stage ->>'plan_completed_at','0') as int)<floor(extract(epoch from now()))
or
task.warn_flag = 1
)
`
condition := []interface{}{param.CompanyId}
whereSql := ``
if param.OnlyMy {
... ... @@ -346,16 +348,17 @@ func (d *TaskDao) CountTaskStageAnomalyByHrbp(param ListTaskCondition) (int, err
withSql := `with
t_task_ignore as (
select task_ignore.task_id,task_ignore.id from task_ignore where task_ignore.user_id =?
)select count(*)
from task_stage
join task on task_stage.task_id =task.id
)select count(*)
from task
left join t_task_ignore on t_task_ignore.task_id=task.id
where 1=1 and task.company_id=?
and(
(task_stage.plan_completed_at <task_stage.real_completed_at)
or
(task_stage.real_completed_at=0 and task_stage.plan_completed_at<extract(epoch from now()))
) `
where 1=1
and task.company_id =?
and t_task_ignore.id isnull
and (
cast(COALESCE(task.current_stage ->>'plan_completed_at','0') as int)<floor(extract(epoch from now()))
or
task.warn_flag = 1
)`
condition := []interface{}{param.UserId, param.CompanyId}
whereSql := ``
if param.OnlyMy {
... ...