Pārlūkot izejas kodu

Merge branch 'fix/trace_edb' into debug

# Conflicts:
#	utils/constants.go
Roc 1 gadu atpakaļ
vecāks
revīzija
eefed2670c

+ 6 - 3
models/data_manage/edb_info_calculate_mapping.go

@@ -84,15 +84,18 @@ type EdbInfoCalculateMappingInfo struct {
 	Sort                      int       `description:"计算指标名称排序"`
 	CreateTime                time.Time `description:"创建时间"`
 	ModifyTime                time.Time `description:"修改时间"`
-	EdbType                   int       `description:"指标类型:1:基础指标,2:计算指标"`
+	FromEdbType               int       `description:"来源指标类型:1:基础指标,2:计算指标"`
+	FromEdbInfoType           int       `description:"来源指标类型: 0-基础指标; 1-预测指标"`
+	FromClassifyId            int       `description:"来源指标分类ID"`
+	FromUniqueCode            string    `description:"来源指标唯一编码"`
 }
 
 // GetEdbInfoCalculateMappingListByEdbInfoId 根据生成的指标id获取来源的指标id列表
 func GetEdbInfoCalculateMappingListByEdbInfoId(edbInfoId int) (items []*EdbInfoCalculateMappingInfo, err error) {
 	o := orm.NewOrmUsingDB("data")
-	sql := ` SELECT a.*,b.edb_type FROM edb_info_calculate_mapping AS a
+	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).QueryRows(&items)
 	return
-}
+}

+ 2 - 1
services/data/edb_info.go

@@ -1299,7 +1299,8 @@ func traceEdbInfoByEdbInfoId(edbInfoId int, traceEdbInfo data_manage.TraceEdbInf
 			//RuleTitle: edbInfoRuleMap[v.EdbInfoId],
 			//Child:     make([]data_manage.TraceEdbInfoResp, 0),
 		}
-		if v.EdbType == 2 { // 计算指标
+		// 计算指标/预测指标继续溯源
+		if edbInfoId != v.FromEdbInfoId && (v.FromEdbType == 2 || v.FromEdbInfoType == 1) {
 			// 查过了就不查了
 			if _, ok2 := findIdMap[tmpEdbInfoId]; !ok2 {
 				tmpTraceEdbInfo.Child, err = traceEdbInfoByEdbInfoId(tmpEdbInfoId, tmpTraceEdbInfo, edbInfoRuleMap, findIdMap, existMap, edbMappingMap)