yulichang / mybatis-plus-join

支持连表查询的mybatis-plus,mybatis-plus风格的连表操作提供wrapper.leftJoin(),wrapper.rightJoin()等操作
https://mybatis-plus-join.github.io
Apache License 2.0
1.11k stars 125 forks source link

Kotlin支持 #1

Closed WingGao closed 6 months ago

WingGao commented 3 years ago

对于Kotlin类型的Entity,好像没法使用

val dList = deviceService.baseMapper.selectJoinList(
            DeviceInfo::class.java, MPJLambdaWrapper<Device>()
                .selectAll(DeviceInfo::class.java)
                .leftJoin(DeviceInfo::class.java, DeviceInfo::deviceNo, Device::deviceNo)
                .eq(Device::ownerId, owner.id)
        )

error

该方法仅能传入 lambda 表达式产生的合成类
com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: 该方法仅能传入 lambda 表达式产生的合成类
    at com.baomidou.mybatisplus.core.toolkit.ExceptionUtils.mpe(ExceptionUtils.java:49)
    at com.baomidou.mybatisplus.core.toolkit.support.SerializedLambda.resolve(SerializedLambda.java:56)
    at com.baomidou.mybatisplus.core.toolkit.LambdaUtils.lambda$resolve$0(LambdaUtils.java:64)
    at java.util.Optional.orElseGet(Optional.java:267)
    at com.baomidou.mybatisplus.core.toolkit.LambdaUtils.resolve(LambdaUtils.java:63)
    at com.github.yulichang.toolkit.LambdaUtils.getColumn(LambdaUtils.java:29)
    at com.github.yulichang.wrapper.MPJLambdaWrapper.join(MPJLambdaWrapper.java:210)
    at com.github.yulichang.wrapper.MPJLambdaWrapper.join(MPJLambdaWrapper.java:29)
    at com.github.yulichang.wrapper.interfaces.LambdaJoin.leftJoin(LambdaJoin.java:17)
    at com.github.yulichang.wrapper.interfaces.LambdaJoin.leftJoin(LambdaJoin.java:13)
    at DeviceInfoController.list(DeviceInfoController.kt:46)
yulichang commented 3 years ago

感谢您的反馈,已将kotlin支持纳入开发计划

yulichang commented 6 months ago

https://github.com/yulichang/mybatis-plus-join/blob/master/mybatis-plus-join-test/test-kotlin/src/test/java/com/github/yulichang/test/kt/LambdaWrapperTest.kt