作者 tangxvhui

调整sql

@@ -322,7 +322,7 @@ func (d *TaskDao) CountTaskStageAnomalyNotHrbp(param ListTaskCondition) (int, er @@ -322,7 +322,7 @@ func (d *TaskDao) CountTaskStageAnomalyNotHrbp(param ListTaskCondition) (int, er
322 and task.company_id =? 322 and task.company_id =?
323 and task.deleted_at isnull 323 and task.deleted_at isnull
324 and ( 324 and (
325 - cast(COALESCE(task.current_stage ->>'plan_completed_at','0') as int)<floor(extract(epoch from now())) 325 + cast(COALESCE(task.current_stage ->>'planCompletedAt','0') as int)<floor(extract(epoch from now()))
326 or 326 or
327 task.warn_flag = 1 327 task.warn_flag = 1
328 ) 328 )
@@ -357,7 +357,7 @@ func (d *TaskDao) CountTaskStageAnomalyByHrbp(param ListTaskCondition) (int, err @@ -357,7 +357,7 @@ func (d *TaskDao) CountTaskStageAnomalyByHrbp(param ListTaskCondition) (int, err
357 and task.deleted_at isnull 357 and task.deleted_at isnull
358 and t_task_ignore.id isnull 358 and t_task_ignore.id isnull
359 and ( 359 and (
360 - cast(COALESCE(task.current_stage ->>'plan_completed_at','0') as int)<floor(extract(epoch from now())) 360 + cast(COALESCE(task.current_stage ->>'planCompletedAt','0') as int)<floor(extract(epoch from now()))
361 or 361 or
362 task.warn_flag = 1 362 task.warn_flag = 1
363 )` 363 )`
@@ -419,7 +419,7 @@ and task.deleted_at isnull @@ -419,7 +419,7 @@ and task.deleted_at isnull
419 and ( 419 and (
420 task.last_stage ->>'planCompletedAt'< task.last_stage ->>'realCompletedAt' 420 task.last_stage ->>'planCompletedAt'< task.last_stage ->>'realCompletedAt'
421 or 421 or
422 - cast(COALESCE(task.current_stage ->>'plan_completed_at','0') as int) between 1 and floor(extract(epoch from now())) 422 + cast(COALESCE(task.current_stage ->>'planCompletedAt','0') as int) between 1 and floor(extract(epoch from now()))
423 ) 423 )
424 and task.leader ->>'id' in(?) ` 424 and task.leader ->>'id' in(?) `
425 425
@@ -442,7 +442,7 @@ and task.deleted_at isnull @@ -442,7 +442,7 @@ and task.deleted_at isnull
442 and ( 442 and (
443 task.last_stage ->>'planCompletedAt'< task.last_stage ->>'realCompletedAt' 443 task.last_stage ->>'planCompletedAt'< task.last_stage ->>'realCompletedAt'
444 or 444 or
445 - cast(COALESCE(task.current_stage ->>'plan_completed_at','0') as int) between 1 and floor(extract(epoch from now())) 445 + cast(COALESCE(task.current_stage ->>'planCompletedAt','0') as int) between 1 and floor(extract(epoch from now()))
446 ) 446 )
447 and task.related_user @>? ` 447 and task.related_user @>? `
448 448
@@ -510,7 +510,7 @@ func (d *TaskDao) CountTaskAnomalyByHrbp(param ListTaskCondition) (int, error) { @@ -510,7 +510,7 @@ func (d *TaskDao) CountTaskAnomalyByHrbp(param ListTaskCondition) (int, error) {
510 )select count(*) 510 )select count(*)
511 from task 511 from task
512 left join t_task_ignore on t_task_ignore.task_id=task.id 512 left join t_task_ignore on t_task_ignore.task_id=task.id
513 - where 1=1 and task.anomaly>1 and task.company_id=?` 513 + where 1=1 and task.anomaly>1 and task.company_id=? and task.deleted_at isnull`
514 condition := []interface{}{param.UserId, param.CompanyId} 514 condition := []interface{}{param.UserId, param.CompanyId}
515 whereSql := `` 515 whereSql := ``
516 if param.OnlyMy { 516 if param.OnlyMy {
@@ -615,7 +615,7 @@ and task.deleted_at isnull @@ -615,7 +615,7 @@ and task.deleted_at isnull
615 and ( 615 and (
616 task.last_stage ->>'planCompletedAt'< task.last_stage ->>'realCompletedAt' 616 task.last_stage ->>'planCompletedAt'< task.last_stage ->>'realCompletedAt'
617 or 617 or
618 - cast(COALESCE(task.current_stage ->>'plan_completed_at','0') as int) between 1 and floor(extract(epoch from now())) 618 + cast(COALESCE(task.current_stage ->>'planCompletedAt','0') as int) between 1 and floor(extract(epoch from now()))
619 ) ` 619 ) `
620 result := []TaskData4{} 620 result := []TaskData4{}
621 tx := d.transactionContext.PgTx 621 tx := d.transactionContext.PgTx
@@ -679,9 +679,9 @@ func (d *TaskDao) ListTaskByHrbpV2(param ListTaskCondition) ([]ListTask, error) @@ -679,9 +679,9 @@ func (d *TaskDao) ListTaskByHrbpV2(param ListTaskCondition) ([]ListTask, error)
679 ), 679 ),
680 t_task as ( 680 t_task as (
681 select 681 select
682 - cast(COALESCE(task.current_stage ->>'plan_completed_at','0') as int) as c_plan_completed_at,  
683 - cast(COALESCE(task.last_stage ->>'plan_completed_at','0') as int) as l_plan_completed_at,  
684 - cast(COALESCE(task.last_stage ->>'real_completed_at','0') as int) as l_real_completed_at, 682 + cast(COALESCE(task.current_stage ->>'planCompletedAt','0') as int) as c_plan_completed_at,
  683 + cast(COALESCE(task.last_stage ->>'planCompletedAt','0') as int) as l_plan_completed_at,
  684 + cast(COALESCE(task.last_stage ->>'realCompletedAt','0') as int) as l_real_completed_at,
685 floor(extract(epoch from now())) as now_time, 685 floor(extract(epoch from now())) as now_time,
686 task.id , 686 task.id ,
687 task.alias , 687 task.alias ,
@@ -61,7 +61,7 @@ func (d *UserDao) AllChildUser(userId int) ([]UserData1, error) { @@ -61,7 +61,7 @@ func (d *UserDao) AllChildUser(userId int) ([]UserData1, error) {
61 // AllParentUser 获取我的全上级 61 // AllParentUser 获取我的全上级
62 func (d *UserDao) AllParentUser(userId int) ([]UserData1, error) { 62 func (d *UserDao) AllParentUser(userId int) ([]UserData1, error) {
63 sqlStr := `with 63 sqlStr := `with
64 --- 人员自身以及全 64 +-- 人员自身以及全
65 recursive t_user as ( 65 recursive t_user as (
66 ( 66 (
67 select "user".id,"user".parent_id ,"user".account,"user".name,1 as "level" 67 select "user".id,"user".parent_id ,"user".account,"user".name,1 as "level"
@@ -80,5 +80,5 @@ recursive t_user as ( @@ -80,5 +80,5 @@ recursive t_user as (
80 result := []UserData1{} 80 result := []UserData1{}
81 tx := d.transactionContext.PgTx 81 tx := d.transactionContext.PgTx
82 _, err := tx.Query(&result, sqlStr, userId) 82 _, err := tx.Query(&result, sqlStr, userId)
83 - return result, err 83 + return nil, err
84 } 84 }
@@ -8,7 +8,6 @@ import ( @@ -8,7 +8,6 @@ import (
8 8
9 "github.com/beego/beego/v2/server/web" 9 "github.com/beego/beego/v2/server/web"
10 "github.com/linmadan/egglib-go/web/beego/filters" 10 "github.com/linmadan/egglib-go/web/beego/filters"
11 - "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/log"  
12 _ "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/port/beego/routers" 11 _ "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/port/beego/routers"
13 ) 12 )
14 13
@@ -42,6 +41,6 @@ func init() { @@ -42,6 +41,6 @@ func init() {
42 time.Local = timeLocal 41 time.Local = timeLocal
43 42
44 web.InsertFilter("/*", web.BeforeRouter, filters.AllowCors()) 43 web.InsertFilter("/*", web.BeforeRouter, filters.AllowCors())
45 - web.InsertFilter("/*", web.BeforeExec, filters.CreateRequstLogFilter(log.Logger)) 44 + // web.InsertFilter("/*", web.BeforeExec, filters.CreateRequstLogFilter(log.Logger))
46 45
47 } 46 }