123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- package bi_dashboard
- import (
- "github.com/beego/beego/v2/client/orm"
- "time"
- )
- type BiDashboardClassify struct {
- BiDashboardClassifyId int `orm:"column(bi_dashboard_classify_id);pk"` // bi看板分类id
- BiDashboardClassifyName string `gorm:"column:bi_dashboard_classify_name;size:255;not null" ` // 看板分类名称
- Sort int `gorm:"column:sort" ` // 排序字段
- CreateTime time.Time `gorm:"column:create_time" ` // 创建时间
- ModifyTime time.Time `gorm:"column:modify_time"` // 更新时间
- }
- type BiDashboardClassifyItem struct {
- BiDashboardClassifyId int // bi看板分类id
- BiDashboardClassifyName string // 看板分类名称
- Sort int // 排序字段
- CreateTime string // 创建时间
- ModifyTime string // 更新时间
- }
- // tableName
- func (m *BiDashboardClassify) TableName() string {
- return "bi_dashboard_classify"
- }
- // add
- func AddBiDashboardClassify(item *BiDashboardClassify) (lastId int64, err error) {
- o := orm.NewOrm()
- lastId, err = o.Insert(item)
- return
- }
- // update
- func EditDashboardClassify(item *BiDashboardClassify) (err error) {
- o := orm.NewOrm()
- _, err = o.Raw("UPDATE bi_dashboard_classify SET bi_dashboard_classify_name=?,sort=?,modify_time=? WHERE bi_dashboard_classify_id=?", item.BiDashboardClassifyName, item.Sort, item.ModifyTime, item.BiDashboardClassifyId).Exec()
- return
- }
- type RespGroupList struct {
- MyList []*BiDashboard
- OtherList []*RespOtherGroupListItem
- }
- type RespMyGroupListItem struct {
- GroupId int64 `description:"目录id"`
- GroupName string `description:"目录名称"`
- AdminId int `description:"目录创建者账号ID"`
- DashboardList []*BiDashboard
- }
- type RespOtherGroupListItem struct {
- GroupId int64 `description:"目录id"`
- GroupName string `description:"目录名称"`
- AdminId int `description:"目录创建者账号ID"`
- DashboardList []*BiDashboard
- }
- type RespGroupDashboardListItem struct {
- GroupPptId int64 `description:"目录和ppt绑定序号"`
- PptId int64 `description:"ppt ID"`
- Title string `description:"标题"`
- AdminId int `description:"移动ppt到该目录的系统用户id"`
- AdminRealName string `description:"系统用户名称"`
- PptVersion int8 `description:"是否ppt的旧版本;1:旧的,2:新的"`
- IsSingleShare int8 `description:"是否是单个共享ppt,0未单个共享,1共享"`
- PptxUrl string `description:"pptx下载地址"`
- ReportId int `description:"关联的报告ID"`
- ReportCode string `description:"关联的报告code"`
- PptCreateTime string `description:"ppt创建时间"`
- PptModifyTime string `description:"ppt修改时间"`
- PublishTime string `description:"发布时间"`
- PptPage int `description:"PPT总页数"`
- IsReceived int8 `description:"是否收到的共享,0:不是,1:是"`
- IsGrant int8 `description:"是否分配了权限,0:不是,1:是"`
- TitleSetting string `description:"PPT标题设置"`
- }
- func GetBiDashboardClassifyAllList() (list []*BiDashboardClassify, err error) {
- //err = global.DEFAULT_DmSQL.Select("*").Find(&list).Error
- o := orm.NewOrm()
- _, err = o.Raw("SELECT * FROM bi_dashboard_classify").QueryRows(&list)
- return
- }
- func GetBiDashboardClassifyById(id int) (item *BiDashboardClassify, err error) {
- //err = global.DEFAULT_DmSQL.Where("bi_dashboard_classify_id = ?", id).First(&item).Error
- o := orm.NewOrm()
- err = o.Raw("SELECT * FROM bi_dashboard_classify where bi_dashboard_classify_id=?", id).QueryRow(&item)
- return
- }
- type AddDashboardClassifyReq struct {
- ClassifyName string `description:"看板名称"`
- }
- type EditDashboardClassifyReq struct {
- BiDashboardClassifyId int `description:"看板id"`
- ClassifyName string `description:"看板名称"`
- }
- type DelDashboardClassifyReq struct {
- BiDashboardClassifyId int `description:"看板id"`
- }
- // GetBiDashboardClassifyMaxSort 获取看板分类下最大的排序数
- func GetBiDashboardClassifyMaxSort() (sort int, err error) {
- sql := `SELECT COALESCE(Max(sort), 0) AS sort FROM bi_dashboard_classify `
- //err = global.DEFAULT_DmSQL.Raw(sql).First(&sort).Error
- o := orm.NewOrm()
- err = o.Raw(sql).QueryRow(&sort)
- return
- }
- // del
- //func DelBiDashboardClassify(id int) (err error) {
- // return global.DEFAULT_DmSQL.Where("bi_dashboard_classify_id = ?", id).Delete(&BiDashboardClassify{}).Error
- //}
- type RespPublicGroupListItem struct {
- GroupId int64 `description:"目录id"`
- GroupName string `description:"目录名称"`
- AdminId int `description:"目录创建者账号ID"`
- DashboardList []*BiDashboard
- Children []*RespPublicGroupListItem
- }
- // getByName
- func GetBiDashboardClassifyByName(classifyName string) (count int64, err error) {
- //err = global.DEFAULT_DmSQL.Model(&BiDashboardClassify{}).Where("bi_dashboard_classify_name = ?", classifyName).Count(&count).Error
- o := orm.NewOrm()
- err = o.Raw("SELECT count(1) FROM bi_dashboard_classify where bi_dashboard_classify_name=?", classifyName).QueryRow(&count)
- return
- }
|