mybatis 返回List<Map>

mybatis 返回List<Map>
 
1.直接通过mapper接口返回,不经过mapper.xml
 
    @Select(
            "select road_type,count(*) from amap_main_channel WHERE pcode = #{pcode} group by road_type"
    )
    List<Map> queryRoadTypeByPcode(@Param("pcode")String adcode);

 

注:要定义返回类型List<Map>,否则会报错
 
2.通过mapper.xml返回
 
mapper定义
 
List queryAmapCount(@Param("record") ReqRoadInfoQo record);
 
mapper.xml定义
 
<select id="queryAmapCount" resultType="java.util.Map">

 

 
posted @ 2019-09-19 17:44  ejQiu  阅读(8147)  评论(0编辑  收藏  举报