|
@@ -123,14 +123,15 @@ func GetChartCollectDetailByCondition(condition string, pars []interface{}) (ite
|
|
|
|
|
|
func GetChartCollectCountByCondition(condition string, pars []interface{}) (total int64, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
- sql := `SELECT count(*) AS num FROM chart_collect AS a INNER JOIN chart_info AS b ON a.chart_info_id=b.chart_info_id
|
|
|
+ sql := `SELECT a.chart_info_id FROM chart_collect AS a INNER JOIN chart_info AS b ON a.chart_info_id=b.chart_info_id
|
|
|
WHERE 1=1
|
|
|
`
|
|
|
if condition != "" {
|
|
|
sql += condition
|
|
|
}
|
|
|
sql += ` GROUP BY a.chart_info_id`
|
|
|
- err = o.Raw(sql, pars).QueryRow(&total)
|
|
|
+ totalSql := `select count(1) as total from (` + sql + `) as t`
|
|
|
+ err = o.Raw(totalSql, pars).QueryRow(&total)
|
|
|
return
|
|
|
}
|
|
|
|