只要设定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"}
]