MyBatis-Plus可以通过多种方式进行多表查询,以下是其中的一些方法:
1.使用注解方式 可以使用MyBatis-Plus提供的@Sql注解来自定义SQL语句进行多表查询,例如:
@Sql("select u.*, a.* from user u left join article a on u.id = a.user_id where u.id = #{userId}")
UserAndArticle selectUserAndArticle(@Param("userId") Long userId);