作者 tangxvhui

更新

@@ -87,7 +87,8 @@ func (d *TaskAnomalyDao) List1(userId int, companyId int, taskName string, categ @@ -87,7 +87,8 @@ func (d *TaskAnomalyDao) List1(userId int, companyId int, taskName string, categ
87 left join t_task_ignore on task_anomaly.task_id=t_task_ignore.task_id 87 left join t_task_ignore on task_anomaly.task_id=t_task_ignore.task_id
88 where t_task_ignore.id isnull and task.deleted_at isnull 88 where t_task_ignore.id isnull and task.deleted_at isnull
89 and task_anomaly.company_id = ? 89 and task_anomaly.company_id = ?
90 - and task.leader->>'id'='?' ` 90 + and task.leader->>'id'='?'
  91 + and task_anomaly.is_last=1 `
91 92
92 sqlStr2 := ` with t_task_ignore as ( 93 sqlStr2 := ` with t_task_ignore as (
93 select task_ignore.id ,task_ignore.task_id 94 select task_ignore.id ,task_ignore.task_id
@@ -99,7 +100,8 @@ func (d *TaskAnomalyDao) List1(userId int, companyId int, taskName string, categ @@ -99,7 +100,8 @@ func (d *TaskAnomalyDao) List1(userId int, companyId int, taskName string, categ
99 left join t_task_ignore on task_anomaly.task_id=t_task_ignore.task_id 100 left join t_task_ignore on task_anomaly.task_id=t_task_ignore.task_id
100 where t_task_ignore.id isnull and task.deleted_at isnull 101 where t_task_ignore.id isnull and task.deleted_at isnull
101 and task_anomaly.company_id = ? 102 and task_anomaly.company_id = ?
102 - and task.leader->>'id'='?' ` 103 + and task.leader->>'id'='?'
  104 + and task_anomaly.is_last=1 `
103 105
104 condition := []interface{}{userId, companyId, userId} 106 condition := []interface{}{userId, companyId, userId}
105 if len(dayTime) > 0 { 107 if len(dayTime) > 0 {
@@ -201,7 +203,9 @@ func (d *TaskAnomalyDao) List2(userId int, companyId int, taskName string, categ @@ -201,7 +203,9 @@ func (d *TaskAnomalyDao) List2(userId int, companyId int, taskName string, categ
201 task_anomaly.notice_who, 203 task_anomaly.notice_who,
202 task_anomaly.created_at 204 task_anomaly.created_at
203 from t_task 205 from t_task
204 - join task_anomaly on t_task.task_id= task_anomaly.task_id ` 206 + join task_anomaly on t_task.task_id= task_anomaly.task_id
  207 + where 1=1 and task_anomaly.is_last=1
  208 + `
205 209
206 sqlStr2 := `with 210 sqlStr2 := `with
207 -- 人员自身以及全下级 211 -- 人员自身以及全下级
@@ -246,7 +250,8 @@ func (d *TaskAnomalyDao) List2(userId int, companyId int, taskName string, categ @@ -246,7 +250,8 @@ func (d *TaskAnomalyDao) List2(userId int, companyId int, taskName string, categ
246 ) 250 )
247 select count(*) as cnt 251 select count(*) as cnt
248 from t_task 252 from t_task
249 - join task_anomaly on t_task.task_id= task_anomaly.task_id ` 253 + join task_anomaly on t_task.task_id= task_anomaly.task_id
  254 + where 1=1 and task_anomaly.is_last=1`
250 condition := []interface{}{userId, userId, companyId, subLevel} 255 condition := []interface{}{userId, userId, companyId, subLevel}
251 if len(dayTime) > 0 { 256 if len(dayTime) > 0 {
252 condition = append(condition, dayTime) 257 condition = append(condition, dayTime)
@@ -322,6 +327,7 @@ func (d *TaskAnomalyDao) List3(userId int, companyId int, taskName string, categ @@ -322,6 +327,7 @@ func (d *TaskAnomalyDao) List3(userId int, companyId int, taskName string, categ
322 and task_anomaly.company_id = ? 327 and task_anomaly.company_id = ?
323 and task.related_user@> ? 328 and task.related_user@> ?
324 and task.leader->>'id' <> ? 329 and task.leader->>'id' <> ?
  330 + and task_anomaly.is_last=1
325 ` 331 `
326 332
327 sqlStr2 := ` with t_task_ignore as ( 333 sqlStr2 := ` with t_task_ignore as (
@@ -335,7 +341,9 @@ func (d *TaskAnomalyDao) List3(userId int, companyId int, taskName string, categ @@ -335,7 +341,9 @@ func (d *TaskAnomalyDao) List3(userId int, companyId int, taskName string, categ
335 where t_task_ignore.id isnull and task.deleted_at isnull 341 where t_task_ignore.id isnull and task.deleted_at isnull
336 and task_anomaly.company_id = ? 342 and task_anomaly.company_id = ?
337 and task.related_user@> ? 343 and task.related_user@> ?
338 - and task.leader->>'id' <> ? ` 344 + and task.leader->>'id' <> ?
  345 + and task_anomaly.is_last=1
  346 + `
339 347
340 condition := []interface{}{userId, companyId, fmt.Sprintf("[%d]", userId), strconv.Itoa(userId)} 348 condition := []interface{}{userId, companyId, fmt.Sprintf("[%d]", userId), strconv.Itoa(userId)}
341 if len(dayTime) > 0 { 349 if len(dayTime) > 0 {