插入或者更新
<insert id="active">
INSERT INTO `csm`.`ms_device`
(
`createTime`,
`modifyTime`,
`regionId`,
`deviceKey`,
`activeTime`
)
VALUES
(
#{po.createTime},
#{po.modifyTime},
#{po.regionId},
#{po.deviceKey},
#{po.activeTime}
)
ON DUPLICATE KEY UPDATE activeTime = #{po.activeTime}
</insert>
批量插入
<insert id="createRegPhotos">
INSERT IGNORE INTO `ms_reg_photo`
(
`personId`,
`regPhotoUrl`,
`createTime`
)
VALUES
<foreach item="po" index="index" collection="pos" open="" separator="," close="">
(
#{po.personId},
#{po.regPhotoUrl},
#{po.createTime}
)
</foreach>
</insert>
网友评论