@@ -20,45 +20,26 @@ import org.mybatis.dynamic.sql.SqlTable
2020import org.mybatis.dynamic.sql.select.QueryExpressionDSL
2121import org.mybatis.dynamic.sql.select.SelectModel
2222
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 ) {
2724 fun select (vararg selectList : BasicColumn ) =
2825 select(selectList.toList())
2926
3027 fun select (selectList : List <BasicColumn >) =
31- KotlinUnionFromGatherer (outerDsl, unionBuilder.select(selectList))
28+ KotlinUnionFromGatherer (unionBuilder.select(selectList))
3229
3330 fun selectDistinct (vararg selectList : BasicColumn ) =
3431 selectDistinct(selectList.toList())
3532
3633 fun selectDistinct (selectList : List <BasicColumn >) =
37- KotlinUnionFromGatherer (outerDsl, unionBuilder.selectDistinct(selectList))
34+ KotlinUnionFromGatherer (unionBuilder.selectDistinct(selectList))
3835}
3936
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)))
5240
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)))
6243}
6344
6445class KotlinUnionQueryBuilder (private val unionDsl : QueryExpressionDSL <SelectModel >) :
0 commit comments