foreach循環遍歷list集合,mybatis多個foreach_mybatis的foreach 刪除多條使用匯總

 2023-12-10 阅读 37 评论 0

摘要:@Test //刪除多條-數組foreach循環遍歷list集合、public void testDeleteByArray(){SqlSession session = factory.openSession();int[] ids = {4,6};session.delete(“cn.qq.mapper.PersonMapper.deleteArray”, ids);session.commit();}@Test //刪除多條-LI

@Test //刪除多條-數組

foreach循環遍歷list集合、public void testDeleteByArray(){

SqlSession session = factory.openSession();

int[] ids = {4,6};

session.delete(“cn.qq.mapper.PersonMapper.deleteArray”, ids);

session.commit();

}

@Test //刪除多條-LIST

public void testDeleteByList(){

SqlSession session = factory.openSession();

List _list = new ArrayList();

_list.add(4);

_list.add(6);

session.delete(“cn.qq.mapper.PersonMapper.deleteList”, _list);

session.commit();

}

@Test //刪除多條 MAP

public void testDeleteByMap(){

SqlSession session = factory.openSession();

Map paraMap = new HashMap();

int[] ids = {4,6};

paraMap.put(“ids”, ids);

session.delete(“cn.qq.mapper.PersonMapper.deleteMap”, paraMap);

session.commit();

}

delete from person

where id in

(

#{id}

)

delete from person

where id in

#{id}

delete from person

where id in

#{id}

版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。

原文链接:https://hbdhgg.com/3/194202.html

发表评论:

本站为非赢利网站,部分文章来源或改编自互联网及其他公众平台,主要目的在于分享信息,版权归原作者所有,内容仅供读者参考,如有侵权请联系我们删除!

Copyright © 2022 匯編語言學習筆記 Inc. 保留所有权利。

底部版权信息