批量删除功能是实现
文件写法
<!-- 批量删除用户 -->
<delete id = "deleteUserWithBatch"parameterType ="">
<![CDATA[
delete from plat_cust where cid in
]]>
<foreach collection="list" item = "model" open="(" separator="," close=")">
#{ model}
</foreach>
</delete>
Mapper中的写法
/**
* 批量删除用户
* @param ids
* @return
*/
intdeleteUserWithBatch(Listlist);
serviceImpl中的写法
/*
* 批量删除用户
* @param
* @return
*/
@Override
publicinttxDeleteUserWithBatch(List<String> ids)throwsException {
intcount = custMapper.deleteUserWithBatch(ids);
returncount;
}
Action中的写法
//批量删除用户
publicvoiddeleteBatch() {
try {
String[] idsList = po.getIdStringList().split(",");
Listids = null;
if (idsList.length>0) {
List<String> idsList1=Arrays.asList(idsList);
ids= newArrayList(idsList1);
}
System.out.println("==============" + ids);
custService.txDeleteUserWithBatch(ids);
this.getMap().put(Constants.RET_CODE, "0000");
this.getMap().put(Constants.RET_MSG, "成功");
} catch (Exceptione) {
e.printStackTrace();
this.getMap().put(Constants.RET_CODE, "9999");
this.getMap().put(Constants.RET_MSG, "查询异常");
this.returnMap2Json(map);
}
}