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

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 >



版权声明:本文为liuli_1234567890原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。