...
|
...
|
@@ -358,6 +358,7 @@ func (cooperationModeService *CooperationModeService) UpdateCooperationMode(upda |
|
|
} else {
|
|
|
cooperationModeRepository = value
|
|
|
}
|
|
|
|
|
|
// 共创模式DAO初始化
|
|
|
var cooperationModeDao *dao.CooperationModeDao
|
|
|
if value, err := factory.CreateCooperationModeDao(map[string]interface{}{
|
...
|
...
|
@@ -367,15 +368,6 @@ func (cooperationModeService *CooperationModeService) UpdateCooperationMode(upda |
|
|
} else {
|
|
|
cooperationModeDao = value
|
|
|
}
|
|
|
// 校验共创模式名称唯一性
|
|
|
nameAvailable, _ := cooperationModeDao.CheckModeNameAvailable(map[string]interface{}{
|
|
|
"companyId": updateCooperationModeCommand.CompanyId,
|
|
|
"orgId": updateCooperationModeCommand.OrgId,
|
|
|
"cooperationModeName": updateCooperationModeCommand.CooperationModeName,
|
|
|
})
|
|
|
if !nameAvailable {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, "模式名称已存在")
|
|
|
}
|
|
|
|
|
|
cooperationMode, err := cooperationModeRepository.FindOne(map[string]interface{}{"cooperationModeId": updateCooperationModeCommand.CooperationModeId})
|
|
|
if err != nil {
|
...
|
...
|
@@ -384,6 +376,19 @@ func (cooperationModeService *CooperationModeService) UpdateCooperationMode(upda |
|
|
if cooperationMode == nil {
|
|
|
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(updateCooperationModeCommand.CooperationModeId, 10)))
|
|
|
}
|
|
|
|
|
|
// 校验共创模式名称唯一性
|
|
|
if cooperationMode.CooperationModeName != updateCooperationModeCommand.CooperationModeName {
|
|
|
nameAvailable, _ := cooperationModeDao.CheckModeNameAvailable(map[string]interface{}{
|
|
|
"companyId": updateCooperationModeCommand.CompanyId,
|
|
|
"orgId": updateCooperationModeCommand.OrgId,
|
|
|
"cooperationModeName": updateCooperationModeCommand.CooperationModeName,
|
|
|
})
|
|
|
if !nameAvailable {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, "模式名称已存在")
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if err := cooperationMode.Update(tool_funs.SimpleStructToMap(updateCooperationModeCommand)); err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
...
|
...
|
|