<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.fs.his.mapper.FsUserWxMapper">

    <insert id="insertOrUpdateByUniqueKey">
        insert into fs_user_wx
            (fs_user_id, app_id, union_id, open_id, create_time, update_time)
        values
            (#{fsUserId}, #{appId}, #{unionId}, #{openId}, #{createTime, jdbcType=TIMESTAMP}, #{updateTime, jdbcType=TIMESTAMP})
        ON DUPLICATE KEY UPDATE
        <if test="unionId != null">
            union_id = VALUES(union_id),
        </if>
            open_id     = VALUES(open_id),
            update_time = VALUES(update_time)
    </insert>
</mapper>
