...
|
...
|
@@ -748,3 +748,56 @@ func (d *TaskDao) CountTaskIgnore(param ListTaskCondition) (int, error) { |
|
|
_, err := tx.Query(pg.Scan(&result), sqlStr, condition...)
|
|
|
return result, err
|
|
|
}
|
|
|
|
|
|
type TaskData6 struct {
|
|
|
TaskId int `pg:"task_id"`
|
|
|
TaskName string `pg:"task_name"`
|
|
|
TaskAlias string `pg:"task_alias"`
|
|
|
LeaderName string `pg:"leader_name"`
|
|
|
LeaderId string `pg:"leader_id"`
|
|
|
WarnFlag int `pg:"warn_flag"`
|
|
|
AssistFlag int `pg:"assist_flag"`
|
|
|
Anomaly int `pg:"anomaly"`
|
|
|
}
|
|
|
|
|
|
func (d *TaskDao) TaskIsAnomalyByLeader(leaderId []string) ([]TaskData6, error) {
|
|
|
sqlStr := `select
|
|
|
task.id as task_id,
|
|
|
task."name" as task_name ,
|
|
|
task.alias as task_alias,
|
|
|
task.leader ->>'id' as leader_id,
|
|
|
task.leader ->>'name' as leader_name,
|
|
|
task.assist_flag ,
|
|
|
task.warn_flag ,
|
|
|
task.anomaly
|
|
|
from task where 1=1
|
|
|
and task.deleted_at isnull
|
|
|
and (task.assist_flag+task.warn_flag +task.anomaly)>0
|
|
|
and task.leader ->>'id' in(?) `
|
|
|
result := []TaskData6{}
|
|
|
tx := d.transactionContext.PgTx
|
|
|
_, err := tx.Query(&result, sqlStr, pg.In(leaderId))
|
|
|
return result, err
|
|
|
}
|
|
|
|
|
|
func (d *TaskDao) TaskIsAnomalyByRelatedUser(relatedUserId int) ([]TaskData6, error) {
|
|
|
sqlStr := `select
|
|
|
task.id as task_id,
|
|
|
task."name" as task_name ,
|
|
|
task.alias as task_alias,
|
|
|
task.leader ->>'id' as leader_id,
|
|
|
task.leader ->>'name' as leader_name,
|
|
|
task.assist_flag ,
|
|
|
task.warn_flag ,
|
|
|
task.anomaly
|
|
|
from task where 1=1
|
|
|
and task.deleted_at isnull
|
|
|
and (task.assist_flag+task.warn_flag +task.anomaly)>0
|
|
|
and task.related_user @>? `
|
|
|
|
|
|
relatedUser := fmt.Sprintf("[%d]", relatedUserId)
|
|
|
result := []TaskData6{}
|
|
|
tx := d.transactionContext.PgTx
|
|
|
_, err := tx.Query(&result, sqlStr, relatedUser)
|
|
|
return result, err
|
|
|
} |
...
|
...
|
|