|
@@ -23,22 +23,25 @@ public class DictionaryServiceImpl implements DictionaryService {
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public Map<String, Object> addDictionary(Dictionary dictionary) {
|
|
|
+ public Map<String, Object> addDictionary(List<Dictionary> dictionarys) {
|
|
|
+
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
try{
|
|
|
- String tableName = dictionaryMapper.getTableName(dictionary.getType());
|
|
|
- if("null".equals(tableName)){
|
|
|
- map.put("msg", "500");
|
|
|
- map.put("errMsg", "失败,请联系是否存在此字典");
|
|
|
- return map;
|
|
|
- }
|
|
|
- dictionary.setTableName(tableName);
|
|
|
- if(dictionary.getType().equals("物料字典")){
|
|
|
- dictionaryMapper.addMaterial(dictionary);
|
|
|
- } else if(dictionary.getType().equals("库账对存")){
|
|
|
- dictionaryMapper.addTreasuryAccount(dictionary);
|
|
|
- } else {
|
|
|
- dictionaryMapper.addDictionary(dictionary);
|
|
|
+ for(Dictionary dictionary : dictionarys) {
|
|
|
+ String tableName = dictionaryMapper.getTableName(dictionary.getType());
|
|
|
+ if ("null".equals(tableName)) {
|
|
|
+ map.put("msg", "500");
|
|
|
+ map.put("errMsg", "失败,请联系是否存在此字典");
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+ dictionary.setTableName(tableName);
|
|
|
+ if (dictionary.getType().equals("物料字典")) {
|
|
|
+ dictionaryMapper.addMaterial(dictionary);
|
|
|
+ } else if (dictionary.getType().equals("库账对存")) {
|
|
|
+ dictionaryMapper.addTreasuryAccount(dictionary);
|
|
|
+ } else {
|
|
|
+ dictionaryMapper.addDictionary(dictionary);
|
|
|
+ }
|
|
|
}
|
|
|
map.put("msg", "200");
|
|
|
} catch (Exception e){
|