|
@@ -0,0 +1,108 @@
|
|
|
+package models
|
|
|
+
|
|
|
+import (
|
|
|
+ "fmt"
|
|
|
+ "rdluck_tools/orm"
|
|
|
+ "rdluck_tools/paging"
|
|
|
+ "time"
|
|
|
+)
|
|
|
+
|
|
|
+type CygxReportSelection struct {
|
|
|
+ ArticleId int `orm:"column(article_id);pk"description:"报告id"`
|
|
|
+ AddType string `description:"更新方式 1重新编辑 ,2 继承往期"`
|
|
|
+ Title string `description:"标题"`
|
|
|
+ Department string `description:"作者"`
|
|
|
+ PublishStatus int `description:"发布状态,1已发布,0未发布"`
|
|
|
+ PublishDate time.Time `description:"发布时间"`
|
|
|
+ CreateTime time.Time `description:"创建时间"`
|
|
|
+ LastUpdatedTime time.Time `description:"最后一次更新时间"`
|
|
|
+ Periods string `description:"期数"`
|
|
|
+ HavePublish int `description:"是否发布过,1是,0否"`
|
|
|
+ InheritPeriods string `description:"继承期数"`
|
|
|
+ ProductDescription string `description:"产品说明"`
|
|
|
+ UpdateDescription string `description:"更新说明"`
|
|
|
+ FocusOn string `description:"近期重点关注方向"`
|
|
|
+}
|
|
|
+
|
|
|
+type CygxReportSelectionRep struct {
|
|
|
+ ArticleId int `orm:"column(article_id);pk"description:"报告id"`
|
|
|
+ Title string `description:"标题"`
|
|
|
+ Department string `description:"作者"`
|
|
|
+ PublishDate string `description:"发布时间"`
|
|
|
+ CreateTime string `description:"创建时间"`
|
|
|
+ Abstract string `description:"摘要/更新说明"`
|
|
|
+ UpdateDescription string `description:"更新说明"`
|
|
|
+ IsRed bool `description:"是否标记红点"`
|
|
|
+}
|
|
|
+
|
|
|
+type CygxReportSelectionListPublicRep struct {
|
|
|
+ Paging *paging.PagingItem `description:"分页数据"`
|
|
|
+ List []*CygxReportSelectionRep
|
|
|
+}
|
|
|
+
|
|
|
+type AddCygxReportSelection struct {
|
|
|
+ ArticleId int `description:"报告Id ,传0时新增,大于0时修改"`
|
|
|
+ AddType string `description:"更新方式 1重新编辑 ,2 继承往期"`
|
|
|
+ InheritPeriods string `description:"继承期数"`
|
|
|
+ Title string `description:"标题"`
|
|
|
+ Department string `description:"作者"`
|
|
|
+ PublishDate string `description:"发布时间"`
|
|
|
+ ProductDescription string `description:"产品说明"`
|
|
|
+ UpdateDescription string `description:"更新说明"`
|
|
|
+ FocusOn string `description:"近期重点关注方向"`
|
|
|
+ DoType int `description:"操作方式,1发布,0保存"`
|
|
|
+}
|
|
|
+
|
|
|
+type DetailCygxReportSelectionRep struct {
|
|
|
+ ArticleId int `description:"报告Id ,传0时新增,大于0时修改"`
|
|
|
+ AddType string `description:"更新方式 1重新编辑 ,2 继承往期"`
|
|
|
+ Title string `description:"标题"`
|
|
|
+ Department string `description:"作者"`
|
|
|
+ PublishStatus int `description:"发布状态,1已发布,0未发布"`
|
|
|
+ PublishDate string `description:"发布时间"`
|
|
|
+ CreateTime string `description:"创建时间"`
|
|
|
+ LastUpdatedTime string `description:"最后一次更新时间"`
|
|
|
+ Periods string `description:"期数"`
|
|
|
+ HavePublish int `description:"是否发布过,1是,0否"`
|
|
|
+ InheritPeriods string `description:"继承期数"`
|
|
|
+ InheritPeriodsName string `description:"继承期数名称"`
|
|
|
+ ProductDescription string `description:"产品说明"`
|
|
|
+ UpdateDescription string `description:"更新说明"`
|
|
|
+ FocusOn string `description:"近期重点关注方向"`
|
|
|
+}
|
|
|
+
|
|
|
+type ReportSelectionId struct {
|
|
|
+ ArticleId int `description:"报告I"`
|
|
|
+}
|
|
|
+
|
|
|
+//获取数量
|
|
|
+func GetCygxReportSelectionPublic(condition, tbdb string, pars []interface{}) (count int, err error) {
|
|
|
+ sqlCount := ` SELECT COUNT(1) AS count FROM ` + tbdb + ` as art WHERE 1= 1 `
|
|
|
+ if condition != "" {
|
|
|
+ sqlCount += condition
|
|
|
+ }
|
|
|
+ o := orm.NewOrm()
|
|
|
+ err = o.Raw(sqlCount, pars).QueryRow(&count)
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+//通过纪要ID获取活动详情
|
|
|
+func GetCygxReportSelectionInfoById(articleId int) (item *CygxReportSelectionRep, err error) {
|
|
|
+ o := orm.NewOrm()
|
|
|
+ sql := `SELECT * FROM cygx_report_selection WHERE article_id=?`
|
|
|
+ err = o.Raw(sql, articleId).QueryRow(&item)
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+//列表
|
|
|
+func GetReportSelectionListPublic(condition, tbdb string, pars []interface{}, startSize, pageSize int) (items []*CygxReportSelectionRep, err error) {
|
|
|
+ o := orm.NewOrm()
|
|
|
+ sql := `SELECT * FROM ` + tbdb + ` as art WHERE 1= 1 `
|
|
|
+ if condition != "" {
|
|
|
+ sql += condition
|
|
|
+ }
|
|
|
+ sql += ` ORDER BY art.publish_date DESC LIMIT ?,?`
|
|
|
+ fmt.Println(sql)
|
|
|
+ _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
|
|
|
+ return
|
|
|
+}
|