|
@@ -25,12 +25,12 @@ type OutsideReport struct {
|
|
|
|
|
|
type OutsideReportResp struct {
|
|
type OutsideReportResp struct {
|
|
OutsideReport
|
|
OutsideReport
|
|
- IsCollect int `description:"是否收藏"`
|
|
|
|
|
|
+ IsCollect int `description:"是否收藏"`
|
|
}
|
|
}
|
|
|
|
|
|
type OutsideReportPage struct {
|
|
type OutsideReportPage struct {
|
|
- List []OutsideReportResp `description:"报告列表"`
|
|
|
|
- Paging *paging.PagingItem `description:"分页数据"`
|
|
|
|
|
|
+ List []OutsideReportResp `description:"报告列表"`
|
|
|
|
+ Paging *paging.PagingItem `description:"分页数据"`
|
|
}
|
|
}
|
|
|
|
|
|
type OutsideReportBO struct {
|
|
type OutsideReportBO struct {
|
|
@@ -55,12 +55,23 @@ func init() {
|
|
}
|
|
}
|
|
|
|
|
|
// GetOutsideReportListByConditionCount 根据条件查询列表条数
|
|
// GetOutsideReportListByConditionCount 根据条件查询列表条数
|
|
-func GetOutsideReportListByConditionCount(condition string, pars []interface{}) (count int, err error) {
|
|
|
|
|
|
+func GetOutsideReportListByConditionCount(condition string, pars []interface{}, chartPermissionIdList []string) (count int, err error) {
|
|
o := orm.NewOrmUsingDB("rddp")
|
|
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 `
|
|
|
|
|
|
+ var sql string
|
|
|
|
+ if len(chartPermissionIdList) > 0 {
|
|
|
|
+ sql = `select count(1) from (`
|
|
|
|
+ }
|
|
|
|
+ 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 += condition
|
|
|
|
+ if len(chartPermissionIdList) > 0 {
|
|
|
|
+ sql += ` ) t`
|
|
|
|
+ }
|
|
|
|
+
|
|
err = o.Raw(sql, pars).QueryRow(&count)
|
|
err = o.Raw(sql, pars).QueryRow(&count)
|
|
- if err != nil {
|
|
|
|
|
|
+ if err != nil && err != orm.ErrNoRows {
|
|
return 0, err
|
|
return 0, err
|
|
}
|
|
}
|
|
|
|
|
|
@@ -74,7 +85,7 @@ func GetOutsideReportListByCondition(condition string, pars []interface{}, curre
|
|
sql += condition
|
|
sql += condition
|
|
sql += ` limit ?, ?`
|
|
sql += ` limit ?, ?`
|
|
_, err = o.Raw(sql, pars, (currentIndex-1)*pageSize, pageSize).QueryRows(&list)
|
|
_, err = o.Raw(sql, pars, (currentIndex-1)*pageSize, pageSize).QueryRows(&list)
|
|
- if err != nil {
|
|
|
|
|
|
+ if err != nil && err != orm.ErrNoRows {
|
|
return nil, err
|
|
return nil, err
|
|
}
|
|
}
|
|
|
|
|