WxSopUserInfoMapper.xml 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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.wx.sop.mapper.WxSopUserInfoMapper">
  6. <resultMap type="WxSopUserInfo" id="WxSopUserInfoResult">
  7. <result property="id" column="id" />
  8. <result property="sopId" column="sop_id" />
  9. <result property="sopUserId" column="sop_user_id" />
  10. <result property="wxContactId" column="wx_contact_id" />
  11. <result property="customerId" column="customer_id" />
  12. <result property="fsUserId" column="fs_user_id" />
  13. <result property="isDaysNotStudy" column="is_days_not_study" />
  14. <result property="finishCout" column="finish_cout" />
  15. <result property="finishTime" column="finish_time" />
  16. <result property="finishCourseDays" column="finish_course_days" />
  17. <result property="grade" column="grade" />
  18. <result property="status" column="status" />
  19. <result property="createTime" column="create_time" />
  20. <result property="createBy" column="create_by" />
  21. <result property="updateTime" column="update_time" />
  22. <result property="updateBy" column="update_by" />
  23. <result property="remark" column="remark" />
  24. <result property="tagNames" column="tag_names" />
  25. </resultMap>
  26. <sql id="selectWxSopUserInfoVo">
  27. select wsui.id, wsui.sop_id, wsui.sop_user_id, wsui.wx_contact_id, wsui.customer_id, wsui.fs_user_id, wsui.is_days_not_study,
  28. wsui.finish_cout, wsui.finish_time, wsui.finish_course_days, wsui.grade, wsui.status,
  29. wsui.create_time, wsui.create_by, wsui.update_time, wsui.update_by, wsui.remark,
  30. COALESCE(wsui.tag_names, cc.tags) as tag_names
  31. from wx_sop_user_info wsui
  32. left join ylrz_his_scrm.wx_contact wc on wsui.wx_contact_id = wc.id
  33. left join ylrz_his_scrm.crm_customer cc on COALESCE(wc.customer_id, wsui.customer_id) = cc.customer_id
  34. </sql>
  35. <select id="selectWxSopUserInfoList" parameterType="WxSopUserInfo" resultMap="WxSopUserInfoResult">
  36. <include refid="selectWxSopUserInfoVo"/>
  37. <where>
  38. <if test="sopId != null "> and wsui.sop_id = #{sopId}</if>
  39. <if test="sopUserId != null "> and wsui.sop_user_id = #{sopUserId}</if>
  40. <if test="wxContactId != null "> and wsui.wx_contact_id = #{wxContactId}</if>
  41. <if test="customerId != null "> and wsui.customer_id = #{customerId}</if>
  42. <if test="fsUserId != null "> and wsui.fs_user_id = #{fsUserId}</if>
  43. <if test="isDaysNotStudy != null "> and wsui.is_days_not_study = #{isDaysNotStudy}</if>
  44. <if test="finishCout != null "> and wsui.finish_cout = #{finishCout}</if>
  45. <if test="finishTime != null "> and wsui.finish_time = #{finishTime}</if>
  46. <if test="finishCourseDays != null "> and wsui.finish_course_days = #{finishCourseDays}</if>
  47. <if test="grade != null "> and wsui.grade = #{grade}</if>
  48. <if test="status != null "> and wsui.status = #{status}</if>
  49. </where>
  50. </select>
  51. <select id="selectWxSopUserInfoById" parameterType="Long" resultMap="WxSopUserInfoResult">
  52. <include refid="selectWxSopUserInfoVo"/>
  53. where wsui.id = #{id}
  54. </select>
  55. <insert id="insertWxSopUserInfo" parameterType="WxSopUserInfo" useGeneratedKeys="true" keyProperty="id">
  56. insert into wx_sop_user_info
  57. <trim prefix="(" suffix=")" suffixOverrides=",">
  58. <if test="sopId != null">sop_id,</if>
  59. <if test="sopUserId != null">sop_user_id,</if>
  60. <if test="wxContactId != null">wx_contact_id,</if>
  61. <if test="customerId != null">customer_id,</if>
  62. <if test="fsUserId != null">fs_user_id,</if>
  63. <if test="isDaysNotStudy != null">is_days_not_study,</if>
  64. <if test="finishCout != null">finish_cout,</if>
  65. <if test="finishTime != null">finish_time,</if>
  66. <if test="finishCourseDays != null">finish_course_days,</if>
  67. <if test="grade != null">grade,</if>
  68. <if test="status != null">status,</if>
  69. <if test="createTime != null">create_time,</if>
  70. <if test="createBy != null">create_by,</if>
  71. <if test="updateTime != null">update_time,</if>
  72. <if test="updateBy != null">update_by,</if>
  73. <if test="remark != null">remark,</if>
  74. <if test="tagNames != null">tag_names,</if>
  75. </trim>
  76. <trim prefix="values (" suffix=")" suffixOverrides=",">
  77. <if test="sopId != null">#{sopId},</if>
  78. <if test="sopUserId != null">#{sopUserId},</if>
  79. <if test="wxContactId != null">#{wxContactId},</if>
  80. <if test="customerId != null">#{customerId},</if>
  81. <if test="fsUserId != null">#{fsUserId},</if>
  82. <if test="isDaysNotStudy != null">#{isDaysNotStudy},</if>
  83. <if test="finishCout != null">#{finishCout},</if>
  84. <if test="finishTime != null">#{finishTime},</if>
  85. <if test="finishCourseDays != null">#{finishCourseDays},</if>
  86. <if test="grade != null">#{grade},</if>
  87. <if test="status != null">#{status},</if>
  88. <if test="createTime != null">#{createTime},</if>
  89. <if test="createBy != null">#{createBy},</if>
  90. <if test="updateTime != null">#{updateTime},</if>
  91. <if test="updateBy != null">#{updateBy},</if>
  92. <if test="remark != null">#{remark},</if>
  93. <if test="tagNames != null">#{tagNames},</if>
  94. </trim>
  95. </insert>
  96. <update id="updateWxSopUserInfo" parameterType="WxSopUserInfo">
  97. update wx_sop_user_info
  98. <trim prefix="SET" suffixOverrides=",">
  99. <if test="sopId != null">sop_id = #{sopId},</if>
  100. <if test="sopUserId != null">sop_user_id = #{sopUserId},</if>
  101. <if test="wxContactId != null">wx_contact_id = #{wxContactId},</if>
  102. <if test="customerId != null">customer_id = #{customerId},</if>
  103. <if test="fsUserId != null">fs_user_id = #{fsUserId},</if>
  104. <if test="isDaysNotStudy != null">is_days_not_study = #{isDaysNotStudy},</if>
  105. <if test="finishCout != null">finish_cout = #{finishCout},</if>
  106. <if test="finishTime != null">finish_time = #{finishTime},</if>
  107. <if test="finishCourseDays != null">finish_course_days = #{finishCourseDays},</if>
  108. <if test="grade != null">grade = #{grade},</if>
  109. <if test="status != null">status = #{status},</if>
  110. <if test="createTime != null">create_time = #{createTime},</if>
  111. <if test="createBy != null">create_by = #{createBy},</if>
  112. <if test="updateTime != null">update_time = #{updateTime},</if>
  113. <if test="updateBy != null">update_by = #{updateBy},</if>
  114. <if test="remark != null">remark = #{remark},</if>
  115. <if test="tagNames != null">tag_names = #{tagNames},</if>
  116. </trim>
  117. where id = #{id}
  118. </update>
  119. <delete id="deleteWxSopUserInfoById" parameterType="Long">
  120. delete from wx_sop_user_info where id = #{id}
  121. </delete>
  122. <delete id="deleteWxSopUserInfoByIds" parameterType="String">
  123. delete from wx_sop_user_info where id in
  124. <foreach item="id" collection="array" open="(" separator="," close=")">
  125. #{id}
  126. </foreach>
  127. </delete>
  128. <select id="selectWxSopUserInfoByCondition" parameterType="WxSopUserInfo" resultMap="WxSopUserInfoResult">
  129. <include refid="selectWxSopUserInfoVo"/>
  130. <where>
  131. <if test="sopId != null">and wsui.sop_id = #{sopId}</if>
  132. <if test="sopUserId != null">and wsui.sop_user_id = #{sopUserId}</if>
  133. <if test="wxContactId != null">and wsui.wx_contact_id = #{wxContactId}</if>
  134. <if test="customerId != null">and wsui.customer_id = #{customerId}</if>
  135. </where>
  136. limit 1
  137. </select>
  138. </mapper>