mybatis 返回List

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

 

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

 

 

转载于:https://www.cnblogs.com/ejQiu-123/p/11551375.html

你可能感兴趣的:(mybatis 返回List)