SaleClueInfoMapper.xml 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  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.ruixuan.salesLeads.mapper.SaleClueInfoMapper">
  6. <!-- 批量新增销售线索-->
  7. <insert id="replaceSaleClueInfoBatch">
  8. replace into sale_clue_info(
  9. sales_leads_type,
  10. seller_id,
  11. seller_name,
  12. fans,
  13. industry_id,
  14. province_id,
  15. city_id,
  16. telephone,
  17. provider_flag,
  18. transition_flag,
  19. upload_date,
  20. distribution_sale_flag,
  21. sale_id,
  22. state,
  23. offline_sale_flag,
  24. create_user_id,
  25. create_time)
  26. values
  27. <foreach collection="saleClueList" item="info" separator=",">
  28. (
  29. #{info.salesLeadsType},
  30. #{info.sellerId},
  31. #{info.sellerName},
  32. #{info.fans},
  33. #{info.industryId},
  34. #{info.provinceId},
  35. #{info.cityId},
  36. #{info.telephone},
  37. #{info.providerFlag},
  38. #{info.transitionFlag},
  39. #{info.uploadDate},
  40. #{info.distributionSaleFlag},
  41. #{info.saleId},
  42. #{info.state},
  43. #{info.offlineSaleFlag},
  44. #{info.createUserId},
  45. NOW()
  46. )
  47. </foreach>
  48. </insert>
  49. <!-- 销售线索列表信息 -->
  50. <select id="selectSaleClueInfoList" resultType="com.ruixuan.salesLeads.pojo.SaleClueInfoPojo">
  51. SELECT
  52. s.id,
  53. s.sales_leads_type,
  54. s.seller_id,
  55. s.seller_name,
  56. s.fans,
  57. s.industry_id,
  58. (SELECT name from sys_industry_info i where i.id = s.industry_id) industryName,
  59. s.province_id,
  60. (SELECT name from sys_area_info a WHERE a.`code` = s.province_id) provinceName,
  61. s.city_id,
  62. (SELECT name from sys_area_info a WHERE a.`code` = s.city_id) cityName,
  63. s.telephone,
  64. s.provider_flag,
  65. s.transition_flag,
  66. s.upload_date,
  67. s.distribution_sale_flag,
  68. s.sale_id,
  69. (SELECT u.nick_name FROM sys_user u WHERE u.user_id = s.sale_id ) saleName,
  70. s.state,
  71. s.offline_sale_flag,
  72. s.create_user_id,
  73. s.create_time
  74. FROM
  75. sale_clue_info s
  76. <where>
  77. <if test="sellerName !=null and sellerName != ''">
  78. and (s.seller_name like CONCAT('%', CONCAT(#{sellerName}, '%')) or s.seller_id like CONCAT('%', CONCAT(#{sellerName}, '%')))
  79. </if>
  80. <if test="uploadDate !=null and uploadDate != ''">
  81. and s.upload_date = #{uploadDate}
  82. </if>
  83. <if test="distributionSaleFlag !=null and distributionSaleFlag != ''" >
  84. and s.distribution_sale_flag = #{distributionSaleFlag}
  85. </if>
  86. <if test="industryId !=null and industryId != ''">
  87. and s.industry_id = #{industryId}
  88. </if>
  89. <if test="state !=null and state != ''">
  90. and s.state = #{state}
  91. </if>
  92. <if test="userId !=null and userId != ''">
  93. and s.update_user_id = #{userId}
  94. </if>
  95. <if test="fansType == '1'.toString()">
  96. and s.fans BETWEEN 0 AND 500000
  97. </if>
  98. <if test="fansType == '2'.toString()">
  99. and s.fans BETWEEN 500000 AND 2000000
  100. </if>
  101. <if test="fansType == '3'.toString()">
  102. and s.fans BETWEEN 2000000 AND 5000000
  103. </if>
  104. <if test="fansType == '4'.toString()">
  105. and s.fans &gt;=5000000
  106. </if>
  107. </where>
  108. </select>
  109. <!-- 销售线索 任务 列表信息 -->
  110. <select id="selectSaleClueTaskList" resultType="com.ruixuan.salesLeads.pojo.SaleClueInfoPojo">
  111. SELECT
  112. s.id,
  113. s.sales_leads_type,
  114. s.seller_id,
  115. s.seller_name,
  116. s.fans,
  117. s.industry_id,
  118. (SELECT name from sys_industry_info i where i.id = s.industry_id) industryName,
  119. s.province_id,
  120. (SELECT name from sys_area_info a WHERE a.`code` = s.province_id) provinceName,
  121. s.city_id,
  122. (SELECT name from sys_area_info a WHERE a.`code` = s.city_id) cityName,
  123. s.telephone,
  124. s.provider_flag,
  125. s.transition_flag,
  126. s.upload_date,
  127. s.distribution_sale_flag,
  128. s.sale_id,
  129. (SELECT u.nick_name FROM sys_user u WHERE u.user_id = s.sale_id ) saleName,
  130. s.state,
  131. s.offline_sale_flag,
  132. s.create_user_id,
  133. s.create_time
  134. FROM
  135. sale_clue_info s
  136. <where>
  137. <if test="sellerName !=null and sellerName != ''">
  138. and (s.seller_name like CONCAT('%', CONCAT(#{sellerName}, '%')) or s.seller_id like CONCAT('%', CONCAT(#{sellerName}, '%')))
  139. </if>
  140. <if test="state !=null and state != ''">
  141. and s.state = #{state}
  142. </if>
  143. <if test="saleId !=null and saleId != ''">
  144. and s.sale_id = #{saleId}
  145. </if>
  146. </where>
  147. </select>
  148. <!-- 根据卖家ids 查询销售线索 -->
  149. <select id="selectSaleClueInfoBySellers" resultType="com.ruixuan.salesLeads.pojo.SaleClueInfoPojo">
  150. SELECT
  151. s.id,
  152. s.sales_leads_type,
  153. s.seller_id,
  154. s.seller_name,
  155. s.fans,
  156. s.industry_id,
  157. s.province_id,
  158. s.city_id,
  159. s.telephone,
  160. s.provider_flag,
  161. s.transition_flag,
  162. s.upload_date,
  163. s.distribution_sale_flag,
  164. s.sale_id,
  165. s.state,
  166. s.offline_sale_flag,
  167. s.create_user_id,
  168. s.create_time
  169. FROM
  170. sale_clue_info s
  171. <where>
  172. <if test="sellerIds != null and sellerIds.size() != 0 ">
  173. and s.seller_id in
  174. <foreach collection="sellerIds" item="item" separator=","
  175. open="(" close=")">
  176. #{item}
  177. </foreach>
  178. </if>
  179. </where>
  180. </select>
  181. <!-- 修改销售线索 销售人员 -->
  182. <update id="updateSaleClueSale">
  183. UPDATE sale_clue_info
  184. SET
  185. distribution_sale_flag = #{distributionSaleFlag},
  186. sale_id = #{saleId}
  187. WHERE
  188. seller_id = #{sellerId}
  189. </update>
  190. <!-- 修改销售线索 状态 -->
  191. <update id="updateSaleClueState">
  192. UPDATE sale_clue_info
  193. SET
  194. state = #{state}
  195. WHERE
  196. seller_id = #{sellerId}
  197. </update>
  198. </mapper>