|
18 | 18 | import java.util.Arrays;
|
19 | 19 | import java.util.List;
|
20 | 20 |
|
21 |
| -import org.mybatis.dynamic.sql.delete.DeleteModelBuilder; |
22 |
| -import org.mybatis.dynamic.sql.insert.InsertBatchModelBuilder; |
23 |
| -import org.mybatis.dynamic.sql.insert.InsertModelBuilder; |
24 |
| -import org.mybatis.dynamic.sql.insert.InsertSelectModelBuilder; |
25 |
| -import org.mybatis.dynamic.sql.insert.InsertSelectModelBuilder.InsertColumnGatherer; |
26 |
| -import org.mybatis.dynamic.sql.select.Buildable; |
27 |
| -import org.mybatis.dynamic.sql.select.QueryExpressionBuilder; |
| 21 | +import org.mybatis.dynamic.sql.delete.DeleteDSL; |
| 22 | +import org.mybatis.dynamic.sql.insert.InsertBatchDSL; |
| 23 | +import org.mybatis.dynamic.sql.insert.InsertDSL; |
| 24 | +import org.mybatis.dynamic.sql.insert.InsertSelectDSL; |
| 25 | +import org.mybatis.dynamic.sql.select.QueryExpressionDSL; |
| 26 | +import org.mybatis.dynamic.sql.select.SelectDSL; |
28 | 27 | import org.mybatis.dynamic.sql.select.SelectModel;
|
29 |
| -import org.mybatis.dynamic.sql.select.SelectModelBuilder; |
30 | 28 | import org.mybatis.dynamic.sql.select.aggregate.Avg;
|
31 | 29 | import org.mybatis.dynamic.sql.select.aggregate.Count;
|
32 | 30 | import org.mybatis.dynamic.sql.select.aggregate.CountAll;
|
|
36 | 34 | import org.mybatis.dynamic.sql.select.join.EqualTo;
|
37 | 35 | import org.mybatis.dynamic.sql.select.join.JoinCondition;
|
38 | 36 | import org.mybatis.dynamic.sql.select.join.JoinCriterion;
|
39 |
| -import org.mybatis.dynamic.sql.update.UpdateModelBuilder; |
| 37 | +import org.mybatis.dynamic.sql.update.UpdateDSL; |
| 38 | +import org.mybatis.dynamic.sql.util.Buildable; |
40 | 39 | import org.mybatis.dynamic.sql.where.condition.IsBetween;
|
41 | 40 | import org.mybatis.dynamic.sql.where.condition.IsEqualTo;
|
42 | 41 | import org.mybatis.dynamic.sql.where.condition.IsEqualToWithSubselect;
|
|
67 | 66 | public interface SqlBuilder {
|
68 | 67 |
|
69 | 68 | // statements
|
70 |
| - static DeleteModelBuilder deleteFrom(SqlTable table) { |
71 |
| - return DeleteModelBuilder.deleteFrom(table); |
| 69 | + static DeleteDSL deleteFrom(SqlTable table) { |
| 70 | + return DeleteDSL.deleteFrom(table); |
72 | 71 | }
|
73 | 72 |
|
74 |
| - static <T> InsertModelBuilder.IntoGatherer<T> insert(T record) { |
75 |
| - return InsertModelBuilder.insert(record); |
| 73 | + static <T> InsertDSL.IntoGatherer<T> insert(T record) { |
| 74 | + return InsertDSL.insert(record); |
76 | 75 | }
|
77 | 76 |
|
78 | 77 | @SafeVarargs
|
79 |
| - static <T> InsertBatchModelBuilder.IntoGatherer<T> insert(T...records) { |
80 |
| - return InsertBatchModelBuilder.insert(records); |
| 78 | + static <T> InsertBatchDSL.IntoGatherer<T> insert(T...records) { |
| 79 | + return InsertBatchDSL.insert(records); |
81 | 80 | }
|
82 | 81 |
|
83 |
| - static <T> InsertBatchModelBuilder.IntoGatherer<T> insert(List<T> records) { |
84 |
| - return InsertBatchModelBuilder.insert(records); |
| 82 | + static <T> InsertBatchDSL.IntoGatherer<T> insert(List<T> records) { |
| 83 | + return InsertBatchDSL.insert(records); |
85 | 84 | }
|
86 | 85 |
|
87 |
| - static InsertColumnGatherer insertInto(SqlTable table) { |
88 |
| - return InsertSelectModelBuilder.insertInto(table); |
| 86 | + static InsertSelectDSL.InsertColumnGatherer insertInto(SqlTable table) { |
| 87 | + return InsertSelectDSL.insertInto(table); |
89 | 88 | }
|
90 | 89 |
|
91 |
| - static QueryExpressionBuilder select(SelectListItem...selectList) { |
92 |
| - return SelectModelBuilder.select(selectList); |
| 90 | + static QueryExpressionDSL select(SelectListItem...selectList) { |
| 91 | + return SelectDSL.select(selectList); |
93 | 92 | }
|
94 | 93 |
|
95 |
| - static QueryExpressionBuilder selectDistinct(SelectListItem...selectList) { |
96 |
| - return SelectModelBuilder.selectDistinct(selectList); |
| 94 | + static QueryExpressionDSL selectDistinct(SelectListItem...selectList) { |
| 95 | + return SelectDSL.selectDistinct(selectList); |
97 | 96 | }
|
98 | 97 |
|
99 |
| - static UpdateModelBuilder update(SqlTable table) { |
100 |
| - return UpdateModelBuilder.update(table); |
| 98 | + static UpdateDSL update(SqlTable table) { |
| 99 | + return UpdateDSL.update(table); |
101 | 100 | }
|
102 | 101 |
|
103 | 102 | // where condition connectors
|
@@ -136,6 +135,19 @@ static <T> SqlCriterion<T> and(SqlColumn<T> column, VisitableCondition<T> condit
|
136 | 135 | .build();
|
137 | 136 | }
|
138 | 137 |
|
| 138 | + // join support |
| 139 | + static <T> JoinCriterion<T> and(SqlColumn<T> joinColumn, JoinCondition<T> joinCondition) { |
| 140 | + return new JoinCriterion.Builder<T>() |
| 141 | + .withJoinColumn(joinColumn) |
| 142 | + .withJoinCondition(joinCondition) |
| 143 | + .withConnector("and") //$NON-NLS-1$ |
| 144 | + .build(); |
| 145 | + } |
| 146 | + |
| 147 | + static <T> EqualTo<T> equalTo(SqlColumn<T> column) { |
| 148 | + return new EqualTo<>(column); |
| 149 | + } |
| 150 | + |
139 | 151 | // aggregate support
|
140 | 152 | static CountAll count() {
|
141 | 153 | return new CountAll();
|
@@ -277,17 +289,4 @@ static IsInCaseInsensitive isInCaseInsensitive(String...values) {
|
277 | 289 | static IsNotInCaseInsensitive isNotInCaseInsensitive(String...values) {
|
278 | 290 | return IsNotInCaseInsensitive.of(Arrays.asList(values));
|
279 | 291 | }
|
280 |
| - |
281 |
| - // join support |
282 |
| - static <T> JoinCriterion<T> and(SqlColumn<T> joinColumn, JoinCondition<T> joinCondition) { |
283 |
| - return new JoinCriterion.Builder<T>() |
284 |
| - .withJoinColumn(joinColumn) |
285 |
| - .withJoinCondition(joinCondition) |
286 |
| - .withConnector("and") //$NON-NLS-1$ |
287 |
| - .build(); |
288 |
| - } |
289 |
| - |
290 |
| - static <T> EqualTo<T> equalTo(SqlColumn<T> column) { |
291 |
| - return new EqualTo<>(column); |
292 |
| - } |
293 | 292 | }
|
0 commit comments