mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-07 09:08:24 +08:00
fix: 修复两个 NPE 问题。
This commit is contained in:
parent
e903b9ed0f
commit
faaa7247bf
@ -316,6 +316,11 @@ public class CommonsDialectImpl implements IDialect {
|
|||||||
@Override
|
@Override
|
||||||
public String buildSelectSql(QueryWrapper queryWrapper) {
|
public String buildSelectSql(QueryWrapper queryWrapper) {
|
||||||
List<QueryTable> queryTables = CPI.getQueryTables(queryWrapper);
|
List<QueryTable> queryTables = CPI.getQueryTables(queryWrapper);
|
||||||
|
|
||||||
|
if (CollectionUtil.isEmpty(queryTables)) {
|
||||||
|
throw FlexExceptions.wrap("You must use the 'FROM' clause to select the table.");
|
||||||
|
}
|
||||||
|
|
||||||
List<QueryTable> joinTables = CPI.getJoinTables(queryWrapper);
|
List<QueryTable> joinTables = CPI.getJoinTables(queryWrapper);
|
||||||
List<QueryTable> allTables = CollectionUtil.merge(queryTables, joinTables);
|
List<QueryTable> allTables = CollectionUtil.merge(queryTables, joinTables);
|
||||||
|
|
||||||
@ -332,6 +337,11 @@ public class CommonsDialectImpl implements IDialect {
|
|||||||
QueryColumn selectColumn = selectColumns.get(i);
|
QueryColumn selectColumn = selectColumns.get(i);
|
||||||
QueryTable selectColumnTable = selectColumn.getTable();
|
QueryTable selectColumnTable = selectColumn.getTable();
|
||||||
|
|
||||||
|
// function 等没有对应的 selectColumnTable
|
||||||
|
if (selectColumnTable == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
//用户未配置别名的情况下,自动未用户添加别名
|
//用户未配置别名的情况下,自动未用户添加别名
|
||||||
if (StringUtil.isBlank(selectColumn.getAlias())
|
if (StringUtil.isBlank(selectColumn.getAlias())
|
||||||
&& !(selectColumnTable instanceof SelectQueryTable)
|
&& !(selectColumnTable instanceof SelectQueryTable)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user