|
@@ -193,7 +193,7 @@ func (m *EtaBusiness) GetItemsByCondition(condition string, pars []interface{},
|
|
|
|
|
|
func (m *EtaBusiness) GetWithChartClassifyCountByCondition(condition string, pars []interface{}) (count int, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
- sql := fmt.Sprintf(`SELECT COUNT(1) FROM %s as e left join business_chart_classify_permission as p on e.eta_business_id = p.eta_business_id WHERE 1=1 %s`, m.TableName(), condition)
|
|
|
+ sql := fmt.Sprintf(`SELECT COUNT(DISTINCT e.eta_business_id) FROM %s as e left join business_chart_classify_permission as p on e.eta_business_id = p.eta_business_id WHERE 1=1 %s`, m.TableName(), condition)
|
|
|
err = o.Raw(sql, pars).QueryRow(&count)
|
|
|
return
|
|
|
}
|
|
@@ -208,7 +208,7 @@ func (m *EtaBusiness) GetPageItemsWithChartClassifyByCondition(condition string,
|
|
|
if orderRule != "" {
|
|
|
order = ` ORDER BY ` + orderRule
|
|
|
}
|
|
|
- sql := fmt.Sprintf(`SELECT %s FROM %s as e left join business_chart_classify_permission as p on e.eta_business_id = p.eta_business_id WHERE 1=1 %s %s LIMIT ?,?`, fields, m.TableName(), condition, order)
|
|
|
+ sql := fmt.Sprintf(`SELECT DISTINCT %s FROM %s as e left join business_chart_classify_permission as p on e.eta_business_id = p.eta_business_id WHERE 1=1 %s %s LIMIT ?,?`, fields, m.TableName(), condition, order)
|
|
|
_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
|
|
|
return
|
|
|
}
|