QwExternalContactCrmMapper.xml 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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.qw.mapper.QwExternalContactCrmMapper">
  6. <resultMap type="QwExternalContactCrm" id="QwExternalContactCrmResult">
  7. <result property="id" column="id" />
  8. <result property="externalUserId" column="external_user_id" />
  9. <result property="openid" column="openid" />
  10. <result property="externalUserName" column="external_user_name" />
  11. <result property="customerId" column="customer_id" />
  12. <result property="companyId" column="company_id" />
  13. <result property="corpId" column="corp_id" />
  14. <result property="avatar" column="avatar" />
  15. <result property="fsUserId" column="fs_user_id" />
  16. </resultMap>
  17. <sql id="selectQwExternalContactCrmVo">
  18. select id, external_user_id,openid, external_user_name, avatar, customer_id, company_id, corp_id, fs_user_id from qw_external_contact_crm
  19. </sql>
  20. <select id="selectQwExternalContactCrmList" parameterType="QwExternalContactCrm" resultMap="QwExternalContactCrmResult">
  21. <include refid="selectQwExternalContactCrmVo"/>
  22. <where>
  23. <if test="externalUserId != null and externalUserId != ''"> and external_user_id = #{externalUserId}</if>
  24. <if test="openid != null and openid != ''"> and openid = #{openid}</if>
  25. <if test="externalUserName != null and externalUserName != ''"> and external_user_name like concat('%', #{externalUserName}, '%')</if>
  26. <if test="customerId != null "> and customer_id = #{customerId}</if>
  27. <if test="companyId != null "> and company_id = #{companyId}</if>
  28. <if test="corpId != null "> and corp_id = #{corpId}</if>
  29. <if test="avatar != null "> and avatar = #{avatar}</if>
  30. <if test="fsUserId != null "> and fs_user_id = #{fsUserId}</if>
  31. </where>
  32. </select>
  33. <select id="selectQwExternalContactCrmById" parameterType="Long" resultMap="QwExternalContactCrmResult">
  34. <include refid="selectQwExternalContactCrmVo"/>
  35. where id = #{id}
  36. </select>
  37. <insert id="insertQwExternalContactCrm" parameterType="QwExternalContactCrm">
  38. insert into qw_external_contact_crm
  39. <trim prefix="(" suffix=")" suffixOverrides=",">
  40. <if test="id != null">id,</if>
  41. <if test="externalUserId != null">external_user_id,</if>
  42. <if test="openid != null">openid,</if>
  43. <if test="externalUserName != null">external_user_name,</if>
  44. <if test="customerId != null">customer_id,</if>
  45. <if test="companyId != null">company_id,</if>
  46. <if test="corpId != null">corp_id,</if>
  47. <if test="avatar != null">avatar,</if>
  48. <if test="fsUserId != null">fs_user_id,</if>
  49. </trim>
  50. <trim prefix="values (" suffix=")" suffixOverrides=",">
  51. <if test="id != null">#{id},</if>
  52. <if test="externalUserId != null">#{externalUserId},</if>
  53. <if test="openid != null">#{openid},</if>
  54. <if test="externalUserName != null">#{externalUserName},</if>
  55. <if test="customerId != null">#{customerId},</if>
  56. <if test="companyId != null">#{companyId},</if>
  57. <if test="corpId != null">#{corpId},</if>
  58. <if test="avatar != null">#{avatar},</if>
  59. <if test="fsUserId != null">#{fsUserId},</if>
  60. </trim>
  61. </insert>
  62. <insert id="insertOrUpdateQwExternalContactCrm" parameterType="QwExternalContactCrm">
  63. insert into qw_external_contact_crm
  64. <trim prefix="(" suffix=")" suffixOverrides=",">
  65. <if test="id != null">id,</if>
  66. <if test="externalUserId != null">external_user_id,</if>
  67. <if test="openid != null">openid,</if>
  68. <if test="externalUserName != null">external_user_name,</if>
  69. <if test="customerId != null">customer_id,</if>
  70. <if test="companyId != null">company_id,</if>
  71. <if test="corpId != null">corp_id,</if>
  72. <if test="avatar != null">avatar,</if>
  73. <if test="fsUserId != null">fs_user_id,</if>
  74. </trim>
  75. <trim prefix="values (" suffix=")" suffixOverrides=",">
  76. <if test="id != null">#{id},</if>
  77. <if test="externalUserId != null">#{externalUserId},</if>
  78. <if test="openid != null">#{openid},</if>
  79. <if test="externalUserName != null">#{externalUserName},</if>
  80. <if test="customerId != null">#{customerId},</if>
  81. <if test="companyId != null">#{companyId},</if>
  82. <if test="corpId != null">#{corpId},</if>
  83. <if test="avatar != null">#{avatar},</if>
  84. <if test="fsUserId != null">#{fsUserId},</if>
  85. </trim>
  86. on duplicate key update
  87. <trim suffixOverrides=",">
  88. <if test="externalUserId != null">external_user_id = #{externalUserId},</if>
  89. <if test="openid != null">openid = #{openid},</if>
  90. <if test="externalUserName != null">external_user_name = #{externalUserName},</if>
  91. <if test="customerId != null">customer_id = #{customerId},</if>
  92. <if test="companyId != null">company_id = #{companyId},</if>
  93. <if test="corpId != null">corp_id = #{corpId},</if>
  94. <if test="avatar != null">avatar = #{avatar},</if>
  95. <if test="fsUserId != null">fs_user_id = #{fsUserId},</if>
  96. </trim>
  97. </insert>
  98. <update id="updateQwExternalContactCrm" parameterType="QwExternalContactCrm">
  99. update qw_external_contact_crm
  100. <trim prefix="SET" suffixOverrides=",">
  101. <if test="externalUserId != null">external_user_id = #{externalUserId},</if>
  102. <if test="openid != null">external_user_id = #{openid},</if>
  103. <if test="externalUserName != null">external_user_name = #{externalUserName},</if>
  104. <if test="customerId != null">customer_id = #{customerId},</if>
  105. <if test="companyId != null">company_id = #{companyId},</if>
  106. <if test="corpId != null">corp_id = #{corpId},</if>
  107. <if test="avatar != null">avatar = #{avatar},</if>
  108. <if test="fsUserId != null">fs_user_id = #{fsUserId},</if>
  109. </trim>
  110. where id = #{id}
  111. </update>
  112. <delete id="deleteQwExternalContactCrmById" parameterType="Long">
  113. delete from qw_external_contact_crm where id = #{id}
  114. </delete>
  115. <delete id="deleteQwExternalContactCrmByIds" parameterType="String">
  116. delete from qw_external_contact_crm where id in
  117. <foreach item="id" collection="array" open="(" separator="," close=")">
  118. #{id}
  119. </foreach>
  120. </delete>
  121. </mapper>