mybatis 批量修改vmi_materialdocument 修改字段AutomaticConsume根据ListVmiMaterialDocument vmiMaterialDocuments中的id以及AutomaticConsume提供完整mapper以及xml
Mapper:
public interface VmiMaterialDocumentMapper {
void updateAutomaticConsumeList(@Param("list") List<VmiMaterialDocument> vmiMaterialDocuments);
}
XML:
<update id="updateAutomaticConsumeList" parameterType="java.util.List">
<foreach collection="list" item="item" separator=";">
UPDATE vmi_materialdocument
SET AutomaticConsume = #{item.automaticConsume}
WHERE id = #{item.id}
</foreach>
</update>
Note: Make sure to replace "vmi_materialdocument" with the actual table name in your database. Also, adjust the parameterType in the XML if your List
原文地址: https://www.cveoy.top/t/topic/iM14 著作权归作者所有。请勿转载和采集!