问题:
在此次测试,我通过jdbc查询返回多个结果,但是由于我们数据可能存在多个,所以不能写死。
![](http://upload-images.jianshu.io/upload_images/2228269-1b1aca7be9f5d073.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/629/format/webp)
![](http://upload-images.jianshu.io/upload_images/2228269-5516c1f3ae8f2fdd.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/602/format/webp)
解决:
![](http://upload-images.jianshu.io/upload_images/2228269-090d1bdbc1e6d72d.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/999/format/webp)
主体结构
第一步 for each 控制器
![](http://upload-images.jianshu.io/upload_images/2228269-dc216241d3091b62.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/622/format/webp)
第一步 循环控制器(第二种方法,最简单)
![](http://upload-images.jianshu.io/upload_images/2228269-e67a306d762af6c1.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/458/format/webp)
第二步 配合计数器
通过计数器获取下标
![](http://upload-images.jianshu.io/upload_images/2228269-ccf3492a588d97b5.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/543/format/webp)
第三部 ${__V(type${range})}
通过上面这个函数,便于我们在每次循环中取到不同的值
![](http://upload-images.jianshu.io/upload_images/2228269-6a7a4999e785159d.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/804/format/webp)
作者:尚酷米C
链接:https://www.jianshu.com/p/db29c13d0bae
来源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。