excel_edb_mapping.go 1.4 KB

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