yulichang / mybatis-plus-join

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

leftjoin分页查询问题, 查询有数据, 但是records是All elements are null #139

Closed qq243329721 closed 2 weeks ago

qq243329721 commented 2 weeks ago

当前使用版本(必填,否则不予处理)

        <dependency>
            <groupId>com.github.yulichang</groupId>
            <artifactId>mybatis-plus-join-core</artifactId>
            <version>1.4.12</version>
        </dependency>

该问题是如何引起的?(确定最新版也有问题再提!!!)

MPJLambdaWrapper query = new MPJLambdaWrapper<>(); query.selectAll(StationGas.class); query.selectCollection(StationGasGun.class, StationGas::getStationGasGunList); query.leftJoin(StationGasGun.class, StationGasGun::getStationGasId, StationGas::getId); query.eq(StationGasGun::getType, 1); Page iPage = this.stationGasService.selectJoinListPage(selectPage, StationGas.class, query); image

query.selectCollection(StationGasGun.class, StationGas::getStationGasGunList); query.leftJoin(StationGasGun.class, StationGasGun::getStationGasId, StationGas::getId); query.eq(StationGasGun::getType, 1); 不加这三行的时候时候返回正常 image

重现步骤(如果有就写完整)

同上

报错信息

无报错

qq243329721 commented 2 weeks ago

image 补充, 带leftjoin条件 selectJoinList也是null

yulichang commented 2 weeks ago

依赖能用starter

cxz158 commented 1 week ago

我也同样遇到了records返回都是null的情况,这个错误可能是因为自定义sqlSessionFactory导致的,我引用的mybatis-plus-join-boot-starter但可能因为公司组件自定义的sqlSessionFactory影响了MPJInterceptor的添加,手动配置最后一个添加MPJInterceptor后正常了。 https://mybatisplusjoin.com/pages/problem.html#invalid-bound-statement-not-found