From 0788a57bece6b358c2f0fdda110a21ff87ca9e96 Mon Sep 17 00:00:00 2001
From: RuoYi <yzz_ivy@163.com>
Date: Thu, 02 Jul 2020 16:09:07 +0800
Subject: [PATCH] 修复代码生成导入表结构出现异常页面不提醒问题
---
ruoyi-modules/ruoyi-gen/src/main/java/com/ruoyi/gen/service/GenTableServiceImpl.java | 22 +++++++++++++---------
1 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/ruoyi-modules/ruoyi-gen/src/main/java/com/ruoyi/gen/service/GenTableServiceImpl.java b/ruoyi-modules/ruoyi-gen/src/main/java/com/ruoyi/gen/service/GenTableServiceImpl.java
index e327e09..817dd3a 100644
--- a/ruoyi-modules/ruoyi-gen/src/main/java/com/ruoyi/gen/service/GenTableServiceImpl.java
+++ b/ruoyi-modules/ruoyi-gen/src/main/java/com/ruoyi/gen/service/GenTableServiceImpl.java
@@ -23,6 +23,7 @@
import com.ruoyi.common.core.constant.GenConstants;
import com.ruoyi.common.core.exception.CustomException;
import com.ruoyi.common.core.utils.StringUtils;
+import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.gen.domain.GenTable;
import com.ruoyi.gen.domain.GenTableColumn;
import com.ruoyi.gen.mapper.GenTableColumnMapper;
@@ -79,6 +80,7 @@
* @param genTable 业务信息
* @return 数据库表集合
*/
+ @Override
public List<GenTable> selectDbTableList(GenTable genTable)
{
return genTableMapper.selectDbTableList(genTable);
@@ -90,6 +92,7 @@
* @param tableNames 表名称组
* @return 数据库表集合
*/
+ @Override
public List<GenTable> selectDbTableListByNames(String[] tableNames)
{
return genTableMapper.selectDbTableListByNames(tableNames);
@@ -120,7 +123,7 @@
/**
* 删除业务对象
*
- * @param ids 需要删除的数据ID
+ * @param tableIds 需要删除的数据ID
* @return 结果
*/
@Override
@@ -140,10 +143,10 @@
@Transactional
public void importGenTable(List<GenTable> tableList)
{
- String operName = "";
- for (GenTable table : tableList)
+ String operName = SecurityUtils.getUsername();
+ try
{
- try
+ for (GenTable table : tableList)
{
String tableName = table.getTableName();
GenUtils.initTable(table, operName);
@@ -159,10 +162,10 @@
}
}
}
- catch (Exception e)
- {
- log.error("表名 " + table.getTableName() + " 导入失败:", e);
- }
+ }
+ catch (Exception e)
+ {
+ throw new CustomException("导入失败:" + e.getMessage());
}
}
@@ -276,6 +279,7 @@
*
* @param genTable 业务信息
*/
+ @Override
public void validateEdit(GenTable genTable)
{
if (GenConstants.TPL_TREE.equals(genTable.getTplCategory()))
@@ -300,7 +304,7 @@
/**
* 设置主键列信息
*
- * @param genTable 业务表信息
+ * @param table 业务表信息
* @param columns 业务字段列表
*/
public void setPkColumn(GenTable table, List<GenTableColumn> columns)
--
Gitblit v1.9.3