search
HomeJavajavaTutorialmybatis springmvc batch deletion code sharing

mybatis springmvc batch deletion code sharing

Jul 24, 2017 pm 01:50 PM
mybatisspringmvcup to date

service层:

 

@Override

public void batchDeletes(List list) {

creditDao.batchDeletes(list);

 

}

控制层controller:

 

/**
* Batch deletion batch
*/
   @RequestMapping(value="/batchDeletes")
   @ResponseBody
   public List batchDeletes(HttpServletRequest request,HttpServletResponse response){
       String items = request.getParameter("creditIdbox");
       List delList = new ArrayList();
       String[] strs = items.split(",");
       for (String str : strs) {
           delList.add(str);
       }
       creditService.batchDeletes(delList);
       List list=creditService.queryUserInfo(null);
      ModelAndView mv = new ModelAndView();
      Map model = new HashMap();
      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();

## });

});

##

Select all
Login name Login password Confirm password ID card No. Landline number Mobile phone number E-mail address Residential address 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
None Employee information.

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!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
Will R.E.P.O. Have Crossplay?
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool