作者 tangxvhui

日常保存

... ... @@ -9,4 +9,5 @@ type ListTaskAnomalyCommand struct {
DayTime string `json:"dayTime"` //发生异常的日期
Category int `json:"category"` //异常分类
LeaderId string `json:"leaderId"` //任务负责人id
SubLevel int `json:"subLevel"` //userId 的下级 ,向下查询多少级
}
... ...
... ... @@ -156,7 +156,10 @@ func (srv TaskService) ListTaskAnomaly2(param *command.ListTaskAnomalyCommand) (
})
limit := 500
offset := 0
cnt, anomalyList, err := taskAnomalyDao.List2(param.UserId, param.CompanyId, param.TaskName, param.Category, param.DayTime, param.LeaderId, limit, offset)
if param.SubLevel < 1 {
param.SubLevel = 2
}
cnt, anomalyList, err := taskAnomalyDao.List2(param.UserId, param.CompanyId, param.TaskName, param.Category, param.DayTime, param.LeaderId, param.SubLevel, limit, offset)
if err != nil {
return map[string]interface{}{}, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
... ...
... ... @@ -132,9 +132,12 @@ func (d *TaskAnomalyDao) List1(userId int, companyId int, taskName string, categ
// userId 谁要查看数据
// companyId 公司id
// dayTime 搜索条件日期 ,例:"2006-01-02"
// taskName 任务名称
// category 异常分类
// pageSize 分页大小
// pageNumber 分页页码
func (d *TaskAnomalyDao) List2(userId int, companyId int, taskName string, category int, leaderId string, dayTime string, limit int, offset int) (int, []ListTaskAnomaly, error) {
// subLevel 我的下级的层级
func (d *TaskAnomalyDao) List2(userId int, companyId int, taskName string, category int, leaderId string, dayTime string, subLevel int, limit int, offset int) (int, []ListTaskAnomaly, error) {
sqlStr1 := `with
-- 人员自身以及全下级
recursive t_user as (
... ... @@ -172,7 +175,7 @@ func (d *TaskAnomalyDao) List2(userId int, companyId int, taskName string, categ
and t_task_ignore.id isnull
and task.deleted_at isnull
and task.leader ->>'id' in (
select t_user.id::text from t_user where t_user."level">0
select t_user.id::text from t_user where t_user."level"=?
)
)
select
... ... @@ -232,7 +235,7 @@ func (d *TaskAnomalyDao) List2(userId int, companyId int, taskName string, categ
and t_task_ignore.id isnull
and task.deleted_at isnull
and task.leader ->>'id' in (
select t_user.id::text from t_user where t_user."level">0
select t_user.id::text from t_user where t_user."level"=?
)
)
select count(*) as cnt
... ...