33
33
34
34
class GroupingTest {
35
35
private static class Foo extends SqlTable {
36
- public SqlColumn <Integer > A = column ("A" );
37
- public SqlColumn <Integer > B = column ("B" );
38
- public SqlColumn <Integer > C = column ("C" );
36
+ public SqlColumn <Integer > columnA = column ("A" );
37
+ public SqlColumn <Integer > columnB = column ("B" );
38
+ public SqlColumn <Integer > columnC = column ("C" );
39
39
40
40
public Foo () {
41
41
super ("Foo" );
42
42
}
43
43
}
44
44
45
45
private static final Foo foo = new Foo ();
46
- private static final SqlColumn <Integer > A = foo .A ;
47
- private static final SqlColumn <Integer > B = foo .B ;
48
- private static final SqlColumn <Integer > C = foo .C ;
46
+ private static final SqlColumn <Integer > columnA = foo .columnA ;
47
+ private static final SqlColumn <Integer > columnB = foo .columnB ;
48
+ private static final SqlColumn <Integer > columnC = foo .columnC ;
49
49
50
50
@ Test
51
51
void testSimpleGrouping () {
52
- SelectStatementProvider selectStatement = select (A , B , C )
52
+ SelectStatementProvider selectStatement = select (columnA , columnB , columnC )
53
53
.from (foo )
54
- .where (A , isEqualTo (1 ), or (A , isEqualTo (2 )))
55
- .and (B , isEqualTo (3 ))
54
+ .where (columnA , isEqualTo (1 ), or (columnA , isEqualTo (2 )))
55
+ .and (columnB , isEqualTo (3 ))
56
56
.build ()
57
57
.render (RenderingStrategies .MYBATIS3 );
58
58
@@ -68,14 +68,14 @@ void testSimpleGrouping() {
68
68
69
69
@ Test
70
70
void testComplexGrouping () {
71
- SelectStatementProvider selectStatement = select (A , B , C )
71
+ SelectStatementProvider selectStatement = select (columnA , columnB , columnC )
72
72
.from (foo )
73
73
.where (
74
- group (A , isEqualTo (1 ), or (A , isGreaterThan (5 ))),
75
- and (B , isEqualTo (1 )),
76
- or (A , isLessThan (0 ), and (B , isEqualTo (2 )))
74
+ group (columnA , isEqualTo (1 ), or (columnA , isGreaterThan (5 ))),
75
+ and (columnB , isEqualTo (1 )),
76
+ or (columnA , isLessThan (0 ), and (columnB , isEqualTo (2 )))
77
77
)
78
- .and (C , isEqualTo (1 ))
78
+ .and (columnC , isEqualTo (1 ))
79
79
.build ()
80
80
.render (RenderingStrategies .MYBATIS3 );
81
81
@@ -94,14 +94,14 @@ void testComplexGrouping() {
94
94
95
95
@ Test
96
96
void testGroupAndExists () {
97
- SelectStatementProvider selectStatement = select (A , B , C )
97
+ SelectStatementProvider selectStatement = select (columnA , columnB , columnC )
98
98
.from (foo )
99
99
.where (
100
- group (exists (select (foo .allColumns ()).from (foo ).where (A , isEqualTo (3 ))), and (A , isEqualTo (1 )), or (A , isGreaterThan (5 ))),
101
- and (B , isEqualTo (1 )),
102
- or (A , isLessThan (0 ), and (B , isEqualTo (2 )))
100
+ group (exists (select (foo .allColumns ()).from (foo ).where (columnA , isEqualTo (3 ))), and (columnA , isEqualTo (1 )), or (columnA , isGreaterThan (5 ))),
101
+ and (columnB , isEqualTo (1 )),
102
+ or (columnA , isLessThan (0 ), and (columnB , isEqualTo (2 )))
103
103
)
104
- .and (C , isEqualTo (1 ))
104
+ .and (columnC , isEqualTo (1 ))
105
105
.build ()
106
106
.render (RenderingStrategies .MYBATIS3 );
107
107
@@ -121,14 +121,14 @@ void testGroupAndExists() {
121
121
122
122
@ Test
123
123
void testNestedGrouping () {
124
- SelectStatementProvider selectStatement = select (A , B , C )
124
+ SelectStatementProvider selectStatement = select (columnA , columnB , columnC )
125
125
.from (foo )
126
126
.where (
127
- group (group (A , isEqualTo (1 ), or (A , isGreaterThan (5 ))), and (A , isGreaterThan (5 ))),
128
- and (group (A , isEqualTo (1 ), or (A , isGreaterThan (5 ))), or (B , isEqualTo (1 ))),
129
- or (group (A , isEqualTo (1 ), or (A , isGreaterThan (5 ))), and (A , isLessThan (0 ), and (B , isEqualTo (2 ))))
127
+ group (group (columnA , isEqualTo (1 ), or (columnA , isGreaterThan (5 ))), and (columnA , isGreaterThan (5 ))),
128
+ and (group (columnA , isEqualTo (1 ), or (columnA , isGreaterThan (5 ))), or (columnB , isEqualTo (1 ))),
129
+ or (group (columnA , isEqualTo (1 ), or (columnA , isGreaterThan (5 ))), and (columnA , isLessThan (0 ), and (columnB , isEqualTo (2 ))))
130
130
)
131
- .and (C , isEqualTo (1 ))
131
+ .and (columnC , isEqualTo (1 ))
132
132
.build ()
133
133
.render (RenderingStrategies .MYBATIS3 );
134
134
@@ -152,12 +152,12 @@ void testNestedGrouping() {
152
152
153
153
@ Test
154
154
void testAndOrCriteriaGroups () {
155
- SelectStatementProvider selectStatement = select (A , B , C )
155
+ SelectStatementProvider selectStatement = select (columnA , columnB , columnC )
156
156
.from (foo )
157
- .where (A , isEqualTo (6 ))
158
- .and (C , isEqualTo (1 ))
159
- .and (group (A , isEqualTo (1 ), or (A , isGreaterThan (5 ))), or (B , isEqualTo (1 )))
160
- .or (group (A , isEqualTo (1 ), or (A , isGreaterThan (5 ))), and (A , isLessThan (0 ), and (B , isEqualTo (2 ))))
157
+ .where (columnA , isEqualTo (6 ))
158
+ .and (columnC , isEqualTo (1 ))
159
+ .and (group (columnA , isEqualTo (1 ), or (columnA , isGreaterThan (5 ))), or (columnB , isEqualTo (1 )))
160
+ .or (group (columnA , isEqualTo (1 ), or (columnA , isGreaterThan (5 ))), and (columnA , isLessThan (0 ), and (columnB , isEqualTo (2 ))))
161
161
.build ()
162
162
.render (RenderingStrategies .MYBATIS3 );
163
163
0 commit comments