diff --git a/src/main/java/neatlogic/framework/sqlgenerator/$sql.java b/src/main/java/neatlogic/framework/sqlgenerator/$sql.java
index ba52355aea444c97f961a705c4a87636b5b2eba9..5c003c15052d39cf78d4ffa996751ea0414f6007 100644
--- a/src/main/java/neatlogic/framework/sqlgenerator/$sql.java
+++ b/src/main/java/neatlogic/framework/sqlgenerator/$sql.java
@@ -30,10 +30,7 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Objects;
+import java.util.*;
/**
*
基本用法
@@ -178,6 +175,99 @@ public class $sql {
return new FunctionVo(funName, parameters);
}
+ public static PlainSelect addSql(SqlVo sqlVo) {
+ PlainSelect plainSelect = new PlainSelect();
+ addSql(plainSelect, sqlVo);
+ return plainSelect;
+ }
+
+ public static void addSql(PlainSelect plainSelect, SqlVo sqlVo) {
+ if (plainSelect == null || sqlVo == null) {
+ return;
+ }
+ List groupByList = new ArrayList<>();
+ List orderByList = new ArrayList<>();
+ List selectColumnList = new ArrayList<>();
+ List whereExpressionList = new ArrayList<>();
+ JoinVo fromTable = sqlVo.getFromTable();
+ if (fromTable != null) {
+ if (CollectionUtils.isNotEmpty(fromTable.getGroupByList())) {
+ groupByList.addAll(fromTable.getGroupByList());
+ }
+ if (CollectionUtils.isNotEmpty(fromTable.getOrderByList())) {
+ orderByList.addAll(fromTable.getOrderByList());
+ }
+ if (CollectionUtils.isNotEmpty(fromTable.getSelectColumnList())) {
+ selectColumnList.addAll(fromTable.getSelectColumnList());
+ }
+ if (CollectionUtils.isNotEmpty(fromTable.getWhereExpressionList())) {
+ whereExpressionList.addAll(fromTable.getWhereExpressionList());
+ }
+ from(plainSelect, fromTable.getSchemaName(), fromTable.getTableName(), fromTable.getAlias());
+ }
+ if (CollectionUtils.isNotEmpty(sqlVo.getGroupByList())) {
+ groupByList.addAll(sqlVo.getGroupByList());
+ }
+ if (CollectionUtils.isNotEmpty(sqlVo.getOrderByList())) {
+ orderByList.addAll(sqlVo.getOrderByList());
+ }
+ if (CollectionUtils.isNotEmpty(sqlVo.getSelectColumnList())) {
+ selectColumnList.addAll(sqlVo.getSelectColumnList());
+ }
+ if (CollectionUtils.isNotEmpty(sqlVo.getWhereExpressionList())) {
+ whereExpressionList.addAll(sqlVo.getWhereExpressionList());
+ }
+ List joinList = sqlVo.getJoinList();
+ for (JoinVo joinVo : joinList) {
+ if (CollectionUtils.isNotEmpty(joinVo.getGroupByList())) {
+ groupByList.addAll(joinVo.getGroupByList());
+ }
+ if (CollectionUtils.isNotEmpty(joinVo.getOrderByList())) {
+ orderByList.addAll(joinVo.getOrderByList());
+ }
+ if (CollectionUtils.isNotEmpty(joinVo.getSelectColumnList())) {
+ selectColumnList.addAll(joinVo.getSelectColumnList());
+ }
+ if (CollectionUtils.isNotEmpty(joinVo.getWhereExpressionList())) {
+ whereExpressionList.addAll(joinVo.getWhereExpressionList());
+ }
+ addJoin(plainSelect, joinVo);
+ }
+ if (CollectionUtils.isNotEmpty(selectColumnList)) {
+ for (ColumnVo selectColumn : selectColumnList) {
+ if (StringUtils.isNotBlank(selectColumn.getName())) {
+ addSelectColumn(plainSelect, selectColumn.getName(), selectColumn.getAlias());
+ } else if (selectColumn.getFunction() != null) {
+ addSelectColumn(plainSelect, selectColumn.getFunction(), selectColumn.getAlias());
+ }
+ }
+ }
+ if (CollectionUtils.isNotEmpty(whereExpressionList)) {
+ for (ExpressionVo whereExpression : whereExpressionList) {
+ addWhereExpression(plainSelect, whereExpression);
+ }
+ }
+ if (CollectionUtils.isNotEmpty(groupByList)) {
+ groupByList.sort(Comparator.comparingInt(GroupByVo::getSort));
+ for (GroupByVo groupByVo : groupByList) {
+ addGroupBy(plainSelect, groupByVo.getColumnName());
+ }
+ }
+ if (CollectionUtils.isNotEmpty(orderByList)) {
+ orderByList.sort(Comparator.comparingInt(OrderByVo::getSort));
+ for (OrderByVo orderByVo : orderByList) {
+ if (StringUtils.isNotBlank(orderByVo.getColumnName())) {
+ addOrderBy(plainSelect, orderByVo.getColumnName(), orderByVo.getAsc());
+ } else if (orderByVo.getFunction() != null) {
+ addOrderBy(plainSelect, orderByVo.getFunction(), orderByVo.getAsc());
+ }
+ }
+ }
+ if (sqlVo.getLimit() != null) {
+ setLimit(plainSelect, sqlVo.getLimit().getOffset(), sqlVo.getLimit().getRowCount());
+ }
+ }
+
public static void from(PlainSelect plainSelect, String tableName) {
if (StringUtils.isNotBlank(tableName)) {
String schemaName = null;
diff --git a/src/main/java/neatlogic/framework/sqlgenerator/$sqlTest.java b/src/main/java/neatlogic/framework/sqlgenerator/$sqlTest.java
index 590be90681bf269b111ba4ba1c3503d7b10c35f2..678083a439e74a190ca1754e49bc7d65ad12bb40 100644
--- a/src/main/java/neatlogic/framework/sqlgenerator/$sqlTest.java
+++ b/src/main/java/neatlogic/framework/sqlgenerator/$sqlTest.java
@@ -30,6 +30,7 @@ public class $sqlTest {
public static void main(String[] args) {
List methodNameList = getMethodNameList($sql.class);
+ testSql(methodNameList);
testForm(methodNameList);
testSetSelectColumn(methodNameList);
testAddSelectColumn(methodNameList);
@@ -60,6 +61,62 @@ public class $sqlTest {
// System.out.println("plainSelect = " + plainSelect);
}
+ private static void testSql(List methodNameList) {
+ String sql = "SELECT count(a.name) AS countName, group_concat(a.name) AS tenantName, b.module_group, count(c.module_id) AS countModuleId FROM tenant a LEFT JOIN tenant_modulegroup b ON b.tenant_uuid = a.uuid LEFT JOIN tenant_module c ON c.tenant_uuid = a.uuid WHERE a.is_active = 1 AND a.name IS NOT NULL AND b.module_group IS NOT NULL AND c.module_id IS NOT NULL GROUP BY a.name, b.module_group ORDER BY a.name, b.module_group DESC LIMIT 2, 3";
+// public static PlainSelect addSql(SqlVo)
+ {
+ SqlVo sqlVo = new SqlVo();
+ sqlVo.withFromTable($sql.join("", "tenant", "a")
+ .withAddWhereExpression($sql.exp("a.is_active", "=", 1))
+ .withAddSelectColumn(new ColumnVo($sql.fun("count", "a.name"), "countName"))
+ );
+ sqlVo.withAddJoin($sql.join("left join", "tenant_modulegroup", "b")
+ .withOn($sql.exp("b.tenant_uuid", "=", "a.uuid"))
+ .withAddWhereExpression($sql.exp("b.module_group", "is not null"))
+ .withAddGroupBy(new GroupByVo("b.module_group").withSort(10))
+ .withAddOrderBy(new OrderByVo("b.module_group", "desc").withSort(10))
+ .withAddSelectColumn(new ColumnVo("b.module_group"))
+ );
+ sqlVo.withAddJoin($sql.join("left join", "tenant_module", "c")
+ .withOn($sql.exp("c.tenant_uuid", "=", "a.uuid"))
+ .withAddWhereExpression($sql.exp("c.module_id", "is not null"))
+ .withAddSelectColumn(new ColumnVo($sql.fun("count", "c.module_id"), "countModuleId")));
+ sqlVo.withAddWhereExpression($sql.exp("a.name", "is not null"));
+ sqlVo.withAddGroupBy(new GroupByVo("a.name"));
+ sqlVo.withAddOrderBy(new OrderByVo("a.name", "asc"));
+ sqlVo.withAddSelectColumn(new ColumnVo($sql.fun("group_concat", "a.name"), "tenantName"));
+ sqlVo.withLimit(new LimitVo(2, 3));
+ PlainSelect plainSelect = $sql.addSql(sqlVo);
+ Assert.isTrue(Objects.equals(plainSelect.toString(), sql), "测试失败");
+ methodNameList.remove("public static PlainSelect addSql(SqlVo)");
+ }
+// public static void addSql(PlainSelect, SqlVo)
+ {
+ SqlVo sqlVo = new SqlVo();
+ PlainSelect plainSelect = $sql.from("tenant", "a");
+ sqlVo.withAddWhereExpression($sql.exp("a.is_active", "=", 1));
+ sqlVo.withAddSelectColumn(new ColumnVo($sql.fun("count", "a.name"), "countName"));
+ sqlVo.withAddJoin($sql.join("left join", "tenant_modulegroup", "b")
+ .withOn($sql.exp("b.tenant_uuid", "=", "a.uuid"))
+ .withAddWhereExpression($sql.exp("b.module_group", "is not null"))
+ .withAddGroupBy(new GroupByVo("b.module_group").withSort(10))
+ .withAddOrderBy(new OrderByVo("b.module_group", "desc").withSort(10))
+ .withAddSelectColumn(new ColumnVo("b.module_group"))
+ );
+ sqlVo.withAddJoin($sql.join("left join", "tenant_module", "c")
+ .withOn($sql.exp("c.tenant_uuid", "=", "a.uuid"))
+ .withAddWhereExpression($sql.exp("c.module_id", "is not null"))
+ .withAddSelectColumn(new ColumnVo($sql.fun("count", "c.module_id"), "countModuleId")));
+ sqlVo.withAddWhereExpression($sql.exp("a.name", "is not null"));
+ sqlVo.withAddGroupBy(new GroupByVo("a.name"));
+ sqlVo.withAddOrderBy(new OrderByVo("a.name", "asc"));
+ sqlVo.withAddSelectColumn(new ColumnVo($sql.fun("group_concat", "a.name"), "tenantName"));
+ sqlVo.withLimit(new LimitVo(2, 3));
+ $sql.addSql(plainSelect, sqlVo);
+ Assert.isTrue(Objects.equals(plainSelect.toString(), sql), "测试失败");
+ methodNameList.remove("public static void addSql(PlainSelect, SqlVo)");
+ }
+ }
private static void testForm(List methodNameList) {
// public static PlainSelect from(String)
Assert.isTrue(Objects.equals($sql.from("tenant").toString(), "SELECT FROM tenant"), "测试失败");
diff --git a/src/main/java/neatlogic/framework/sqlgenerator/ColumnVo.java b/src/main/java/neatlogic/framework/sqlgenerator/ColumnVo.java
new file mode 100644
index 0000000000000000000000000000000000000000..65d9139866d09eb66117a85cb974701ac250b2db
--- /dev/null
+++ b/src/main/java/neatlogic/framework/sqlgenerator/ColumnVo.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2025 深圳极向量科技有限公司 All Rights Reserved.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package neatlogic.framework.sqlgenerator;
+
+public class ColumnVo {
+ private String name;
+ private FunctionVo function;
+ private String alias;
+
+ public ColumnVo(String name) {
+ this.name = name;
+ }
+
+ public ColumnVo(String name, String alias) {
+ this.name = name;
+ this.alias = alias;
+ }
+
+ public ColumnVo(FunctionVo function) {
+ this.function = function;
+ }
+
+ public ColumnVo(FunctionVo function, String alias) {
+ this.function = function;
+ this.alias = alias;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public FunctionVo getFunction() {
+ return function;
+ }
+
+ public String getAlias() {
+ return alias;
+ }
+
+ public ColumnVo withAlias(String alias) {
+ this.alias = alias;
+ return this;
+ }
+}
diff --git a/src/main/java/neatlogic/framework/sqlgenerator/GroupByVo.java b/src/main/java/neatlogic/framework/sqlgenerator/GroupByVo.java
new file mode 100644
index 0000000000000000000000000000000000000000..a797cbc7f08bbb64f74d0600c8045b3a881088d3
--- /dev/null
+++ b/src/main/java/neatlogic/framework/sqlgenerator/GroupByVo.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2025 深圳极向量科技有限公司 All Rights Reserved.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package neatlogic.framework.sqlgenerator;
+
+public class GroupByVo {
+ private final String columnName;
+
+ private int sort;
+
+ public GroupByVo(String columnName) {
+ this.columnName = columnName;
+ }
+
+ public String getColumnName() {
+ return columnName;
+ }
+
+ public int getSort() {
+ return sort;
+ }
+
+ public GroupByVo withSort(int sort) {
+ this.sort = sort;
+ return this;
+ }
+}
diff --git a/src/main/java/neatlogic/framework/sqlgenerator/JoinVo.java b/src/main/java/neatlogic/framework/sqlgenerator/JoinVo.java
index f4ccfe048d123db298326a34451a8136e7c26c81..e79804fd5de32d0f62f78c808499ca328c92f369 100644
--- a/src/main/java/neatlogic/framework/sqlgenerator/JoinVo.java
+++ b/src/main/java/neatlogic/framework/sqlgenerator/JoinVo.java
@@ -19,6 +19,9 @@ package neatlogic.framework.sqlgenerator;
import org.apache.commons.lang3.StringUtils;
+import java.util.ArrayList;
+import java.util.List;
+
public class JoinVo {
// join类型,LEFT JOIN, JOIN
private final String operationSymbol;
@@ -26,6 +29,10 @@ public class JoinVo {
private final String tableName;
private final String alias;
private ExpressionVo on;
+ private List selectColumnList;
+ private List groupByList;
+ private List orderByList;
+ private List whereExpressionList;
JoinVo(String operationSymbol, String schemaName, String tableName, String alias, ExpressionVo on) {
this.operationSymbol = operationSymbol;
@@ -51,6 +58,110 @@ public class JoinVo {
return this;
}
+ public List getSelectColumnList() {
+ return selectColumnList;
+ }
+
+ public JoinVo withSelectColumnList(List selectColumnList) {
+ this.selectColumnList = selectColumnList;
+ return this;
+ }
+
+ public JoinVo withAddSelectColumnList(List selectColumnList) {
+ if (this.selectColumnList == null) {
+ this.selectColumnList = selectColumnList;
+ } else {
+ this.selectColumnList.addAll(selectColumnList);
+ }
+ return this;
+ }
+
+ public JoinVo withAddSelectColumn(ColumnVo selectColumn) {
+ if (this.selectColumnList == null) {
+ this.selectColumnList = new ArrayList<>();
+ }
+ this.selectColumnList.add(selectColumn);
+ return this;
+ }
+
+ public List getGroupByList() {
+ return groupByList;
+ }
+
+ public JoinVo withGroupByList(List groupByList) {
+ this.groupByList = groupByList;
+ return this;
+ }
+
+ public JoinVo withAddGroupByList(List groupByList) {
+ if (this.groupByList == null) {
+ this.groupByList = groupByList;
+ } else {
+ this.groupByList.addAll(groupByList);
+ }
+ return this;
+ }
+
+ public JoinVo withAddGroupBy(GroupByVo groupBy) {
+ if (this.groupByList == null) {
+ this.groupByList = new ArrayList<>();
+ }
+ this.groupByList.add(groupBy);
+ return this;
+ }
+
+ public List getOrderByList() {
+ return orderByList;
+ }
+
+ public JoinVo withOrderByList(List orderByList) {
+ this.orderByList = orderByList;
+ return this;
+ }
+
+ public JoinVo withAddOrderByList(List orderByList) {
+ if (this.orderByList == null) {
+ this.orderByList = orderByList;
+ } else {
+ this.orderByList.addAll(orderByList);
+ }
+ return this;
+ }
+
+ public JoinVo withAddOrderBy(OrderByVo orderBy) {
+ if (this.orderByList == null) {
+ this.orderByList = new ArrayList<>();
+ }
+ this.orderByList.add(orderBy);
+ return this;
+ }
+
+ public List getWhereExpressionList() {
+ return whereExpressionList;
+ }
+
+ public JoinVo withWhereExpressionList(List whereExpressionList) {
+ this.whereExpressionList = whereExpressionList;
+ return this;
+ }
+
+ public JoinVo withAddWhereExpressionList(List whereExpressionList) {
+ if (this.whereExpressionList == null) {
+ this.whereExpressionList = whereExpressionList;
+ } else {
+ this.whereExpressionList.addAll(whereExpressionList);
+ }
+ return this;
+ }
+
+ public JoinVo withAddWhereExpression(ExpressionVo whereExpression) {
+ if (this.whereExpressionList == null) {
+ this.whereExpressionList = new ArrayList<>();
+ }
+ this.whereExpressionList.add(whereExpression);
+ return this;
+ }
+
public String getOperationSymbol() {
return operationSymbol;
}
diff --git a/src/main/java/neatlogic/framework/sqlgenerator/LimitVo.java b/src/main/java/neatlogic/framework/sqlgenerator/LimitVo.java
new file mode 100644
index 0000000000000000000000000000000000000000..98872cdf721434f484864d8eb276b94437ac164a
--- /dev/null
+++ b/src/main/java/neatlogic/framework/sqlgenerator/LimitVo.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2025 深圳极向量科技有限公司 All Rights Reserved.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package neatlogic.framework.sqlgenerator;
+
+public class LimitVo {
+ private int offset;
+ private int rowCount;
+
+ public LimitVo(int rowCount) {
+ this.rowCount = rowCount;
+ }
+
+ public LimitVo(int offset, int rowCount) {
+ this.offset = offset;
+ this.rowCount = rowCount;
+ }
+
+ public int getOffset() {
+ return offset;
+ }
+
+ public void withOffset(int offset) {
+ this.offset = offset;
+ }
+
+ public int getRowCount() {
+ return rowCount;
+ }
+
+ public void withRowCount(int rowCount) {
+ this.rowCount = rowCount;
+ }
+}
diff --git a/src/main/java/neatlogic/framework/sqlgenerator/OrderByVo.java b/src/main/java/neatlogic/framework/sqlgenerator/OrderByVo.java
new file mode 100644
index 0000000000000000000000000000000000000000..3675fd5171ab993c391330f12014c515f59f0661
--- /dev/null
+++ b/src/main/java/neatlogic/framework/sqlgenerator/OrderByVo.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2025 深圳极向量科技有限公司 All Rights Reserved.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package neatlogic.framework.sqlgenerator;
+
+public class OrderByVo {
+
+ private String columnName;
+ private FunctionVo function;
+ private String asc;
+ private int sort;;
+
+ public OrderByVo(String columnName) {
+ this.columnName = columnName;
+ }
+
+ public OrderByVo(String columnName, String asc) {
+ this.columnName = columnName;
+ this.asc = asc;
+ }
+
+ public OrderByVo(FunctionVo function) {
+ this.function = function;
+ }
+
+ public OrderByVo(FunctionVo function, String asc) {
+ this.function = function;
+ this.asc = asc;
+ }
+
+ public String getColumnName() {
+ return columnName;
+ }
+
+ public FunctionVo getFunction() {
+ return function;
+ }
+
+ public String getAsc() {
+ return asc;
+ }
+
+ public int getSort() {
+ return sort;
+ }
+
+ public OrderByVo withSort(int sort) {
+ this.sort = sort;
+ return this;
+ }
+}
diff --git a/src/main/java/neatlogic/framework/sqlgenerator/SqlVo.java b/src/main/java/neatlogic/framework/sqlgenerator/SqlVo.java
new file mode 100644
index 0000000000000000000000000000000000000000..765fb4a9ac295ba48fdf73b363a7c0a411f5ad27
--- /dev/null
+++ b/src/main/java/neatlogic/framework/sqlgenerator/SqlVo.java
@@ -0,0 +1,179 @@
+/*
+ * Copyright (C) 2025 深圳极向量科技有限公司 All Rights Reserved.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package neatlogic.framework.sqlgenerator;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class SqlVo {
+ private List selectColumnList;
+ private JoinVo fromTable;
+ private List joinList;
+ private List whereExpressionList;
+ private List groupByList;
+ private List orderByList;
+ private LimitVo limit;
+
+ public JoinVo getFromTable() {
+ return fromTable;
+ }
+
+ public SqlVo withFromTable(JoinVo fromTable) {
+ this.fromTable = fromTable;
+ return this;
+ }
+
+ public List getJoinList() {
+ return joinList;
+ }
+
+ public SqlVo withJoinList(List joinList) {
+ this.joinList = joinList;
+ return this;
+ }
+
+ public SqlVo withAddJoinList(List joinList) {
+ if (this.joinList == null) {
+ this.joinList = joinList;
+ } else {
+ this.joinList.addAll(joinList);
+ }
+ return this;
+ }
+
+ public SqlVo withAddJoin(JoinVo join) {
+ if (this.joinList == null) {
+ this.joinList = new ArrayList<>();
+ }
+ this.joinList.add(join);
+ return this;
+ }
+
+ public List getSelectColumnList() {
+ return selectColumnList;
+ }
+
+ public SqlVo withSelectColumnList(List selectColumnList) {
+ this.selectColumnList = selectColumnList;
+ return this;
+ }
+
+ public SqlVo withAddSelectColumnList(List selectColumnList) {
+ if (this.selectColumnList == null) {
+ this.selectColumnList = selectColumnList;
+ } else {
+ this.selectColumnList.addAll(selectColumnList);
+ }
+ return this;
+ }
+
+ public SqlVo withAddSelectColumn(ColumnVo selectColumn) {
+ if (this.selectColumnList == null) {
+ this.selectColumnList = new ArrayList<>();
+ }
+ this.selectColumnList.add(selectColumn);
+ return this;
+ }
+
+ public List getGroupByList() {
+ return groupByList;
+ }
+
+ public SqlVo withGroupByList(List groupByList) {
+ this.groupByList = groupByList;
+ return this;
+ }
+
+ public SqlVo withAddGroupByList(List groupByList) {
+ if (this.groupByList == null) {
+ this.groupByList = groupByList;
+ } else {
+ this.groupByList.addAll(groupByList);
+ }
+ return this;
+ }
+
+ public SqlVo withAddGroupBy(GroupByVo groupBy) {
+ if (this.groupByList == null) {
+ this.groupByList = new ArrayList<>();
+ }
+ this.groupByList.add(groupBy);
+ return this;
+ }
+
+ public List getOrderByList() {
+ return orderByList;
+ }
+
+ public SqlVo withOrderByList(List orderByList) {
+ this.orderByList = orderByList;
+ return this;
+ }
+
+ public SqlVo withAddOrderByList(List orderByList) {
+ if (this.orderByList == null) {
+ this.orderByList = orderByList;
+ } else {
+ this.orderByList.addAll(orderByList);
+ }
+ return this;
+ }
+
+ public SqlVo withAddOrderBy(OrderByVo orderBy) {
+ if (this.orderByList == null) {
+ this.orderByList = new ArrayList<>();
+ }
+ this.orderByList.add(orderBy);
+ return this;
+ }
+
+ public List getWhereExpressionList() {
+ return whereExpressionList;
+ }
+
+ public SqlVo withWhereExpressionList(List whereExpressionList) {
+ this.whereExpressionList = whereExpressionList;
+ return this;
+ }
+
+ public SqlVo withAddWhereExpressionList(List whereExpressionList) {
+ if (this.whereExpressionList == null) {
+ this.whereExpressionList = whereExpressionList;
+ } else {
+ this.whereExpressionList.addAll(whereExpressionList);
+ }
+ return this;
+ }
+
+ public SqlVo withAddWhereExpression(ExpressionVo whereExpression) {
+ if (this.whereExpressionList == null) {
+ this.whereExpressionList = new ArrayList<>();
+ }
+ this.whereExpressionList.add(whereExpression);
+ return this;
+ }
+
+ public LimitVo getLimit() {
+ return limit;
+ }
+
+ public SqlVo withLimit(LimitVo limit) {
+ this.limit = limit;
+ return this;
+ }
+}