...
|
...
|
@@ -60,14 +60,12 @@ func (d *TaskDao) catchTaskIdByPermission(userId int) string { |
|
|
}
|
|
|
|
|
|
type ListTaskCondition struct {
|
|
|
Limit int //分页
|
|
|
Offset int //分页
|
|
|
CompanyId int //公司id
|
|
|
UserId int //谁要查看任务数据
|
|
|
TaskName string //任务名称
|
|
|
LevelName string //优先级
|
|
|
OnlyMy bool //只查看我负责的任务
|
|
|
LeaderName string //任务负责人名称
|
|
|
Limit int //分页
|
|
|
Offset int //分页
|
|
|
CompanyId int //公司id
|
|
|
UserId int //谁要查看任务数据
|
|
|
OnlyMy bool //只查看我负责的任务
|
|
|
SearchWord string
|
|
|
}
|
|
|
|
|
|
// 任务和里程碑列表
|
...
|
...
|
@@ -162,17 +160,10 @@ 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.LeaderName != "" {
|
|
|
condition = append(condition, param.LeaderName)
|
|
|
whereSql += ` and t_task_tage_1.leader_name = ? `
|
|
|
}
|
|
|
if len(param.TaskName) > 0 {
|
|
|
condition = append(condition, param.TaskName)
|
|
|
whereSql += ` and t_task_tage_1.task_name like ? `
|
|
|
}
|
|
|
if len(param.LevelName) > 0 {
|
|
|
condition = append(condition, param.LevelName)
|
|
|
whereSql += ` and t_task_tage_1.level_name like ? `
|
|
|
if param.SearchWord != "" {
|
|
|
condition = append(condition, param.SearchWord, param.SearchWord)
|
|
|
whereSql += ` and (t_task_tage_1.leader_name like ? or t_task_tage_1.task_alias_name like ?)`
|
|
|
}
|
|
|
condition = append(condition, param.Limit, param.Offset)
|
|
|
sqlStr := fmt.Sprintf(withSql, whereSql)
|
...
|
...
|
@@ -193,18 +184,12 @@ func (d *TaskDao) CountTaskStageNotHrbp(param ListTaskCondition) (int, error) { |
|
|
if param.OnlyMy {
|
|
|
condition = append(condition, param.UserId)
|
|
|
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)
|
|
|
whereSql += ` and task.name like ? `
|
|
|
}
|
|
|
if len(param.LevelName) > 0 {
|
|
|
condition = append(condition, param.LevelName)
|
|
|
whereSql += ` and task.level_name like ? `
|
|
|
if param.SearchWord != "" {
|
|
|
condition = append(condition, param.SearchWord, param.SearchWord)
|
|
|
whereSql += ` and (t_task_tage_1.leader_name like ? or t_task_tage_1.task_alias_name like ?)`
|
|
|
}
|
|
|
|
|
|
sqlStr := withSql + whereSql
|
|
|
tx := d.transactionContext.PgTx
|
|
|
var cnt int
|
...
|
...
|
@@ -286,17 +271,10 @@ 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.LeaderName != "" {
|
|
|
condition = append(condition, param.LeaderName)
|
|
|
whereSql += ` and t_task_tage_1.leader_name = ? `
|
|
|
}
|
|
|
if len(param.TaskName) > 0 {
|
|
|
condition = append(condition, param.TaskName)
|
|
|
whereSql += ` and t_task_tage_1.task_name like ? `
|
|
|
}
|
|
|
if len(param.LevelName) > 0 {
|
|
|
condition = append(condition, param.LevelName)
|
|
|
whereSql += ` and t_task_tage_1.level_name like ? `
|
|
|
if param.SearchWord != "" {
|
|
|
condition = append(condition, param.SearchWord, param.SearchWord)
|
|
|
whereSql += ` and (t_task_tage_1.leader_name like ? or t_task_tage_1.task_alias_name like ?)`
|
|
|
}
|
|
|
condition = append(condition, param.Limit, param.Offset)
|
|
|
sqlStr := fmt.Sprintf(withSql, whereSql)
|
...
|
...
|
@@ -320,17 +298,10 @@ func (d *TaskDao) CountTaskStageByHrbp(param ListTaskCondition) (int, error) { |
|
|
if param.OnlyMy {
|
|
|
condition = append(condition, param.UserId)
|
|
|
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)
|
|
|
whereSql += ` and task.name like ? `
|
|
|
}
|
|
|
if len(param.LevelName) > 0 {
|
|
|
condition = append(condition, param.LevelName)
|
|
|
whereSql += ` and task.level_name like ? `
|
|
|
if param.SearchWord != "" {
|
|
|
condition = append(condition, param.SearchWord, param.SearchWord)
|
|
|
whereSql += ` and (t_task_tage_1.leader_name like ? or t_task_tage_1.task_alias_name like ?)`
|
|
|
}
|
|
|
sqlStr := withSql + whereSql
|
|
|
tx := d.transactionContext.PgTx
|
...
|
...
|
@@ -357,17 +328,10 @@ func (d *TaskDao) CountTaskStageAnomalyNotHrbp(param ListTaskCondition) (int, er |
|
|
if param.OnlyMy {
|
|
|
condition = append(condition, param.UserId)
|
|
|
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)
|
|
|
whereSql += ` and task.name like ? `
|
|
|
}
|
|
|
if len(param.LevelName) > 0 {
|
|
|
condition = append(condition, param.LevelName)
|
|
|
whereSql += ` and task.level_name like ? `
|
|
|
if param.SearchWord != "" {
|
|
|
condition = append(condition, param.SearchWord, param.SearchWord)
|
|
|
whereSql += ` and (t_task_tage_1.leader_name like ? or t_task_tage_1.task_alias_name like ?)`
|
|
|
}
|
|
|
sqlStr := withSql + whereSql
|
|
|
tx := d.transactionContext.PgTx
|
...
|
...
|
@@ -396,18 +360,12 @@ func (d *TaskDao) CountTaskStageAnomalyByHrbp(param ListTaskCondition) (int, err |
|
|
if param.OnlyMy {
|
|
|
condition = append(condition, param.UserId)
|
|
|
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)
|
|
|
whereSql += ` and task.name like ? `
|
|
|
}
|
|
|
if len(param.LevelName) > 0 {
|
|
|
condition = append(condition, param.LevelName)
|
|
|
whereSql += ` and task.level_name like ? `
|
|
|
if param.SearchWord != "" {
|
|
|
condition = append(condition, param.SearchWord, param.SearchWord)
|
|
|
whereSql += ` and (t_task_tage_1.leader_name like ? or t_task_tage_1.task_alias_name like ?)`
|
|
|
}
|
|
|
|
|
|
sqlStr := withSql + whereSql
|
|
|
tx := d.transactionContext.PgTx
|
|
|
var cnt int
|
...
|
...
|
@@ -475,17 +433,10 @@ func (d *TaskDao) CountTaskAnomalyNotHrbp(param ListTaskCondition) (int, error) |
|
|
if param.OnlyMy {
|
|
|
condition = append(condition, param.UserId)
|
|
|
whereSql += ` and task.leader ->>'id' = '?' `
|
|
|
} else if param.LeaderName != "" {
|
|
|
condition = append(condition, param.LeaderName)
|
|
|
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 ? `
|
|
|
if param.SearchWord != "" {
|
|
|
condition = append(condition, param.SearchWord, param.SearchWord)
|
|
|
whereSql += ` and (t_task_tage_1.leader_name like ? or t_task_tage_1.task_alias_name like ?)`
|
|
|
}
|
|
|
sqlStr := withSql + whereSql
|
|
|
tx := d.transactionContext.PgTx
|
...
|
...
|
@@ -502,23 +453,16 @@ func (d *TaskDao) CountTaskAnomalyByHrbp(param ListTaskCondition) (int, error) { |
|
|
)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}
|
|
|
where 1=1 and task.anomaly>1 and task.company_id=?`
|
|
|
condition := []interface{}{param.UserId, param.CompanyId}
|
|
|
whereSql := ``
|
|
|
if param.OnlyMy {
|
|
|
condition = append(condition, param.UserId)
|
|
|
whereSql += ` and task.leader ->>'id' = '?' `
|
|
|
} else if param.LeaderName != "" {
|
|
|
condition = append(condition, param.LeaderName)
|
|
|
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 ? `
|
|
|
if param.SearchWord != "" {
|
|
|
condition = append(condition, param.SearchWord, param.SearchWord)
|
|
|
whereSql += ` and (t_task_tage_1.leader_name like ? or t_task_tage_1.task_alias_name like ?)`
|
|
|
}
|
|
|
sqlStr := withSql + whereSql
|
|
|
tx := d.transactionContext.PgTx
|
...
|
...
|
@@ -543,7 +487,9 @@ func (d *TaskDao) ListTask2(userId int) ([]TaskData1, error) { |
|
|
task.leader ->>'id' as leader_id,
|
|
|
task.leader ->>'name' as leader_name,
|
|
|
task.level_name
|
|
|
from task `
|
|
|
from task
|
|
|
join t_task_1 on task.id =t_task_1.id
|
|
|
`
|
|
|
result := []TaskData1{}
|
|
|
tx := d.transactionContext.PgTx
|
|
|
_, err := tx.Query(&result, sqlStr)
|
...
|
...
|
@@ -551,7 +497,7 @@ func (d *TaskDao) ListTask2(userId int) ([]TaskData1, error) { |
|
|
}
|
|
|
|
|
|
// 获取任务列表
|
|
|
func (d *TaskDao) ListTask2ForHrbp(userId int) ([]TaskData1, error) {
|
|
|
func (d *TaskDao) ListTask2ForHrbp(userId int, companyId 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 =?
|
...
|
...
|
@@ -561,10 +507,10 @@ func (d *TaskDao) ListTask2ForHrbp(userId int) ([]TaskData1, error) { |
|
|
task.level_name
|
|
|
from task
|
|
|
left join t_task_ignore on t_task_ignore.task_id=task.id
|
|
|
where 1=1 `
|
|
|
where 1=1 and task.company_id=? `
|
|
|
result := []TaskData1{}
|
|
|
tx := d.transactionContext.PgTx
|
|
|
_, err := tx.Query(&result, sqlStr, userId)
|
|
|
_, err := tx.Query(&result, sqlStr, userId, companyId)
|
|
|
return result, err
|
|
|
|
|
|
} |
...
|
...
|
|