12345678910111213141516171819202122232425262728293031323334353637383940 |
- package models
- import (
- "github.com/beego/beego/v2/client/orm"
- "time"
- )
- type TableData struct {
- TableDataId int `orm:"column(table_data_id);pk"`
- TableInfoId int `description:"表格id"`
- Date time.Time `description:"指标时间"`
- DataCol1 string `orm:"column(data_col_1);" description:"第1个表格的数据"`
- DataCol2 string `orm:"column(data_col_2);" description:"第2个表格的数据"`
- DataCol3 string `orm:"column(data_col_3);" description:"第3个表格的数据"`
- DataCol4 string `orm:"column(data_col_4);" description:"第4个表格的数据"`
- DataCol5 string `orm:"column(data_col_5);" description:"第5个表格的数据"`
- DataCol6 string `orm:"column(data_col_6);" description:"第6个表格的数据"`
- DataCol7 string `orm:"column(data_col_7);" description:"第7个表格的数据"`
- DataCol8 string `orm:"column(data_col_8);" description:"第8个表格的数据"`
- DataCol9 string `orm:"column(data_col_9);" description:"第9个表格的数据"`
- DataCol10 string `orm:"column(data_col_10);" description:"第10个表格的数据"`
- DataType int8 `description:"数据类型,默认的区间数据是 1;插入数据是 2"`
- Sort int `description:"排序字段,越小越靠前"`
- AfterTableDataId int `description:"在某个表格数据id后面"`
- BeforeTableDataId int `description:"在某个表格数据id前面"`
- ModifyTime time.Time `description:"修改时间"`
- CreateTime time.Time `description:"创建时间"`
- }
- // GetTableDataListByTableInfoId 根据表格id获取数据列表
- func GetTableDataListByTableInfoId(tableInfoId int) (items []*TableData, err error) {
- o := orm.NewOrmUsingDB("data")
- pars := make([]interface{}, 0)
- pars = append(pars, tableInfoId)
- sql := ` SELECT * FROM table_data WHERE table_info_id = ? order by sort asc `
- _, err = o.Raw(sql, tableInfoId).QueryRows(&items)
- return
- }
|