From a9bcfc66c3f4a356a7b84844bd591e5500739c81 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E4=B9=9F=E6=9B=BE=E4=B8=BA=E4=BD=A0=E5=83=8F=E8=B6=85?=
=?UTF-8?q?=E4=BA=BA?= <1553592282@qq.com>
Date: Sun, 10 Dec 2023 14:18:35 +0000
Subject: [PATCH 01/15] =?UTF-8?q?=E5=AF=86=E7=A0=81=E8=BE=93=E5=85=A5?=
=?UTF-8?q?=E9=94=99=E8=AF=AF=E6=97=B6=EF=BC=8C=E7=99=BB=E5=BD=95=E6=97=A5?=
=?UTF-8?q?=E5=BF=97=E9=87=8D=E5=A4=8D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: 也曾为你像超人 <1553592282@qq.com>
---
.../com/ruoyi/framework/web/service/SysPasswordService.java | 4 ----
1 file changed, 4 deletions(-)
diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysPasswordService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysPasswordService.java
index a68dbc88..7cf1fff7 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysPasswordService.java
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysPasswordService.java
@@ -60,16 +60,12 @@ public class SysPasswordService
if (retryCount >= Integer.valueOf(maxRetryCount).intValue())
{
- AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL,
- MessageUtils.message("user.password.retry.limit.exceed", maxRetryCount, lockTime)));
throw new UserPasswordRetryLimitExceedException(maxRetryCount, lockTime);
}
if (!matches(user, password))
{
retryCount = retryCount + 1;
- AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL,
- MessageUtils.message("user.password.retry.limit.count", retryCount)));
redisCache.setCacheObject(getCacheKey(username), retryCount, lockTime, TimeUnit.MINUTES);
throw new UserPasswordNotMatchException();
}
From 94d5c174aa78399abff1c2acc38005815795f158 Mon Sep 17 00:00:00 2001
From: RuoYi
Date: Wed, 13 Dec 2023 11:47:35 +0800
Subject: [PATCH 02/15] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=96=B0=E7=BE=A4?=
=?UTF-8?q?=E5=8F=B7=EF=BC=9A161281055?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 2 +-
ruoyi-ui/src/views/index.vue | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 927a49ae..364d6c00 100644
--- a/README.md
+++ b/README.md
@@ -93,4 +93,4 @@
## 若依前后端分离交流群
-QQ群: [](https://jq.qq.com/?_wv=1027&k=5bVB1og) [](https://jq.qq.com/?_wv=1027&k=5eiA4DH) [](https://jq.qq.com/?_wv=1027&k=5AxMKlC) [](https://jq.qq.com/?_wv=1027&k=51G72yr) [](https://jq.qq.com/?_wv=1027&k=VvjN2nvu) [](https://jq.qq.com/?_wv=1027&k=5vYAqA05) [](https://jq.qq.com/?_wv=1027&k=kOIINEb5) [](https://jq.qq.com/?_wv=1027&k=UKtX5jhs) [](https://jq.qq.com/?_wv=1027&k=EI9an8lJ) [](https://jq.qq.com/?_wv=1027&k=SWCtLnMz) [](https://jq.qq.com/?_wv=1027&k=96Dkdq0k) [](https://jq.qq.com/?_wv=1027&k=0fsNiYZt) [](https://jq.qq.com/?_wv=1027&k=7xw4xUG1) [](https://jq.qq.com/?_wv=1027&k=eCx8eyoJ) [](https://jq.qq.com/?_wv=1027&k=SpyH2875) [](https://jq.qq.com/?_wv=1027&k=tKEt51dz) [](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=0vBbSb0ztbBgVtn3kJS-Q4HUNYwip89G&authKey=8irq5PhutrZmWIvsUsklBxhj57l%2F1nOZqjzigkXZVoZE451GG4JHPOqW7AW6cf0T&noverify=0&group_code=143961921) [](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=ZFAPAbp09S2ltvwrJzp7wGlbopsc0rwi&authKey=HB2cxpxP2yspk%2Bo3WKTBfktRCccVkU26cgi5B16u0KcAYrVu7sBaE7XSEqmMdFQp&noverify=0&group_code=174951577) 点击按钮入群。
\ No newline at end of file
+QQ群: [](https://jq.qq.com/?_wv=1027&k=5bVB1og) [](https://jq.qq.com/?_wv=1027&k=5eiA4DH) [](https://jq.qq.com/?_wv=1027&k=5AxMKlC) [](https://jq.qq.com/?_wv=1027&k=51G72yr) [](https://jq.qq.com/?_wv=1027&k=VvjN2nvu) [](https://jq.qq.com/?_wv=1027&k=5vYAqA05) [](https://jq.qq.com/?_wv=1027&k=kOIINEb5) [](https://jq.qq.com/?_wv=1027&k=UKtX5jhs) [](https://jq.qq.com/?_wv=1027&k=EI9an8lJ) [](https://jq.qq.com/?_wv=1027&k=SWCtLnMz) [](https://jq.qq.com/?_wv=1027&k=96Dkdq0k) [](https://jq.qq.com/?_wv=1027&k=0fsNiYZt) [](https://jq.qq.com/?_wv=1027&k=7xw4xUG1) [](https://jq.qq.com/?_wv=1027&k=eCx8eyoJ) [](https://jq.qq.com/?_wv=1027&k=SpyH2875) [](https://jq.qq.com/?_wv=1027&k=tKEt51dz) [](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=0vBbSb0ztbBgVtn3kJS-Q4HUNYwip89G&authKey=8irq5PhutrZmWIvsUsklBxhj57l%2F1nOZqjzigkXZVoZE451GG4JHPOqW7AW6cf0T&noverify=0&group_code=143961921) [](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=ZFAPAbp09S2ltvwrJzp7wGlbopsc0rwi&authKey=HB2cxpxP2yspk%2Bo3WKTBfktRCccVkU26cgi5B16u0KcAYrVu7sBaE7XSEqmMdFQp&noverify=0&group_code=161281055) [](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=Fn2aF5IHpwsy8j6VlalNJK6qbwFLFHat&authKey=uyIT%2B97x2AXj3odyXpsSpVaPMC%2Bidw0LxG5MAtEqlrcBcWJUA%2FeS43rsF1Tg7IRJ&noverify=0&group_code=161281055) 点击按钮入群。
\ No newline at end of file
diff --git a/ruoyi-ui/src/views/index.vue b/ruoyi-ui/src/views/index.vue
index 8b04afd3..84f9262f 100644
--- a/ruoyi-ui/src/views/index.vue
+++ b/ruoyi-ui/src/views/index.vue
@@ -122,7 +122,7 @@
满180251782 满104180207 满186866453 满201396349
满101456076 满101539465 满264312783 满167385320
满104748341 满160110482 满170801498 满108482800
- 满101046199 满136919097 满143961921 174951577
+ 满101046199 满136919097 满143961921 满174951577 161281055
微信:
Date: Wed, 13 Dec 2023 11:51:17 +0800
Subject: [PATCH 03/15] remove packages
---
.../com/ruoyi/framework/web/service/SysPasswordService.java | 4 ----
1 file changed, 4 deletions(-)
diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysPasswordService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysPasswordService.java
index 7cf1fff7..7a1f93d4 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysPasswordService.java
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysPasswordService.java
@@ -6,15 +6,11 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.core.Authentication;
import org.springframework.stereotype.Component;
import com.ruoyi.common.constant.CacheConstants;
-import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.exception.user.UserPasswordNotMatchException;
import com.ruoyi.common.exception.user.UserPasswordRetryLimitExceedException;
-import com.ruoyi.common.utils.MessageUtils;
import com.ruoyi.common.utils.SecurityUtils;
-import com.ruoyi.framework.manager.AsyncManager;
-import com.ruoyi.framework.manager.factory.AsyncFactory;
import com.ruoyi.framework.security.context.AuthenticationContextHolder;
/**
From 08d0326718c52f1f7bfbaa265ec3177ea900ec4c Mon Sep 17 00:00:00 2001
From: zhaoxc5
Date: Mon, 25 Dec 2023 10:22:05 +0800
Subject: [PATCH 04/15] fix: delete unuse code
---
ruoyi-ui/vue.config.js | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/ruoyi-ui/vue.config.js b/ruoyi-ui/vue.config.js
index cfc179bb..486801b1 100644
--- a/ruoyi-ui/vue.config.js
+++ b/ruoyi-ui/vue.config.js
@@ -123,12 +123,7 @@ module.exports = {
}
}
})
-
- config.optimization.runtimeChunk('single'),
- {
- from: path.resolve(__dirname, './public/robots.txt'), //防爬虫文件
- to: './' //到根目录下
- }
+ config.optimization.runtimeChunk('single')
})
}
}
From 3cc6fb5535dc692f66c768dddb4fc4d43d908f67 Mon Sep 17 00:00:00 2001
From: oddfar
Date: Thu, 4 Jan 2024 21:11:13 +0800
Subject: [PATCH 05/15] =?UTF-8?q?update:=20=E4=BF=AE=E6=94=B9=E9=80=80?=
=?UTF-8?q?=E5=87=BA=E5=A4=84=E7=90=86=E7=B1=BB=E7=9A=84=E6=97=A5=E5=BF=97?=
=?UTF-8?q?=E8=AE=B0=E5=BD=95=E5=92=8C=E8=BF=94=E5=9B=9E=E5=86=85=E5=AE=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../framework/security/handle/LogoutSuccessHandlerImpl.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/security/handle/LogoutSuccessHandlerImpl.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/security/handle/LogoutSuccessHandlerImpl.java
index 50e7d36b..d9b7d529 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/security/handle/LogoutSuccessHandlerImpl.java
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/security/handle/LogoutSuccessHandlerImpl.java
@@ -12,6 +12,7 @@ import com.alibaba.fastjson2.JSON;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.model.LoginUser;
+import com.ruoyi.common.utils.MessageUtils;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.framework.manager.AsyncManager;
@@ -45,8 +46,8 @@ public class LogoutSuccessHandlerImpl implements LogoutSuccessHandler
// 删除用户缓存记录
tokenService.delLoginUser(loginUser.getToken());
// 记录用户退出日志
- AsyncManager.me().execute(AsyncFactory.recordLogininfor(userName, Constants.LOGOUT, "退出成功"));
+ AsyncManager.me().execute(AsyncFactory.recordLogininfor(userName, Constants.LOGOUT, MessageUtils.message("user.logout.success")));
}
- ServletUtils.renderString(response, JSON.toJSONString(AjaxResult.success("退出成功")));
+ ServletUtils.renderString(response, JSON.toJSONString(AjaxResult.success(MessageUtils.message("user.logout.success"))));
}
}
From 649cfe8652b3b25e553d1985a27da9aeec77daf4 Mon Sep 17 00:00:00 2001
From: RuoYi
Date: Thu, 25 Jan 2024 11:34:25 +0800
Subject: [PATCH 06/15] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=8C=B9=E9=85=8D?=
=?UTF-8?q?=E6=96=B9=E5=BC=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/main/java/com/ruoyi/common/xss/XssValidator.java | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/xss/XssValidator.java b/ruoyi-common/src/main/java/com/ruoyi/common/xss/XssValidator.java
index 34d07004..b859428e 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/xss/XssValidator.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/xss/XssValidator.java
@@ -27,8 +27,13 @@ public class XssValidator implements ConstraintValidator
public static boolean containsHtml(String value)
{
+ StringBuilder sHtml = new StringBuilder();
Pattern pattern = Pattern.compile(HTML_PATTERN);
Matcher matcher = pattern.matcher(value);
- return matcher.matches();
+ while (matcher.find())
+ {
+ sHtml.append(matcher.group());
+ }
+ return pattern.matcher(sHtml).matches();
}
}
\ No newline at end of file
From 7e9d050432c7e0e03e9c0a64e2801cb80e77745f Mon Sep 17 00:00:00 2001
From: RuoYi
Date: Thu, 25 Jan 2024 11:41:20 +0800
Subject: [PATCH 07/15] update http user-agent
---
.../main/java/com/ruoyi/common/utils/http/HttpUtils.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpUtils.java
index f82bef66..d3b61cad 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpUtils.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpUtils.java
@@ -74,7 +74,7 @@ public class HttpUtils
URLConnection connection = realUrl.openConnection();
connection.setRequestProperty("accept", "*/*");
connection.setRequestProperty("connection", "Keep-Alive");
- connection.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
+ connection.setRequestProperty("user-agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64)");
connection.connect();
in = new BufferedReader(new InputStreamReader(connection.getInputStream(), contentType));
String line;
@@ -136,7 +136,7 @@ public class HttpUtils
URLConnection conn = realUrl.openConnection();
conn.setRequestProperty("accept", "*/*");
conn.setRequestProperty("connection", "Keep-Alive");
- conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
+ conn.setRequestProperty("user-agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64)");
conn.setRequestProperty("Accept-Charset", "utf-8");
conn.setRequestProperty("contentType", "utf-8");
conn.setDoOutput(true);
@@ -202,7 +202,7 @@ public class HttpUtils
HttpsURLConnection conn = (HttpsURLConnection) console.openConnection();
conn.setRequestProperty("accept", "*/*");
conn.setRequestProperty("connection", "Keep-Alive");
- conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
+ conn.setRequestProperty("user-agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64)");
conn.setRequestProperty("Accept-Charset", "utf-8");
conn.setRequestProperty("contentType", "utf-8");
conn.setDoOutput(true);
From 80f96b4915e25acb0faad48d2fd65b34b1047b7e Mon Sep 17 00:00:00 2001
From: RuoYi
Date: Thu, 25 Jan 2024 11:41:57 +0800
Subject: [PATCH 08/15] =?UTF-8?q?=E5=8D=87=E7=BA=A7oshi=E5=88=B0=E6=9C=80?=
=?UTF-8?q?=E6=96=B0=E7=89=88=E6=9C=AC6.4.11?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 91a7a4b2..a7215ac1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,7 @@
2.3.3
1.4.7
2.0.43
- 6.4.8
+ 6.4.11
2.13.0
3.2.2
4.1.2
From 2f624ab5f41f15a4a1093867e4519b7ddc7ccedf Mon Sep 17 00:00:00 2001
From: RuoYi
Date: Fri, 1 Mar 2024 14:33:09 +0800
Subject: [PATCH 09/15] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E7=94=9F=E6=88=90?=
=?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=88=9B=E5=BB=BA=E8=A1=A8=E7=BB=93=E6=9E=84?=
=?UTF-8?q?=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../com/ruoyi/common/constant/Constants.java | 2 +-
ruoyi-generator/pom.xml | 14 +++---
.../generator/controller/GenController.java | 46 ++++++++++++++++++-
.../generator/mapper/GenTableMapper.java | 8 ++++
.../service/GenTableServiceImpl.java | 16 +++++--
.../generator/service/IGenTableService.java | 13 +++++-
.../mapper/generator/GenTableMapper.xml | 4 ++
ruoyi-ui/src/api/tool/gen.js | 9 ++++
ruoyi-ui/src/views/tool/gen/createTable.vue | 45 ++++++++++++++++++
ruoyi-ui/src/views/tool/gen/index.vue | 19 +++++++-
10 files changed, 161 insertions(+), 15 deletions(-)
create mode 100644 ruoyi-ui/src/views/tool/gen/createTable.vue
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java
index 5fbfc739..e97ef4fc 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java
@@ -163,5 +163,5 @@ public class Constants
* 定时任务违规的字符
*/
public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
- "org.springframework", "org.apache", "com.ruoyi.common.utils.file", "com.ruoyi.common.config" };
+ "org.springframework", "org.apache", "com.ruoyi.common.utils.file", "com.ruoyi.common.config", "com.ruoyi.generator" };
}
diff --git a/ruoyi-generator/pom.xml b/ruoyi-generator/pom.xml
index 83fde2f5..8663be6e 100644
--- a/ruoyi-generator/pom.xml
+++ b/ruoyi-generator/pom.xml
@@ -17,24 +17,24 @@
-
+
org.apache.velocity
velocity-engine-core
-
-
- commons-collections
- commons-collections
-
-
com.ruoyi
ruoyi-common
+
+
+ com.alibaba
+ druid-spring-boot-starter
+
+
\ No newline at end of file
diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java
index af9f4ee3..75f7fbe1 100644
--- a/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java
+++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java
@@ -1,6 +1,7 @@
package com.ruoyi.generator.controller;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -17,12 +18,18 @@ import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
+import com.alibaba.druid.DbType;
+import com.alibaba.druid.sql.SQLUtils;
+import com.alibaba.druid.sql.ast.SQLStatement;
+import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlCreateTableStatement;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.common.utils.sql.SqlUtil;
import com.ruoyi.generator.domain.GenTable;
import com.ruoyi.generator.domain.GenTableColumn;
import com.ruoyi.generator.service.IGenTableColumnService;
@@ -109,10 +116,47 @@ public class GenController extends BaseController
String[] tableNames = Convert.toStrArray(tables);
// 查询表信息
List tableList = genTableService.selectDbTableListByNames(tableNames);
- genTableService.importGenTable(tableList);
+ genTableService.importGenTable(tableList, SecurityUtils.getUsername());
return success();
}
+ /**
+ * 创建表结构(保存)
+ */
+ @PreAuthorize("@ss.hasRole('admin')")
+ @Log(title = "创建表", businessType = BusinessType.OTHER)
+ @PostMapping("/createTable")
+ public AjaxResult createTableSave(String sql)
+ {
+ try
+ {
+ SqlUtil.filterKeyword(sql);
+ List sqlStatements = SQLUtils.parseStatements(sql, DbType.mysql);
+ List tableNames = new ArrayList<>();
+ for (SQLStatement sqlStatement : sqlStatements)
+ {
+ if (sqlStatement instanceof MySqlCreateTableStatement)
+ {
+ MySqlCreateTableStatement createTableStatement = (MySqlCreateTableStatement) sqlStatement;
+ if (genTableService.createTable(createTableStatement.toString()))
+ {
+ String tableName = createTableStatement.getTableName().replaceAll("`", "");
+ tableNames.add(tableName);
+ }
+ }
+ }
+ List tableList = genTableService.selectDbTableListByNames(tableNames.toArray(new String[tableNames.size()]));
+ String operName = SecurityUtils.getUsername();
+ genTableService.importGenTable(tableList, operName);
+ return AjaxResult.success();
+ }
+ catch (Exception e)
+ {
+ logger.error(e.getMessage(), e);
+ return AjaxResult.error("创建表结构异常");
+ }
+ }
+
/**
* 修改保存代码生成业务
*/
diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/GenTableMapper.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/GenTableMapper.java
index c2fdf71f..a5ce3c60 100644
--- a/ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/GenTableMapper.java
+++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/GenTableMapper.java
@@ -80,4 +80,12 @@ public interface GenTableMapper
* @return 结果
*/
public int deleteGenTableByIds(Long[] ids);
+
+ /**
+ * 创建表
+ *
+ * @param sql 表结构
+ * @return 结果
+ */
+ public int createTable(String sql);
}
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 ff6291db..18231ebe 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
@@ -27,7 +27,6 @@ import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.constant.GenConstants;
import com.ruoyi.common.core.text.CharsetKit;
import com.ruoyi.common.exception.ServiceException;
-import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.generator.domain.GenTable;
import com.ruoyi.generator.domain.GenTableColumn;
@@ -150,6 +149,18 @@ public class GenTableServiceImpl implements IGenTableService
genTableColumnMapper.deleteGenTableColumnByIds(tableIds);
}
+ /**
+ * 创建表
+ *
+ * @param sql 创建表语句
+ * @return 结果
+ */
+ @Override
+ public boolean createTable(String sql)
+ {
+ return genTableMapper.createTable(sql) == 0;
+ }
+
/**
* 导入表结构
*
@@ -157,9 +168,8 @@ public class GenTableServiceImpl implements IGenTableService
*/
@Override
@Transactional
- public void importGenTable(List tableList)
+ public void importGenTable(List tableList, String operName)
{
- String operName = SecurityUtils.getUsername();
try
{
for (GenTable table : tableList)
diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableService.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableService.java
index 955b326b..526038d5 100644
--- a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableService.java
+++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableService.java
@@ -66,12 +66,21 @@ public interface IGenTableService
*/
public void deleteGenTableByIds(Long[] tableIds);
+ /**
+ * 创建表
+ *
+ * @param sql 创建表语句
+ * @return 结果
+ */
+ public boolean createTable(String sql);
+
/**
* 导入表结构
- *
+ *
* @param tableList 导入表列表
+ * @param operName 操作人员
*/
- public void importGenTable(List tableList);
+ public void importGenTable(List tableList, String operName);
/**
* 预览代码
diff --git a/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml b/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml
index 9c65e4ca..8ec82113 100644
--- a/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml
+++ b/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml
@@ -171,6 +171,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
)
+
+ ${sql}
+
+
update gen_table
diff --git a/ruoyi-ui/src/api/tool/gen.js b/ruoyi-ui/src/api/tool/gen.js
index afaf2a95..5728980c 100644
--- a/ruoyi-ui/src/api/tool/gen.js
+++ b/ruoyi-ui/src/api/tool/gen.js
@@ -43,6 +43,15 @@ export function importTable(data) {
})
}
+// 创建表
+export function createTable(data) {
+ return request({
+ url: '/tool/gen/createTable',
+ method: 'post',
+ params: data
+ })
+}
+
// 预览生成代码
export function previewTable(tableId) {
return request({
diff --git a/ruoyi-ui/src/views/tool/gen/createTable.vue b/ruoyi-ui/src/views/tool/gen/createTable.vue
new file mode 100644
index 00000000..f914b5d3
--- /dev/null
+++ b/ruoyi-ui/src/views/tool/gen/createTable.vue
@@ -0,0 +1,45 @@
+
+
+
+ 创建表语句(支持多个建表语句):
+
+
+
+
+
+
diff --git a/ruoyi-ui/src/views/tool/gen/index.vue b/ruoyi-ui/src/views/tool/gen/index.vue
index 3f1f9308..9237c302 100644
--- a/ruoyi-ui/src/views/tool/gen/index.vue
+++ b/ruoyi-ui/src/views/tool/gen/index.vue
@@ -41,10 +41,21 @@
plain
icon="el-icon-download"
size="mini"
+ :disabled="multiple"
@click="handleGenTable"
v-hasPermi="['tool:gen:code']"
>生成
+
+ 创建
+
+