package excel import ( "eta/eta_task/utils" "github.com/beego/beego/v2/client/orm" "time" ) // ExcelEdbMapping excel与指标的关系表 type ExcelEdbMapping struct { ExcelEdbMappingId int `orm:"column(excel_edb_mapping_id);pk"` ExcelInfoId int `description:"excel的id"` Source int `description:"表格来源,1:excel插件的表格,2:自定义表格,3:混合表格,4:自定义分析,默认:1"` EdbInfoId int `description:"计算指标id"` CreateTime time.Time `description:"创建时间"` ModifyTime time.Time `description:"修改时间"` } // GetExcelEdbMappingTotalBySource 根据表格类型获取总数 func GetExcelEdbMappingTotalBySource(sources []int) (total int, err error) { o := orm.NewOrmUsingDB("data") sql := ` SELECT count(*) FROM excel_edb_mapping WHERE source in (` + utils.GetOrmInReplace(len(sources)) + `)` err = o.Raw(sql, sources).QueryRow(&total) return } // GetExcelEdbMappingListBySource 根据表格类型获取列表 func GetExcelEdbMappingListBySource(sources []int, pageIndex, pageSize int) (items []*ExcelEdbMapping, err error) { o := orm.NewOrmUsingDB("data") sql := ` SELECT * FROM excel_edb_mapping WHERE source in (` + utils.GetOrmInReplace(len(sources)) + `) Limit ?,? ` _, err = o.Raw(sql, sources, pageIndex, pageSize).QueryRows(&items) return }