edb_data_residual_analysis.go 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package residual_analysis_model
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. type edbDataResidualAnalysis struct {
  7. EdbDataId int `orm:"column(edb_data_id);pk;auto" description:"自增id"`
  8. EdbInfoId int `orm:"column(edb_info_id)" description:"指标id"`
  9. EdbCode string `orm:"column(edb_code)" description:"指标编码"`
  10. DataTime string `orm:"column(data_time)" description:"数据日期"`
  11. Value float64 `orm:"column(value)" description:"数据值"`
  12. CreateTime time.Time `orm:"column(create_time)" description:"创建时间"`
  13. ModifyTime time.Time `orm:"column(modify_time)" description:"修改时间"`
  14. DataTimeStamp int64 `orm:"column(data_timestamp)"`
  15. }
  16. func init() {
  17. orm.RegisterModel(new(edbDataResidualAnalysis))
  18. }
  19. // DeleteResidualAnalysisDataByEdbCode 根据指标编码删除数据
  20. func DeleteResidualAnalysisDataByEdbCode(edbCode string) error {
  21. o := orm.NewOrmUsingDB("data")
  22. sql := `delete from edb_data_residual_analysis where edb_code = ?`
  23. _, err := o.Raw(sql, edbCode).Exec()
  24. return err
  25. }
  26. // AddResidualAnalysisData 新增指标数据
  27. func AddResidualAnalysisData(dataList []edbDataResidualAnalysis) (num int64, err error) {
  28. o := orm.NewOrmUsingDB("data")
  29. num, err = o.InsertMulti(len(dataList), dataList)
  30. if err != nil {
  31. return 0, err
  32. }
  33. return num, nil
  34. }