Mybatis Plus代码方式实现多表关联查询

  Mapper接口如下:

  • 例1
@Select("SELECT t_question.*,t_student.`name` FROM t_question,t_student WHERE t_question.student_id=t_student.id")
    List getQuestionStudent(Pagination page);
  • 例2
@Select("SELECT a.id,a.`name`,a.age,b.`describe` FROM USER a LEFT JOIN userinfo b ON a.id = b.user_id where a.id=#{id}")  List> dyGetUserList(Page> page,Integer id);

转载于:https://my.oschina.net/u/3734816/blog/3069832

你可能感兴趣的:(Mybatis Plus代码方式实现多表关联查询)