ibatis返回map列表

时间:2022-12-18 07:51:02

ibatis返回map列表

1. resultClass="java.util.HashMap"
 
<select id="queryCustmerCarNoByCustId" resultClass="java.util.HashMap" parameterClass="string">
select t.vehicle_no from NETS2_T_PC_VEHICLE t
where t.nets_cust_id=#custId#
order by t.updated_date desc
</select>
2. dao: 使用_queryForList得到map列表,map存放的字段值都是大写
public String queryCustmerCarNoByCustId(String custId)
throws DAOException {
List<Map> list = (List<Map>)_queryForList("mobileMoneyUserinfo.queryCustmerCarNoByCustId", custId);

log.info("CustomerContactInfoDaoImpl.queryCustmerCarNoByCustId() list="+list);

if(list==null || list.isEmpty()){
return null;
}
Map map = list.get(0);
return (String)map.get("VEHICLE_NO");
}