How to implement double foreach cycle in MyBatis
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