FsUserWxMapper.xml 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.fs.store.mapper.FsUserWxMapper">
  6. <insert id="insertOrUpdateByUniqueKey">
  7. insert into fs_user_wx
  8. (fs_user_id, app_id, union_id, open_id, create_time, update_time)
  9. values
  10. (#{fsUserId}, #{appId}, #{unionId}, #{openId}, #{createTime, jdbcType=TIMESTAMP}, #{updateTime, jdbcType=TIMESTAMP})
  11. ON DUPLICATE KEY UPDATE
  12. <if test="unionId != null">
  13. union_id = VALUES(union_id),
  14. </if>
  15. open_id = VALUES(open_id),
  16. update_time = VALUES(update_time)
  17. </insert>
  18. <update id="updateFsUserWx">
  19. UPDATE fs_user_wx
  20. <set>
  21. <if test="companyId != null and companyId != ''">
  22. company_id = #{companyId},
  23. </if>
  24. <if test="unionId != null">
  25. union_id = #{unionId},
  26. </if>
  27. update_time = #{updateTime}
  28. </set>
  29. WHERE
  30. fs_user_id = #{userId}
  31. AND app_id = #{appId}
  32. AND open_id = #{openId}
  33. </update>
  34. <select id="selectListByUserIdAndAppId" resultType="com.fs.store.domain.FsUserWx">
  35. SELECT * FROM fs_user_wx
  36. WHERE fs_user_id = #{userId}
  37. AND app_id = #{appId} limit 1
  38. </select>
  39. </mapper>