QwContactWayMapper.xml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  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. <!--suppress ALL -->
  6. <mapper namespace="com.fs.qw.mapper.QwContactWayMapper">
  7. <resultMap type="QwContactWay" id="QwContactWayResult">
  8. <result property="id" column="id" />
  9. <result property="type" column="type" />
  10. <result property="name" column="name" />
  11. <result property="remark" column="remark" />
  12. <result property="skipVerify" column="skip_verify" />
  13. <result property="state" column="state" />
  14. <result property="userIds" column="user_ids" />
  15. <result property="addNum" column="add_num" />
  16. <result property="deleteNum" column="delete_num" />
  17. <result property="num" column="num" />
  18. <result property="qrCode" column="qr_code" />
  19. <result property="configId" column="config_id" />
  20. <result property="isDel" column="is_del" />
  21. <result property="createTime" column="create_time" />
  22. <result property="companyId" column="company_id" />
  23. <result property="isWelcome" column="is_welcome" />
  24. <result property="textContent" column="text_content" />
  25. <result property="imagePicUrl" column="image_pic_url" />
  26. <result property="isUserLimit" column="is_user_limit" />
  27. <result property="isSpanWelcome" column="is_span_welcome" />
  28. <result property="isCloseWelcome" column="is_close_welcome" />
  29. <result property="closeWelcomeWord" column="close_welcome_word" />
  30. <result property="isTag" column="is_tag" />
  31. <result property="tags" column="tags" />
  32. <result property="isRemark" column="is_remark" />
  33. <result property="remarkStatus" column="remark_status" />
  34. <result property="description" column="description" />
  35. <result property="isDescription" column="is_description" />
  36. <result property="spareUserIds" column="spare_user_ids" />
  37. <result property="groupId" column="group_id" />
  38. <result property="userLimitJson" column="user_limit_json" />
  39. <result property="userTimeJson" column="user_time_json" />
  40. <result property="userType" column="user_type" />
  41. <result property="welcomeJson" column="welcome_json" />
  42. <result property="corpId" column="corp_id" />
  43. <result property="informationId" column="information_id" />
  44. </resultMap>
  45. <sql id="selectQwContactWayVo">
  46. select id, type,corp_id,information_id, name,welcome_json, remark, skip_verify, state, user_ids, add_num, delete_num, num, qr_code, config_id, is_del, create_time, company_id, is_welcome, text_content, image_pic_url, is_user_limit, is_span_welcome, is_close_welcome, close_welcome_word, is_tag, tags, is_remark, remark_status, description, is_description, spare_user_ids, group_id, user_limit_json, user_time_json, user_type from qw_contact_way
  47. </sql>
  48. <select id="selectQwContactWayList" parameterType="QwContactWay" resultMap="QwContactWayResult">
  49. <include refid="selectQwContactWayVo"/>
  50. <where>
  51. <if test="type != null "> and type = #{type}</if>
  52. <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
  53. <if test="skipVerify != null "> and skip_verify = #{skipVerify}</if>
  54. <if test="state != null and state != ''"> and state = #{state}</if>
  55. <if test="userIds != null and userIds != ''"> and user_ids = #{userIds}</if>
  56. <if test="corpId != null and corpId != ''"> and corp_id = #{corpId}</if>
  57. <if test="addNum != null "> and add_num = #{addNum}</if>
  58. <if test="deleteNum != null "> and delete_num = #{deleteNum}</if>
  59. <if test="num != null "> and num = #{num}</if>
  60. <if test="qrCode != null and qrCode != ''"> and qr_code = #{qrCode}</if>
  61. <if test="configId != null and configId != ''"> and config_id = #{configId}</if>
  62. <if test="isDel != null "> and is_del = #{isDel}</if>
  63. <if test="companyId != null "> and company_id = #{companyId}</if>
  64. <if test="isWelcome != null "> and is_welcome = #{isWelcome}</if>
  65. <if test="textContent != null and textContent != ''"> and text_content = #{textContent}</if>
  66. <if test="imagePicUrl != null and imagePicUrl != ''"> and image_pic_url = #{imagePicUrl}</if>
  67. <if test="isUserLimit != null "> and is_user_limit = #{isUserLimit}</if>
  68. <if test="isSpanWelcome != null "> and is_span_welcome = #{isSpanWelcome}</if>
  69. <if test="isCloseWelcome != null "> and is_close_welcome = #{isCloseWelcome}</if>
  70. <if test="closeWelcomeWord != null and closeWelcomeWord != ''"> and close_welcome_word = #{closeWelcomeWord}</if>
  71. <if test="isTag != null "> and is_tag = #{isTag}</if>
  72. <if test="tags != null and tags != ''"> and tags = #{tags}</if>
  73. <if test="isRemark != null "> and is_remark = #{isRemark}</if>
  74. <if test="remarkStatus != null and remarkStatus != ''"> and remark_status = #{remarkStatus}</if>
  75. <if test="description != null and description != ''"> and description = #{description}</if>
  76. <if test="isDescription != null "> and is_description = #{isDescription}</if>
  77. <if test="spareUserIds != null and spareUserIds != ''"> and spare_user_ids = #{spareUserIds}</if>
  78. <if test="groupId != null "> and group_id = #{groupId}</if>
  79. <if test="userLimitJson != null and userLimitJson != ''"> and user_limit_json = #{userLimitJson}</if>
  80. <if test="userTimeJson != null and userTimeJson != ''"> and user_time_json = #{userTimeJson}</if>
  81. <if test="userType != null "> and user_type = #{userType}</if>
  82. </where> order by id desc
  83. </select>
  84. <select id="selectQwContactWayById" parameterType="Long" resultMap="QwContactWayResult">
  85. <include refid="selectQwContactWayVo"/>
  86. where id = #{id}
  87. </select>
  88. <insert id="insertQwContactWay" parameterType="QwContactWay" useGeneratedKeys="true" keyProperty="id">
  89. insert into qw_contact_way
  90. <trim prefix="(" suffix=")" suffixOverrides=",">
  91. <if test="type != null">type,</if>
  92. <if test="name != null">name,</if>
  93. <if test="remark != null">remark,</if>
  94. <if test="skipVerify != null">skip_verify,</if>
  95. <if test="state != null">state,</if>
  96. <if test="userIds != null">user_ids,</if>
  97. <if test="addNum != null">add_num,</if>
  98. <if test="deleteNum != null">delete_num,</if>
  99. <if test="num != null">num,</if>
  100. <if test="qrCode != null">qr_code,</if>
  101. <if test="configId != null">config_id,</if>
  102. <if test="isDel != null">is_del,</if>
  103. <if test="createTime != null">create_time,</if>
  104. <if test="companyId != null">company_id,</if>
  105. <if test="isWelcome != null">is_welcome,</if>
  106. <if test="textContent != null">text_content,</if>
  107. <if test="imagePicUrl != null">image_pic_url,</if>
  108. <if test="isUserLimit != null">is_user_limit,</if>
  109. <if test="isSpanWelcome != null">is_span_welcome,</if>
  110. <if test="isCloseWelcome != null">is_close_welcome,</if>
  111. <if test="closeWelcomeWord != null">close_welcome_word,</if>
  112. <if test="isTag != null">is_tag,</if>
  113. <if test="tags != null">tags,</if>
  114. <if test="isRemark != null">is_remark,</if>
  115. <if test="remarkStatus != null">remark_status,</if>
  116. <if test="description != null">description,</if>
  117. <if test="isDescription != null">is_description,</if>
  118. <if test="spareUserIds != null">spare_user_ids,</if>
  119. <if test="groupId != null">group_id,</if>
  120. <if test="userLimitJson != null">user_limit_json,</if>
  121. <if test="userTimeJson != null">user_time_json,</if>
  122. <if test="userType != null">user_type,</if>
  123. <if test="welcomeJson != null">welcome_json,</if>
  124. <if test="corpId != null">corp_id,</if>
  125. <if test="informationId != null">information_id,</if>
  126. </trim>
  127. <trim prefix="values (" suffix=")" suffixOverrides=",">
  128. <if test="type != null">#{type},</if>
  129. <if test="name != null">#{name},</if>
  130. <if test="remark != null">#{remark},</if>
  131. <if test="skipVerify != null">#{skipVerify},</if>
  132. <if test="state != null">#{state},</if>
  133. <if test="userIds != null">#{userIds},</if>
  134. <if test="addNum != null">#{addNum},</if>
  135. <if test="deleteNum != null">#{deleteNum},</if>
  136. <if test="num != null">#{num},</if>
  137. <if test="qrCode != null">#{qrCode},</if>
  138. <if test="configId != null">#{configId},</if>
  139. <if test="isDel != null">#{isDel},</if>
  140. <if test="createTime != null">#{createTime},</if>
  141. <if test="companyId != null">#{companyId},</if>
  142. <if test="isWelcome != null">#{isWelcome},</if>
  143. <if test="textContent != null">#{textContent},</if>
  144. <if test="imagePicUrl != null">#{imagePicUrl},</if>
  145. <if test="isUserLimit != null">#{isUserLimit},</if>
  146. <if test="isSpanWelcome != null">#{isSpanWelcome},</if>
  147. <if test="isCloseWelcome != null">#{isCloseWelcome},</if>
  148. <if test="closeWelcomeWord != null">#{closeWelcomeWord},</if>
  149. <if test="isTag != null">#{isTag},</if>
  150. <if test="tags != null">#{tags},</if>
  151. <if test="isRemark != null">#{isRemark},</if>
  152. <if test="remarkStatus != null">#{remarkStatus},</if>
  153. <if test="description != null">#{description},</if>
  154. <if test="isDescription != null">#{isDescription},</if>
  155. <if test="spareUserIds != null">#{spareUserIds},</if>
  156. <if test="groupId != null">#{groupId},</if>
  157. <if test="userLimitJson != null">#{userLimitJson},</if>
  158. <if test="userTimeJson != null">#{userTimeJson},</if>
  159. <if test="userType != null">#{userType},</if>
  160. <if test="welcomeJson != null">#{welcomeJson},</if>
  161. <if test="corpId != null">#{corpId},</if>
  162. <if test="informationId != null">#{informationId},</if>
  163. </trim>
  164. </insert>
  165. <update id="updateQwContactWay" parameterType="QwContactWay">
  166. update qw_contact_way
  167. <trim prefix="SET" suffixOverrides=",">
  168. <if test="type != null">type = #{type},</if>
  169. <if test="name != null">name = #{name},</if>
  170. <if test="remark != null">remark = #{remark},</if>
  171. <if test="skipVerify != null">skip_verify = #{skipVerify},</if>
  172. <if test="state != null">state = #{state},</if>
  173. <if test="userIds != null">user_ids = #{userIds},</if>
  174. <if test="addNum != null">add_num = #{addNum},</if>
  175. <if test="deleteNum != null">delete_num = #{deleteNum},</if>
  176. <if test="num != null">num = #{num},</if>
  177. <if test="qrCode != null">qr_code = #{qrCode},</if>
  178. <if test="configId != null">config_id = #{configId},</if>
  179. <if test="isDel != null">is_del = #{isDel},</if>
  180. <if test="createTime != null">create_time = #{createTime},</if>
  181. <if test="companyId != null">company_id = #{companyId},</if>
  182. <if test="isWelcome != null">is_welcome = #{isWelcome},</if>
  183. <if test="textContent != null">text_content = #{textContent},</if>
  184. <if test="imagePicUrl != null">image_pic_url = #{imagePicUrl},</if>
  185. <if test="isUserLimit != null">is_user_limit = #{isUserLimit},</if>
  186. <if test="isSpanWelcome != null">is_span_welcome = #{isSpanWelcome},</if>
  187. <if test="isCloseWelcome != null">is_close_welcome = #{isCloseWelcome},</if>
  188. <if test="closeWelcomeWord != null">close_welcome_word = #{closeWelcomeWord},</if>
  189. <if test="isTag != null">is_tag = #{isTag},</if>
  190. <if test="tags != null">tags = #{tags},</if>
  191. <if test="isRemark != null">is_remark = #{isRemark},</if>
  192. <if test="remarkStatus != null">remark_status = #{remarkStatus},</if>
  193. <if test="description != null">description = #{description},</if>
  194. <if test="isDescription != null">is_description = #{isDescription},</if>
  195. <if test="spareUserIds != null">spare_user_ids = #{spareUserIds},</if>
  196. <if test="groupId != null">group_id = #{groupId},</if>
  197. <if test="userLimitJson != null">user_limit_json = #{userLimitJson},</if>
  198. <if test="userTimeJson != null">user_time_json = #{userTimeJson},</if>
  199. <if test="userType != null">user_type = #{userType},</if>
  200. <if test="welcomeJson != null">welcome_json = #{welcomeJson},</if>
  201. <if test="corpId != null">corp_id = #{corpId},</if>
  202. <if test="informationId != null">information_id = #{informationId},</if>
  203. </trim>
  204. where id = #{id}
  205. </update>
  206. <delete id="deleteQwContactWayById" parameterType="Long">
  207. delete from qw_contact_way where id = #{id}
  208. </delete>
  209. <select id="selectQwWayStatisticsCounts" resultType="com.alibaba.fastjson.JSONObject">
  210. SELECT count( IF ( t.tt =2,1, null ) ) AS deleteNum,count( IF ( t.tt =1,1, NULL ) ) AS addNum, (count( IF ( t.tt =1,1, NULL ) ) - count( IF ( t.tt =2,1, null ) )) as num ,t.type
  211. FROM
  212. (
  213. SELECT DATE_FORMAT( l.create_time, #{sqlDateFormat} ) AS type, l.type as tt
  214. FROM
  215. qw_contact_way_logs AS l
  216. WHERE
  217. (DATE_FORMAT(l.create_time,#{sqlDateFormat}) between #{beginTime} and #{finalTime})
  218. AND l.way_id=#{companyId} )t
  219. GROUP BY t.type
  220. </select>
  221. <delete id="deleteQwContactWayByIds" parameterType="String">
  222. delete from qw_contact_way where id in
  223. <foreach item="id" collection="array" open="(" separator="," close=")">
  224. #{id}
  225. </foreach>
  226. </delete>
  227. </mapper>