一:单个参数
DAO层:public List searchXXX(int id);
Bean.xml:<select id="searchXXX" parameterType="java.lang.Integer" resultType="Bean">
select t.* from tbalename t where t.id=#{id}
</select>
二:多参数
public List getXCarEventList(String carID, String eventCode);
<select id="getList" resultType="Bean">//多参数不用parameterType
select t.* from car_event where id = #{0} and name = #{1} //改用#{index},是第几个就用第几个的索引
</select>
三、Map封装多参数
网友评论