正在显示
1 个修改的文件
包含
35 行增加
和
33 行删除
@@ -37,6 +37,7 @@ func (d *TaskDao) catchTaskIdByPermission(userId int) string { | @@ -37,6 +37,7 @@ func (d *TaskDao) catchTaskIdByPermission(userId int) string { | ||
37 | select "child_user".id,"child_user".parent_id | 37 | select "child_user".id,"child_user".parent_id |
38 | from "user" as "child_user" | 38 | from "user" as "child_user" |
39 | join t_user as "parent_user" on "parent_user".id="child_user".parent_id | 39 | join t_user as "parent_user" on "parent_user".id="child_user".parent_id |
40 | + where "child_user".deleted_at isnull | ||
40 | ) | 41 | ) |
41 | ), | 42 | ), |
42 | -- 根据任务负责人和相关人员查询 | 43 | -- 根据任务负责人和相关人员查询 |
@@ -379,16 +380,16 @@ func (d *TaskDao) CountTaskStageAnomalyByHrbp(param ListTaskCondition) (int, err | @@ -379,16 +380,16 @@ func (d *TaskDao) CountTaskStageAnomalyByHrbp(param ListTaskCondition) (int, err | ||
379 | return cnt, err | 380 | return cnt, err |
380 | } | 381 | } |
381 | 382 | ||
382 | -func (d *TaskDao) IncreaseAnomaly(id []int, incr int) error { | ||
383 | - if len(id) == 0 { | ||
384 | - return nil | ||
385 | - } | ||
386 | - sqlStr := `update task set anomaly=task.anomaly+? | ||
387 | - where id in(?)` | ||
388 | - tx := d.transactionContext.PgTx | ||
389 | - _, err := tx.Exec(sqlStr, incr, pg.In(id)) | ||
390 | - return err | ||
391 | -} | 383 | +// func (d *TaskDao) IncreaseAnomaly(id []int, incr int) error { |
384 | +// if len(id) == 0 { | ||
385 | +// return nil | ||
386 | +// } | ||
387 | +// sqlStr := `update task set anomaly=task.anomaly+? | ||
388 | +// where id in(?)` | ||
389 | +// tx := d.transactionContext.PgTx | ||
390 | +// _, err := tx.Exec(sqlStr, incr, pg.In(id)) | ||
391 | +// return err | ||
392 | +// } | ||
392 | 393 | ||
393 | // TaskStageData | 394 | // TaskStageData |
394 | // type TaskStageData struct { | 395 | // type TaskStageData struct { |
@@ -470,7 +471,7 @@ func (d *TaskDao) TaskAnomalyByLeader(leaderId []string, anomaly int) ([]TaskDat | @@ -470,7 +471,7 @@ func (d *TaskDao) TaskAnomalyByLeader(leaderId []string, anomaly int) ([]TaskDat | ||
470 | task.leader ->>'name' as leader_name, | 471 | task.leader ->>'name' as leader_name, |
471 | task.anomaly | 472 | task.anomaly |
472 | from task | 473 | from task |
473 | - where task.anomaly >=? and task.leader ->>'id' in(?) ` | 474 | + where task.anomaly >=? and task.leader ->>'id' in(?) and task.deleted_at isnull ` |
474 | result := []TaskData2{} | 475 | result := []TaskData2{} |
475 | tx := d.transactionContext.PgTx | 476 | tx := d.transactionContext.PgTx |
476 | _, err := tx.Query(&result, sqlStr, anomaly, pg.In(leaderId)) | 477 | _, err := tx.Query(&result, sqlStr, anomaly, pg.In(leaderId)) |
@@ -484,7 +485,7 @@ func (d *TaskDao) CountTaskAnomalyNotHrbp(param ListTaskCondition) (int, error) | @@ -484,7 +485,7 @@ func (d *TaskDao) CountTaskAnomalyNotHrbp(param ListTaskCondition) (int, error) | ||
484 | from task | 485 | from task |
485 | join t_task_1 on task.id =t_task_1.id | 486 | join t_task_1 on task.id =t_task_1.id |
486 | where 1=1 | 487 | where 1=1 |
487 | - and task.anomaly>1 ` | 488 | + and task.anomaly>1 and task.deleted_at isnull ` |
488 | condition := []interface{}{} | 489 | condition := []interface{}{} |
489 | whereSql := `` | 490 | whereSql := `` |
490 | if param.OnlyMy { | 491 | if param.OnlyMy { |
@@ -546,6 +547,7 @@ func (d *TaskDao) ListTask2(userId int) ([]TaskData1, error) { | @@ -546,6 +547,7 @@ func (d *TaskDao) ListTask2(userId int) ([]TaskData1, error) { | ||
546 | task.level_name | 547 | task.level_name |
547 | from task | 548 | from task |
548 | join t_task_1 on task.id =t_task_1.id | 549 | join t_task_1 on task.id =t_task_1.id |
550 | + where task.deleted_at isnull | ||
549 | ` | 551 | ` |
550 | result := []TaskData1{} | 552 | result := []TaskData1{} |
551 | tx := d.transactionContext.PgTx | 553 | tx := d.transactionContext.PgTx |
@@ -564,7 +566,7 @@ func (d *TaskDao) ListTask2ForHrbp(userId int, companyId int) ([]TaskData1, erro | @@ -564,7 +566,7 @@ func (d *TaskDao) ListTask2ForHrbp(userId int, companyId int) ([]TaskData1, erro | ||
564 | task.level_name | 566 | task.level_name |
565 | from task | 567 | from task |
566 | left join t_task_ignore on t_task_ignore.task_id=task.id | 568 | left join t_task_ignore on t_task_ignore.task_id=task.id |
567 | - where 1=1 and task.company_id=? ` | 569 | + where 1=1 and task.company_id=? and task.deleted_at isnull` |
568 | result := []TaskData1{} | 570 | result := []TaskData1{} |
569 | tx := d.transactionContext.PgTx | 571 | tx := d.transactionContext.PgTx |
570 | _, err := tx.Query(&result, sqlStr, userId, companyId) | 572 | _, err := tx.Query(&result, sqlStr, userId, companyId) |
@@ -573,26 +575,26 @@ func (d *TaskDao) ListTask2ForHrbp(userId int, companyId int) ([]TaskData1, erro | @@ -573,26 +575,26 @@ func (d *TaskDao) ListTask2ForHrbp(userId int, companyId int) ([]TaskData1, erro | ||
573 | } | 575 | } |
574 | 576 | ||
575 | // 获取异常任务对应的公司 | 577 | // 获取异常任务对应的公司 |
576 | -func (d *TaskDao) TaskStageAnomalyForCompany() ([]int, error) { | ||
577 | - var companyIds []struct { | ||
578 | - CompanyId int `pg:"company_id"` | ||
579 | - } | ||
580 | - sqlStr := `select distinct company_id | ||
581 | - from task | ||
582 | - where 1=1 | ||
583 | - and (task.warn_flag >0)` | ||
584 | - result := []TaskData1{} | ||
585 | - tx := d.transactionContext.PgTx | ||
586 | - _, err := tx.Query(&result, sqlStr) | ||
587 | - if err != nil { | ||
588 | - return nil, err | ||
589 | - } | ||
590 | - var ids []int | ||
591 | - for _, v := range companyIds { | ||
592 | - ids = append(ids, v.CompanyId) | ||
593 | - } | ||
594 | - return ids, nil | ||
595 | -} | 578 | +// func (d *TaskDao) TaskStageAnomalyForCompany() ([]int, error) { |
579 | +// var companyIds []struct { | ||
580 | +// CompanyId int `pg:"company_id"` | ||
581 | +// } | ||
582 | +// sqlStr := `select distinct company_id | ||
583 | +// from task | ||
584 | +// where 1=1 | ||
585 | +// and (task.warn_flag >0)` | ||
586 | +// result := []TaskData1{} | ||
587 | +// tx := d.transactionContext.PgTx | ||
588 | +// _, err := tx.Query(&result, sqlStr) | ||
589 | +// if err != nil { | ||
590 | +// return nil, err | ||
591 | +// } | ||
592 | +// var ids []int | ||
593 | +// for _, v := range companyIds { | ||
594 | +// ids = append(ids, v.CompanyId) | ||
595 | +// } | ||
596 | +// return ids, nil | ||
597 | +// } | ||
596 | 598 | ||
597 | type TaskData4 struct { | 599 | type TaskData4 struct { |
598 | TaskId int `pg:"task_id"` | 600 | TaskId int `pg:"task_id"` |
-
请 注册 或 登录 后发表评论