@Results 注解

@Select("select * from student where sid = 1 ")
    @Results({
            @Result(property = "sid",column = "sid"),
            @Result(property = "name",column = "name"),
            @Result(property = "sex",column = "sex"),
            @Result(property = "age",column = "age"),
    })
    Student getStudentInfo();

@One 注解 与 @Many注解

@Select("select * from borrow where id = #{id}")
    @Results({
          @Result(id = true,property = "id",column = "id"),
          @Result(property = "student",column = "sid",one = @One(select = "getStudentInfo")),
          @Result(property = "book",column = "bid",one = @One(select = "getBookInfo")),
          @Result(property = "date",column = "date")
    })
    Borrow getBorrowInfo(int id);

// student 子查询
@Select("select * from student where sid = #{sid}")
    @Results({
            @Result(property = "sid",column = "sid"),
            @Result(property = "name",column = "name"),
            @Result(property = "sex",column = "sex"),
            @Result(property = "age",column = "age"),
    })
    Student getStudentInfo(int sid);

// book 子查询
@Select("select * from book where bid = #{bid}")
    @Results({
            @Result(property = "bid",column = "bid"),
            @Result(property = "title",column = "title"),
            @Result(property = "desc",column = "desc"),
            @Result(property = "price",column = "price"),
    })
    Book getBookInfo(int bid);