<insert id="patchUpdateUser" parameterType="com.xxx.data.PatchUserData ">
<if test="data.updateIfHave">
INSERT INTO user
(uid, name, phone)
VALUES
<foreach collection="data.users" separator="," item="item">
(#{item.uid},
#{item.name},
#{item.phone},)
</foreach>
ON DUPLICATE KEY
UPDATE
uid = VALUES(uid),
name= VALUES(name),
phone= VALUES(phone)
</if>
</insert>
public class PatchUserData {
/**
* 更新导入
*/
private boolean updateIfHave;
/**
* xx列表
*/
private List<User> users;
}