123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- package data_manage
- import (
- "eta_gn/eta_chart_lib/global"
- "eta_gn/eta_chart_lib/utils"
- "time"
- )
- func GetEdbInfoCalculateMap(edbInfoId, source int) (list []*EdbInfo, err error) {
- o := global.DmSQL["data"]
- sql := ` SELECT b.* FROM edb_info_calculate_mapping AS a
- INNER JOIN edb_info AS b ON a.from_edb_info_id=b.edb_info_id
- WHERE a.edb_info_id=? ORDER BY sort ASC `
- err = o.Raw(sql, edbInfoId).Find(&list).Error
- return
- }
- func GetEdbInfoAllCalculateByEdbInfoIdList(edbInfoIdList []int) (list []*EdbInfo, err error) {
- num := len(edbInfoIdList)
- if num <= 0 {
- return
- }
- o := global.DmSQL["data"]
- sql := ` SELECT b.* FROM edb_info_calculate_mapping AS a
- INNER JOIN edb_info AS b ON a.edb_info_id=b.edb_info_id
- WHERE a.from_edb_info_id in (` + utils.GetGormInReplace(num) + `)
- GROUP BY a.edb_info_id
- ORDER BY a.edb_info_id ASC `
- err = o.Raw(sql, edbInfoIdList).Scan(&list).Error
- return
- }
- type EdbInfoCalculateMappingInfo struct {
- EdbInfoCalculateMappingId int `gorm:"column:edb_info_calculate_mapping_id;primaryKey" description:"计算指标映射ID" orm:"column(edb_info_calculate_mapping_id);pk"`
- EdbInfoId int `gorm:"column:edb_info_id" description:"计算指标id"`
- Source int `gorm:"column:source" description:"计算指标来源"`
- SourceName string `gorm:"column:source_name" description:"计算指标来源名称"`
- EdbCode string `gorm:"column:edb_code" description:"计算指标编码"`
- FromEdbInfoId int `gorm:"column:from_edb_info_id" description:"基础指标id"`
- FromEdbCode string `gorm:"column:from_edb_code" description:"基础指标编码"`
- FromEdbName string `gorm:"column:from_edb_name" description:"基础指标名称"`
- FromSource int `gorm:"column:from_source" description:"基础指标来源"`
- FromSourceName string `gorm:"column:from_source_name" description:"基础指标来源名称"`
- MoveValue int `gorm:"column:move_value" description:"领先值"`
- FromTag string `gorm:"column:from_tag" description:"来源指标标签"`
- Sort int `gorm:"column:sort" description:"计算指标名称排序"`
- CreateTime time.Time `gorm:"column:create_time" description:"创建时间"`
- ModifyTime time.Time `gorm:"column:modify_time" description:"修改时间"`
- FromEdbType int `gorm:"column:from_edb_type" description:"来源指标类型:1:基础指标,2:计算指标"`
- FromEdbInfoType int `gorm:"column:from_edb_info_type" description:"来源指标类型: 0-基础指标; 1-预测指标"`
- FromClassifyId int `gorm:"column:from_classify_id" description:"来源指标分类ID"`
- FromUniqueCode string `gorm:"column:from_unique_code" description:"来源指标唯一编码"`
- }
- func GetEdbInfoCalculateMappingListByEdbInfoId(edbInfoId int) (items []*EdbInfoCalculateMappingInfo, err error) {
- o := global.DmSQL["data"]
- sql := ` SELECT a.*,b.edb_type as from_edb_type,b.edb_info_type as from_edb_info_type, b.unique_code AS from_unique_code, b.classify_id AS from_classify_id FROM edb_info_calculate_mapping AS a
- INNER JOIN edb_info AS b ON a.from_edb_info_id=b.edb_info_id
- WHERE a.edb_info_id=? `
- err = o.Raw(sql, edbInfoId).Scan(&items).Error
- return
- }
|