excel_edb_mapping.go 1.2 KB

123456789101112131415161718192021222324252627282930
  1. package excel
  2. import (
  3. "eta_gn/eta_task/global"
  4. "eta_gn/eta_task/utils"
  5. "time"
  6. )
  7. type ExcelEdbMapping struct {
  8. ExcelEdbMappingId int `gorm:"column:excel_edb_mapping_id;primaryKey"` // `orm:"column(excel_edb_mapping_id);pk"`
  9. ExcelInfoId int `description:"excel的id"`
  10. Source int `description:"表格来源,1:excel插件的表格,2:自定义表格,3:混合表格,4:自定义分析,默认:1"`
  11. EdbInfoId int `description:"计算指标id"`
  12. CreateTime time.Time `description:"创建时间"`
  13. ModifyTime time.Time `description:"修改时间"`
  14. }
  15. func GetExcelEdbMappingTotalBySource(sources []int) (total int, err error) {
  16. sql := ` SELECT count(*) FROM excel_edb_mapping WHERE source in (` + utils.GetOrmInReplace(len(sources)) + `)`
  17. err = global.DmSQL["data"].Raw(sql, sources).Scan(total).Error
  18. return
  19. }
  20. func GetExcelEdbMappingListBySource(sources []int, pageIndex, pageSize int) (items []*ExcelEdbMapping, err error) {
  21. sql := ` SELECT * FROM excel_edb_mapping WHERE source in (` + utils.GetOrmInReplace(len(sources)) + `) Limit ?,? `
  22. err = global.DmSQL["data"].Raw(sql, sources, pageIndex, pageSize).Find(&items).Error
  23. return
  24. }