tuoling805 1 year ago
parent
commit
cd1139a0c5
1 changed files with 3 additions and 2 deletions
  1. 3 2
      models/edb_info.go

+ 3 - 2
models/edb_info.go

@@ -988,13 +988,13 @@ func EdbInfoAdd(req *AddEdbInfoParams, serverUrl string, sysUserId int, sysUserR
 	condition += " AND edb_code=? "
 	pars = append(pars, req.EdbCode)
 
-	count, err := GetEdbInfoCountByCondition(condition, pars)
+	items, err := GetEdbInfoByCondition(condition, pars, 0)
 	if err != nil {
 		err = errors.New("判断指标是否存在失败,Err:" + err.Error())
 		return
 	}
 
-	if count > 0 {
+	if len(items) > 0 {
 		sql := ` UPDATE edb_info SET classify_id=?,modify_time=NOW() WHERE edb_code=? `
 		o := orm.NewOrm()
 		_, err = o.Raw(sql, req.ClassifyId, req.EdbCode).Exec()
@@ -1002,6 +1002,7 @@ func EdbInfoAdd(req *AddEdbInfoParams, serverUrl string, sysUserId int, sysUserR
 			err = errors.New("更新指标分类信息失败,Err:" + err.Error())
 			return
 		}
+		edbInfo = items[0]
 		return
 	}