mybatis返回值爲map怎麼處理
sql
<select id="selectCount" parameterType="map" resultType="map">
<![CDATA[
select sum(total - pay) as "total",
count(1) as "unpaid",
max(total - pay) as "max"
from t_order
]]>
</select>
method
Map<String,Object> selectCount(Map<String,Object> map);
result
{“max”:7,“unpaid”:2,“total”:9}
或者
sql
<select id="selectCount" parameterType="map" resultType="map">
select sum(total - pay) as "tota",
count(1) as "unpaid",
max(total - pay) as "max"
from t_order
</select>
result
{“max”:7,“unpaid”:2,“tota”:9}