|
@@ -0,0 +1,120 @@
|
|
|
+package com.zhongzheng.framework.mybatisplus;
|
|
|
+
|
|
|
+import net.sf.jsqlparser.expression.Expression;
|
|
|
+import net.sf.jsqlparser.expression.ExpressionVisitor;
|
|
|
+import net.sf.jsqlparser.expression.operators.relational.ItemsList;
|
|
|
+import net.sf.jsqlparser.expression.operators.relational.MultiExpressionList;
|
|
|
+import net.sf.jsqlparser.expression.operators.relational.SupportsOldOracleJoinSyntax;
|
|
|
+import net.sf.jsqlparser.parser.ASTNodeAccessImpl;
|
|
|
+
|
|
|
+public class FindInSetExpression extends ASTNodeAccessImpl implements Expression {
|
|
|
+ private Expression leftExpression;
|
|
|
+ private ItemsList leftItemsList;
|
|
|
+ private ItemsList rightItemsList;
|
|
|
+ private boolean not = false;
|
|
|
+ private Expression rightExpression;
|
|
|
+ private MultiExpressionList multiExpressionList;
|
|
|
+ private int oldOracleJoinSyntax = 0;
|
|
|
+
|
|
|
+ public FindInSetExpression() {
|
|
|
+ }
|
|
|
+
|
|
|
+ public FindInSetExpression(Expression leftExpression, ItemsList itemsList) {
|
|
|
+ this.setLeftExpression(leftExpression);
|
|
|
+ this.setRightItemsList(itemsList);
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setOldOracleJoinSyntax(int oldOracleJoinSyntax) {
|
|
|
+ this.oldOracleJoinSyntax = oldOracleJoinSyntax;
|
|
|
+ if (oldOracleJoinSyntax < 0 || oldOracleJoinSyntax > 1) {
|
|
|
+ throw new IllegalArgumentException("unexpected join type for oracle found with IN (type=" + oldOracleJoinSyntax + ")");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public int getOldOracleJoinSyntax() {
|
|
|
+ return this.oldOracleJoinSyntax;
|
|
|
+ }
|
|
|
+
|
|
|
+ public ItemsList getRightItemsList() {
|
|
|
+ return this.rightItemsList;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Expression getLeftExpression() {
|
|
|
+ return this.leftExpression;
|
|
|
+ }
|
|
|
+
|
|
|
+ public final void setRightItemsList(ItemsList list) {
|
|
|
+ this.rightItemsList = list;
|
|
|
+ }
|
|
|
+
|
|
|
+ public final void setLeftExpression(Expression expression) {
|
|
|
+ this.leftExpression = expression;
|
|
|
+ }
|
|
|
+
|
|
|
+ public boolean isNot() {
|
|
|
+ return this.not;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setNot(boolean b) {
|
|
|
+ this.not = b;
|
|
|
+ }
|
|
|
+
|
|
|
+ public ItemsList getLeftItemsList() {
|
|
|
+ return this.leftItemsList;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setLeftItemsList(ItemsList leftItemsList) {
|
|
|
+ this.leftItemsList = leftItemsList;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Expression getRightExpression() {
|
|
|
+ return this.rightExpression;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setRightExpression(Expression rightExpression) {
|
|
|
+ this.rightExpression = rightExpression;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ private String getLeftExpressionString() {
|
|
|
+ return this.leftExpression + (this.oldOracleJoinSyntax == 1 ? "(+)" : "");
|
|
|
+ }
|
|
|
+
|
|
|
+ public String toString() {
|
|
|
+ StringBuilder statementBuilder = new StringBuilder();
|
|
|
+
|
|
|
+ statementBuilder.append("FIND_IN_SET ");
|
|
|
+ statementBuilder.append("(");
|
|
|
+ statementBuilder.append(this.getLeftExpressionString());
|
|
|
+ statementBuilder.append(",");
|
|
|
+ statementBuilder.append(this.rightExpression);
|
|
|
+ statementBuilder.append(")");
|
|
|
+
|
|
|
+ return statementBuilder.toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ public int getOraclePriorPosition() {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setOraclePriorPosition(int priorPosition) {
|
|
|
+ if (priorPosition != 0) {
|
|
|
+ throw new IllegalArgumentException("unexpected prior for oracle found");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public MultiExpressionList getMultiExpressionList() {
|
|
|
+ return this.multiExpressionList;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setMultiExpressionList(MultiExpressionList multiExpressionList) {
|
|
|
+ this.multiExpressionList = multiExpressionList;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void accept(ExpressionVisitor expressionVisitor) {
|
|
|
+
|
|
|
+ }
|
|
|
+}
|
|
|
+
|