正在显示
1 个修改的文件
包含
14 行增加
和
9 行删除
@@ -358,6 +358,7 @@ func (cooperationModeService *CooperationModeService) UpdateCooperationMode(upda | @@ -358,6 +358,7 @@ func (cooperationModeService *CooperationModeService) UpdateCooperationMode(upda | ||
358 | } else { | 358 | } else { |
359 | cooperationModeRepository = value | 359 | cooperationModeRepository = value |
360 | } | 360 | } |
361 | + | ||
361 | // 共创模式DAO初始化 | 362 | // 共创模式DAO初始化 |
362 | var cooperationModeDao *dao.CooperationModeDao | 363 | var cooperationModeDao *dao.CooperationModeDao |
363 | if value, err := factory.CreateCooperationModeDao(map[string]interface{}{ | 364 | if value, err := factory.CreateCooperationModeDao(map[string]interface{}{ |
@@ -367,15 +368,6 @@ func (cooperationModeService *CooperationModeService) UpdateCooperationMode(upda | @@ -367,15 +368,6 @@ func (cooperationModeService *CooperationModeService) UpdateCooperationMode(upda | ||
367 | } else { | 368 | } else { |
368 | cooperationModeDao = value | 369 | cooperationModeDao = value |
369 | } | 370 | } |
370 | - // 校验共创模式名称唯一性 | ||
371 | - nameAvailable, _ := cooperationModeDao.CheckModeNameAvailable(map[string]interface{}{ | ||
372 | - "companyId": updateCooperationModeCommand.CompanyId, | ||
373 | - "orgId": updateCooperationModeCommand.OrgId, | ||
374 | - "cooperationModeName": updateCooperationModeCommand.CooperationModeName, | ||
375 | - }) | ||
376 | - if !nameAvailable { | ||
377 | - return nil, application.ThrowError(application.TRANSACTION_ERROR, "模式名称已存在") | ||
378 | - } | ||
379 | 371 | ||
380 | cooperationMode, err := cooperationModeRepository.FindOne(map[string]interface{}{"cooperationModeId": updateCooperationModeCommand.CooperationModeId}) | 372 | cooperationMode, err := cooperationModeRepository.FindOne(map[string]interface{}{"cooperationModeId": updateCooperationModeCommand.CooperationModeId}) |
381 | if err != nil { | 373 | if err != nil { |
@@ -384,6 +376,19 @@ func (cooperationModeService *CooperationModeService) UpdateCooperationMode(upda | @@ -384,6 +376,19 @@ func (cooperationModeService *CooperationModeService) UpdateCooperationMode(upda | ||
384 | if cooperationMode == nil { | 376 | if cooperationMode == nil { |
385 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(updateCooperationModeCommand.CooperationModeId, 10))) | 377 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(updateCooperationModeCommand.CooperationModeId, 10))) |
386 | } | 378 | } |
379 | + | ||
380 | + // 校验共创模式名称唯一性 | ||
381 | + if cooperationMode.CooperationModeName != updateCooperationModeCommand.CooperationModeName { | ||
382 | + nameAvailable, _ := cooperationModeDao.CheckModeNameAvailable(map[string]interface{}{ | ||
383 | + "companyId": updateCooperationModeCommand.CompanyId, | ||
384 | + "orgId": updateCooperationModeCommand.OrgId, | ||
385 | + "cooperationModeName": updateCooperationModeCommand.CooperationModeName, | ||
386 | + }) | ||
387 | + if !nameAvailable { | ||
388 | + return nil, application.ThrowError(application.BUSINESS_ERROR, "模式名称已存在") | ||
389 | + } | ||
390 | + } | ||
391 | + | ||
387 | if err := cooperationMode.Update(tool_funs.SimpleStructToMap(updateCooperationModeCommand)); err != nil { | 392 | if err := cooperationMode.Update(tool_funs.SimpleStructToMap(updateCooperationModeCommand)); err != nil { |
388 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | 393 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) |
389 | } | 394 | } |
-
请 注册 或 登录 后发表评论