$("#createApplysjinfo").click(function(){
var allTableData=datagrid.bootstrapTable('getData');//获取表格的所有内容行
var array= [];
$.each(allTableData,function(i,e){
array.push(e.a_id);
})
$.get("/apply/create",{"array":JSON.stringify(array)},function(data){
datagrid.bootstrapTable("removeAll");
});
})
@ResponseBody
@RequestMapping("/create")
public void createApplysjinfo(String array){
List<String> ListString=new ArrayList<String>();
ListString=JSON.parseArray(array,String.class);
//批量更新数据
applyinfoServices.updateBatch(ListString);
}
//java结合mybatis批量操作
@Update("<script> UPDATE applyinfo set a_flag=1 where a_id in\n" +
" <foreach collection='listString' item='a_id' open='(' close=')' separator=',' >\n" +
" #{a_id}\n" +
" </foreach>" +
" </script>")
void updateBatch(@Param("listString")List<String> listString);