excel_draft.go 1.1 KB

1234567891011121314151617181920212223242526272829
  1. package excel
  2. import (
  3. "eta_gn/eta_chart_lib/global"
  4. "time"
  5. )
  6. type ExcelDraft struct {
  7. ExcelDraftId int `gorm:"column:excel_draft_id;primaryKey" description:"excel表格草稿记录id"`
  8. ExcelId int `gorm:"column:excel_id" description:"excel表格id"`
  9. Name string `gorm:"column:name" description:"excel表格名称"`
  10. Content string `gorm:"column:content" description:"excel数据"`
  11. OpUserId int `gorm:"column:op_user_id" description:"最近一次编辑操作的用户id"`
  12. OpUserName string `gorm:"column:op_user_name" description:"最近一次编辑的用户名称(冗余字段,避免查表)"`
  13. CreateTime time.Time `gorm:"column:create_time" description:"创建时间"`
  14. }
  15. func AddExcelDraft(excelDraft *ExcelDraft) (err error) {
  16. o := global.DmSQL["data"]
  17. err = o.Create(excelDraft).Error
  18. return
  19. }
  20. func GetLastExcelDraftById(excelId int) (excelDraft *ExcelDraft, err error) {
  21. o := global.DmSQL["data"]
  22. sql := `select * from excel_draft where excel_id = ? order by excel_draft_id desc `
  23. err = o.Raw(sql, excelId).First(&excelDraft).Error
  24. return
  25. }