diff --git a/src/main/java/neatlogic/framework/sqlgenerator/$sql.java b/src/main/java/neatlogic/framework/sqlgenerator/$sql.java index af25ce7cd2fb840538ed51d1aedc9b3a369d0fd0..964e43d615c08ce7b7675a6cba793647c882d4e2 100644 --- a/src/main/java/neatlogic/framework/sqlgenerator/$sql.java +++ b/src/main/java/neatlogic/framework/sqlgenerator/$sql.java @@ -17,6 +17,8 @@ package neatlogic.framework.sqlgenerator; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.serializer.SerializerFeature; import neatlogic.framework.util.TimeUtil; import net.sf.jsqlparser.expression.*; import net.sf.jsqlparser.expression.operators.conditional.AndExpression; @@ -255,8 +257,13 @@ public class $sql { } } if (CollectionUtils.isNotEmpty(whereExpressionList)) { + List expressionJSONStringList = new ArrayList<>(); for (ExpressionVo whereExpression : whereExpressionList) { - addWhereExpression(plainSelect, whereExpression); + String expressionJSONString = JSON.toJSONString(whereExpression, SerializerFeature.MapSortField); + if (!expressionJSONStringList.contains(expressionJSONString)) { + addWhereExpression(plainSelect, whereExpression); + expressionJSONStringList.add(expressionJSONString); + } } } if (CollectionUtils.isNotEmpty(groupByList)) {