作者 tangxvhui

修复sql 错误

@@ -187,7 +187,7 @@ func (d *TaskDao) CountTaskStageNotHrbp(param ListTaskCondition) (int, error) { @@ -187,7 +187,7 @@ func (d *TaskDao) CountTaskStageNotHrbp(param ListTaskCondition) (int, error) {
187 } 187 }
188 if param.SearchWord != "" { 188 if param.SearchWord != "" {
189 condition = append(condition, param.SearchWord, param.SearchWord) 189 condition = append(condition, param.SearchWord, param.SearchWord)
190 - whereSql += ` and (t_task_tage_1.leader_name like ? or t_task_tage_1.task_alias_name like ?)` 190 + whereSql += ` and (task.leader->>'name' like ? or task.alias like ?)`
191 } 191 }
192 192
193 sqlStr := withSql + whereSql 193 sqlStr := withSql + whereSql
@@ -301,7 +301,7 @@ func (d *TaskDao) CountTaskStageByHrbp(param ListTaskCondition) (int, error) { @@ -301,7 +301,7 @@ func (d *TaskDao) CountTaskStageByHrbp(param ListTaskCondition) (int, error) {
301 } 301 }
302 if param.SearchWord != "" { 302 if param.SearchWord != "" {
303 condition = append(condition, param.SearchWord, param.SearchWord) 303 condition = append(condition, param.SearchWord, param.SearchWord)
304 - whereSql += ` and (t_task_tage_1.leader_name like ? or t_task_tage_1.task_alias_name like ?)` 304 + whereSql += ` and (task.leader->>'name' like ? or task.alias like ?)`
305 } 305 }
306 sqlStr := withSql + whereSql 306 sqlStr := withSql + whereSql
307 tx := d.transactionContext.PgTx 307 tx := d.transactionContext.PgTx
@@ -331,7 +331,7 @@ func (d *TaskDao) CountTaskStageAnomalyNotHrbp(param ListTaskCondition) (int, er @@ -331,7 +331,7 @@ func (d *TaskDao) CountTaskStageAnomalyNotHrbp(param ListTaskCondition) (int, er
331 } 331 }
332 if param.SearchWord != "" { 332 if param.SearchWord != "" {
333 condition = append(condition, param.SearchWord, param.SearchWord) 333 condition = append(condition, param.SearchWord, param.SearchWord)
334 - whereSql += ` and (t_task_tage_1.leader_name like ? or t_task_tage_1.task_alias_name like ?)` 334 + whereSql += ` and (task.leader->>'name' like ? or task.alias like ?)`
335 } 335 }
336 sqlStr := withSql + whereSql 336 sqlStr := withSql + whereSql
337 tx := d.transactionContext.PgTx 337 tx := d.transactionContext.PgTx
@@ -363,7 +363,7 @@ func (d *TaskDao) CountTaskStageAnomalyByHrbp(param ListTaskCondition) (int, err @@ -363,7 +363,7 @@ func (d *TaskDao) CountTaskStageAnomalyByHrbp(param ListTaskCondition) (int, err
363 } 363 }
364 if param.SearchWord != "" { 364 if param.SearchWord != "" {
365 condition = append(condition, param.SearchWord, param.SearchWord) 365 condition = append(condition, param.SearchWord, param.SearchWord)
366 - whereSql += ` and (t_task_tage_1.leader_name like ? or t_task_tage_1.task_alias_name like ?)` 366 + whereSql += ` and (task.leader->>'name' like ? or task.alias like ?)`
367 } 367 }
368 368
369 sqlStr := withSql + whereSql 369 sqlStr := withSql + whereSql
@@ -413,7 +413,7 @@ func (d *TaskDao) TaskAnomaly(leaderId []string, anomaly int) ([]TaskStageData, @@ -413,7 +413,7 @@ func (d *TaskDao) TaskAnomaly(leaderId []string, anomaly int) ([]TaskStageData,
413 task.leader ->>'name' as leader_name, 413 task.leader ->>'name' as leader_name,
414 task.anomaly 414 task.anomaly
415 from task 415 from task
416 - where task.anomaly >=? and task.leader ->'id' in(?) ` 416 + where task.anomaly >=? and task.leader ->>'id' in(?) `
417 result := []TaskStageData{} 417 result := []TaskStageData{}
418 tx := d.transactionContext.PgTx 418 tx := d.transactionContext.PgTx
419 _, err := tx.Query(&result, sqlStr, anomaly, pg.In(leaderId)) 419 _, err := tx.Query(&result, sqlStr, anomaly, pg.In(leaderId))
@@ -436,7 +436,7 @@ func (d *TaskDao) CountTaskAnomalyNotHrbp(param ListTaskCondition) (int, error) @@ -436,7 +436,7 @@ func (d *TaskDao) CountTaskAnomalyNotHrbp(param ListTaskCondition) (int, error)
436 } 436 }
437 if param.SearchWord != "" { 437 if param.SearchWord != "" {
438 condition = append(condition, param.SearchWord, param.SearchWord) 438 condition = append(condition, param.SearchWord, param.SearchWord)
439 - whereSql += ` and (t_task_tage_1.leader_name like ? or t_task_tage_1.task_alias_name like ?)` 439 + whereSql += ` and (task.leader->>'name' like ? or task.alias like ?)`
440 } 440 }
441 sqlStr := withSql + whereSql 441 sqlStr := withSql + whereSql
442 tx := d.transactionContext.PgTx 442 tx := d.transactionContext.PgTx
@@ -462,7 +462,7 @@ func (d *TaskDao) CountTaskAnomalyByHrbp(param ListTaskCondition) (int, error) { @@ -462,7 +462,7 @@ func (d *TaskDao) CountTaskAnomalyByHrbp(param ListTaskCondition) (int, error) {
462 } 462 }
463 if param.SearchWord != "" { 463 if param.SearchWord != "" {
464 condition = append(condition, param.SearchWord, param.SearchWord) 464 condition = append(condition, param.SearchWord, param.SearchWord)
465 - whereSql += ` and (t_task_tage_1.leader_name like ? or t_task_tage_1.task_alias_name like ?)` 465 + whereSql += ` and (task.leader->>'name' like ? or task.alias like ?)`
466 } 466 }
467 sqlStr := withSql + whereSql 467 sqlStr := withSql + whereSql
468 tx := d.transactionContext.PgTx 468 tx := d.transactionContext.PgTx