calculate_residual_analysis_config_mapping.go 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package models
  2. import (
  3. "fmt"
  4. "github.com/beego/beego/v2/client/orm"
  5. "time"
  6. )
  7. type CalculateResidualAnalysisConfigMapping struct {
  8. CalculateResidualAnalysisConfigMappingId int `orm:"column(calculate_residual_analysis_config_mapping_id);pk;auto" description:"自增id"`
  9. CalculateResidualAnalysisConfigId int `orm:"column(calculate_residual_analysis_config_id)" description:"残差分析配置id"`
  10. EdbInfoId int64 `orm:"column(edb_info_id)" description:"指标id"`
  11. ResidualType int `orm:"column(residual_type)" description:"残差类型: 1-映射残差 2-拟合残差"`
  12. IndexType int `orm:"column(index_type)" description:"指标类型:1-映射指标 2-残差指标 3-因变量指标 4-自变量指标"`
  13. CreateTime time.Time `orm:"column(create_time)" description:"创建时间"`
  14. ModifyTime time.Time `orm:"column(modify_time)" description:"修改时间"`
  15. }
  16. func init() {
  17. orm.RegisterModel(new(CalculateResidualAnalysisConfigMapping))
  18. }
  19. // GetConfigMappingListByConditionNotBase 查询非基础指标的配置映射
  20. func GetConfigMappingListByConditionNotBase(edbInfoId int) (configMapping []CalculateResidualAnalysisConfigMapping, err error) {
  21. o := orm.NewOrm()
  22. sql := `
  23. SELECT
  24. *
  25. FROM
  26. calculate_residual_analysis_config_mapping
  27. WHERE
  28. calculate_residual_analysis_config_id IN ( SELECT calculate_residual_analysis_config_id FROM calculate_residual_analysis_config_mapping WHERE edb_info_id = ? )
  29. AND index_type != 3
  30. AND index_type != 4`
  31. _, err = o.Raw(sql, edbInfoId).QueryRows(&configMapping)
  32. if err != nil {
  33. return nil, fmt.Errorf("查询数据时出错: %v", err)
  34. }
  35. return configMapping, nil
  36. }