...
|
...
|
@@ -276,7 +276,7 @@ func (d *TaskDao) ListTaskStageByHrbp(param ListTaskCondition) ([]ListTaskStage, |
|
|
where t_task_tage_1.task_id in(
|
|
|
select t_task_page.task_id from t_task_page
|
|
|
)`
|
|
|
condition := []interface{}{}
|
|
|
condition := []interface{}{param.UserId}
|
|
|
whereSql := ``
|
|
|
if param.OnlyMy {
|
|
|
condition = append(condition, param.UserId)
|
...
|
...
|
@@ -310,7 +310,7 @@ func (d *TaskDao) CountTaskStageByHrbp(param ListTaskCondition) (int, error) { |
|
|
)select count(*) from task
|
|
|
left join t_task_ignore on t_task_ignore.task_id=task.id
|
|
|
where 1=1 `
|
|
|
condition := []interface{}{}
|
|
|
condition := []interface{}{param.UserId}
|
|
|
whereSql := ``
|
|
|
if param.OnlyMy {
|
|
|
condition = append(condition, param.UserId)
|
...
|
...
|
@@ -386,7 +386,7 @@ func (d *TaskDao) CountTaskStageAnomalyByHrbp(param ListTaskCondition) (int, err |
|
|
or
|
|
|
(task_stage.real_completed_at=0 and task_stage.plan_completed_at<extract(epoch from now()))
|
|
|
) `
|
|
|
condition := []interface{}{}
|
|
|
condition := []interface{}{param.UserId}
|
|
|
whereSql := ``
|
|
|
if param.OnlyMy {
|
|
|
condition = append(condition, param.UserId)
|
...
|
...
|
@@ -456,3 +456,68 @@ func (d *TaskDao) TaskAnomaly(leaderId []string, anomaly int) ([]TaskStageData, |
|
|
_, err := tx.Query(&result, sqlStr, anomaly, pg.In(leaderId))
|
|
|
return result, err
|
|
|
}
|
|
|
|
|
|
// 统计任务异常的数量,以非hrbp角色统计
|
|
|
func (d *TaskDao) CountTaskAnomalyNotHrbp(param ListTaskCondition) (int, error) {
|
|
|
task1 := d.catchTaskIdByPermission(param.UserId)
|
|
|
withSql := task1 + ` select count(*)
|
|
|
from task
|
|
|
join t_task_1 on task.id =t_task_1.id
|
|
|
where 1=1
|
|
|
and task.anomaly>1 `
|
|
|
condition := []interface{}{}
|
|
|
whereSql := ``
|
|
|
if param.OnlyMy {
|
|
|
condition = append(condition, param.UserId)
|
|
|
whereSql += ` and task.leader ->>'id' = '?' `
|
|
|
} else if param.LeaderId != "" {
|
|
|
condition = append(condition, param.LeaderId)
|
|
|
whereSql += ` and task.leader ->>'id' = ? `
|
|
|
}
|
|
|
if len(param.TaskName) > 0 {
|
|
|
condition = append(condition, param.TaskName)
|
|
|
whereSql += ` and task.name like ? `
|
|
|
}
|
|
|
if len(param.LevelName) > 0 {
|
|
|
condition = append(condition, param.LevelName)
|
|
|
whereSql += ` and task.level_name like ? `
|
|
|
}
|
|
|
sqlStr := withSql + whereSql
|
|
|
tx := d.transactionContext.PgTx
|
|
|
var cnt int
|
|
|
_, err := tx.QueryOne(pg.Scan(&cnt), sqlStr, condition...)
|
|
|
return cnt, err
|
|
|
}
|
|
|
|
|
|
// 统计任务异常的数量,以hrbp角色统计
|
|
|
func (d *TaskDao) CountTaskAnomalyByHrbp(param ListTaskCondition) (int, error) {
|
|
|
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
|
|
|
left join t_task_ignore on t_task_ignore.task_id=task.id
|
|
|
where 1=1 and task.anomaly>1 `
|
|
|
condition := []interface{}{param.UserId}
|
|
|
whereSql := ``
|
|
|
if param.OnlyMy {
|
|
|
condition = append(condition, param.UserId)
|
|
|
whereSql += ` and task.leader ->>'id' = '?' `
|
|
|
} else if param.LeaderId != "" {
|
|
|
condition = append(condition, param.LeaderId)
|
|
|
whereSql += ` and task.leader ->>'id' = ? `
|
|
|
}
|
|
|
if len(param.TaskName) > 0 {
|
|
|
condition = append(condition, param.TaskName)
|
|
|
whereSql += ` and task.name like ? `
|
|
|
}
|
|
|
if len(param.LevelName) > 0 {
|
|
|
condition = append(condition, param.LevelName)
|
|
|
whereSql += ` and task.level_name like ? `
|
|
|
}
|
|
|
sqlStr := withSql + whereSql
|
|
|
tx := d.transactionContext.PgTx
|
|
|
var cnt int
|
|
|
_, err := tx.QueryOne(pg.Scan(&cnt), sqlStr, condition...)
|
|
|
return cnt, err
|
|
|
} |
...
|
...
|
|