Get the App
SLTechnology News&Howtos  ›  Development  › 

How to implement double foreach cycle in MyBatis

Shulou Source: shulou.com Published: 2022-06-01 18:54:25 10月04日 Update

This article mainly introduces MyBatis how to carry out the double foreach cycle, the article is very detailed, has a certain reference value, interested friends must read it!

Perform a double foreach cycle

Mapname is a Map object

# {key1}, # {key2}, # {value2} usage scenarios

For example, the amount of the waybill under a payer, then key1 is the payer number, key2 is the waybill number, and value2 is the apportioned amount.

Mybatis foreach loop, passing in codes on multiple parameters

Controller:

@ RequestMapping (value = "/ findPage", method = RequestMethod.POST) @ ResponseBody public Object findPage (@ RequestParam (required=false) String jobCategory,@RequestParam (required=false) String ids,@RequestParam (required=false) String cities) {try {List listJob = new ArrayList (); List listIds = new ArrayList (); List listCities = new ArrayList () / / query if (StringUtils.isNotBlank (jobCategory) & & StringUtils.isNotBlank (cities)) {String [] temp = jobCategory.split (",") by city name and type of work; String [] cityTemp = cities.split (","); for (int item0

Tags: Query loop type of work payer content name city article waybill amount code value information interest parameter scene multiple object boy partner Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Linux MariaDB Shulou Tech Info Huawei