传一个list到mybatis sql语句怎么写
展开全部
可以封成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>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询