|
@@ -54,16 +54,23 @@ func (a *CrmFinancialAnalyst) ToView() *AnalystView {
|
|
|
CreatedTime: a.CreatedTime.Format(time.DateTime),
|
|
|
}
|
|
|
}
|
|
|
-func GetAnalystCount() (count int, err error) {
|
|
|
+func GetAnalystCount(condition string) (count int, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
- sql := `SELECT COUNT(*) AS count FROM crm_financial_analysts`
|
|
|
+ sql := `SELECT COUNT(*) AS count FROM crm_financial_analysts WHERE 1=1 `
|
|
|
+ if condition != "" {
|
|
|
+ sql += condition
|
|
|
+ }
|
|
|
err = o.Raw(sql).QueryRow(&count)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-func GetAnalystList(startSize int, pageSize int) (item []*CrmFinancialAnalyst, err error) {
|
|
|
+func GetAnalystList(condition string, startSize int, pageSize int) (item []*CrmFinancialAnalyst, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
- sql := `SELECT * FROM crm_financial_analysts ORDER BY created_time desc LIMIT ?,?`
|
|
|
+ sql := `SELECT * FROM crm_financial_analysts WHERE 1=1`
|
|
|
+ if condition != "" {
|
|
|
+ sql += condition
|
|
|
+ }
|
|
|
+ sql = sql + ` ORDER BY created_time desc LIMIT ?,?`
|
|
|
_, err = o.Raw(sql, startSize, pageSize).QueryRows(&item)
|
|
|
return
|
|
|
}
|