@@ -20,45 +20,26 @@ import org.mybatis.dynamic.sql.SqlTable
20
20
import org.mybatis.dynamic.sql.select.QueryExpressionDSL
21
21
import org.mybatis.dynamic.sql.select.SelectModel
22
22
23
- class KotlinUnionBuilder (
24
- private val outerDsl : QueryExpressionDSL <SelectModel >,
25
- private val unionBuilder : QueryExpressionDSL <SelectModel >.UnionBuilder
26
- ) {
23
+ class KotlinUnionBuilder (private val unionBuilder : QueryExpressionDSL <SelectModel >.UnionBuilder ) {
27
24
fun select (vararg selectList : BasicColumn ) =
28
25
select(selectList.toList())
29
26
30
27
fun select (selectList : List <BasicColumn >) =
31
- KotlinUnionFromGatherer (outerDsl, unionBuilder.select(selectList))
28
+ KotlinUnionFromGatherer (unionBuilder.select(selectList))
32
29
33
30
fun selectDistinct (vararg selectList : BasicColumn ) =
34
31
selectDistinct(selectList.toList())
35
32
36
33
fun selectDistinct (selectList : List <BasicColumn >) =
37
- KotlinUnionFromGatherer (outerDsl, unionBuilder.selectDistinct(selectList))
34
+ KotlinUnionFromGatherer (unionBuilder.selectDistinct(selectList))
38
35
}
39
36
40
- class KotlinUnionFromGatherer (
41
- private val outerDsl : QueryExpressionDSL <SelectModel >,
42
- private val fromGatherer : QueryExpressionDSL .FromGatherer <SelectModel >
43
- ) {
44
- fun from (
45
- table : SqlTable ,
46
- enhance : KotlinUnionQueryBuilder .() -> KotlinUnionQueryBuilder
47
- ): QueryExpressionDSL <SelectModel > {
48
- val unionBuilder = KotlinUnionQueryBuilder (fromGatherer.from(table))
49
- enhance(unionBuilder)
50
- return outerDsl
51
- }
37
+ class KotlinUnionFromGatherer (private val fromGatherer : QueryExpressionDSL .FromGatherer <SelectModel >) {
38
+ fun from (table : SqlTable , enhance : KotlinUnionQueryBuilder .() -> Unit ) =
39
+ enhance(KotlinUnionQueryBuilder (fromGatherer.from(table)))
52
40
53
- fun from (
54
- table : SqlTable ,
55
- alias : String ,
56
- enhance : KotlinUnionQueryBuilder .() -> KotlinUnionQueryBuilder
57
- ): QueryExpressionDSL <SelectModel > {
58
- val unionBuilder = KotlinUnionQueryBuilder (fromGatherer.from(table, alias))
59
- enhance(unionBuilder)
60
- return outerDsl
61
- }
41
+ fun from (table : SqlTable , alias : String , enhance : KotlinUnionQueryBuilder .() -> Unit ) =
42
+ enhance(KotlinUnionQueryBuilder (fromGatherer.from(table, alias)))
62
43
}
63
44
64
45
class KotlinUnionQueryBuilder (private val unionDsl : QueryExpressionDSL <SelectModel >) :
0 commit comments