查詢List<Map>類型數據
阿新 • • 發佈:2018-05-26
ID 設定 measure strong PE des str list ont
只要設定resultType而不設定resultMap就可以了。
Java接口:
List<Map<String, String>> getMtypeList();
XML:
<select id="getMtypeList" parameterType="java.util.Map" resultType="java.util.HashMap"> select code,`name` from jk_control_measure rs where rs.TYPE_ID != 1 <if test="qKeyWord != null"> and rs.stock_code = #{qKeyWord} </if> <if test="rsTitle != null"> and rs.title like #{rsTitle} </if> order by rs.crt_time desc limit #{pageIndex}, #{pageSize} </select>
輸出結果:
[
{"NAME":"地面沖洗","name":"地面沖洗","code":"one","CODE":"one"},
{"NAME":"邊界圍擋","name":"邊界圍擋","code":"two","CODE":"two"},
{"NAME":"垃圾覆蓋","name":"垃圾覆蓋","code":"three","CODE":"three"},
{"NAME":"裸地覆蓋","name":"裸地覆蓋","code":"four","CODE":"four"},
{"NAME":"灑水降塵","name":"灑水降塵","code":"five","CODE":"five"}
]
查詢List<Map>類型數據