|
@@ -60,14 +60,12 @@ func (d *TaskDao) catchTaskIdByPermission(userId int) string { |
|
@@ -60,14 +60,12 @@ func (d *TaskDao) catchTaskIdByPermission(userId int) string { |
60
|
}
|
60
|
}
|
61
|
|
61
|
|
62
|
type ListTaskCondition struct {
|
62
|
type ListTaskCondition struct {
|
63
|
- Limit int //分页
|
|
|
64
|
- Offset int //分页
|
|
|
65
|
- CompanyId int //公司id
|
|
|
66
|
- UserId int //谁要查看任务数据
|
|
|
67
|
- TaskName string //任务名称
|
|
|
68
|
- LevelName string //优先级
|
|
|
69
|
- OnlyMy bool //只查看我负责的任务
|
|
|
70
|
- LeaderName string //任务负责人名称
|
63
|
+ Limit int //分页
|
|
|
64
|
+ Offset int //分页
|
|
|
65
|
+ CompanyId int //公司id
|
|
|
66
|
+ UserId int //谁要查看任务数据
|
|
|
67
|
+ OnlyMy bool //只查看我负责的任务
|
|
|
68
|
+ SearchWord string
|
71
|
}
|
69
|
}
|
72
|
|
70
|
|
73
|
// 任务和里程碑列表
|
71
|
// 任务和里程碑列表
|
|
@@ -162,17 +160,10 @@ func (d *TaskDao) ListTaskStageNotHrbp(param ListTaskCondition) ([]ListTaskStage |
|
@@ -162,17 +160,10 @@ func (d *TaskDao) ListTaskStageNotHrbp(param ListTaskCondition) ([]ListTaskStage |
162
|
if param.OnlyMy {
|
160
|
if param.OnlyMy {
|
163
|
condition = append(condition, param.UserId)
|
161
|
condition = append(condition, param.UserId)
|
164
|
whereSql += ` and t_task_tage_1.leader_id = '?' `
|
162
|
whereSql += ` and t_task_tage_1.leader_id = '?' `
|
165
|
- } else if param.LeaderName != "" {
|
|
|
166
|
- condition = append(condition, param.LeaderName)
|
|
|
167
|
- whereSql += ` and t_task_tage_1.leader_name = ? `
|
|
|
168
|
}
|
163
|
}
|
169
|
- if len(param.TaskName) > 0 {
|
|
|
170
|
- condition = append(condition, param.TaskName)
|
|
|
171
|
- whereSql += ` and t_task_tage_1.task_name like ? `
|
|
|
172
|
- }
|
|
|
173
|
- if len(param.LevelName) > 0 {
|
|
|
174
|
- condition = append(condition, param.LevelName)
|
|
|
175
|
- whereSql += ` and t_task_tage_1.level_name like ? `
|
164
|
+ if param.SearchWord != "" {
|
|
|
165
|
+ condition = append(condition, param.SearchWord, param.SearchWord)
|
|
|
166
|
+ whereSql += ` and (t_task_tage_1.leader_name like ? or t_task_tage_1.task_alias_name like ?)`
|
176
|
}
|
167
|
}
|
177
|
condition = append(condition, param.Limit, param.Offset)
|
168
|
condition = append(condition, param.Limit, param.Offset)
|
178
|
sqlStr := fmt.Sprintf(withSql, whereSql)
|
169
|
sqlStr := fmt.Sprintf(withSql, whereSql)
|
|
@@ -193,18 +184,12 @@ func (d *TaskDao) CountTaskStageNotHrbp(param ListTaskCondition) (int, error) { |
|
@@ -193,18 +184,12 @@ func (d *TaskDao) CountTaskStageNotHrbp(param ListTaskCondition) (int, error) { |
193
|
if param.OnlyMy {
|
184
|
if param.OnlyMy {
|
194
|
condition = append(condition, param.UserId)
|
185
|
condition = append(condition, param.UserId)
|
195
|
whereSql += ` and task.leader ->>'id' = '?' `
|
186
|
whereSql += ` and task.leader ->>'id' = '?' `
|
196
|
- } else if param.LeaderName != "" {
|
|
|
197
|
- condition = append(condition, param.LeaderName)
|
|
|
198
|
- whereSql += ` and task.leader ->>'name' = ? `
|
|
|
199
|
- }
|
|
|
200
|
- if len(param.TaskName) > 0 {
|
|
|
201
|
- condition = append(condition, param.TaskName)
|
|
|
202
|
- whereSql += ` and task.name like ? `
|
|
|
203
|
}
|
187
|
}
|
204
|
- if len(param.LevelName) > 0 {
|
|
|
205
|
- condition = append(condition, param.LevelName)
|
|
|
206
|
- whereSql += ` and task.level_name like ? `
|
188
|
+ if param.SearchWord != "" {
|
|
|
189
|
+ condition = append(condition, param.SearchWord, param.SearchWord)
|
|
|
190
|
+ whereSql += ` and (t_task_tage_1.leader_name like ? or t_task_tage_1.task_alias_name like ?)`
|
207
|
}
|
191
|
}
|
|
|
192
|
+
|
208
|
sqlStr := withSql + whereSql
|
193
|
sqlStr := withSql + whereSql
|
209
|
tx := d.transactionContext.PgTx
|
194
|
tx := d.transactionContext.PgTx
|
210
|
var cnt int
|
195
|
var cnt int
|
|
@@ -286,17 +271,10 @@ func (d *TaskDao) ListTaskStageByHrbp(param ListTaskCondition) ([]ListTaskStage, |
|
@@ -286,17 +271,10 @@ func (d *TaskDao) ListTaskStageByHrbp(param ListTaskCondition) ([]ListTaskStage, |
286
|
if param.OnlyMy {
|
271
|
if param.OnlyMy {
|
287
|
condition = append(condition, param.UserId)
|
272
|
condition = append(condition, param.UserId)
|
288
|
whereSql += ` and t_task_tage_1.leader_id = '?' `
|
273
|
whereSql += ` and t_task_tage_1.leader_id = '?' `
|
289
|
- } else if param.LeaderName != "" {
|
|
|
290
|
- condition = append(condition, param.LeaderName)
|
|
|
291
|
- whereSql += ` and t_task_tage_1.leader_name = ? `
|
|
|
292
|
}
|
274
|
}
|
293
|
- if len(param.TaskName) > 0 {
|
|
|
294
|
- condition = append(condition, param.TaskName)
|
|
|
295
|
- whereSql += ` and t_task_tage_1.task_name like ? `
|
|
|
296
|
- }
|
|
|
297
|
- if len(param.LevelName) > 0 {
|
|
|
298
|
- condition = append(condition, param.LevelName)
|
|
|
299
|
- whereSql += ` and t_task_tage_1.level_name like ? `
|
275
|
+ if param.SearchWord != "" {
|
|
|
276
|
+ condition = append(condition, param.SearchWord, param.SearchWord)
|
|
|
277
|
+ whereSql += ` and (t_task_tage_1.leader_name like ? or t_task_tage_1.task_alias_name like ?)`
|
300
|
}
|
278
|
}
|
301
|
condition = append(condition, param.Limit, param.Offset)
|
279
|
condition = append(condition, param.Limit, param.Offset)
|
302
|
sqlStr := fmt.Sprintf(withSql, whereSql)
|
280
|
sqlStr := fmt.Sprintf(withSql, whereSql)
|
|
@@ -320,17 +298,10 @@ func (d *TaskDao) CountTaskStageByHrbp(param ListTaskCondition) (int, error) { |
|
@@ -320,17 +298,10 @@ func (d *TaskDao) CountTaskStageByHrbp(param ListTaskCondition) (int, error) { |
320
|
if param.OnlyMy {
|
298
|
if param.OnlyMy {
|
321
|
condition = append(condition, param.UserId)
|
299
|
condition = append(condition, param.UserId)
|
322
|
whereSql += ` and task.leader ->>'id' = '?' `
|
300
|
whereSql += ` and task.leader ->>'id' = '?' `
|
323
|
- } else if param.LeaderName != "" {
|
|
|
324
|
- condition = append(condition, param.LeaderName)
|
|
|
325
|
- whereSql += ` and task.leader ->>'name' = ? `
|
|
|
326
|
- }
|
|
|
327
|
- if len(param.TaskName) > 0 {
|
|
|
328
|
- condition = append(condition, param.TaskName)
|
|
|
329
|
- whereSql += ` and task.name like ? `
|
|
|
330
|
}
|
301
|
}
|
331
|
- if len(param.LevelName) > 0 {
|
|
|
332
|
- condition = append(condition, param.LevelName)
|
|
|
333
|
- whereSql += ` and task.level_name like ? `
|
302
|
+ if param.SearchWord != "" {
|
|
|
303
|
+ condition = append(condition, param.SearchWord, param.SearchWord)
|
|
|
304
|
+ whereSql += ` and (t_task_tage_1.leader_name like ? or t_task_tage_1.task_alias_name like ?)`
|
334
|
}
|
305
|
}
|
335
|
sqlStr := withSql + whereSql
|
306
|
sqlStr := withSql + whereSql
|
336
|
tx := d.transactionContext.PgTx
|
307
|
tx := d.transactionContext.PgTx
|
|
@@ -357,17 +328,10 @@ func (d *TaskDao) CountTaskStageAnomalyNotHrbp(param ListTaskCondition) (int, er |
|
@@ -357,17 +328,10 @@ func (d *TaskDao) CountTaskStageAnomalyNotHrbp(param ListTaskCondition) (int, er |
357
|
if param.OnlyMy {
|
328
|
if param.OnlyMy {
|
358
|
condition = append(condition, param.UserId)
|
329
|
condition = append(condition, param.UserId)
|
359
|
whereSql += ` and task.leader ->>'id' = '?' `
|
330
|
whereSql += ` and task.leader ->>'id' = '?' `
|
360
|
- } else if param.LeaderName != "" {
|
|
|
361
|
- condition = append(condition, param.LeaderName)
|
|
|
362
|
- whereSql += ` and task.leader ->>'name' = ? `
|
|
|
363
|
- }
|
|
|
364
|
- if len(param.TaskName) > 0 {
|
|
|
365
|
- condition = append(condition, param.TaskName)
|
|
|
366
|
- whereSql += ` and task.name like ? `
|
|
|
367
|
}
|
331
|
}
|
368
|
- if len(param.LevelName) > 0 {
|
|
|
369
|
- condition = append(condition, param.LevelName)
|
|
|
370
|
- whereSql += ` and task.level_name like ? `
|
332
|
+ if param.SearchWord != "" {
|
|
|
333
|
+ condition = append(condition, param.SearchWord, param.SearchWord)
|
|
|
334
|
+ whereSql += ` and (t_task_tage_1.leader_name like ? or t_task_tage_1.task_alias_name like ?)`
|
371
|
}
|
335
|
}
|
372
|
sqlStr := withSql + whereSql
|
336
|
sqlStr := withSql + whereSql
|
373
|
tx := d.transactionContext.PgTx
|
337
|
tx := d.transactionContext.PgTx
|
|
@@ -396,18 +360,12 @@ func (d *TaskDao) CountTaskStageAnomalyByHrbp(param ListTaskCondition) (int, err |
|
@@ -396,18 +360,12 @@ func (d *TaskDao) CountTaskStageAnomalyByHrbp(param ListTaskCondition) (int, err |
396
|
if param.OnlyMy {
|
360
|
if param.OnlyMy {
|
397
|
condition = append(condition, param.UserId)
|
361
|
condition = append(condition, param.UserId)
|
398
|
whereSql += ` and task.leader ->>'id' = '?' `
|
362
|
whereSql += ` and task.leader ->>'id' = '?' `
|
399
|
- } else if param.LeaderName != "" {
|
|
|
400
|
- condition = append(condition, param.LeaderName)
|
|
|
401
|
- whereSql += ` and task.leader ->>'name' = ? `
|
|
|
402
|
}
|
363
|
}
|
403
|
- if len(param.TaskName) > 0 {
|
|
|
404
|
- condition = append(condition, param.TaskName)
|
|
|
405
|
- whereSql += ` and task.name like ? `
|
|
|
406
|
- }
|
|
|
407
|
- if len(param.LevelName) > 0 {
|
|
|
408
|
- condition = append(condition, param.LevelName)
|
|
|
409
|
- whereSql += ` and task.level_name like ? `
|
364
|
+ if param.SearchWord != "" {
|
|
|
365
|
+ condition = append(condition, param.SearchWord, param.SearchWord)
|
|
|
366
|
+ whereSql += ` and (t_task_tage_1.leader_name like ? or t_task_tage_1.task_alias_name like ?)`
|
410
|
}
|
367
|
}
|
|
|
368
|
+
|
411
|
sqlStr := withSql + whereSql
|
369
|
sqlStr := withSql + whereSql
|
412
|
tx := d.transactionContext.PgTx
|
370
|
tx := d.transactionContext.PgTx
|
413
|
var cnt int
|
371
|
var cnt int
|
|
@@ -475,17 +433,10 @@ func (d *TaskDao) CountTaskAnomalyNotHrbp(param ListTaskCondition) (int, error) |
|
@@ -475,17 +433,10 @@ func (d *TaskDao) CountTaskAnomalyNotHrbp(param ListTaskCondition) (int, error) |
475
|
if param.OnlyMy {
|
433
|
if param.OnlyMy {
|
476
|
condition = append(condition, param.UserId)
|
434
|
condition = append(condition, param.UserId)
|
477
|
whereSql += ` and task.leader ->>'id' = '?' `
|
435
|
whereSql += ` and task.leader ->>'id' = '?' `
|
478
|
- } else if param.LeaderName != "" {
|
|
|
479
|
- condition = append(condition, param.LeaderName)
|
|
|
480
|
- whereSql += ` and task.leader ->>'id' = ? `
|
|
|
481
|
- }
|
|
|
482
|
- if len(param.TaskName) > 0 {
|
|
|
483
|
- condition = append(condition, param.TaskName)
|
|
|
484
|
- whereSql += ` and task.name like ? `
|
|
|
485
|
}
|
436
|
}
|
486
|
- if len(param.LevelName) > 0 {
|
|
|
487
|
- condition = append(condition, param.LevelName)
|
|
|
488
|
- whereSql += ` and task.level_name like ? `
|
437
|
+ if param.SearchWord != "" {
|
|
|
438
|
+ condition = append(condition, param.SearchWord, param.SearchWord)
|
|
|
439
|
+ whereSql += ` and (t_task_tage_1.leader_name like ? or t_task_tage_1.task_alias_name like ?)`
|
489
|
}
|
440
|
}
|
490
|
sqlStr := withSql + whereSql
|
441
|
sqlStr := withSql + whereSql
|
491
|
tx := d.transactionContext.PgTx
|
442
|
tx := d.transactionContext.PgTx
|
|
@@ -502,23 +453,16 @@ func (d *TaskDao) CountTaskAnomalyByHrbp(param ListTaskCondition) (int, error) { |
|
@@ -502,23 +453,16 @@ func (d *TaskDao) CountTaskAnomalyByHrbp(param ListTaskCondition) (int, error) { |
502
|
)select count(*)
|
453
|
)select count(*)
|
503
|
from task
|
454
|
from task
|
504
|
left join t_task_ignore on t_task_ignore.task_id=task.id
|
455
|
left join t_task_ignore on t_task_ignore.task_id=task.id
|
505
|
- where 1=1 and task.anomaly>1 `
|
|
|
506
|
- condition := []interface{}{param.UserId}
|
456
|
+ where 1=1 and task.anomaly>1 and task.company_id=?`
|
|
|
457
|
+ condition := []interface{}{param.UserId, param.CompanyId}
|
507
|
whereSql := ``
|
458
|
whereSql := ``
|
508
|
if param.OnlyMy {
|
459
|
if param.OnlyMy {
|
509
|
condition = append(condition, param.UserId)
|
460
|
condition = append(condition, param.UserId)
|
510
|
whereSql += ` and task.leader ->>'id' = '?' `
|
461
|
whereSql += ` and task.leader ->>'id' = '?' `
|
511
|
- } else if param.LeaderName != "" {
|
|
|
512
|
- condition = append(condition, param.LeaderName)
|
|
|
513
|
- whereSql += ` and task.leader ->>'id' = ? `
|
|
|
514
|
- }
|
|
|
515
|
- if len(param.TaskName) > 0 {
|
|
|
516
|
- condition = append(condition, param.TaskName)
|
|
|
517
|
- whereSql += ` and task.name like ? `
|
|
|
518
|
}
|
462
|
}
|
519
|
- if len(param.LevelName) > 0 {
|
|
|
520
|
- condition = append(condition, param.LevelName)
|
|
|
521
|
- whereSql += ` and task.level_name like ? `
|
463
|
+ if param.SearchWord != "" {
|
|
|
464
|
+ condition = append(condition, param.SearchWord, param.SearchWord)
|
|
|
465
|
+ whereSql += ` and (t_task_tage_1.leader_name like ? or t_task_tage_1.task_alias_name like ?)`
|
522
|
}
|
466
|
}
|
523
|
sqlStr := withSql + whereSql
|
467
|
sqlStr := withSql + whereSql
|
524
|
tx := d.transactionContext.PgTx
|
468
|
tx := d.transactionContext.PgTx
|
|
@@ -543,7 +487,9 @@ func (d *TaskDao) ListTask2(userId int) ([]TaskData1, error) { |
|
@@ -543,7 +487,9 @@ func (d *TaskDao) ListTask2(userId int) ([]TaskData1, error) { |
543
|
task.leader ->>'id' as leader_id,
|
487
|
task.leader ->>'id' as leader_id,
|
544
|
task.leader ->>'name' as leader_name,
|
488
|
task.leader ->>'name' as leader_name,
|
545
|
task.level_name
|
489
|
task.level_name
|
546
|
- from task `
|
490
|
+ from task
|
|
|
491
|
+ join t_task_1 on task.id =t_task_1.id
|
|
|
492
|
+ `
|
547
|
result := []TaskData1{}
|
493
|
result := []TaskData1{}
|
548
|
tx := d.transactionContext.PgTx
|
494
|
tx := d.transactionContext.PgTx
|
549
|
_, err := tx.Query(&result, sqlStr)
|
495
|
_, err := tx.Query(&result, sqlStr)
|
|
@@ -551,7 +497,7 @@ func (d *TaskDao) ListTask2(userId int) ([]TaskData1, error) { |
|
@@ -551,7 +497,7 @@ func (d *TaskDao) ListTask2(userId int) ([]TaskData1, error) { |
551
|
}
|
497
|
}
|
552
|
|
498
|
|
553
|
// 获取任务列表
|
499
|
// 获取任务列表
|
554
|
-func (d *TaskDao) ListTask2ForHrbp(userId int) ([]TaskData1, error) {
|
500
|
+func (d *TaskDao) ListTask2ForHrbp(userId int, companyId int) ([]TaskData1, error) {
|
555
|
sqlStr := `with
|
501
|
sqlStr := `with
|
556
|
t_task_ignore as (
|
502
|
t_task_ignore as (
|
557
|
select task_ignore.task_id,task_ignore.id from task_ignore where task_ignore.user_id =?
|
503
|
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) { |
|
@@ -561,10 +507,10 @@ func (d *TaskDao) ListTask2ForHrbp(userId int) ([]TaskData1, error) { |
561
|
task.level_name
|
507
|
task.level_name
|
562
|
from task
|
508
|
from task
|
563
|
left join t_task_ignore on t_task_ignore.task_id=task.id
|
509
|
left join t_task_ignore on t_task_ignore.task_id=task.id
|
564
|
- where 1=1 `
|
510
|
+ where 1=1 and task.company_id=? `
|
565
|
result := []TaskData1{}
|
511
|
result := []TaskData1{}
|
566
|
tx := d.transactionContext.PgTx
|
512
|
tx := d.transactionContext.PgTx
|
567
|
- _, err := tx.Query(&result, sqlStr, userId)
|
513
|
+ _, err := tx.Query(&result, sqlStr, userId, companyId)
|
568
|
return result, err
|
514
|
return result, err
|
569
|
|
515
|
|
570
|
} |
516
|
} |