您的位置:首页 > 其它

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 >
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: