mybatis聚合函式count()+group by返回值
阿新 • • 發佈:2021-01-30
技術標籤:mybatis
一般,count()函式返回一條記錄的數值型
那麼加上group by返回不止一條資料怎麼辦?
首先還是返回Integer數值型
<select id="queryJobOrient" resultType="Integer">
SELECT COUNT(*) FROM internshipinfo
<where>
<if test="gradeId != '' and gradeId != null">
and gradeId = #{gradeId}
</if>
</where>
GROUP BY direction ORDER BY direction
</select>
介面中返回數值列表
List<Integer> queryJobOrient(@Param("gradeId")Integer gradeId);