修复代码生成导入表结构出现异常页面不提醒问题

This commit is contained in:
RuoYi 2020-06-24 17:58:24 +08:00
parent 7ce70965c8
commit 7dde164be0

View File

@ -80,6 +80,7 @@ public class GenTableServiceImpl implements IGenTableService
* @param genTable 业务信息 * @param genTable 业务信息
* @return 数据库表集合 * @return 数据库表集合
*/ */
@Override
public List<GenTable> selectDbTableList(GenTable genTable) public List<GenTable> selectDbTableList(GenTable genTable)
{ {
return genTableMapper.selectDbTableList(genTable); return genTableMapper.selectDbTableList(genTable);
@ -91,6 +92,7 @@ public class GenTableServiceImpl implements IGenTableService
* @param tableNames 表名称组 * @param tableNames 表名称组
* @return 数据库表集合 * @return 数据库表集合
*/ */
@Override
public List<GenTable> selectDbTableListByNames(String[] tableNames) public List<GenTable> selectDbTableListByNames(String[] tableNames)
{ {
return genTableMapper.selectDbTableListByNames(tableNames); return genTableMapper.selectDbTableListByNames(tableNames);
@ -121,7 +123,7 @@ public class GenTableServiceImpl implements IGenTableService
/** /**
* 删除业务对象 * 删除业务对象
* *
* @param ids 需要删除的数据ID * @param tableIds 需要删除的数据ID
* @return 结果 * @return 结果
*/ */
@Override @Override
@ -142,9 +144,9 @@ public class GenTableServiceImpl implements IGenTableService
public void importGenTable(List<GenTable> tableList) public void importGenTable(List<GenTable> tableList)
{ {
String operName = SecurityUtils.getUsername(); String operName = SecurityUtils.getUsername();
for (GenTable table : tableList) try
{ {
try for (GenTable table : tableList)
{ {
String tableName = table.getTableName(); String tableName = table.getTableName();
GenUtils.initTable(table, operName); GenUtils.initTable(table, operName);
@ -160,10 +162,10 @@ public class GenTableServiceImpl implements IGenTableService
} }
} }
} }
catch (Exception e) }
{ catch (Exception e)
log.error("表名 " + table.getTableName() + " 导入失败:", e); {
} throw new CustomException("导入失败:" + e.getMessage());
} }
} }
@ -173,6 +175,7 @@ public class GenTableServiceImpl implements IGenTableService
* @param tableId 表编号 * @param tableId 表编号
* @return 预览数据列表 * @return 预览数据列表
*/ */
@Override
public Map<String, String> previewCode(Long tableId) public Map<String, String> previewCode(Long tableId)
{ {
Map<String, String> dataMap = new LinkedHashMap<>(); Map<String, String> dataMap = new LinkedHashMap<>();
@ -265,7 +268,7 @@ public class GenTableServiceImpl implements IGenTableService
zip.putNextEntry(new ZipEntry(VelocityUtils.getFileName(template, table))); zip.putNextEntry(new ZipEntry(VelocityUtils.getFileName(template, table)));
IOUtils.write(sw.toString(), zip, Constants.UTF8); IOUtils.write(sw.toString(), zip, Constants.UTF8);
IOUtils.closeQuietly(sw); IOUtils.closeQuietly(sw);
zip.flush(); zip.flush();
zip.closeEntry(); zip.closeEntry();
} }
catch (IOException e) catch (IOException e)
@ -280,6 +283,7 @@ public class GenTableServiceImpl implements IGenTableService
* *
* @param genTable 业务信息 * @param genTable 业务信息
*/ */
@Override
public void validateEdit(GenTable genTable) public void validateEdit(GenTable genTable)
{ {
if (GenConstants.TPL_TREE.equals(genTable.getTplCategory())) if (GenConstants.TPL_TREE.equals(genTable.getTplCategory()))
@ -304,7 +308,7 @@ public class GenTableServiceImpl implements IGenTableService
/** /**
* 设置主键列信息 * 设置主键列信息
* *
* @param genTable 业务表信息 * @param table 业务表信息
* @param columns 业务字段列表 * @param columns 业务字段列表
*/ */
public void setPkColumn(GenTable table, List<GenTableColumn> columns) public void setPkColumn(GenTable table, List<GenTableColumn> columns)