meeting_probabilities.go 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. package data_manage
  2. import (
  3. "eta_gn/eta_task/global"
  4. "time"
  5. )
  6. // MeetingProbabilities excel表格详情表
  7. type MeetingProbabilities struct {
  8. MeetingInfoId int `gorm:"column:meeting_info_id;primaryKey"` //`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. type MeetingProbabilitiesResp struct {
  17. Ret int
  18. Msg string
  19. ErrMsg string
  20. ErrCode string
  21. Data []*MeetingProbabilities `gorm:"-"`
  22. }
  23. // AddMeetingProbabilities 新增表格
  24. func AddMeetingProbabilities(meetingInfo *MeetingProbabilities) (newId int, err error) {
  25. //o := orm.NewOrmUsingDB("data")
  26. //// 表格信息入库
  27. //lastId, err := o.Insert(meetingInfo)
  28. //if err != nil {
  29. // return
  30. //}
  31. //meetingInfo.MeetingInfoId = int(lastId)
  32. //newId = int(lastId)
  33. err = global.DmSQL["data"].Create(meetingInfo).Error
  34. return
  35. }
  36. func GetMeetingProbabilitiesAll(dateStr string) (list []*MeetingProbabilities, err error) {
  37. //o := orm.NewOrm()
  38. //sql := `SELECT * FROM meeting_probabilities WHERE date_time>=?`
  39. //_, err = o.Raw(sql, dateStr).QueryRows(&list)
  40. sql := `SELECT * FROM meeting_probabilities WHERE date_time>=?`
  41. err = global.DEFAULT_DmSQL.Raw(sql, dateStr).Find(&list).Error
  42. return
  43. }
  44. type ISheet struct {
  45. ScrollTop int `json:"scrollTop"`
  46. ScrollLeft int `json:"scrollLeft"`
  47. Index string `json:"index"`
  48. Status int `json:"status"`
  49. JfGirdSelectSave []struct{} `json:"jfgird_select_save"`
  50. LuckySheetSelectSave []struct{} `json:"luckysheet_select_save"`
  51. Data [][]interface{} `json:"data"`
  52. Config map[string]struct {
  53. } `json:"config"`
  54. VisibleDataRow []int `json:"visibledatarow"`
  55. VisibleDataColumn []int `json:"visibledatacolumn"`
  56. ChWidth int `json:"ch_width"`
  57. RhHeight int `json:"rh_height"`
  58. LuckySheetSelectionRange []int `json:"luckysheet_selection_range"`
  59. ZoomRatio int `json:"zoomRatio"`
  60. CellData []ISheetCellData `json:"celldata"`
  61. }
  62. type ISheetData struct {
  63. M string `json:"m"`
  64. Ct ISheetDataCt `json:"ct"`
  65. V string `json:"v"`
  66. }
  67. type ISheetDataCt struct {
  68. Fa string `json:"fa"`
  69. T string `json:"t"`
  70. }
  71. type ISheetCellData struct {
  72. R int `json:"r"`
  73. C int `json:"c"`
  74. V ISheetData `json:"v"`
  75. }
  76. type SheetData struct {
  77. Data [][]*struct {
  78. Ct struct {
  79. Fa string `json:"fa"`
  80. T string `json:"t"`
  81. } `json:"ct"`
  82. M string `json:"m"`
  83. V float64 `json:"v"`
  84. } `json:"data"`
  85. }
  86. // AddExcelInfoReq 新增表格请求
  87. type AddExcelInfoReq struct {
  88. ExcelName string `description:"表格名称"`
  89. Source int `description:"表格来源,1:excel插件的表格,2:自定义表格,默认:1"`
  90. ExcelType int `description:"表格类型,1:指标列,2:日期列,默认:1"`
  91. ExcelImage string `description:"表格截图"`
  92. ExcelClassifyId int `description:"分类id"`
  93. Content string `description:"Excel表格内容"`
  94. TableData interface{} `description:"自定义表格的数据内容"`
  95. }
  96. func GetMeetingProbabilitiesMaxDate() (max_date time.Time, err error) {
  97. //o := orm.NewOrm()
  98. //sql := ` SELECT max(a.date_time)as max_date FROM meeting_probabilities as a `
  99. //err = o.Raw(sql).QueryRow(&max_date)
  100. sql := ` SELECT max(a.date_time)as max_date FROM meeting_probabilities as a `
  101. err = global.DEFAULT_DmSQL.Raw(sql).Scan(&max_date).Error
  102. return
  103. }