|
@@ -66,7 +66,7 @@ func AddPredictEdbInfo(sourceEdbInfoId, classifyId int, edbName, dataDateType st
|
|
|
edbCode := sourceEdbInfo.EdbCode + "_" + time.Now().Format(utils.FormatShortDateTimeUnSpace)
|
|
|
|
|
|
|
|
|
- existEdbName, err := CheckExistByEdbNameAndEdbInfoId(utils.PREDICT_EDB_INFO_TYPE, 0, edbName, lang)
|
|
|
+ existEdbName, err := CheckExistByEdbNameAndEdbInfoId(utils.PREDICT_EDB_INFO_TYPE, sysUserId, 0, edbName, lang)
|
|
|
if err != nil {
|
|
|
errMsg = "判断指标名称是否存在失败"
|
|
|
err = errors.New("判断指标名称是否存在失败,Err:" + err.Error())
|
|
@@ -404,24 +404,22 @@ func AddPredictEdbInfo(sourceEdbInfoId, classifyId int, edbName, dataDateType st
|
|
|
|
|
|
func EditPredictEdbInfo(edbInfoId, classifyId int, edbName, dataDateType string, ruleList []models.RuleConfig, minValue, maxValue float64, lang string) (edbInfo *models.EdbInfo, err error, errMsg string) {
|
|
|
|
|
|
- {
|
|
|
- edbInfo, err = models.GetEdbInfoById(edbInfoId)
|
|
|
- if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
- errMsg = "修改失败"
|
|
|
- err = errors.New("获取预测指标失败,Err:" + err.Error())
|
|
|
- return
|
|
|
- }
|
|
|
- if edbInfo == nil {
|
|
|
- errMsg = "找不到该预测指标"
|
|
|
- err = errors.New(errMsg)
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- if edbInfo.EdbInfoType != 1 {
|
|
|
- errMsg = "指标异常,不是预测指标"
|
|
|
- err = errors.New(errMsg)
|
|
|
- return
|
|
|
- }
|
|
|
+ edbInfo, err = models.GetEdbInfoById(edbInfoId)
|
|
|
+ if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
+ errMsg = "修改失败"
|
|
|
+ err = errors.New("获取预测指标失败,Err:" + err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if edbInfo == nil {
|
|
|
+ errMsg = "找不到该预测指标"
|
|
|
+ err = errors.New(errMsg)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if edbInfo.EdbInfoType != 1 {
|
|
|
+ errMsg = "指标异常,不是预测指标"
|
|
|
+ err = errors.New(errMsg)
|
|
|
+ return
|
|
|
}
|
|
|
|
|
|
var predictEdbConf *models.PredictEdbConf
|
|
@@ -443,7 +441,7 @@ func EditPredictEdbInfo(edbInfoId, classifyId int, edbName, dataDateType string,
|
|
|
}
|
|
|
|
|
|
|
|
|
- existEdbName, err := CheckExistByEdbNameAndEdbInfoId(utils.PREDICT_EDB_INFO_TYPE, edbInfoId, edbName, lang)
|
|
|
+ existEdbName, err := CheckExistByEdbNameAndEdbInfoId(utils.PREDICT_EDB_INFO_TYPE, edbInfo.SysUserId, edbInfoId, edbName, lang)
|
|
|
if err != nil {
|
|
|
errMsg = "判断指标名称是否存在失败"
|
|
|
err = errors.New("判断指标名称是否存在失败,Err:" + err.Error())
|
|
@@ -988,12 +986,12 @@ func RefreshPredictEdbInfo(edbInfoId int) (edbInfo *models.EdbInfo, err error, e
|
|
|
|
|
|
|
|
|
|
|
|
-func checkExistByEdbName(edbInfoType int, edbName, lang string) (has bool, err error) {
|
|
|
+func checkExistByEdbName(edbInfoType, userId int, edbName, lang string) (has bool, err error) {
|
|
|
var condition string
|
|
|
var pars []interface{}
|
|
|
|
|
|
- condition += " AND edb_info_type=? "
|
|
|
- pars = append(pars, 0)
|
|
|
+ condition += " AND edb_info_type=? AND sys_user_id=? "
|
|
|
+ pars = append(pars, edbInfoType, userId)
|
|
|
|
|
|
switch lang {
|
|
|
case utils.EnLangVersion:
|
|
@@ -1027,11 +1025,11 @@ func checkExistByEdbName(edbInfoType int, edbName, lang string) (has bool, err e
|
|
|
|
|
|
|
|
|
|
|
|
-func checkExistByEdbNameAndEdbInfoId(edbInfoType, edbInfoId int, edbName, lang string) (has bool, err error) {
|
|
|
+func checkExistByEdbNameAndEdbInfoId(edbInfoType, userId, edbInfoId int, edbName, lang string) (has bool, err error) {
|
|
|
var condition string
|
|
|
var pars []interface{}
|
|
|
- condition += " AND edb_info_type=? "
|
|
|
- pars = append(pars, edbInfoType)
|
|
|
+ condition += " AND edb_info_type=? AND sys_user_id=? "
|
|
|
+ pars = append(pars, edbInfoType, userId)
|
|
|
|
|
|
condition += " AND edb_info_id<>? "
|
|
|
pars = append(pars, edbInfoId)
|
|
@@ -1068,12 +1066,12 @@ func checkExistByEdbNameAndEdbInfoId(edbInfoType, edbInfoId int, edbName, lang s
|
|
|
|
|
|
|
|
|
|
|
|
-func CheckExistByEdbNameAndEdbInfoId(edbInfoType, edbInfoId int, edbName, lang string) (has bool, err error) {
|
|
|
+func CheckExistByEdbNameAndEdbInfoId(edbInfoType, userId, edbInfoId int, edbName, lang string) (has bool, err error) {
|
|
|
|
|
|
if edbInfoId == 0 {
|
|
|
- return checkExistByEdbName(edbInfoType, edbName, lang)
|
|
|
+ return checkExistByEdbName(edbInfoType, userId, edbName, lang)
|
|
|
}
|
|
|
|
|
|
|
|
|
- return checkExistByEdbNameAndEdbInfoId(edbInfoType, edbInfoId, edbName, lang)
|
|
|
+ return checkExistByEdbNameAndEdbInfoId(edbInfoType, userId, edbInfoId, edbName, lang)
|
|
|
}
|