mybatis传值同时传入list和string该怎么弄
1个回答
2017-06-14
展开全部
的确可以唤碰虚封成map传入啊和燃;
多项删除的时候,例如吵清传入ids=[1,2,3,4,5]
controler:
Map<String,Object> map = new HashMap<String,Object>();
map.put("ids",ids);
mapper:
public void deleteByMultipe(@Param("map")Map<String,Object> map);
mapper.xml:
<delete id="deleteByMultipe" parameterType="map">
delete
from oa_user u
where u.id in
<foreach collection="map.ids" item="id" open="(" close=")" separetor=",">
#{id}
</foreach>
</delete>
多项删除的时候,例如吵清传入ids=[1,2,3,4,5]
controler:
Map<String,Object> map = new HashMap<String,Object>();
map.put("ids",ids);
mapper:
public void deleteByMultipe(@Param("map")Map<String,Object> map);
mapper.xml:
<delete id="deleteByMultipe" parameterType="map">
delete
from oa_user u
where u.id in
<foreach collection="map.ids" item="id" open="(" close=")" separetor=",">
#{id}
</foreach>
</delete>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询