Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method that the mybatis mysql delete in operation can only delete the first piece of data

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Bug that appears

As shown in the picture, I began to copy delete statements and parameters to the database for execution, deleting two pieces of data, but the background execution did delete only one piece of data, which showed that I was confused at that time.

Analyze the reasons

Analyze the reasons

As shown in the picture, the value of the correct parameter should be like this. Smart students should know what is wrong.

Solve the problem

Solve the problem

I will not post the initial code, but directly post the code that solves the bug.

Code in mybatis

# {arr}

Code in controller

/ * deletion and batch deletion * / @ RequestMapping (value = "/ del", method = RequestMethod.POST, produces = {MediaType.APPLICATION_JSON_VALUE}) public ResponseEntity delete (@ RequestParam String customerId) throws Exception {/ / get the batch deleted id, removing the last "," customerId=customerId.substring (0meme customerId.length ()-1); String [] strarr=customerId.split (","); int [] arr=new int [strarr.length] For (int iTuno Bandi)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report