注意
association标签中的 select , column 属性使用
collection 标签中的 ofType 属性使用
@Data
public class Tours implements Serializable {private static final long serialVersionUID = 1L;private Integer touId;private String tourName;private Integer guideId;private Guides guides;private List<Visitors> visitorsList;
}
<resultMap id="BaseResultMap" type="com.rag.bi_2.chaotama.domain.Tours"><id column="tou_id" jdbcType="INTEGER" property="touId" /><result column="tour_name" jdbcType="VARCHAR" property="tourName" /><result column="guide_id" jdbcType="INTEGER" property="guideId" /><association property="guides" javaType="com.rag.bi_2.chaotama.domain.Guides" select="com.rag.bi_2.chaotama.mapper.GuidesMapper.selectByPrimaryKey" column="guide_id" ><id column="id" jdbcType="INTEGER" property="id" /><result column="name" jdbcType="VARCHAR" property="name" /><result column="phone" jdbcType="VARCHAR" property="phone" /></association><collection property="visitorsList" ofType="com.rag.bi_2.chaotama.domain.Visitors"><id column="visitor_id" jdbcType="INTEGER" property="id" /><result column="visitor_name" jdbcType="VARCHAR" property="name" /><result column="visitor_age" jdbcType="INTEGER" property="age" /></collection></resultMap>