Sfoglia il codice sorgente

指标替换报错处理

xyxie 9 mesi fa
parent
commit
c669eb8506
1 ha cambiato i file con 8 aggiunte e 0 eliminazioni
  1. 8 0
      models/data_manage/excel/excel_info.go

+ 8 - 0
models/data_manage/excel/excel_info.go

@@ -763,6 +763,14 @@ func ReplaceEdbInExcel(oldEdbInfoId, newEdbInfoId int, updateExcelList []*ExcelI
 			return
 		}
 		//更新配置中的指标B
+		// 判断是否已存在绑定,如果存在则删除
+		sql = `DELETE FROM excel_edb_mapping WHERE excel_info_id=? and edb_info_id=?`
+		_, err = to.Raw(sql, excelInfo.ExcelInfoId, newEdbInfoId).Exec()
+		if err != nil {
+			errmsg = "删除指标B关联图表配置信息失败:Err:" + err.Error()
+			return
+		}
+		// 插入新的绑定
 		sql = `UPDATE excel_edb_mapping SET edb_info_id=?, modify_time=? WHERE excel_info_id=? and edb_info_id=?`
 		_, err = to.Raw(sql, newEdbInfoId, time.Now(), excelInfo.ExcelInfoId, oldEdbInfoId).Exec()
 		if err != nil {