Mybatis的foreach事列,如何获取foreach的index值
- XML文件里面:
- <select id="countByUserList" resultType="_int" parameterType="list">
- select count(*) from users
- <where>
- id in
- <foreach item="item" collection="list" separator="," open="(" close=")" index="index">
- #{item.id, jdbcType=NUMERIC}
- </foreach>
- </where>
- </select>
- java里面就直接
- dao.find("userMapper.countByUserList", list);就可以了
- foreach中的index是遍历的当前索引,从0开始,相当于list集合里面的索引一样
- 取值的时候直接#{index}就可以了;
正在加载评论...
相关文章
- java后台遍历json
- Java的break和continue语句分析
- java拦截器HandlerInterceptor的preHandle、postHa...
- Java后台获取当前访问客户端的真实IP地址(外网或...
- maven项目 pom.xml的execution报错的解决方法
- ERROR ParametersInterceptor Developer Notificat...
- eclipse启动TOMCAT服务器报错8005 8080 8009端口被...
- java发送http的get、post请求
- tomcat启动maven工程报错-Updating status for Tom...
栏目列表
推荐阅读
- java的StringEscapeUtils转义与反转义
- errcode: 40001, errmsg: invalid credential, access_token is invalid or not latest rid: 5f6981c2-6cc9cb20-6833977a
- Java Ehcache缓存的timeToIdleSeconds和timeToLiveSeconds区别
- Java四种线程池newCachedThreadPool,newFixedThreadPool,newScheduledThreadPool,newSingleThreadExecutor
- tomcat启动maven工程报错-Updating status for Tomcat v7.0 Server at localhost...
- Mybatis异常There is no getter for property named 'XXX' in 'class java.lang.String'
- 服务器侦听端口 netstat -na 命令详解
- Java后台获取当前访问客户端的真实IP地址(外网或内网地址)
- java发送http的get、post请求
- StringSubstitutor替换占位符,处理SQL参数
- java拦截器HandlerInterceptor的preHandle、postHandle与afterCompletion三个方法
- com.googlecode.aviator.AviatorEvaluator规则引擎用法
- java中Session缓存和Cache缓存的区别
- Java8对象集合转List<Integer>id集合,转List<String>name集合,List<Class>对象集合
- Java导出excel利用jxls合并单元格jx:mergeCells实现表格嵌套技术
- 利用ObjectMapper,将json数组转List<Map<String,Object>>
- java图片文件base64流之间的互转帮助类源码下载
- java的DES加密解密辅助类
- ERROR ParametersInterceptor Developer Notification (set struts.devMode to false to disable this message)
- Java中UrlRewriteFilter的使用