Mybatis中查询的参数为Map条件中是in 数据组参数

来源:互联网 发布:形容女生的词语网络词 编辑:程序博客网 时间:2024/05/18 02:07

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 >


0 0
原创粉丝点击