方案一:
public List<XXXBean> getXXXBeanList(String xxId, String xxCode);
<select id="getXXXBeanList" resultType="XXBean">
select t.* from tableName where id = #{0} and name = #{1}
</select>
由于是多参数那么就不能使用parameterType, 改用#{index}是第几个就用第几个的索引,索引从0开始
方案二(基于注解):
public int delCart(@Param("username")String username,@Param("ids")List<Integer> ids);
<delete id="delCart">
delete from carts where username=#{username} and cid in
<foreach collection="ids" item="cid" open="(" separator="," close=")">
#{cid}
</foreach>
</delete>
由于是多参数那么就不能使用parameterType, 这里用@Param来指定哪一个