12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- package excel
- import (
- "eta_gn/eta_chart_lib/global"
- "time"
- )
- // ExcelDraft 沙盘推演草稿表
- //
- // type ExcelDraft struct {
- // ExcelDraftId int `orm:"column(excel_draft_id);pk" description:"excel表格草稿记录id"`
- // ExcelId int `description:"excel表格id"`
- // Name string `description:"excel表格名称"`
- // Content string `description:"excel数据"`
- // OpUserId int `description:"最近一次编辑操作的用户id"`
- // OpUserName string `description:"最近一次编辑的用户名称(冗余字段,避免查表)"`
- // CreateTime time.Time `description:"创建时间"`
- // }
- type ExcelDraft struct {
- ExcelDraftId int `gorm:"column:excel_draft_id;primaryKey" description:"excel表格草稿记录id"`
- ExcelId int `gorm:"column:excel_id" description:"excel表格id"`
- Name string `gorm:"column:name" description:"excel表格名称"`
- Content string `gorm:"column:content" description:"excel数据"`
- OpUserId int `gorm:"column:op_user_id" description:"最近一次编辑操作的用户id"`
- OpUserName string `gorm:"column:op_user_name" description:"最近一次编辑的用户名称(冗余字段,避免查表)"`
- CreateTime time.Time `gorm:"column:create_time" description:"创建时间"`
- }
- // AddExcelDraft 添加一个新的excel表格草稿
- func AddExcelDraft(excelDraft *ExcelDraft) (err error) {
- o := global.DmSQL["data"]
- // 新增草稿
- err = o.Create(excelDraft).Error
- return
- }
- // GetLastExcelDraftById 根据沙盘id获取最后一条沙盘草稿详情
- func GetLastExcelDraftById(excelId int) (excelDraft *ExcelDraft, err error) {
- o := global.DmSQL["data"]
- sql := `select * from excel_draft where excel_id = ? order by excel_draft_id desc `
- err = o.Raw(sql, excelId).First(&excelDraft).Error
- return
- }
|