作者 tangxvhui

调整sql

... ... @@ -322,7 +322,7 @@ func (d *TaskDao) CountTaskStageAnomalyNotHrbp(param ListTaskCondition) (int, er
and task.company_id =?
and task.deleted_at isnull
and (
cast(COALESCE(task.current_stage ->>'plan_completed_at','0') as int)<floor(extract(epoch from now()))
cast(COALESCE(task.current_stage ->>'planCompletedAt','0') as int)<floor(extract(epoch from now()))
or
task.warn_flag = 1
)
... ... @@ -357,7 +357,7 @@ func (d *TaskDao) CountTaskStageAnomalyByHrbp(param ListTaskCondition) (int, err
and task.deleted_at isnull
and t_task_ignore.id isnull
and (
cast(COALESCE(task.current_stage ->>'plan_completed_at','0') as int)<floor(extract(epoch from now()))
cast(COALESCE(task.current_stage ->>'planCompletedAt','0') as int)<floor(extract(epoch from now()))
or
task.warn_flag = 1
)`
... ... @@ -419,7 +419,7 @@ and task.deleted_at isnull
and (
task.last_stage ->>'planCompletedAt'< task.last_stage ->>'realCompletedAt'
or
cast(COALESCE(task.current_stage ->>'plan_completed_at','0') as int) between 1 and floor(extract(epoch from now()))
cast(COALESCE(task.current_stage ->>'planCompletedAt','0') as int) between 1 and floor(extract(epoch from now()))
)
and task.leader ->>'id' in(?) `
... ... @@ -442,7 +442,7 @@ and task.deleted_at isnull
and (
task.last_stage ->>'planCompletedAt'< task.last_stage ->>'realCompletedAt'
or
cast(COALESCE(task.current_stage ->>'plan_completed_at','0') as int) between 1 and floor(extract(epoch from now()))
cast(COALESCE(task.current_stage ->>'planCompletedAt','0') as int) between 1 and floor(extract(epoch from now()))
)
and task.related_user @>? `
... ... @@ -510,7 +510,7 @@ 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 and task.company_id=?`
where 1=1 and task.anomaly>1 and task.company_id=? and task.deleted_at isnull`
condition := []interface{}{param.UserId, param.CompanyId}
whereSql := ``
if param.OnlyMy {
... ... @@ -615,7 +615,7 @@ and task.deleted_at isnull
and (
task.last_stage ->>'planCompletedAt'< task.last_stage ->>'realCompletedAt'
or
cast(COALESCE(task.current_stage ->>'plan_completed_at','0') as int) between 1 and floor(extract(epoch from now()))
cast(COALESCE(task.current_stage ->>'planCompletedAt','0') as int) between 1 and floor(extract(epoch from now()))
) `
result := []TaskData4{}
tx := d.transactionContext.PgTx
... ... @@ -679,9 +679,9 @@ func (d *TaskDao) ListTaskByHrbpV2(param ListTaskCondition) ([]ListTask, error)
),
t_task as (
select
cast(COALESCE(task.current_stage ->>'plan_completed_at','0') as int) as c_plan_completed_at,
cast(COALESCE(task.last_stage ->>'plan_completed_at','0') as int) as l_plan_completed_at,
cast(COALESCE(task.last_stage ->>'real_completed_at','0') as int) as l_real_completed_at,
cast(COALESCE(task.current_stage ->>'planCompletedAt','0') as int) as c_plan_completed_at,
cast(COALESCE(task.last_stage ->>'planCompletedAt','0') as int) as l_plan_completed_at,
cast(COALESCE(task.last_stage ->>'realCompletedAt','0') as int) as l_real_completed_at,
floor(extract(epoch from now())) as now_time,
task.id ,
task.alias ,
... ...
... ... @@ -61,7 +61,7 @@ func (d *UserDao) AllChildUser(userId int) ([]UserData1, error) {
// AllParentUser 获取我的全上级
func (d *UserDao) AllParentUser(userId int) ([]UserData1, error) {
sqlStr := `with
-- 人员自身以及全
-- 人员自身以及全
recursive t_user as (
(
select "user".id,"user".parent_id ,"user".account,"user".name,1 as "level"
... ... @@ -80,5 +80,5 @@ recursive t_user as (
result := []UserData1{}
tx := d.transactionContext.PgTx
_, err := tx.Query(&result, sqlStr, userId)
return result, err
return nil, err
}
... ...
... ... @@ -8,7 +8,6 @@ import (
"github.com/beego/beego/v2/server/web"
"github.com/linmadan/egglib-go/web/beego/filters"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/log"
_ "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/port/beego/routers"
)
... ... @@ -42,6 +41,6 @@ func init() {
time.Local = timeLocal
web.InsertFilter("/*", web.BeforeRouter, filters.AllowCors())
web.InsertFilter("/*", web.BeforeExec, filters.CreateRequstLogFilter(log.Logger))
// web.InsertFilter("/*", web.BeforeExec, filters.CreateRequstLogFilter(log.Logger))
}
... ...