一、resultType:
(1)、基本类型 :resultType=基本类型
案例一:
Integer selectCount();
<select id="selectCount" resultType="java.lang.Integer" databaseId="mysql"> select count(*) from country </select>
案例二:对象
Country selectById(Long id);
<select id="selectById" resultType="Country" databaseId="mysql"> select <include refid="Base_Column_List" /> from country WHERE id=#{id} </select>
(2)、List类型: resultType=List中元素的类型
案例: List<Country> selectAll(); <select id="selectAll" resultType="Country" databaseId="mysql"> select <include refid="Base_Column_List" /> from country </select>
(3)、Map类型
单条记录:resultType =map
案例:
Map selectResultMap(@Param("id") Long id,@Param("name") String name);
<select id="selectResultMap" resultType="java.util.Map" databaseId="mysql">
select <include refid="Base_Column_List" /> from country
WHERE id=#{id} and country