bi_dashboard_classify.go 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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. // tableName
  21. func (m *BiDashboardClassify) TableName() string {
  22. return "bi_dashboard_classify"
  23. }
  24. // add
  25. func AddBiDashboardClassify(item *BiDashboardClassify) (lastId int64, err error) {
  26. err = global.DEFAULT_DmSQL.Create(item).Error
  27. lastId = int64(item.BiDashboardClassifyId)
  28. return
  29. }
  30. // update
  31. func EditDashboardClassify(item *BiDashboardClassify) (err error) {
  32. return global.DEFAULT_DmSQL.Model(item).Updates(item).Error
  33. }
  34. type RespGroupList struct {
  35. MyList []*BiDashboard
  36. OtherList []*RespOtherGroupListItem
  37. }
  38. type RespMyGroupListItem struct {
  39. GroupId int64 `description:"目录id"`
  40. GroupName string `description:"目录名称"`
  41. AdminId int `description:"目录创建者账号ID"`
  42. DashboardList []*BiDashboard
  43. }
  44. type RespOtherGroupListItem struct {
  45. GroupId int64 `description:"目录id"`
  46. GroupName string `description:"目录名称"`
  47. AdminId int `description:"目录创建者账号ID"`
  48. DashboardList []*BiDashboard
  49. }
  50. type RespGroupDashboardListItem struct {
  51. GroupPptId int64 `description:"目录和ppt绑定序号"`
  52. PptId int64 `description:"ppt ID"`
  53. Title string `description:"标题"`
  54. AdminId int `description:"移动ppt到该目录的系统用户id"`
  55. AdminRealName string `description:"系统用户名称"`
  56. PptVersion int8 `description:"是否ppt的旧版本;1:旧的,2:新的"`
  57. IsSingleShare int8 `description:"是否是单个共享ppt,0未单个共享,1共享"`
  58. PptxUrl string `description:"pptx下载地址"`
  59. ReportId int `description:"关联的报告ID"`
  60. ReportCode string `description:"关联的报告code"`
  61. PptCreateTime string `description:"ppt创建时间"`
  62. PptModifyTime string `description:"ppt修改时间"`
  63. PublishTime string `description:"发布时间"`
  64. PptPage int `description:"PPT总页数"`
  65. IsReceived int8 `description:"是否收到的共享,0:不是,1:是"`
  66. IsGrant int8 `description:"是否分配了权限,0:不是,1:是"`
  67. TitleSetting string `description:"PPT标题设置"`
  68. }
  69. func GetBiDashboardClassifyAllList() (list []*BiDashboardClassify, err error) {
  70. err = global.DEFAULT_DmSQL.Select("*").Find(&list).Error
  71. return
  72. }
  73. func GetBiDashboardClassifyById(id int) (item *BiDashboardClassify, err error) {
  74. err = global.DEFAULT_DmSQL.Where("bi_dashboard_classify_id = ?", id).First(&item).Error
  75. return
  76. }
  77. type AddDashboardClassifyReq struct {
  78. ClassifyName string `description:"看板名称"`
  79. }
  80. type EditDashboardClassifyReq struct {
  81. BiDashboardClassifyId int `description:"看板id"`
  82. ClassifyName string `description:"看板名称"`
  83. }
  84. type DelDashboardClassifyReq struct {
  85. BiDashboardClassifyId int `description:"看板id"`
  86. }
  87. // GetBiDashboardClassifyMaxSort 获取看板分类下最大的排序数
  88. func GetBiDashboardClassifyMaxSort() (sort int, err error) {
  89. sql := `SELECT COALESCE(Max(sort), 0) AS sort FROM bi_dashboard_classify `
  90. err = global.DEFAULT_DmSQL.Raw(sql).First(&sort).Error
  91. return
  92. }
  93. // del
  94. func DelBiDashboardClassify(id int) (err error) {
  95. return global.DEFAULT_DmSQL.Where("bi_dashboard_classify_id = ?", id).Delete(&BiDashboardClassify{}).Error
  96. }
  97. type RespPublicGroupListItem struct {
  98. GroupId int64 `description:"目录id"`
  99. GroupName string `description:"目录名称"`
  100. AdminId int `description:"目录创建者账号ID"`
  101. DashboardList []*BiDashboard
  102. Children []*RespPublicGroupListItem
  103. }
  104. // getByName
  105. func GetBiDashboardClassifyByName(classifyName string) (count int64, err error) {
  106. err = global.DEFAULT_DmSQL.Model(&BiDashboardClassify{}).Where("bi_dashboard_classify_name = ?", classifyName).Count(&count).Error
  107. return
  108. }