Ver Fonte

Merge branch 'out_report_2.1' into debug

xiziwen há 4 meses atrás
pai
commit
0e97edd7f9
2 ficheiros alterados com 2 adições e 4 exclusões
  1. 1 2
      models/document_manage_model/outside_report.go
  2. 1 2
      models/report.go

+ 1 - 2
models/document_manage_model/outside_report.go

@@ -52,9 +52,8 @@ func init() {
 // GetOutsideReportListByConditionCount 根据条件查询列表条数
 func GetOutsideReportListByConditionCount(condition string, pars []interface{}) (count int, err error) {
 	o := orm.NewOrmUsingDB("rddp")
-	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 := `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 += condition
-	sql += ` group by t1.outside_report_id `
 	err = o.Raw(sql, pars).QueryRow(&count)
 	if err != nil {
 		return 0, err

+ 1 - 2
models/report.go

@@ -166,12 +166,11 @@ type ReportListResp struct {
 // @return err error
 func GetReportListCountV1(condition string, pars []interface{}) (count int, err error) {
 	o := orm.NewOrmUsingDB("rddp")
-	sql := `SELECT COUNT(1) AS count  FROM report as a left join chart_permission_search_key_word_mapping b on
+	sql := `SELECT COUNT(DISTINCT a.id) AS count  FROM report as a left join chart_permission_search_key_word_mapping b on
 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
 }