修改SQL编辑器自动提示对于表别名报错的BUG

This commit is contained in:
datagear 2020-05-24 13:53:51 +08:00
parent 03e9e37964
commit 843ef1ed75
1 changed files with 23 additions and 10 deletions

View File

@ -80,6 +80,7 @@ public class SqlEditorController extends AbstractSchemaConnTableController
return tableNames;
}
@SuppressWarnings("unchecked")
@RequestMapping(value = "/{schemaId}/findColumnNames", produces = CONTENT_TYPE_JSON)
@ResponseBody
public List<String> findColumnNames(HttpServletRequest request, HttpServletResponse response,
@ -89,17 +90,29 @@ public class SqlEditorController extends AbstractSchemaConnTableController
{
final User user = WebUtils.getUser(request, response);
Table tableObj = new ReturnSchemaConnTableExecutor<Table>(request, response, springModel, schemaId, table, true)
{
@Override
protected Table execute(HttpServletRequest request, HttpServletResponse response,
org.springframework.ui.Model springModel, Schema schema, Table table) throws Exception
{
checkReadTableDataPermission(schema, user);
Table tableObj = null;
return table;
}
}.execute();
try
{
tableObj = new ReturnSchemaConnTableExecutor<Table>(request, response, springModel, schemaId, table, true)
{
@Override
protected Table execute(HttpServletRequest request, HttpServletResponse response,
org.springframework.ui.Model springModel, Schema schema, Table table) throws Exception
{
checkReadTableDataPermission(schema, user);
return table;
}
}.execute();
}
catch (Throwable t)
{
// 避免出现TableNotFoundException导致界面出现错误提示
}
if (tableObj == null)
return Collections.EMPTY_LIST;
Column[] columns = tableObj.getColumns();