mybatis多联合查询
多表联合查询注解实现方式:
1、首先在model中添加所需对象
2、在查询语句出进行映射
@Select("select * from myhouse,myarea,mysort where myhouse.aid=myarea.aid and myhouse.sid=mysort.sid") @Results({ @Result(column="aid",property="area",one=@One(select="com.cc.house.mapper.MyareaMapper.findById",fetchType = FetchType.LAZY)), @Result(column="sid",property="sort",one=@One(select="com.cc.house.mapper.MysortMapper.findSortById",fetchType = FetchType.LAZY)) }) public List<Myhouse> findAllHouseWithAreaAndSort();