1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- package models
- import (
- "eta/eta_hub/utils"
- "github.com/beego/beego/v2/client/orm"
- "github.com/rdlucklib/rdluck_tools/paging"
- "time"
- )
- type Classify struct {
- Id int `orm:"column(id);pk"`
- ClassifyName string `description:"分类名称"`
- Sort int `json:"-"`
- ParentId int `description:"父级分类id"`
- CreateTime time.Time `json:"-" description:"创建时间"`
- ModifyTime time.Time `json:"-" description:"修改时间"`
- Abstract string `json:"-" description:"栏目简介"`
- Descript string `json:"-" description:"分享描述"`
- ReportAuthor string `json:"-" description:"栏目作者"`
- AuthorDescript string `json:"-" description:"作者简介"`
- ColumnImgUrl string `json:"-" description:"栏目配图"`
- HeadImgUrl string `json:"-" description:"头部banner"`
- AvatarImgUrl string `json:"-" description:"头像"`
- ReportImgUrl string `json:"-" description:"报告配图"`
- HomeImgUrl string `json:"-" description:"首页配图"`
- ClassifyLabel string `description:"分类标签"`
- ShowType int `json:"-" description:"展示类型:1-列表 2-专栏"`
- HasTeleconference int `json:"-" description:"是否有电话会:0-否 1-是"`
- VipTitle string `json:"-" description:"研究员头衔"`
- IsShow int `json:"-" description:"是否在小程序显示:1-显示 0-隐藏"`
- YbFiccSort int `json:"-" description:"小程序FICC页排序"`
- YbFiccIcon string `json:"-" description:"小程序FICC页icon"`
- YbFiccPcIcon string `json:"-" description:"小程序PC端FICC页背景图"`
- YbIconUrl string `json:"-" description:"小程序已购页icon"`
- YbBgUrl string `json:"-" description:"小程序已购详情背景图"`
- YbListImg string `json:"-" description:"小程序研报列表封面图"`
- YbShareBgImg string `json:"-" description:"小程序研报详情分享背景图"`
- YbRightBanner string `json:"-" description:"Pc端详情页,右侧,报告合集背景图"`
- RelateTel int `json:"-" description:"是否在电话会中可选: 0-否; 1-是"`
- RelateVideo int `json:"-" description:"是否在路演视频中可选: 0-否; 1-是"`
- IsMassSend int `json:"-" description:"1:群发,0:非群发"`
- }
- type ClassifyListResp struct {
- List []*ClassifyList
- Paging *paging.PagingItem `description:"分页数据"`
- }
- type ClassifyList struct {
- Id int `orm:"column(id);pk"`
- ClassifyName string `description:"分类名称"`
- Sort int `description:"排序"`
- ParentId int `description:"父级分类id"`
- CreateTime time.Time `json:"-" description:"创建时间"`
- ModifyTime time.Time `json:"-" description:"修改时间"`
- Abstract string `description:"简介"`
- Descript string `description:"描述"`
- ClassifyLabel string `description:"分类标签"`
- ShowType int `json:"-" description:"展示类型:1-列表 2-专栏"`
- HasTeleconference int `json:"-" description:"是否有电话会:0-否 1-是"`
- IsShow int `json:"-" description:"是否在小程序显示:1-显示 0-隐藏"`
- YbFiccSort int `json:"-" description:"小程序FICC页排序"`
- YbFiccIcon string `json:"-" description:"小程序FICC页icon"`
- YbFiccPcIcon string `json:"-" description:"小程序PC端FICC页背景图"`
- YbIconUrl string `json:"-" description:"小程序已购页icon"`
- YbBgUrl string `json:"-" description:"小程序已购详情背景图"`
- YbListImg string `json:"-" description:"小程序研报列表封面图"`
- YbShareBgImg string `json:"-" description:"小程序研报详情分享背景图"`
- YbRightBanner string `json:"-" description:"Pc端详情页,右侧,报告合集背景图"`
- RelateTel int `json:"-" description:"是否在电话会中可选: 0-否; 1-是"`
- RelateVideo int `json:"-" description:"是否在路演视频中可选: 0-否; 1-是"`
- Child []*ClassifyItem
- //ClassifyMenuList []*ClassifyMenu
- }
- type ClassifyItem struct {
- Classify
- }
- func GetClassifyChildByParentIds(parentId []int, keyWord string) (items []*Classify, err error) {
- parentIdLen := len(parentId)
- if parentIdLen == 0 {
- return
- }
- o := orm.NewOrmUsingDB("rddp")
- sql := ``
- pars := make([]interface{}, 0)
- pars = append(pars, parentId)
- if keyWord != "" {
- sql = `SELECT * FROM classify WHERE parent_id IN (` + utils.GetOrmInReplace(parentIdLen) + `) AND classify_name LIKE ? ORDER BY create_time ASC `
- pars = append(pars, utils.GetLikeKeyword(keyWord))
- } else {
- sql = `SELECT * FROM classify WHERE parent_id IN (` + utils.GetOrmInReplace(parentIdLen) + `) ORDER BY create_time ASC `
- }
- _, err = o.Raw(sql, pars...).QueryRows(&items)
- return
- }
|