1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- package models
- import (
- "github.com/beego/beego/v2/client/orm"
- "time"
- )
- type CygxUserLabelArticle struct {
- Id int `orm:"column(id);pk"`
- UserId int `description:"用户ID"`
- CompanyId int `description:"公司id"`
- RealName string `description:"用户实际名称"`
- Mobile string `description:"手机号"`
- Email string `description:"邮箱"`
- Label string `description:"标签内容"`
- ArticleId int `description:"文章ID"`
- SourceId int `description:"来源ID(产业ID,系列ID)"`
- Source int `description:"来源1:产业、2:系列"`
- CreateTime time.Time `description:"创建时间"`
- ModifyTime time.Time `description:"更新时间"`
- }
- // 添加
- func AddCygxUserLabelArticle(item *CygxUserLabelArticle) (lastId int64, err error) {
- o := orm.NewOrm()
- lastId, err = o.Insert(item)
- return
- }
- // 批量添加
- func AddCygxUserLabelArticleList(items []*CygxUserLabelArticle) (lastId int64, err error) {
- lenitems := len(items)
- if lenitems == 0 {
- return
- }
- o := orm.NewOrm()
- _, err = o.InsertMulti(1, items)
- return
- }
- // 列表
- func GetCygxUserLabelArticleList(condition string, pars []interface{}) (items []*CygxUserLabelArticle, err error) {
- o := orm.NewOrm()
- sql := `SELECT * FROM cygx_user_label_article as art WHERE 1= 1 `
- if condition != "" {
- sql += condition
- }
- _, err = o.Raw(sql, pars).QueryRows(&items)
- return
- }
|