Merge pull request #8109 from dataease/pr@dev@feat_permissions

fix(数据集): oracle 数据源的sql数据集使用 in 语法和参数时,执行异常 #8053
This commit is contained in:
taojinlong 2024-02-21 12:31:08 +08:00 committed by GitHub
commit 6e6d4d469d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1118,7 +1118,7 @@ public class DataSetTableService {
private void handleFromItems(PlainSelect plainSelect, String dsType) throws Exception {
FromItem fromItem = plainSelect.getFromItem();
if (fromItem instanceof ParenthesedSelect) {
if(((ParenthesedSelect) fromItem).getSelect() instanceof SetOperationList){
if (((ParenthesedSelect) fromItem).getSelect() instanceof SetOperationList) {
StringBuilder result = new StringBuilder();
SetOperationList setOperationList = (SetOperationList) ((ParenthesedSelect) fromItem).getSelect().getSelectBody();
for (int i = 0; i < setOperationList.getSelects().size(); i++) {
@ -1127,7 +1127,7 @@ public class DataSetTableService {
result.append(" ").append(setOperationList.getOperations().get(i).toString()).append(" ");
}
}
}else {
} else {
PlainSelect selectBody = ((ParenthesedSelect) fromItem).getSelect().getPlainSelect();
Select subSelectTmp = (Select) CCJSqlParserUtil.parse(removeVariables(selectBody.toString(), dsType));
((ParenthesedSelect) fromItem).setSelect(subSelectTmp.getSelectBody());
@ -2808,6 +2808,9 @@ public class DataSetTableService {
}
inExpression.getRightExpression().accept(this);
}
if (inExpression.getRightExpression() instanceof ParenthesedExpressionList) {
buffer.append(inExpression.getRightExpression());
}
}
@Override