Browse Source

fix count

xiziwen 4 months ago
parent
commit
ed2f694b7c
2 changed files with 3 additions and 1 deletions
  1. 2 1
      models/document_manage_model/outside_report.go
  2. 1 0
      models/report.go

+ 2 - 1
models/document_manage_model/outside_report.go

@@ -52,8 +52,9 @@ func init() {
 // GetOutsideReportListByConditionCount 根据条件查询列表条数
 func GetOutsideReportListByConditionCount(condition string, pars []interface{}) (count int, err error) {
 	o := orm.NewOrmUsingDB("rddp")
-	sql := `select count(distinct t1.outside_report_id) from outside_report t1 left join chart_permission_search_key_word_mapping t2 on t1.classify_id = t2.classify_id  where 1 = 1 `
+	sql := `select count(t1.outside_report_id) from outside_report t1 left join chart_permission_search_key_word_mapping t2 on t1.classify_id = t2.classify_id  where 1 = 1 `
 	sql += condition
+	sql += ` group by t1.outside_report_id `
 	err = o.Raw(sql, pars).QueryRow(&count)
 	if err != nil {
 		return 0, err

+ 1 - 0
models/report.go

@@ -171,6 +171,7 @@ a.classify_id_first = b.classify_id WHERE 1=1 `
 	if condition != "" {
 		sql += condition
 	}
+	sql += ` group by a.id `
 	err = o.Raw(sql, pars).QueryRow(&count)
 	return
 }