excel_sheet_data.go 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. package excel
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. // ExcelSheetData excel表格详情表
  7. type ExcelSheetData struct {
  8. ExcelDataId int `orm:"column(excel_data_id);pk"`
  9. ExcelInfoId int `description:"数据归属的excel_info的id"`
  10. ExcelSheetId int `description:"数据归属sheet"`
  11. Sort int `description:"数据排序"`
  12. Data string `description:"数据,分页存储"`
  13. ModifyTime time.Time `description:"最近修改日期"`
  14. CreateTime time.Time `description:"创建日期"`
  15. }
  16. // Update 更新 excel表格的sheet基础信息
  17. func (ExcelSheetData *ExcelSheetData) Update(cols []string) (err error) {
  18. o := orm.NewOrmUsingDB("data")
  19. _, err = o.Update(ExcelSheetData, cols...)
  20. return
  21. }
  22. // AddExcelSheetData 新增excel表格的sheet基础信息
  23. func AddExcelSheetData(excelInfo *ExcelSheetData) (err error) {
  24. o := orm.NewOrmUsingDB("data")
  25. // 表格信息入库
  26. lastId, err := o.Insert(excelInfo)
  27. if err != nil {
  28. return
  29. }
  30. excelInfo.ExcelInfoId = int(lastId)
  31. return
  32. }