mybatis-plus 多表条件查询

@Select("select * from tb_test as test left join tb_test1 as test1 ${ew.customSqlSegment}")   //${ew.customSqlSegment} 吧wrapper条件拼接在sql上
IPage<CompanyTableVo> queryCompanyPage(@Param("page") Page page, @Param(Constants.WRAPPER) Wrapper wrapper);

使用 queryWrapper.eq()方法:这里的eq中的test1可以是你sql中写的其他表名称/别名
eq("test1.id",3)

 官方文档: https://baomidou.com/pages/10c804/

posted @ 2020-03-19 17:07  朱思年  阅读(8172)  评论(0编辑  收藏  举报