[myabtis-plus]XML中返回的id顺序问题

问题 <insert id="insertListIfNotExists" useGeneratedKeys="true" keyProperty="id"> INSERT IGNORE INTO `tag` (name, create_time) VALUES <foreach collection="list" item="item" separator=","> (#{item.name}, #{item.createTime}) </foreach> </insert> useGeneratedKeys与INSERT IGNORE配合后,若插入顺序是 id:1 name: name1 id: null name: name2 id: null name: name3 返回的id会变成 ...

2022-12-22 · 1 min · 102 words · kutake

[myabtis-plus]xml中的字段注入不生效

未声明则不插入 create_time是自动注入字段 xml是最终执行的sql命令,未声明加入则不会插入 <insert id="insertListIfNotExists" useGeneratedKeys="true" keyProperty="id"> INSERT IGNORE INTO `tag` (name) VALUES <foreach collection="list" item="item" separator=","> (#{item.name}) </foreach> </insert> 修改: <insert id="insertListIfNotExists" useGeneratedKeys="true" keyProperty="id"> INSERT IGNORE INTO `tag` (name, create_time) VALUES <foreach collection="list" item="item" separator=","> (#{item.name}, #{item.createTime}) </foreach> </insert>

2022-12-22 · 1 min · 89 words · kutake