|
@@ -1202,13 +1202,23 @@ func ReplaceChartEdb(oldEdbInfo, newEdbInfo *EdbInfo) (relationEdbInfoIdList []i
|
|
|
{
|
|
|
//获取所有包含的计算指标
|
|
|
mappingList := make([]*EdbInfoCalculateMapping, 0)
|
|
|
- fields := []string{"edb_info_calculate_mapping_id", "edb_info_id", "source", "source_name", "edb_code", "from_edb_info_id", "from_edb_code", "from_edb_name", "from_source", "from_source_name", "move_value", "sort", "create_time", "modify_time", "from_tag", "from_sub_source"}
|
|
|
- msql := fmt.Sprintf(` SELECT %s FROM edb_info_calculate_mapping WHERE from_edb_info_id=? GROUP BY %s `, strings.Join(fields, ","), strings.Join(fields, ","))
|
|
|
- err = to.Raw(msql, oldEdbInfo.EdbInfoId).Find(&mappingList).Error
|
|
|
+ queryList := make([]*EdbInfoCalculateMapping, 0)
|
|
|
+ //fields := []string{"edb_info_calculate_mapping_id", "edb_info_id", "source", "source_name", "edb_code", "from_edb_info_id", "from_edb_code", "from_edb_name", "from_source", "from_source_name", "move_value", "sort", "create_time", "modify_time", "from_tag", "from_sub_source"}
|
|
|
+ //msql := fmt.Sprintf(` SELECT %s FROM edb_info_calculate_mapping WHERE from_edb_info_id=? GROUP BY %s `, strings.Join(fields, ","), strings.Join(fields, ","))
|
|
|
+ msql := ` SELECT * FROM edb_info_calculate_mapping WHERE from_edb_info_id = ?`
|
|
|
+ err = to.Raw(msql, oldEdbInfo.EdbInfoId).Find(&queryList).Error
|
|
|
if err != nil {
|
|
|
errmsg = "获取计算指标关联基础指标信息失败:Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
+ exists := make(map[int]bool)
|
|
|
+ for _, v := range queryList {
|
|
|
+ if exists[v.EdbInfoId] {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ exists[v.EdbInfoId] = true
|
|
|
+ mappingList = append(mappingList, v)
|
|
|
+ }
|
|
|
replaceCalculateTotal = len(mappingList)
|
|
|
//计算指标
|
|
|
if len(mappingList) > 0 {
|
|
@@ -1236,13 +1246,23 @@ func ReplaceChartEdb(oldEdbInfo, newEdbInfo *EdbInfo) (relationEdbInfoIdList []i
|
|
|
{
|
|
|
//获取所有包含的计算指标
|
|
|
predictEdbConfList := make([]*PredictEdbConf, 0)
|
|
|
- fields := []string{"config_id", "predict_edb_info_id", "source_edb_info_id", "rule_type", "fixed_value", "value", "empty_type", "max_empty_type", "end_date", "modify_time", "create_time"}
|
|
|
- msql := fmt.Sprintf(` SELECT %s FROM predict_edb_conf WHERE source_edb_info_id=? GROUP BY %s `, strings.Join(fields, ","), strings.Join(fields, ","))
|
|
|
+ queryList := make([]*PredictEdbConf, 0)
|
|
|
+ //fields := []string{"config_id", "predict_edb_info_id", "source_edb_info_id", "rule_type", "fixed_value", "value", "empty_type", "max_empty_type", "end_date", "modify_time", "create_time"}
|
|
|
+ //msql := fmt.Sprintf(` SELECT %s FROM predict_edb_conf WHERE source_edb_info_id=? GROUP BY %s `, strings.Join(fields, ","), strings.Join(fields, ","))
|
|
|
+ msql := ` SELECT * FROM predict_edb_conf WHERE source_edb_info_id = ?`
|
|
|
err = to.Raw(msql, oldEdbInfo.EdbInfoId).Scan(&predictEdbConfList).Error
|
|
|
if err != nil {
|
|
|
errmsg = "获取关联的预测指标信息失败:Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
+ exists := make(map[int]bool)
|
|
|
+ for _, v := range queryList {
|
|
|
+ if exists[v.PredictEdbInfoId] {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ exists[v.PredictEdbInfoId] = true
|
|
|
+ predictEdbConfList = append(predictEdbConfList, v)
|
|
|
+ }
|
|
|
replaceCalculateTotal += len(predictEdbConfList)
|
|
|
|
|
|
//替换预测指标的来源指标
|