浏览代码

指标替换,过滤自定义分析表格

xyxie 10 月之前
父节点
当前提交
9e795c914e
共有 2 个文件被更改,包括 11 次插入2 次删除
  1. 9 0
      models/data_manage/excel/excel_edb_mapping.go
  2. 2 2
      services/edb_info_replace.go

+ 9 - 0
models/data_manage/excel/excel_edb_mapping.go

@@ -119,6 +119,15 @@ func GetAllExcelEdbMappingByExcelInfoId(excelInfoId int) (items []*ExcelEdbMappi
 	return
 }
 
+// GetExcelEdbMappingByEdbInfoIdAndSource 根据指标id获取配置关系
+func GetExcelEdbMappingByEdbInfoIdAndSource(edbInfoId int, sources []int) (items []*ExcelEdbMapping, err error) {
+	o := orm.NewOrmUsingDB("data")
+	sql := ` SELECT *  FROM excel_edb_mapping WHERE 1=1 AND edb_info_id = ? AND source in (` + utils.GetOrmInReplace(len(sources)) + `) `
+
+	_, err = o.Raw(sql, edbInfoId, sources).QueryRows(&items)
+	return
+}
+
 // DeleteCustomAnalysisExcelEdbMappingByEdbInfoId
 // @Description: 根据指标id删除与自定义分析表格的关系
 // @author: Roc

+ 2 - 2
services/edb_info_replace.go

@@ -81,8 +81,8 @@ func ReplaceEdbInExcel(oldEdbInfo, newEdbInfo *data_manage.EdbInfo) (err error)
 			go alarm_msg.SendAlarmMsg("替换表格中的指标失败提醒,errmsg:"+err.Error(), 3)
 		}
 	}()
-	//查询和指标相关的 表格
-	mappingList, err := excelModel.GetExcelEdbMappingByEdbInfoId(oldEdbInfo.EdbInfoId)
+	//查询和指标相关的时间序列表格和混合表格
+	mappingList, err := excelModel.GetExcelEdbMappingByEdbInfoIdAndSource(oldEdbInfo.EdbInfoId, []int{utils.TIME_TABLE, utils.MIXED_TABLE})
 	if err != nil {
 		err = fmt.Errorf("查询和指标相关的表格失败,错误:%s", err.Error())
 		return