update table set column='...' where id in (1,2,3)l
这样的sql就可以了。Mybatis中这样写就行
<update id="batchUpdateStudentWithMap" parameterType="java.util.Map" >
UPDATE STUDENT SET name = #{name} WHERE id IN
<foreach collection="idList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</update>
<!-- 通过logsId去doorSensorDevice表把相关id的记录标识为0不可以 -->
<!-- <update id="updatedoorSensorDeviceById" parameterType="java.util.List" >
UPDATE doorSensorDevice
SET
enable = 0
WHERE
id in
<foreach item="logId" index="index" collection="list" open="(" separator=","
close=")">
#{logId,jdbcType=INTEGER}
</foreach>
</update> -->
<update id="updatedoorSensorDeviceById" parameterType="java.util.Map" >
UPDATE doorSensorDevice SET enable = 0 WHERE id IN
<foreach collection="logIds" index="index" item="logId" open="(" separator="," close=")">
#{logId}
</foreach>
</update>
public Integer updatedoorSensorDeviceById(@Param(value="logIds")List<Integer> logIds);