关键点:resultType
resultType是sql映射文件中定义返回值类型,返回值有基本类型,对象类型,List类型,Map类型等
一般我们查询中resultType带的都是实体类
<select id="findPaperTitleByPaperId" resultType="PaperTitle">
select * from paper_title
</select>
当我们想查询数据的条数之类的数据,这个适合改变一下我们的resultType返回类型即可
<select id="PaperTitleCount" resultType="Int">
select count(*) from paper_title
</select>
结果:

本文来自博客园,作者:最帅爸爸,转载请注明原文链接:https://www.cnblogs.com/zsbb
浙公网安备 33010602011771号