|
@@ -139,7 +139,7 @@ func (d *TaskAnomalyDao) List1(userId int, companyId int, taskName string, categ |
|
@@ -139,7 +139,7 @@ func (d *TaskAnomalyDao) List1(userId int, companyId int, taskName string, categ |
139
|
// pageSize 分页大小
|
139
|
// pageSize 分页大小
|
140
|
// pageNumber 分页页码
|
140
|
// pageNumber 分页页码
|
141
|
// subLevel 我的下级的层级
|
141
|
// subLevel 我的下级的层级
|
142
|
-func (d *TaskAnomalyDao) List2(userId int, companyId int, taskName string, category int, leaderId string, dayTime string, subLevel int, limit int, offset int) (int, []ListTaskAnomaly, error) {
|
142
|
+func (d *TaskAnomalyDao) List2(userId int, companyId int, taskName string, category int, leaderId []string, dayTime string, subLevel int, limit int, offset int) (int, []ListTaskAnomaly, error) {
|
143
|
sqlStr1 := `with
|
143
|
sqlStr1 := `with
|
144
|
-- 人员自身以及全下级
|
144
|
-- 人员自身以及全下级
|
145
|
recursive t_user as (
|
145
|
recursive t_user as (
|
|
@@ -232,6 +232,7 @@ func (d *TaskAnomalyDao) List2(userId int, companyId int, taskName string, categ |
|
@@ -232,6 +232,7 @@ func (d *TaskAnomalyDao) List2(userId int, companyId int, taskName string, categ |
232
|
task.end_time as "task_end_time",
|
232
|
task.end_time as "task_end_time",
|
233
|
task.sort_by as "task_sort_by",
|
233
|
task.sort_by as "task_sort_by",
|
234
|
task.leader->>'name' as "leader_name",
|
234
|
task.leader->>'name' as "leader_name",
|
|
|
235
|
+ task.leader ->>'id' as "leader_id"
|
235
|
task.level_name
|
236
|
task.level_name
|
236
|
from task
|
237
|
from task
|
237
|
left join t_task_ignore on task.id=t_task_ignore.task_id
|
238
|
left join t_task_ignore on task.id=t_task_ignore.task_id
|
|
@@ -261,6 +262,11 @@ func (d *TaskAnomalyDao) List2(userId int, companyId int, taskName string, categ |
|
@@ -261,6 +262,11 @@ func (d *TaskAnomalyDao) List2(userId int, companyId int, taskName string, categ |
261
|
sqlStr1 += ` and task_anomaly.category=? `
|
262
|
sqlStr1 += ` and task_anomaly.category=? `
|
262
|
sqlStr2 += ` and task_anomaly.category=? `
|
263
|
sqlStr2 += ` and task_anomaly.category=? `
|
263
|
}
|
264
|
}
|
|
|
265
|
+ if len(leaderId) > 0 {
|
|
|
266
|
+ condition = append(condition, pg.In(leaderId))
|
|
|
267
|
+ sqlStr2 += ` and t_task.leader_id in (?) `
|
|
|
268
|
+ sqlStr1 += ` and t_task.leader_id in (?) `
|
|
|
269
|
+ }
|
264
|
condition = append(condition, limit, offset)
|
270
|
condition = append(condition, limit, offset)
|
265
|
sqlStr1 += ` order by task_anomaly.id desc limit ? offset ? `
|
271
|
sqlStr1 += ` order by task_anomaly.id desc limit ? offset ? `
|
266
|
|
272
|
|
|
@@ -281,7 +287,7 @@ func (d *TaskAnomalyDao) List2(userId int, companyId int, taskName string, categ |
|
@@ -281,7 +287,7 @@ func (d *TaskAnomalyDao) List2(userId int, companyId int, taskName string, categ |
281
|
// dayTime 搜索条件日期 ,例:"2006-01-02"
|
287
|
// dayTime 搜索条件日期 ,例:"2006-01-02"
|
282
|
// pageSize 分页大小
|
288
|
// pageSize 分页大小
|
283
|
// pageNumber 分页页码
|
289
|
// pageNumber 分页页码
|
284
|
-func (d *TaskAnomalyDao) List3(userId int, companyId int, taskName string, category int, dayTime string, leaderId string, limit int, offset int) (int, []ListTaskAnomaly, error) {
|
290
|
+func (d *TaskAnomalyDao) List3(userId int, companyId int, taskName string, category int, dayTime string, leaderId []string, limit int, offset int) (int, []ListTaskAnomaly, error) {
|
285
|
sqlStr1 := ` with t_task_ignore as (
|
291
|
sqlStr1 := ` with t_task_ignore as (
|
286
|
select task_ignore.id ,task_ignore.task_id
|
292
|
select task_ignore.id ,task_ignore.task_id
|
287
|
from task_ignore
|
293
|
from task_ignore
|
|
@@ -345,9 +351,9 @@ func (d *TaskAnomalyDao) List3(userId int, companyId int, taskName string, categ |
|
@@ -345,9 +351,9 @@ func (d *TaskAnomalyDao) List3(userId int, companyId int, taskName string, categ |
345
|
|
351
|
|
346
|
}
|
352
|
}
|
347
|
if len(leaderId) > 0 {
|
353
|
if len(leaderId) > 0 {
|
348
|
- condition = append(condition, fmt.Sprintf(`{"id":"%s"}`, leaderId))
|
|
|
349
|
- sqlStr1 += ` and task.leader@>? `
|
|
|
350
|
- sqlStr2 += ` and task.leader@>? `
|
354
|
+ condition = append(condition, pg.In(leaderId))
|
|
|
355
|
+ sqlStr1 += ` and task.leader->>'id' in (?) `
|
|
|
356
|
+ sqlStr2 += ` and task.leader->>'id' in (?) `
|
351
|
}
|
357
|
}
|
352
|
condition = append(condition, limit, offset)
|
358
|
condition = append(condition, limit, offset)
|
353
|
sqlStr1 += ` order by task_anomaly.id desc limit ? offset ? `
|
359
|
sqlStr1 += ` order by task_anomaly.id desc limit ? offset ? `
|