...
|
...
|
@@ -60,13 +60,13 @@ func (d *TaskDao) catchTaskIdByPermission(userId int) string { |
|
|
}
|
|
|
|
|
|
type ListTaskCondition struct {
|
|
|
Limit int //分页
|
|
|
Offset int //分页
|
|
|
UserId int //谁要查看任务数据
|
|
|
TaskName string //任务名称
|
|
|
LevelName string //优先级
|
|
|
OnlyMy bool //只查看我负责的任务
|
|
|
LeaderId string //任务负责人id
|
|
|
Limit int //分页
|
|
|
Offset int //分页
|
|
|
UserId int //谁要查看任务数据
|
|
|
TaskName string //任务名称
|
|
|
LevelName string //优先级
|
|
|
OnlyMy bool //只查看我负责的任务
|
|
|
LeaderName string //任务负责人名称
|
|
|
}
|
|
|
|
|
|
// 任务和里程碑列表
|
...
|
...
|
@@ -161,9 +161,9 @@ func (d *TaskDao) ListTaskStageNotHrbp(param ListTaskCondition) ([]ListTaskStage |
|
|
if param.OnlyMy {
|
|
|
condition = append(condition, param.UserId)
|
|
|
whereSql += ` and t_task_tage_1.leader_id = '?' `
|
|
|
} else if param.LeaderId != "" && param.LeaderId != "0" {
|
|
|
condition = append(condition, param.LeaderId)
|
|
|
whereSql += ` and t_task_tage_1.leader_id = ? `
|
|
|
} else if param.LeaderName != "" {
|
|
|
condition = append(condition, param.LeaderName)
|
|
|
whereSql += ` and t_task_tage_1.leader_name = ? `
|
|
|
}
|
|
|
if len(param.TaskName) > 0 {
|
|
|
condition = append(condition, param.TaskName)
|
...
|
...
|
@@ -192,9 +192,9 @@ func (d *TaskDao) CountTaskStageNotHrbp(param ListTaskCondition) (int, error) { |
|
|
if param.OnlyMy {
|
|
|
condition = append(condition, param.UserId)
|
|
|
whereSql += ` and task.leader ->>'id' = '?' `
|
|
|
} else if param.LeaderId != "" && param.LeaderId != "0" {
|
|
|
condition = append(condition, param.LeaderId)
|
|
|
whereSql += ` and task.leader ->>'id' = ? `
|
|
|
} else if param.LeaderName != "" {
|
|
|
condition = append(condition, param.LeaderName)
|
|
|
whereSql += ` and task.leader ->>'name' = ? `
|
|
|
}
|
|
|
if len(param.TaskName) > 0 {
|
|
|
condition = append(condition, param.TaskName)
|
...
|
...
|
@@ -285,9 +285,9 @@ func (d *TaskDao) ListTaskStageByHrbp(param ListTaskCondition) ([]ListTaskStage, |
|
|
if param.OnlyMy {
|
|
|
condition = append(condition, param.UserId)
|
|
|
whereSql += ` and t_task_tage_1.leader_id = '?' `
|
|
|
} else if param.LeaderId != "" && param.LeaderId != "0" {
|
|
|
condition = append(condition, param.LeaderId)
|
|
|
whereSql += ` and t_task_tage_1.leader_id = ? `
|
|
|
} else if param.LeaderName != "" {
|
|
|
condition = append(condition, param.LeaderName)
|
|
|
whereSql += ` and t_task_tage_1.leader_name = ? `
|
|
|
}
|
|
|
if len(param.TaskName) > 0 {
|
|
|
condition = append(condition, param.TaskName)
|
...
|
...
|
@@ -319,9 +319,9 @@ func (d *TaskDao) CountTaskStageByHrbp(param ListTaskCondition) (int, error) { |
|
|
if param.OnlyMy {
|
|
|
condition = append(condition, param.UserId)
|
|
|
whereSql += ` and task.leader ->>'id' = '?' `
|
|
|
} else if param.LeaderId != "" && param.LeaderId != "0" {
|
|
|
condition = append(condition, param.LeaderId)
|
|
|
whereSql += ` and task.leader ->>'id' = ? `
|
|
|
} else if param.LeaderName != "" {
|
|
|
condition = append(condition, param.LeaderName)
|
|
|
whereSql += ` and task.leader ->>'name' = ? `
|
|
|
}
|
|
|
if len(param.TaskName) > 0 {
|
|
|
condition = append(condition, param.TaskName)
|
...
|
...
|
@@ -356,9 +356,9 @@ func (d *TaskDao) CountTaskStageAnomalyNotHrbp(param ListTaskCondition) (int, er |
|
|
if param.OnlyMy {
|
|
|
condition = append(condition, param.UserId)
|
|
|
whereSql += ` and task.leader ->>'id' = '?' `
|
|
|
} else if param.LeaderId != "" && param.LeaderId != "0" {
|
|
|
condition = append(condition, param.LeaderId)
|
|
|
whereSql += ` and task.leader ->>'id' = ? `
|
|
|
} else if param.LeaderName != "" {
|
|
|
condition = append(condition, param.LeaderName)
|
|
|
whereSql += ` and task.leader ->>'name' = ? `
|
|
|
}
|
|
|
if len(param.TaskName) > 0 {
|
|
|
condition = append(condition, param.TaskName)
|
...
|
...
|
@@ -395,9 +395,9 @@ func (d *TaskDao) CountTaskStageAnomalyByHrbp(param ListTaskCondition) (int, err |
|
|
if param.OnlyMy {
|
|
|
condition = append(condition, param.UserId)
|
|
|
whereSql += ` and task.leader ->>'id' = '?' `
|
|
|
} else if param.LeaderId != "" && param.LeaderId != "0" {
|
|
|
condition = append(condition, param.LeaderId)
|
|
|
whereSql += ` and task.leader ->>'id' = ? `
|
|
|
} else if param.LeaderName != "" {
|
|
|
condition = append(condition, param.LeaderName)
|
|
|
whereSql += ` and task.leader ->>'name' = ? `
|
|
|
}
|
|
|
if len(param.TaskName) > 0 {
|
|
|
condition = append(condition, param.TaskName)
|
...
|
...
|
@@ -474,8 +474,8 @@ func (d *TaskDao) CountTaskAnomalyNotHrbp(param ListTaskCondition) (int, error) |
|
|
if param.OnlyMy {
|
|
|
condition = append(condition, param.UserId)
|
|
|
whereSql += ` and task.leader ->>'id' = '?' `
|
|
|
} else if param.LeaderId != "" {
|
|
|
condition = append(condition, param.LeaderId)
|
|
|
} else if param.LeaderName != "" {
|
|
|
condition = append(condition, param.LeaderName)
|
|
|
whereSql += ` and task.leader ->>'id' = ? `
|
|
|
}
|
|
|
if len(param.TaskName) > 0 {
|
...
|
...
|
@@ -507,8 +507,8 @@ func (d *TaskDao) CountTaskAnomalyByHrbp(param ListTaskCondition) (int, error) { |
|
|
if param.OnlyMy {
|
|
|
condition = append(condition, param.UserId)
|
|
|
whereSql += ` and task.leader ->>'id' = '?' `
|
|
|
} else if param.LeaderId != "" {
|
|
|
condition = append(condition, param.LeaderId)
|
|
|
} else if param.LeaderName != "" {
|
|
|
condition = append(condition, param.LeaderName)
|
|
|
whereSql += ` and task.leader ->>'id' = ? `
|
|
|
}
|
|
|
if len(param.TaskName) > 0 {
|
...
|
...
|
@@ -525,3 +525,45 @@ func (d *TaskDao) CountTaskAnomalyByHrbp(param ListTaskCondition) (int, error) { |
|
|
_, err := tx.QueryOne(pg.Scan(&cnt), sqlStr, condition...)
|
|
|
return cnt, err
|
|
|
}
|
|
|
|
|
|
// 任务数据
|
|
|
type TaskData1 struct {
|
|
|
Name string `pg:"name"`
|
|
|
Alias string `pg:"alias"`
|
|
|
LeaderId string `pg:"leader_id"`
|
|
|
LeaderName string `pg:"leader_name"`
|
|
|
LevelName string `pg:"level_name"`
|
|
|
}
|
|
|
|
|
|
// 获取任务列表
|
|
|
func (d *TaskDao) ListTask2(userId int) ([]TaskData1, error) {
|
|
|
task1 := d.catchTaskIdByPermission(userId)
|
|
|
sqlStr := task1 + ` select task."name" ,task.alias ,
|
|
|
task.leader ->>'id' as leader_id,
|
|
|
task.leader ->>'name' as leaer_name,
|
|
|
task.level_name
|
|
|
from task `
|
|
|
result := []TaskData1{}
|
|
|
tx := d.transactionContext.PgTx
|
|
|
_, err := tx.Query(&result, sqlStr)
|
|
|
return result, err
|
|
|
}
|
|
|
|
|
|
// 获取任务列表
|
|
|
func (d *TaskDao) ListTask2ForHrbp(userId int) ([]TaskData1, error) {
|
|
|
sqlStr := `with
|
|
|
t_task_ignore as (
|
|
|
select task_ignore.task_id,task_ignore.id from task_ignore where task_ignore.user_id =?
|
|
|
)select task."name" ,task.alias ,
|
|
|
task.leader ->>'id' as leader_id,
|
|
|
task.leader ->>'name' as leaer_name,
|
|
|
task.level_name
|
|
|
from task
|
|
|
left join t_task_ignore on t_task_ignore.task_id=task.id
|
|
|
where 1=1 `
|
|
|
result := []TaskData1{}
|
|
|
tx := d.transactionContext.PgTx
|
|
|
_, err := tx.Query(&result, sqlStr, userId)
|
|
|
return result, err
|
|
|
|
|
|
} |
...
|
...
|
|