service层:
@Override
public void batchDeletes(List list) {
creditDao.batchDeletes(list);
}
控制层controller:
/**
* Batch deletion batch
*/
@RequestMapping(value="/batchDeletes")
@ResponseBody
public List
String items = request.getParameter("creditIdbox");
List
String[] strs = items.split(",");
for (String str : strs) {
delList.add(str);
}
creditService.batchDeletes(delList);
List
ModelAndView mv = new ModelAndView();
Map
model.put("creditVOList", list);
mv.addAllObjects(model);
mv.setViewName("queryregister");
return list;
}
mapper.xml:
DELETE FROM t_credit where t_credit_id in
#{item}
页面:
$(function(){
$("#button").click(function(){
var form=$("#registerform");
form.prop("action","http://localhost:8080/ssmy2/CreditController/intiqu.do");
form.submit() ;
});
//Method 2:
/*$(function(){
## $("#button").click(function(){
document.registerform.action="http://localhost:8080/ssmy/CreditController/intiqu.do";
document.registerform.submit();
});**/
//Determine the dead state of the query button
$("#status").val($("#statushidden").val());
});
function selectAll(){
if ($("#SelectAll").is(":checked")) {
$ (": Checkbox"). Prop ("Checked", TRUE); // Select all the selection boxes
} Else {
$(":checkbox").prop(""checked", false); }
##$(function(){
$("#deleteuser").click(function() {
//Check that at least one item has been written
var checkedNum = $("input[name='creditIdbox']:checked" ).length;console.log(checkedNum);
if(checkedNum==0){
alert("Please select at least one item!");
alert("Please select at least one item!");
# if(confirm("Are you sure to delete the selected item?")){
$ ("INPUT [name = 'creditidbox']: Checked"). );
## ); # $.ajax({
type:"POST",
## url:"http://localhost:8080/ssmy2/CreditController /batchDeletes.do",
use with using using ’ through through through out through out out through out out through out out out through out out’'s' out’s ’ ’ s ‐ ‐ ‐ ‐ ‐ ‐ n ‐ through – – data:{"creditIdbox":checkedList.toString()},
## . success:function(data){
$("[name='creditIdbox']:checkbox").attr("checked",false);
Alert ('Delete success!');
## stettimeout ("local##
# /* var form=$("#registerform");
form.prop("action","http://localhost:8080/ssmy/CreditController/deleteuser.do" );
## form.submit(); */});
$ ("#exports").click(function(){
var form =$("#registerform");
form. prop("action","http://localhost:8080/ssmy2/CreditController/exprotExcel.do");
## form.submit();
## });
$("#delete").click(function(){
var form =$("#registerform");
## var form =$("#registerform");
## form.prop("action","http://localhost:8080/ssmy2/ CreditController/batchDeletes.do?creditIdbox=${credit.creditId}");form.submit();
});
$("#uploadFile").click(function(){
var form =$("#registerform");
form.prop("action","http://localhost:8080/ssmy2/CreditController/uploadFile.do");
form.submit();
## });
});
##
# & LT; input Type = "Hidden" name = "Status" ID = "Statushidden" Value = "$ {Status}" /& gt; # "0" cellpadding=0 # ="margin-right:5px;"/>Select all # ## td > Email address "address">Submission status ## ## "${creditVOList}" varStatus="status"> ## ## & LT; TD & GT; $ {Credit.telephonumber} & lt;/td & gt; # & LT; TD & GT; $ {Credit.email} ## 没有任何员工信息. service层:@Override public void batchDeletes(List list) { creditDao.batchDeletes(list); } 控制层controller/** * Delete batch batch*/ @RequestMapping(value="/batchDeletes") @ResponseBody public List<Credit> batchDeletes(HttpServletRequest request,HttpServletResponse response){ String items = request.getParameter("creditIdbox"); List<String> delList = new ArrayList<String>(); String[] strs = items.split(","); for (String str : strs) { delList.add(str); } creditService.batchDeletes(delList); List<Credit> list=creditService.queryUserInfo(null); ModelAndView mv = new ModelAndView(); MapLand-line number
${credit.status ==0 ? '已提交':'未提交'}
${creditVO.createtime}
< c:forEach var="credit" items="${creditVOList}" varStatus="status"> Select all Login name Login password Confirm password ID card No. Landline number Mobile phone number E-mail address Residential address< /td> Submit status Creation time Operation ${status.index} ${credit.loginName} ${credit.loginPwd} ${credit.againPwd} ${credit.IDCard} ${credit.fixedTelephoneNumber} ${credit.telephoneNumber} ${credit.email} ${credit.address} ${credit.status ==0 ? 'Submitted':'Not submitted'} ${ creditVO.createtime} Delete
< div id="box" style="border: 1px solid #ccc;">
The above is the detailed content of mybatis springmvc batch deletion code sharing. For more information, please follow other related articles on the PHP Chinese website!