瀏覽代碼

问题修改

zhs 2 年之前
父節點
當前提交
d7f0e53d4f
共有 1 個文件被更改,包括 30 次插入0 次删除
  1. 30 0
      src/main/java/com/tld/service/impl/DictionaryServiceImpl.java

+ 30 - 0
src/main/java/com/tld/service/impl/DictionaryServiceImpl.java

@@ -38,6 +38,11 @@ public class DictionaryServiceImpl implements DictionaryService {
         Map<String, Object> map = new HashMap<>();
         try{
             for(Dictionary dictionary : dictionarys) {
+                if(dictionary.getType().equals("") || dictionary.getType() == null){
+                    map.put("msg", "500");
+                    map.put("errMsg", "类型不存在请检查");
+                    return map;
+                }
                 String tableName = dictionaryMapper.getTableName(dictionary.getType());
                 if ("null".equals(tableName)) {
                     map.put("msg", "500");
@@ -70,6 +75,11 @@ public class DictionaryServiceImpl implements DictionaryService {
     public Map<String, Object> getDictionary(Dictionary dictionary) {
         Map<String, Object> map = new HashMap<>();
         try{
+            if(dictionary.getType().equals("") || dictionary.getType() == null){
+                map.put("msg", "500");
+                map.put("errMsg", "类型不存在请检查");
+                return map;
+            }
             String tableName = dictionaryMapper.getTableName(dictionary.getType());
             dictionary.setTableName(tableName);
             List<Dictionary> list = dictionaryMapper.getDictionary(dictionary);
@@ -97,6 +107,11 @@ public class DictionaryServiceImpl implements DictionaryService {
     public Map<String, Object> getDictionaryPage(Dictionary dictionary) {
         Map<String, Object> map = new HashMap<>();
         try{
+            if(dictionary.getType().equals("") || dictionary.getType() == null){
+                map.put("msg", "500");
+                map.put("errMsg", "类型不存在请检查");
+                return map;
+            }
             Map<String, Object> amountMap = new HashMap<>();
             String tableName = dictionaryMapper.getTableName(dictionary.getType());
             dictionary.setTableName(tableName);
@@ -126,6 +141,11 @@ public class DictionaryServiceImpl implements DictionaryService {
     public Map<String, Object> updateDictionary(Dictionary dictionary, HttpServletRequest request) {
         Map<String, Object> map = new HashMap<>();
         try{
+            if(dictionary.getType().equals("") || dictionary.getType() == null){
+                map.put("msg", "500");
+                map.put("errMsg", "类型不存在请检查");
+                return map;
+            }
             String tableName = dictionaryMapper.getTableName(dictionary.getType());
             if ("null".equals(tableName)) {
                 map.put("msg", "500");
@@ -154,6 +174,11 @@ public class DictionaryServiceImpl implements DictionaryService {
     public Map<String, Object> deleteDictionary(Dictionary dictionary, HttpServletRequest request) {
         Map<String, Object> map = new HashMap<>();
         try{
+            if(dictionary.getType().equals("") || dictionary.getType() == null){
+                map.put("msg", "500");
+                map.put("errMsg", "类型不存在请检查");
+                return map;
+            }
             String userId = request.getHeader("userId");
             String tableName = dictionaryMapper.getTableName(dictionary.getType());
             if ("null".equals(tableName)) {
@@ -183,6 +208,11 @@ public class DictionaryServiceImpl implements DictionaryService {
     public Map<String, Object> addDiction(Dictionary dictionary, HttpServletRequest request) {
         Map<String, Object> map = new HashMap<>();
         try{
+            if(dictionary.getType().equals("") || dictionary.getType() == null){
+                map.put("msg", "500");
+                map.put("errMsg", "类型不存在请检查");
+                return map;
+            }
             String tableName = dictionaryMapper.getTableName(dictionary.getType());
             if ("null".equals(tableName)) {
                 map.put("msg", "500");