spring mvc接收数组mybatis 接收批量删除代码

页面接收参数

//批量删除的操作
function optDelete(){
//校验,至少选择一个
var size = $("input[name =ids]:checked").size();
if(size==0){
alert("请至少选择一个");
return ;
}


if(!confirm("你确认删除吗")){
return ;
}




//上传
$("#jvForm").attr("action","/brand/delete.do");
$("#jvForm").attr("method","post");
$("#jvForm").submit();
}


controller接收参数

@RequestMapping(value="/brand/delete.do")
public String deleteBrands(Long[] ids){

brandService.deleteBrands(ids);
return "redirect:/brand/list.do";
}



mybatissql操作


 
delete * from bbs_brand where id (语法错误,delete from bbs_brand where id in)
in

#{id}

 

你可能感兴趣的:(java,基础,springMVC,Mybatis)