mapper支持的返回数据类型
- 返回一般数据类型
resultType="String"
- 返回JavaBean
resultType="BeanName"
- 当数据只有一条,可返回map
resultType="map"
返回多条,可封装成List
List<User> getAllUser();
resultType="User"当返回数据为多条,可在Mapper接口中指定某一属性为Key,从而可以将多条结果封装成Map
@MapKey("id") Map<Integer, Employee> getAllEmpsAsMap();<select id="getAllEmpsAsMap" resultType="employee"> select * from t_employee </select>
