12345678910111213141516171819202122232425262728293031323334353637383940 |
- package cygx
- import (
- "github.com/beego/beego/v2/client/orm"
- "time"
- )
- type CygxResourceData struct {
- Id int `orm:"column(id);pk"`
- SourceId int `description:"资源ID"`
- Source string `description:"资源类型 报告 :article 、图表 :newchart、微路演 :roadshow、活动 :activity、活动视频:activityvideo、活动音频:activityvoice、专项调研活动:activityspecial"`
- Title string `description:"标题"`
- Annotation string `description:"核心观点"`
- CreateTime time.Time `description:"创建时间"`
- PublishDate string `description:"发布时间"`
- Abstract string `description:"摘要"`
- }
- func AddCygxResourceData(item *CygxResourceData) (lastId int64, err error) {
- o := orm.NewOrm()
- lastId, err = o.Insert(item)
- return
- }
- func DeleteResourceData(sourceId int, source string) (err error) {
- o := orm.NewOrm()
- sql := ` DELETE FROM cygx_resource_data WHERE source_id = ? AND source =? `
- _, err = o.Raw(sql, sourceId, source).Exec()
- return
- }
- func UpdateResourceData(sourceId int, source, publishDate string) (err error) {
- o := orm.NewOrm()
- sql := `UPDATE cygx_resource_data SET publish_date=? WHERE source_id=? AND source =? `
- _, err = o.Raw(sql, publishDate, sourceId, source).Exec()
- return
- }
|