(improvement)(chat) support add parenthesis and add arenthesis in sys_imp_date (#184)

This commit is contained in:
lexluo09
2023-10-10 16:13:48 +08:00
committed by GitHub
parent eee39f56a8
commit 500652da36
4 changed files with 172 additions and 52 deletions

View File

@@ -72,6 +72,7 @@ public class WhereCorrector extends BaseSemanticCorrector {
List<String> whereFields = SqlParserSelectHelper.getWhereFields(sql);
if (CollectionUtils.isEmpty(whereFields) || !whereFields.contains(DateUtils.DATE_FIELD)) {
String currentDate = DSLDateHelper.getReferenceDate(semanticCorrectInfo.getParseInfo().getModelId());
sql = SqlParserUpdateHelper.addParenthesisToWhere(sql);
sql = SqlParserUpdateHelper.addWhere(sql, DateUtils.DATE_FIELD, currentDate);
}
semanticCorrectInfo.setSql(sql);