|
@@ -36,16 +36,6 @@ type ReportList struct {
|
|
|
ClassifyDetail
|
|
|
}
|
|
|
|
|
|
-func GetReportListCount(condition string, pars []interface{}) (count int, err error) {
|
|
|
- o := orm.NewOrmUsingDB("rddp")
|
|
|
- sql := ` SELECT COUNT(*) AS count FROM report WHERE 1=1 AND state=2 `
|
|
|
- if condition != "" {
|
|
|
- sql += condition
|
|
|
- }
|
|
|
- err = o.Raw(sql, pars...).QueryRow(&count)
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
// GetReportDailyListCount 获得今日报告数量
|
|
|
func GetReportDailyListCount() (count int, err error) {
|
|
|
o := orm.NewOrmUsingDB("rddp")
|
|
@@ -68,28 +58,10 @@ func GetReportDailyList(startSize, pageSize int) (items []*ReportList, err error
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-func GetReportListByIds(reportIds []string, startSize, pageSize int) (items []*ReportList, err error) {
|
|
|
- o := orm.NewOrmUsingDB("rddp")
|
|
|
- sql := `SELECT a.id,a.add_type,a.classify_id_first,a.classify_name_first,a.classify_id_second,a.classify_name_second,a.title,a.abstract,a.author,a.frequency,
|
|
|
- a.create_time,a.modify_time,a.state,a.publish_time,a.stage,a.msg_is_send,b.id AS classify_id,b.classify_name,b.descript,b.report_author,b.author_descript,
|
|
|
- b.report_img_url,b.head_img_url,b.avatar_img_url,b.column_img_url,a.video_url,a.video_name,a.video_play_seconds,a.video_size,
|
|
|
- CASE WHEN DATE(a.modify_time)=DATE(NOW()) THEN 1 ELSE 0 END AS is_current_date
|
|
|
- FROM report AS a
|
|
|
- INNER JOIN classify AS b ON a.classify_id_second=b.id
|
|
|
- WHERE a.state=2 AND a.id IN (?)
|
|
|
- ORDER BY a.publish_time DESC LIMIT ?,? `
|
|
|
- var reportIdsStr string
|
|
|
- if len(reportIds) > 0 {
|
|
|
- reportIdsStr = strings.Join(reportIds, ",")
|
|
|
- }
|
|
|
- _, err = o.Raw(sql, reportIdsStr, startSize, pageSize).QueryRows(&items)
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
func GetReportCountByClassifyIds(classifyIds []string, condition string) (count int, err error) {
|
|
|
o := orm.NewOrmUsingDB("rddp")
|
|
|
sql := `SELECT COUNT(*) AS count FROM report AS a
|
|
|
- WHERE a.state=2 AND a.classify_id_second IN (%s) `
|
|
|
+ WHERE (a.state=2 OR a.state=6) AND a.classify_id_second IN (%s) `
|
|
|
var reportIdsStr string
|
|
|
if len(classifyIds) > 0 {
|
|
|
reportIdsStr = strings.Join(classifyIds, ",")
|
|
@@ -110,7 +82,7 @@ func GetReportListByClassifyIds(classifyIds []string, condition string, startSiz
|
|
|
CASE WHEN DATE(a.modify_time)=DATE(NOW()) THEN 1 ELSE 0 END AS is_current_date
|
|
|
FROM report AS a
|
|
|
INNER JOIN classify AS b ON a.classify_id_second=b.id
|
|
|
- WHERE a.state=2 AND a.classify_id_second IN (%s) `
|
|
|
+ WHERE (a.state=2 OR a.state=6) AND a.classify_id_second IN (%s) `
|
|
|
|
|
|
var reportIdsStr string
|
|
|
if len(classifyIds) > 0 {
|
|
@@ -125,38 +97,6 @@ func GetReportListByClassifyIds(classifyIds []string, condition string, startSiz
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-func GetReportList(condition string, pars []interface{}, startSize, pageSize int) (items []*ReportList, err error) {
|
|
|
- o := orm.NewOrmUsingDB("rddp")
|
|
|
- sql := ` SELECT a.id,a.add_type,a.classify_id_first,a.classify_name_first,a.classify_id_second,a.classify_name_second,a.title,a.abstract,a.author,a.frequency,
|
|
|
- a.create_time,a.modify_time,a.state,a.publish_time,a.stage,a.msg_is_send,b.id AS classify_id,b.classify_name,b.descript,b.report_author,b.author_descript,
|
|
|
- b.report_img_url,b.head_img_url,b.avatar_img_url,b.column_img_url,a.video_url,a.video_name,a.video_play_seconds,a.video_size,
|
|
|
- CASE WHEN DATE(a.modify_time)=DATE(NOW()) THEN 1 ELSE 0 END AS is_current_date
|
|
|
- FROM report AS a
|
|
|
- INNER JOIN classify AS b ON a.classify_id_second=b.id
|
|
|
- WHERE a.state=2 `
|
|
|
- if condition != "" {
|
|
|
- sql += condition
|
|
|
- }
|
|
|
- sql += ` ORDER BY a.publish_time DESC LIMIT ?,? `
|
|
|
- _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
-func GetReportPermission(userId int, classifyNameSecond string) (count int, err error) {
|
|
|
- o := orm.NewOrm()
|
|
|
- sql := ` SELECT COUNT(1) AS count
|
|
|
- FROM company_report_permission AS crp
|
|
|
- INNER JOIN chart_permission_chapter_mapping AS cpcm ON crp.chart_permission_id = cpcm.chart_permission_id
|
|
|
- INNER JOIN chart_permission_search_key_word_mapping AS cskwm ON cskwm.chart_permission_id=crp.chart_permission_id
|
|
|
- INNER JOIN wx_user wu ON wu.company_id = crp.company_id
|
|
|
- WHERE wu.user_id = ?
|
|
|
- AND cpcm.research_type = 'rddp'
|
|
|
- AND cskwm.from='rddp'
|
|
|
- AND cskwm.key_word=? `
|
|
|
- err = o.Raw(sql, userId, classifyNameSecond).QueryRow(&count)
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
type ReportDetail struct {
|
|
|
Id int `description:"报告Id"`
|
|
|
AddType int `description:"新增方式:1:新增报告,2:继承报告"`
|