<delete id="deleteAppUserByIds">
delete from app_userinfo where
<foreach item="item" index="key" collection="ids" open="" separator="," close="">
userid=
</foreach>
</delete>
测试代码
public int removeAppUseryIds(String ids) throws Exception {
try {
String[] keysArr = ids.split(",");
List<AppUserInfo> targets = new ArrayList<AppUserInfo>();
String appid = "";
String userid = "";
boolean removed = false;
int flag = 0;
if (keysArr.length > 0) {
for (int i = 0; i < keysArr.length; i++) {
appid = keysArr[i].split("_")[0];
userid = keysArr[i].split("_")[1];
AppUserInfo target = new AppUserInfo(userid, appid);
targets.add(target);
removed = appUserInfoDao.deleteAppUserByIds(targets);
if (removed) {
flag++;
}
}
}
if(flag == keysArr.length) {
return 1;
}
return 0;
} catch (Exception e) {
throw new Exception();
}
}