meeting_probabilities.go 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. // MeetingProbabilities excel表格详情表
  7. type MeetingProbabilities struct {
  8. MeetingInfoId int `orm:"column(meeting_info_id);pk"`
  9. Content string `description:"表格内容"`
  10. ExcelImage string `description:"表格图片"`
  11. DateTime string `description:"数据日期"`
  12. IsDelete int `description:"是否删除,0:未删除,1:已删除"`
  13. ModifyTime time.Time `description:"最近修改日期"`
  14. CreateTime time.Time `description:"创建日期"`
  15. }
  16. func GetMeetingProbabilities(startDate, endDate string) (list []*MeetingProbabilities, err error) {
  17. o := orm.NewOrm()
  18. sql := `SELECT * FROM meeting_probabilities WHERE create_time>=? AND create_time<=? `
  19. _, err = o.Raw(sql, startDate, endDate).QueryRows(&list)
  20. return
  21. }
  22. // AddMeetingProbabilities 新增表格
  23. func AddMeetingProbabilities(meetingInfo *MeetingProbabilities) (err error) {
  24. o := orm.NewOrm()
  25. // 表格信息入库
  26. lastId, err := o.Insert(meetingInfo)
  27. if err != nil {
  28. return
  29. }
  30. meetingInfo.MeetingInfoId = int(lastId)
  31. return
  32. }
  33. type ISheet struct {
  34. ScrollTop int `json:"scrollTop"`
  35. ScrollLeft int `json:"scrollLeft"`
  36. Index string `json:"index"`
  37. Status int `json:"status"`
  38. JfGirdSelectSave []struct{} `json:"jfgird_select_save"`
  39. LuckySheetSelectSave []struct{} `json:"luckysheet_select_save"`
  40. Data [][]interface{} `json:"data"`
  41. Config map[string]struct {
  42. } `json:"config"`
  43. VisibleDataRow []int `json:"visibledatarow"`
  44. VisibleDataColumn []int `json:"visibledatacolumn"`
  45. ChWidth int `json:"ch_width"`
  46. RhHeight int `json:"rh_height"`
  47. LuckySheetSelectionRange []int `json:"luckysheet_selection_range"`
  48. ZoomRatio int `json:"zoomRatio"`
  49. CellData []ISheetCellData `json:"celldata"`
  50. }
  51. type ISheetData struct {
  52. M string `json:"m"`
  53. Ct ISheetDataCt `json:"ct"`
  54. V string `json:"v"`
  55. }
  56. type ISheetDataCt struct {
  57. Fa string `json:"fa"`
  58. T string `json:"t"`
  59. }
  60. type ISheetCellData struct {
  61. R int `json:"r"`
  62. C int `json:"c"`
  63. V ISheetData `json:"v"`
  64. }
  65. type SheetData struct {
  66. Data [][]*struct {
  67. Ct struct {
  68. Fa string `json:"fa"`
  69. T string `json:"t"`
  70. } `json:"ct"`
  71. M string `json:"m"`
  72. V float64 `json:"v"`
  73. } `json:"data"`
  74. }
  75. // AddExcelInfoReq 新增表格请求
  76. type AddExcelInfoReq struct {
  77. ExcelName string `description:"表格名称"`
  78. Source int `description:"表格来源,1:excel插件的表格,2:自定义表格,默认:1"`
  79. ExcelType int `description:"表格类型,1:指标列,2:日期列,默认:1"`
  80. ExcelImage string `description:"表格截图"`
  81. ExcelClassifyId int `description:"分类id"`
  82. Content string `description:"Excel表格内容"`
  83. TableData interface{} `description:"自定义表格的数据内容"`
  84. }
  85. func GetMeetingProbabilitiesMaxDate() (max_date time.Time, err error) {
  86. o := orm.NewOrm()
  87. sql := ` SELECT max(a.date_time)as max_date FROM meeting_probabilities as a `
  88. err = o.Raw(sql).QueryRow(&max_date)
  89. return
  90. }