插入数据时,不想重复插入,可以加入 on duplicate key
<insert id="register" parameterType="model.Member" useGeneratedKeys="true" keyProperty="key">
INSERT INTO.member (`code`,`mobileNumber`,`password`,`status`,`registeredAt`)
VALUES (#{code}, #{mobileNumber}, #{password}, 'ACTIVE', now())
on duplicate key update mobileNumber=#{mobileNumber},`password`= #{password}
</insert>