From d3abd6c96e99e32ccfc030230e06ce4b529f2bbd Mon Sep 17 00:00:00 2001
From: 疯狂的狮子li <15040126243@163.com>
Date: 星期二, 17 八月 2021 10:38:07 +0800
Subject: [PATCH] Merge branch 'master' of https://gitee.com/y_project/RuoYi-Vue into dev

---
 ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java |   24 ++++++++++++++----------
 1 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java
index fddd0bd..48bec60 100644
--- a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java
+++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java
@@ -9,7 +9,7 @@
 import com.ruoyi.common.constant.GenConstants;
 import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
 import com.ruoyi.common.core.page.TableDataInfo;
-import com.ruoyi.common.exception.CustomException;
+import com.ruoyi.common.exception.ServiceException;
 import com.ruoyi.common.utils.JsonUtils;
 import com.ruoyi.common.utils.PageUtils;
 import com.ruoyi.common.utils.SecurityUtils;
@@ -188,7 +188,7 @@
 				}
             }
         } catch (Exception e) {
-            throw new CustomException("瀵煎叆澶辫触锛�" + e.getMessage());
+            throw new ServiceException("瀵煎叆澶辫触锛�" + e.getMessage());
         }
     }
 
@@ -264,8 +264,12 @@
                 StringWriter sw = new StringWriter();
                 Template tpl = Velocity.getTemplate(template, Constants.UTF8);
                 tpl.merge(context, sw);
-                String path = getGenPath(table, template);
-                FileUtils.writeUtf8String(sw.toString(), path);
+				try {
+                	String path = getGenPath(table, template);
+                	FileUtils.writeUtf8String(sw.toString(), path);
+				} catch (IOException e) {
+					throw new ServiceException("娓叉煋妯℃澘澶辫触锛岃〃鍚嶏細" + table.getTableName());
+				}
             }
         }
     }
@@ -284,7 +288,7 @@
 
         List<GenTableColumn> dbTableColumns = genTableColumnMapper.selectDbTableColumnsByName(tableName);
         if (StringUtils.isEmpty(dbTableColumns)) {
-            throw new CustomException("鍚屾鏁版嵁澶辫触锛屽師琛ㄧ粨鏋勪笉瀛樺湪");
+            throw new ServiceException("鍚屾鏁版嵁澶辫触锛屽師琛ㄧ粨鏋勪笉瀛樺湪");
         }
         List<String> dbTableColumnNames = dbTableColumns.stream().map(GenTableColumn::getColumnName).collect(Collectors.toList());
 
@@ -364,16 +368,16 @@
         if (GenConstants.TPL_TREE.equals(genTable.getTplCategory())) {
 			Map<String, Object> paramsObj = genTable.getParams();
             if (StringUtils.isEmpty(paramsObj.get(GenConstants.TREE_CODE))) {
-                throw new CustomException("鏍戠紪鐮佸瓧娈典笉鑳戒负绌�");
+                throw new ServiceException("鏍戠紪鐮佸瓧娈典笉鑳戒负绌�");
             } else if (StringUtils.isEmpty(paramsObj.get(GenConstants.TREE_PARENT_CODE))) {
-                throw new CustomException("鏍戠埗缂栫爜瀛楁涓嶈兘涓虹┖");
+                throw new ServiceException("鏍戠埗缂栫爜瀛楁涓嶈兘涓虹┖");
             } else if (StringUtils.isEmpty(paramsObj.get(GenConstants.TREE_NAME))) {
-                throw new CustomException("鏍戝悕绉板瓧娈典笉鑳戒负绌�");
+                throw new ServiceException("鏍戝悕绉板瓧娈典笉鑳戒负绌�");
             } else if (GenConstants.TPL_SUB.equals(genTable.getTplCategory())) {
                 if (StringUtils.isEmpty(genTable.getSubTableName())) {
-                    throw new CustomException("鍏宠仈瀛愯〃鐨勮〃鍚嶄笉鑳戒负绌�");
+                    throw new ServiceException("鍏宠仈瀛愯〃鐨勮〃鍚嶄笉鑳戒负绌�");
                 } else if (StringUtils.isEmpty(genTable.getSubTableFkName())) {
-                    throw new CustomException("瀛愯〃鍏宠仈鐨勫閿悕涓嶈兘涓虹┖");
+                    throw new ServiceException("瀛愯〃鍏宠仈鐨勫閿悕涓嶈兘涓虹┖");
                 }
             }
         }

--
Gitblit v1.9.3