32
32
*/
33
33
public class SelectDSL <R > {
34
34
35
- private Function <SelectModel , R > decoratorFunction ;
35
+ private Function <SelectModel , R > adapterFunction ;
36
36
private List <QueryExpressionModel > queryExpressions = new ArrayList <>();
37
37
private OrderByModel orderByModel ;
38
38
39
- private SelectDSL (Function <SelectModel , R > decoratorFunction ) {
40
- this .decoratorFunction = Objects .requireNonNull (decoratorFunction );
39
+ private SelectDSL (Function <SelectModel , R > adapterFunction ) {
40
+ this .adapterFunction = Objects .requireNonNull (adapterFunction );
41
41
}
42
42
43
43
private QueryExpressionDSL <R > queryExpressionBuilder (BasicColumn ...selectList ) {
@@ -55,34 +55,30 @@ private QueryExpressionDSL<R> distinctQueryExpressionBuilder(BasicColumn...selec
55
55
.build ();
56
56
}
57
57
58
- public static <R > QueryExpressionDSL <R > genericSelect (Function <SelectModel , R > decoratorFunction , BasicColumn ...selectList ) {
59
- SelectDSL <R > selectModelBuilder = new SelectDSL <>(decoratorFunction );
58
+ public static <R > QueryExpressionDSL <R > genericSelect (Function <SelectModel , R > adapterFunction , BasicColumn ...selectList ) {
59
+ SelectDSL <R > selectModelBuilder = new SelectDSL <>(adapterFunction );
60
60
return selectModelBuilder .queryExpressionBuilder (selectList );
61
61
}
62
62
63
- public static <R > QueryExpressionDSL <R > genericSelectDistinct (Function <SelectModel , R > decoratorFunction , BasicColumn ...selectList ) {
64
- SelectDSL <R > selectModelBuilder = new SelectDSL <>(decoratorFunction );
63
+ public static <R > QueryExpressionDSL <R > genericSelectDistinct (Function <SelectModel , R > adapterFunction , BasicColumn ...selectList ) {
64
+ SelectDSL <R > selectModelBuilder = new SelectDSL <>(adapterFunction );
65
65
return selectModelBuilder .distinctQueryExpressionBuilder (selectList );
66
66
}
67
67
68
68
public static QueryExpressionDSL <SelectModel > select (BasicColumn ...selectList ) {
69
69
return genericSelect (Function .identity (), selectList );
70
70
}
71
71
72
- public static <T > QueryExpressionDSL <MyBatis3SelectModel <T >> select (Function <SelectStatement , T > mapperMethod , BasicColumn ...selectList ) {
73
- return genericSelect (decorate ( mapperMethod ), selectList );
72
+ public static <T > QueryExpressionDSL <MyBatis3SelectModelAdapter <T >> select (Function <SelectStatement , T > mapperMethod , BasicColumn ...selectList ) {
73
+ return genericSelect (selectModel -> MyBatis3SelectModelAdapter . of ( selectModel , mapperMethod ), selectList );
74
74
}
75
75
76
76
public static QueryExpressionDSL <SelectModel > selectDistinct (BasicColumn ...selectList ) {
77
77
return genericSelectDistinct (Function .identity (), selectList );
78
78
}
79
79
80
- public static <T > QueryExpressionDSL <MyBatis3SelectModel <T >> selectDistinct (Function <SelectStatement , T > mapperMethod , BasicColumn ...selectList ) {
81
- return genericSelectDistinct (decorate (mapperMethod ), selectList );
82
- }
83
-
84
- private static <T > Function <SelectModel , MyBatis3SelectModel <T >> decorate (Function <SelectStatement , T > mapperMethod ) {
85
- return selectModel -> MyBatis3SelectModel .of (selectModel , mapperMethod );
80
+ public static <T > QueryExpressionDSL <MyBatis3SelectModelAdapter <T >> selectDistinct (Function <SelectStatement , T > mapperMethod , BasicColumn ...selectList ) {
81
+ return genericSelectDistinct (selectModel -> MyBatis3SelectModelAdapter .of (selectModel , mapperMethod ), selectList );
86
82
}
87
83
88
84
void addQueryExpression (QueryExpressionModel queryExpression ) {
@@ -98,6 +94,6 @@ public R build() {
98
94
.withQueryExpressions (queryExpressions )
99
95
.withOrderByModel (orderByModel )
100
96
.build ();
101
- return decoratorFunction .apply (selectModel );
97
+ return adapterFunction .apply (selectModel );
102
98
}
103
99
}
0 commit comments