Mybatis中查询的参数为Map条件中是in 数据组参数
2016-04-21 15:10
453 查看
Java中的代码
Map<String, Object> map = new HashMap<String, Object>();
map.put("iAuditStatus", audisStatusID);
map.put("iUpdateTime", DateFormat.dateToTimeStamp(new Date()));
map.put("iAutoId", str.split(",")); // where 条件中的in参数为数组
res = presentAuditService.updatepl(map);
Mybatis中的sql
<update id= "updatepl" parameterType= "java.util.HashMap">
update t_present_audit
<set>
<if test="iAuditStatus != null">
iAuditStatus = #{iAuditStatus,jdbcType=INTEGER},
</if>
<if test="iUpdateTime != null">
iUpdateTime = #{iUpdateTime,jdbcType=INTEGER},
</if>
</set>
where iAutoId in
<foreach collection="iAutoId" item= "iAutoId" index ="index"
open= "(" close =")" separator=",">
#{iAutoId,jdbcType=INTEGER}
</foreach >
</update >
Map<String, Object> map = new HashMap<String, Object>();
map.put("iAuditStatus", audisStatusID);
map.put("iUpdateTime", DateFormat.dateToTimeStamp(new Date()));
map.put("iAutoId", str.split(",")); // where 条件中的in参数为数组
res = presentAuditService.updatepl(map);
Mybatis中的sql
<update id= "updatepl" parameterType= "java.util.HashMap">
update t_present_audit
<set>
<if test="iAuditStatus != null">
iAuditStatus = #{iAuditStatus,jdbcType=INTEGER},
</if>
<if test="iUpdateTime != null">
iUpdateTime = #{iUpdateTime,jdbcType=INTEGER},
</if>
</set>
where iAutoId in
<foreach collection="iAutoId" item= "iAutoId" index ="index"
open= "(" close =")" separator=",">
#{iAutoId,jdbcType=INTEGER}
</foreach >
</update >
相关文章推荐
- Thrift
- 集群和负载均衡和分布式
- POJ 1167 The Buses
- C#界面设计之复选按钮与单选按钮的使用实例
- saleae逻辑分析仪使用分享
- eclipse新建安卓项目低于4.0,去除v7依赖包的方法
- hdu-1878 欧拉回路
- MYSQL的慢查询两个方法
- (java)关于List中对象实现Comparable接口的例子
- render layout: false
- 关于emjoy表情在android5.x以上系统触发jni错误的修改(基于cocos2dx2.1.5修改)
- Swift中宏#define的替代方案
- okhttp总结
- OIO和NIO区别
- Android 身份证、车牌号验证工具类
- 微信公众号第三方开发之二获取预授权码(pre_auth_code)
- 智能化硬件
- paip.自适应网页设计 跟 响应式 设计的区别跟原理and实践总结
- 使用CURL下载远程文件保存到服务器
- Qt槽和信号参数