...
|
...
|
@@ -174,21 +174,27 @@ func (dictionaryService *DictionaryService) RemoveDictionary(removeDictionaryCom |
|
|
} else {
|
|
|
dictionaryRepository = value
|
|
|
}
|
|
|
dictionary, err := dictionaryRepository.FindOne(map[string]interface{}{"dictionaryId": removeDictionaryCommand.DictionaryId})
|
|
|
for _, dictionaryId := range removeDictionaryCommand.DictionaryIds {
|
|
|
if dictionaryId == 0 {
|
|
|
continue
|
|
|
}
|
|
|
dictionary, err := dictionaryRepository.FindOne(map[string]interface{}{"dictionaryId": dictionaryId})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
if dictionary == nil {
|
|
|
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%d", removeDictionaryCommand.DictionaryId))
|
|
|
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%d", dictionaryId))
|
|
|
}
|
|
|
if dictionary, err := dictionaryRepository.Remove(dictionary); err != nil {
|
|
|
if _, err := dictionaryRepository.Remove(dictionary); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
return dictionary, nil
|
|
|
}
|
|
|
return removeDictionaryCommand, nil
|
|
|
|
|
|
}
|
|
|
|
|
|
// 更新数据字典设置
|
...
|
...
|
|