Переглянути джерело

Merge branch 'fix/predict_edb_name_check'

Roc 1 місяць тому
батько
коміт
50862a9377
2 змінених файлів з 5 додано та 5 видалено
  1. 2 2
      controllers/base_from_predict_calculate.go
  2. 3 3
      logic/predict_edb.go

+ 2 - 2
controllers/base_from_predict_calculate.go

@@ -127,7 +127,7 @@ func addPredictCalculate(br *models.BaseResponse, req models.EdbInfoCalculateSav
 	}
 
 	// 根据指标名称和指标ID校验库中是否还存在其他同名指标
-	existEdbName, err := logic.CheckExistByEdbNameAndEdbInfoId(1, 0, req.EdbName, lang)
+	existEdbName, err := logic.CheckExistByEdbNameAndEdbInfoId(utils.PREDICT_EDB_INFO_TYPE, 0, req.EdbName, lang)
 	if err != nil {
 		br.Msg = "判断指标名称是否存在失败"
 		br.ErrMsg = "判断指标名称是否存在失败,Err:" + err.Error()
@@ -610,7 +610,7 @@ func (this *PredictCalculateController) CalculateBatchSave() {
 	//加入缓存机制,避免创建同一个名称的指标 end
 
 	// 根据指标名称和指标ID校验库中是否还存在其他同名指标
-	existEdbName, err := logic.CheckExistByEdbNameAndEdbInfoId(1, req.EdbInfoId, req.EdbName, this.Lang)
+	existEdbName, err := logic.CheckExistByEdbNameAndEdbInfoId(utils.PREDICT_EDB_INFO_TYPE, req.EdbInfoId, req.EdbName, this.Lang)
 	if err != nil {
 		br.Msg = "判断指标名称是否存在失败"
 		br.ErrMsg = "判断指标名称是否存在失败,Err:" + err.Error()

+ 3 - 3
logic/predict_edb.go

@@ -66,7 +66,7 @@ func AddPredictEdbInfo(sourceEdbInfoId, classifyId int, edbName, dataDateType st
 	edbCode := sourceEdbInfo.EdbCode + "_" + time.Now().Format(utils.FormatShortDateTimeUnSpace)
 
 	// 根据指标名称和指标ID校验库中是否还存在其他同名指标
-	existEdbName, err := CheckExistByEdbNameAndEdbInfoId(0, 0, edbName, lang)
+	existEdbName, err := CheckExistByEdbNameAndEdbInfoId(utils.PREDICT_EDB_INFO_TYPE, 0, edbName, lang)
 	if err != nil {
 		errMsg = "判断指标名称是否存在失败"
 		err = errors.New("判断指标名称是否存在失败,Err:" + err.Error())
@@ -443,7 +443,7 @@ func EditPredictEdbInfo(edbInfoId, classifyId int, edbName, dataDateType string,
 	}
 
 	// 根据指标名称和指标ID校验库中是否还存在其他同名指标
-	existEdbName, err := CheckExistByEdbNameAndEdbInfoId(1, edbInfoId, edbName, lang)
+	existEdbName, err := CheckExistByEdbNameAndEdbInfoId(utils.PREDICT_EDB_INFO_TYPE, edbInfoId, edbName, lang)
 	if err != nil {
 		errMsg = "判断指标名称是否存在失败"
 		err = errors.New("判断指标名称是否存在失败,Err:" + err.Error())
@@ -993,7 +993,7 @@ func checkExistByEdbName(edbInfoType int, edbName, lang string) (has bool, err e
 	var pars []interface{}
 
 	condition += " AND edb_info_type=? "
-	pars = append(pars, 0)
+	pars = append(pars, edbInfoType)
 
 	switch lang {
 	case utils.EnLangVersion: