123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- package data_stat
- import (
- "github.com/beego/beego/v2/client/orm"
- "github.com/rdlucklib/rdluck_tools/paging"
- "time"
- )
- // EdbInfoUpdateStat 指标更新/刷新 汇总表(数据源明细表)
- type EdbInfoUpdateStat struct {
- Id uint64 `orm:"column(id);pk"`
- EdbInfoId int `description:"指标ID"`
- SourceName string `description:"来源名称"`
- Source int `description:"来源id"`
- EdbCode string `description:"指标编码"`
- EdbName string `description:"指标名称"`
- EdbNameSource string `description:"指标名称来源"`
- Frequency string `description:"频率"`
- Unit string `description:"单位"`
- StartDate string `description:"起始日期"`
- EndDate string `description:"终止日期"`
- SysUserId int `description:"创建人ID"`
- SysUserRealName string `description:"创建人姓名"`
- UniqueCode string `description:"指标唯一编码"`
- EdbCreateTime time.Time `description:"指标创建时间"`
- EdbModifyTime time.Time `description:"指标修改时间"`
- CreateTime time.Time
- LatestDate string `description:"数据最新日期"`
- LatestValue float64 `description:"数据最新值"`
- TerminalCode string `description:"终端编码,用于配置在机器上"`
- DataUpdateTime string `description:"最近一次数据发生变化的时间"`
- ErDataUpdateDate string `description:"本次更新,数据发生变化的最早日期"`
- /*UpdateResult int32 `description:"本次刷新结果:1成功,2失败"`
- UpdateTime string `description:"刷新/修改时间"`
- UpdateFailedReason string `description:"数据未正常刷新原因"`*/
- SourceUpdateResult int `description:"从终端刷新到数据源的刷新结果:1成功,2失败"`
- SourceUpdateFailedReason string `description:"从终端刷新到数据源的数据未正常刷新原因"`
- SourceUpdateTime string `description:"从终端刷新到数据源的 刷新时间"`
- ModifyTime string `description:"修改时间"`
- IsAdd int8 `description:"是否是当日新增的指标:1是,2否"`
- NeedRefresh int8 `description:"今日是否需要定时刷新,1需要,0不需要"` //todo 确认该字段
- HasRefresh int8 `description:"今日是否已刷新,1是,0否"`
- }
- type EdbInfoUpdateStatItem struct {
- Id uint64 `orm:"column(id);pk"`
- EdbInfoId int `description:"指标ID"`
- SourceName string `description:"来源名称"`
- Source int `description:"来源id"`
- EdbCode string `description:"指标编码"`
- EdbName string `description:"指标名称"`
- EdbNameSource string `description:"指标名称来源"`
- Frequency string `description:"频率"`
- Unit string `description:"单位"`
- StartDate string `description:"起始日期"`
- SysUserId int `description:"创建人ID"`
- SysUserRealName string `description:"创建人姓名"`
- LatestDate string `description:"数据最新日期"`
- LatestValue float64 `description:"数据最新值"`
- TerminalCode string `description:"终端编码,用于配置在机器上"`
- DataUpdateTime string `description:"最近一次数据发生变化的时间"`
- ErDataUpdateDate string `description:"本次更新,数据发生变化的最早日期"`
- /* UpdateResult int32 `description:"本次刷新结果:1成功,2失败"`
- UpdateFailedReason string `description:"数据未正常刷新原因"`
- UpdateTime string `description:"当日刷新/修改时间"`*/
- SourceUpdateResult int `description:"从终端刷新到数据源的刷新结果:1成功,2失败"`
- SourceUpdateFailedReason string `description:"从终端刷新到数据源的数据未正常刷新原因"`
- SourceUpdateTime string `description:"从终端刷新到数据源的 刷新时间"`
- IsAdd int8 `description:"是否是当日新增的指标:1是,2否"`
- NeedRefresh int8 `description:"今日是否需要定时刷新,1需要,0不需要"` //todo 确认该字段
- HasRefresh int8 `description:"今日是否已刷新,1是,0否"`
- }
- type GetEdbUpdateStatResp struct {
- List []*EdbInfoUpdateStatItem
- Paging *paging.PagingItem
- }
- func GetEdbUpdateStatByCondition(condition string, pars []interface{}, orderStr string, pageSize, startSize int) (item []*EdbInfoUpdateStat, err error) {
- o := orm.NewOrmUsingDB("data")
- sql := ` SELECT * FROM edb_info_update_stat WHERE 1=1 `
- if condition != "" {
- sql += condition
- }
- if orderStr != "" {
- sql += orderStr
- } else {
- sql += ` ORDER BY create_time DESC, id DESC `
- }
- sql += ` LIMIT ?,? `
- _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&item)
- return
- }
- // GetEdbUpdateStatCount
- func GetEdbUpdateStatCount(condition string, pars []interface{}) (count int, err error) {
- o := orm.NewOrmUsingDB("data")
- sql := ` SELECT count(*) FROM edb_info_update_stat WHERE 1=1 `
- if condition != "" {
- sql += condition
- }
- err = o.Raw(sql, pars).QueryRow(&count)
- return
- }
|