bi_dashboard_classify.go 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. package bi_dashboard
  2. import (
  3. "eta_gn/eta_api/global"
  4. "time"
  5. )
  6. type BiDashboardClassify struct {
  7. BiDashboardClassifyId int `gorm:"primaryKey;autoIncrement;column:bi_dashboard_classify_id"` // bi看板分类id
  8. BiDashboardClassifyName string `gorm:"column:bi_dashboard_classify_name;size:255;not null" ` // 看板分类名称
  9. Sort int `gorm:"column:sort" ` // 排序字段
  10. CreateTime time.Time `gorm:"column:create_time" ` // 创建时间
  11. ModifyTime time.Time `gorm:"column:modify_time"` // 更新时间
  12. }
  13. type BiDashboardClassifyItem struct {
  14. BiDashboardClassifyId int // bi看板分类id
  15. BiDashboardClassifyName string // 看板分类名称
  16. Sort int // 排序字段
  17. CreateTime string // 创建时间
  18. ModifyTime string // 更新时间
  19. }
  20. func (m *BiDashboardClassify) TableName() string {
  21. return "bi_dashboard_classify"
  22. }
  23. func AddBiDashboardClassify(item *BiDashboardClassify) (lastId int64, err error) {
  24. err = global.DEFAULT_DmSQL.Create(item).Error
  25. lastId = int64(item.BiDashboardClassifyId)
  26. return
  27. }
  28. func EditDashboardClassify(item *BiDashboardClassify) (err error) {
  29. return global.DEFAULT_DmSQL.Model(item).Updates(item).Error
  30. }
  31. type RespGroupList struct {
  32. MyList []*BiDashboard
  33. OtherList []*RespOtherGroupListItem
  34. }
  35. type RespMyGroupListItem struct {
  36. GroupId int64 `description:"目录id"`
  37. GroupName string `description:"目录名称"`
  38. AdminId int `description:"目录创建者账号ID"`
  39. DashboardList []*BiDashboard
  40. }
  41. type RespOtherGroupListItem struct {
  42. GroupId int64 `description:"目录id"`
  43. GroupName string `description:"目录名称"`
  44. AdminId int `description:"目录创建者账号ID"`
  45. DashboardList []*BiDashboard
  46. }
  47. type RespGroupDashboardListItem struct {
  48. GroupPptId int64 `description:"目录和ppt绑定序号"`
  49. PptId int64 `description:"ppt ID"`
  50. Title string `description:"标题"`
  51. AdminId int `description:"移动ppt到该目录的系统用户id"`
  52. AdminRealName string `description:"系统用户名称"`
  53. PptVersion int8 `description:"是否ppt的旧版本;1:旧的,2:新的"`
  54. IsSingleShare int8 `description:"是否是单个共享ppt,0未单个共享,1共享"`
  55. PptxUrl string `description:"pptx下载地址"`
  56. ReportId int `description:"关联的报告ID"`
  57. ReportCode string `description:"关联的报告code"`
  58. PptCreateTime string `description:"ppt创建时间"`
  59. PptModifyTime string `description:"ppt修改时间"`
  60. PublishTime string `description:"发布时间"`
  61. PptPage int `description:"PPT总页数"`
  62. IsReceived int8 `description:"是否收到的共享,0:不是,1:是"`
  63. IsGrant int8 `description:"是否分配了权限,0:不是,1:是"`
  64. TitleSetting string `description:"PPT标题设置"`
  65. }
  66. func GetBiDashboardClassifyAllList() (list []*BiDashboardClassify, err error) {
  67. err = global.DEFAULT_DmSQL.Select("*").Find(&list).Error
  68. return
  69. }
  70. func GetBiDashboardClassifyById(id int) (item *BiDashboardClassify, err error) {
  71. err = global.DEFAULT_DmSQL.Where("bi_dashboard_classify_id = ?", id).First(&item).Error
  72. return
  73. }
  74. type AddDashboardClassifyReq struct {
  75. ClassifyName string `description:"看板名称"`
  76. }
  77. type EditDashboardClassifyReq struct {
  78. BiDashboardClassifyId int `description:"看板id"`
  79. ClassifyName string `description:"看板名称"`
  80. }
  81. type DelDashboardClassifyReq struct {
  82. BiDashboardClassifyId int `description:"看板id"`
  83. }
  84. func GetBiDashboardClassifyMaxSort() (sort int, err error) {
  85. sql := `SELECT COALESCE(Max(sort), 0) AS sort FROM bi_dashboard_classify `
  86. err = global.DEFAULT_DmSQL.Raw(sql).First(&sort).Error
  87. return
  88. }
  89. func DelBiDashboardClassify(id int) (err error) {
  90. return global.DEFAULT_DmSQL.Where("bi_dashboard_classify_id = ?", id).Delete(&BiDashboardClassify{}).Error
  91. }
  92. type RespPublicGroupListItem struct {
  93. GroupId int64 `description:"目录id"`
  94. GroupName string `description:"目录名称"`
  95. AdminId int `description:"目录创建者账号ID"`
  96. DashboardList []*BiDashboard
  97. Children []*RespPublicGroupListItem
  98. }
  99. func GetBiDashboardClassifyByName(classifyName string) (count int64, err error) {
  100. err = global.DEFAULT_DmSQL.Model(&BiDashboardClassify{}).Where("bi_dashboard_classify_name = ?", classifyName).Count(&count).Error
  101. return
  102. }