欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

Ibatis.net结合oracle批量删除实现代码

程序员文章站 2024-03-06 11:18:43
要删除的字符串id为 复制代码 代码如下: string sdsales_idstring = 1,2,3,4,5,6,7 //转成array array array =...
要删除的字符串id为
复制代码 代码如下:

string sdsales_idstring = 1,2,3,4,5,6,7
//转成array
array array = sdsales_idstring.split(new string[] { "," }, stringsplitoptions.removeemptyentries).toarray<string>();

在模型定义一个 public array sdsales_ids {get;set;}
xml:
复制代码 代码如下:

<delete id="deletemanyt_label_sdsales" parameterclass="t_label_sdsales">
delete from t_label_sdsales where
<isnotnull property="sdsales_ids">
sdsales_id in
<iterate property="sdsales_ids" conjunction="," open="(" close=")">
#sdsales_ids[]#
</iterate>
</isnotnull>
</delete>