zhs %!s(int64=2) %!d(string=hai) anos
pai
achega
d7f0e53d4f
Modificáronse 1 ficheiros con 30 adicións e 0 borrados
  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");