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>
复制代码 代码如下:
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>
上一篇: Android实现短信验证功能的代码