123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157 |
- 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:非群发"`
- Enabled int `description:"是否可用,1可用,0禁用"`
- Level int `description:"层级"`
- HasChild int `description:"是否有子级别,0:下面没有子分类,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
- }
- type ClassifyListV2Resp struct {
- List []*ClassifyListV2
- }
- type ClassifyListV2 struct {
- Id int `orm:"column(id);pk"`
- ClassifyName string `description:"分类名称"`
- Sort int `description:"排序"`
- ParentId int `description:"父级分类id"`
- CreateTime time.Time `description:"创建时间"`
- ModifyTime time.Time `description:"修改时间"`
- Abstract string `description:"简介"`
- Descript string `description:"描述"`
- ClassifyLabel string `description:"分类标签"`
- ShowType int `description:"展示类型:1-列表 2-专栏"`
- HasTeleconference int `description:"是否有电话会:0-否 1-是"`
- IsShow int `description:"是否在小程序显示:1-显示 0-隐藏"`
- YbFiccSort int `description:"小程序FICC页排序"`
- YbFiccIcon string `description:"小程序FICC页icon"`
- YbFiccPcIcon string `description:"小程序PC端FICC页背景图"`
- YbIconUrl string `description:"小程序已购页icon"`
- YbBgUrl string `description:"小程序已购详情背景图"`
- YbListImg string `description:"小程序研报列表封面图"`
- YbShareBgImg string `description:"小程序研报详情分享背景图"`
- YbRightBanner string `description:"Pc端详情页,右侧,报告合集背景图"`
- RelateTel int `description:"是否在电话会中可选: 0-否; 1-是"`
- RelateVideo int `description:"是否在路演视频中可选: 0-否; 1-是"`
- Enabled int `description:"是否可用,1可用,0禁用"`
- Child []*ClassifyListV2
- ClassifyMenuId int `description:"二级分类-子目录ID"`
- //ClassifyMenuList []*ClassifyMenu
- //ChartPermissionIdList []int `description:"绑定的权限ID"`
- Level int `description:"层级"`
- HasChild int `description:"是否有子级别,0:下面没有子分类,1:下面有子分类;默认:0"`
- }
- // GetClassifyListByParentIdList
- // @Description: 获取分类列表
- // @author: Roc
- // @datetime 2024-06-19 09:49:33
- // @param keyWord string
- // @param enabled int
- // @return items []*ClassifyList
- // @return err error
- func GetClassifyListByParentIdList(parentClassifyIdList []int) (items []*ClassifyListV2, err error) {
- num := len(parentClassifyIdList)
- if num <= 0 {
- return
- }
- sql := `SELECT * FROM classify WHERE id in (` + utils.GetOrmInReplace(num) + `) ORDER BY sort ASC, create_time ASC`
- o := orm.NewOrmUsingDB("rddp")
- _, err = o.Raw(sql, parentClassifyIdList).QueryRows(&items)
- return
- }
|