切换导航条
此项目
正在载入...
登录
allied-creation
/
performance
·
提交
转到一个项目
GitLab
转到群组
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
tangxvhui
2 years ago
提交
6915f86fcbeacb716c1085693e12019884e551bf
1 个父辈
57e4429e
调整异常的任务记录 列表逻辑
隐藏空白字符变更
内嵌
并排对比
正在显示
1 个修改的文件
包含
37 行增加
和
5 行删除
pkg/infrastructure/dao/task_anomaly.go
pkg/infrastructure/dao/task_anomaly.go
查看文件 @
6915f86
...
...
@@ -317,7 +317,23 @@ func (d *TaskAnomalyDao) List2(userId int, companyId int, taskName string, categ
// pageSize 分页大小
// pageNumber 分页页码
func
(
d
*
TaskAnomalyDao
)
List3
(
userId
int
,
companyId
int
,
taskName
string
,
category
int
,
dayTime
string
,
leaderId
[]
string
,
limit
int
,
offset
int
)
(
int
,
[]
ListTaskAnomaly
,
error
)
{
sqlStr1
:=
` with t_task_ignore as (
sqlStr1
:=
` with
recursive t_user as (
(
select "user".id,"user".parent_id ,"user".account,"user".name, 1 as "level"
from "user"
where "user".id=? and "user".deleted_at isnull
)
union
(
select "child_user".id,"child_user".parent_id,"child_user".account,"child_user".name,
"parent_user"."level"+1 as "level"
from "user" as "child_user"
join t_user as "parent_user" on "parent_user".id="child_user".parent_id
where "child_user".deleted_at isnull
)
),
t_task_ignore as (
select task_ignore.id ,task_ignore.task_id
from task_ignore
where user_id = ?
...
...
@@ -349,11 +365,27 @@ func (d *TaskAnomalyDao) List3(userId int, companyId int, taskName string, categ
where t_task_ignore.id isnull and task.deleted_at isnull
and task_anomaly.company_id = ?
and task.related_user@> ?
and task.leader->>'id'
<> ?
and task.leader->>'id'
not in (select id::text from t_user where t_user."level" <3)
and task_anomaly.is_last=1
`
sqlStr2
:=
` with t_task_ignore as (
sqlStr2
:=
` with
recursive t_user as (
(
select "user".id,"user".parent_id ,"user".account,"user".name, 1 as "level"
from "user"
where "user".id=? and "user".deleted_at isnull
)
union
(
select "child_user".id,"child_user".parent_id,"child_user".account,"child_user".name,
"parent_user"."level"+1 as "level"
from "user" as "child_user"
join t_user as "parent_user" on "parent_user".id="child_user".parent_id
where "child_user".deleted_at isnull
)
),
t_task_ignore as (
select task_ignore.id ,task_ignore.task_id
from task_ignore
where user_id = ?
...
...
@@ -364,11 +396,11 @@ func (d *TaskAnomalyDao) List3(userId int, companyId int, taskName string, categ
where t_task_ignore.id isnull and task.deleted_at isnull
and task_anomaly.company_id = ?
and task.related_user@> ?
and task.leader->>'id'
<> ?
and task.leader->>'id'
not in (select id::text from t_user where t_user."level" <3)
and task_anomaly.is_last=1
`
condition
:=
[]
interface
{}{
userId
,
companyId
,
fmt
.
Sprintf
(
"[%d]"
,
userId
),
strconv
.
Itoa
(
userId
)}
condition
:=
[]
interface
{}{
userId
,
userId
,
companyId
,
fmt
.
Sprintf
(
"[%d]"
,
userId
),
strconv
.
Itoa
(
userId
)}
if
len
(
dayTime
)
>
0
{
condition
=
append
(
condition
,
dayTime
)
sqlStr2
+=
` and to_char(task_anomaly.created_at,'yyyy-MM-dd') =? `
...
...
请
注册
或
登录
后发表评论