快捷搜索: 王者荣耀 脱发

mybatis-plus如何多表查询

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);
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);
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);
经验分享 程序员 微信小程序 职场和发展