Mybatis foreach update problem

<update id="updateList"  parameterType="java.util.List">
    <foreach collection="list" item="item">
        update message set isread=-sharp{item.isread} where id = -sharp{item.id};
    </foreach>
</update>

when you batch update in this way, when there is only one list, it is normal, but when you have more than one piece of data in list, there will be more than one single quotation mark when the id parameter is set to the second entry. Why? No reason found

clipboard.png

Jan.31,2022

Note that the last quotation mark of your error is the quotation mark after near, not your sql quotation mark.


if the < set > < / set > syntax is used, we need to actively set batch updates to mysql. We need to add & allowMultiQueries=true
to the connection address of the configuration database. For more information, please see https://www.jianshu.com/p/feb.

.

verified

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b372e6-2adb8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b372e6-2adb8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?