QwContactWayMapper.xml 14 KB

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