其他没有变化知识mapper使用了单表查询通过将查询结构装载set当中。这样就产生了缓存。
mapper:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cbh.dao.ICountryDao">
<select id="selectMinisterByCountry" resultType="Minister">
select mid,mname from minister where countryId=#{ooo}
</select>
<resultMap type="Country" id="countryMapper">
<id column="cid" property="cid" />
<result column="cname" property="cname" />
<collection property="minister" ofType="Minister"
select="selectMinisterByCountry" column="cid"/>
</resultMap>
<select id="selectCountryById" resultMap="countryMapper">
select cid,cname from country where cid=#{xxx}
</select>
</mapper>
以上是一对多查询