123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- package residual_analysis_model
- import (
- "github.com/beego/beego/v2/client/orm"
- "time"
- )
- type edbDataResidualAnalysis struct {
- EdbDataId int `orm:"column(edb_data_id);pk;auto" description:"自增id"`
- EdbInfoId int `orm:"column(edb_info_id)" description:"指标id"`
- EdbCode string `orm:"column(edb_code)" description:"指标编码"`
- DataTime string `orm:"column(data_time)" description:"数据日期"`
- Value float64 `orm:"column(value)" description:"数据值"`
- CreateTime time.Time `orm:"column(create_time)" description:"创建时间"`
- ModifyTime time.Time `orm:"column(modify_time)" description:"修改时间"`
- DataTimeStamp int64 `orm:"column(data_timestamp)"`
- }
- func init() {
- orm.RegisterModel(new(edbDataResidualAnalysis))
- }
- // DeleteResidualAnalysisDataByEdbCode 根据指标编码删除数据
- func DeleteResidualAnalysisDataByEdbCode(edbCode string) error {
- o := orm.NewOrmUsingDB("data")
- sql := `delete from edb_data_residual_analysis where edb_code = ?`
- _, err := o.Raw(sql, edbCode).Exec()
- return err
- }
- // AddResidualAnalysisData 新增指标数据
- func AddResidualAnalysisData(dataList []edbDataResidualAnalysis) (num int64, err error) {
- o := orm.NewOrmUsingDB("data")
- num, err = o.InsertMulti(len(dataList), dataList)
- if err != nil {
- return 0, err
- }
- return num, nil
- }
- // GetDataListByCondition 根据条件查询所有数据
- func GetDataListByCondition(condition string, pars []interface{}) (items []edbDataResidualAnalysis, err error) {
- o := orm.NewOrmUsingDB("data")
- sql := `select * from edb_data_residual_analysis where 1=1` + condition
- _, err = o.Raw(sql, pars...).QueryRows(&items)
- return items, err
- }
- // RefreshDataTimestamp 刷新残差指标时间戳
- func (m *edbDataResidualAnalysis) RefreshDataTimestamp(cols []string) {
- o := orm.NewOrmUsingDB("data")
- _, err := o.Update(m, cols...)
- if err != nil {
- return
- }
- }
|