一、查询表中的某个字段
dao/mapper
String getSalt(@Param("userName") String userName);
<select id="getSalt" resultType="string" parameterType="map">
select salt from com_manager
where user_name = #{userName,jdbcType=VARCHAR} limit 1
</select>
二、只取部分值,不定义新DTO
dao/mapper :
List<Map<String, Object>> selectPartBook();
List<Map<String, Object>> map = bookMapper.selectPartBook();
<!-- 查询语句 -->
<select id="selectPartBook" resultMap="PartBookMap">
select book_id, book_name, author from book
</select>