KuaishouPromoterMapper.xml 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521
  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.isc.mapper.KuaishouPromoterMapper">
  6. <resultMap type="com.ruixuan.isc.entity.KuaishouPromoter" id="KuaishouPromoterResult">
  7. <result property="id" column="id"/>
  8. <result property="userId" column="user_id"/>
  9. <result property="mediaId" column="media_id"/>
  10. <result property="userName" column="user_name"/>
  11. <result property="promoterId" column="promoter_id"/>
  12. <result property="promoterNickName" column="promoter_nick_name"/>
  13. <result property="state" column="state"/>
  14. <result property="province" column="province"/>
  15. <result property="commissionRequirement" column="commission_requirement"/>
  16. <result property="categoryRequirement" column="category_requirement"/>
  17. <result property="createTime" column="create_time"/>
  18. <result property="promoterUrl" column="promoter_url"/>
  19. <result property="totalSale" column="total_sale"/>
  20. <result property="fansNumber" column="fans_number"/>
  21. <result property="phone" column="phone"/>
  22. <result property="consignee" column="consignee"/>
  23. <result property="promoterAddress" column="promoter_address"/>
  24. <result property="avgVideoSales" column="avg_video_sales"/>
  25. <result property="videoSales" column="video_sales"/>
  26. <result property="updateTime" column="update_time"/>
  27. <result property="monthDayGmv" column="30day_gmv"/>
  28. <result property="monthDayOrderNum" column="30day_order_num"/>
  29. <result property="validAmount" column="valid_amount"/>
  30. <result property="followerIncr" column="follower_incr"/>
  31. <result property="liveCount30" column="live_count_30"/>
  32. <result property="awemeAvgDiggCount30" column="aweme_avg_digg_count_30"/>
  33. <result property="awemeDiggFollowerRation" column="aweme_digg_follower_ration"/>
  34. <result property="liveAverageUser30" column="live_average_user_30"/>
  35. <result property="followUpRecord" column="txt"/>
  36. </resultMap>
  37. <sql id="selectKuaishouPromoterVo">
  38. select id,
  39. media_id,
  40. user_id,
  41. user_name,
  42. promoter_id,
  43. promoter_nick_name,
  44. `state`,
  45. province,
  46. commission_requirement,
  47. category_requirement,
  48. promoter_url,
  49. phone,
  50. consignee,
  51. promoter_address,
  52. total_sale,
  53. fans_number,
  54. avg_video_sales,
  55. video_sales,
  56. create_time,
  57. update_time
  58. from kuaishou_promoter
  59. </sql>
  60. <select id="selectKuaishouPromoterList" resultMap="KuaishouPromoterResult">
  61. SELECT * from (
  62. SELECT
  63. t1.id,
  64. t1.user_id,
  65. t1.media_id,
  66. t1.user_name,
  67. t1.promoter_id,
  68. t1.promoter_nick_name,
  69. t1.`state`,
  70. t1.province,
  71. t1.commission_requirement,
  72. t1.category_requirement,
  73. t1.promoter_url,
  74. t1.phone,
  75. t1.consignee,
  76. t1.promoter_address,
  77. if(t1.media_id = 1, t1.total_sale,t3.total_sale ) as 'total_sale',
  78. if(t1.media_id = 1, t1.fans_number,t3.fans_number ) as 'fans_number',
  79. if(t1.media_id = 1, t1.avg_video_sales,t3.avg_video_sales ) as 'avg_video_sales',
  80. if(t1.media_id = 1,t1.video_sales ,t3.video_sales ) as 'video_sales',
  81. t1.create_time,
  82. t2.30day_gmv,
  83. t2.30day_order_num,
  84. t1.follower_incr,
  85. t1.live_count_30,
  86. t1.aweme_avg_digg_count_30,
  87. t1.aweme_digg_follower_ration,
  88. t1.live_average_user_30,
  89. case
  90. WHEN t3.total_sale like '%万%'
  91. then SUBSTRING_INDEX(t3.total_sale,'-',-1)+0
  92. else SUBSTRING_INDEX(t3.total_sale,'-',-1)/10000 end as 'totalSaleOrder',
  93. case
  94. WHEN t3.video_sales like '%万%'
  95. then SUBSTRING_INDEX(t3.video_sales,'-',-1)+0
  96. else SUBSTRING_INDEX(t3.video_sales,'-',-1)/10000 end as 'videoSalesOrder',
  97. case
  98. WHEN t3.avg_video_sales like '%万%'
  99. then SUBSTRING_INDEX(t3.avg_video_sales,'-',-1)+0
  100. else SUBSTRING_INDEX(t3.avg_video_sales,'-',-1)/10000 end as 'avgVideoSalesOrder'
  101. FROM
  102. kuaishou_promoter t1
  103. LEFT JOIN promoter_oerder_amount t2 on t1.promoter_id = t2.promoter_id
  104. LEFT JOIN promoter_sales_info t3 ON t1.promoter_id = t3.promoter_id
  105. <where>
  106. <if test="userList != null and userList.size() > 0 ">
  107. and t1.user_id in
  108. <foreach collection="userList" item="userId" open="(" separator="," close=")">
  109. #{userId}
  110. </foreach>
  111. </if>
  112. <if test="promoterId != null ">
  113. and t1.promoter_id = #{promoterId}
  114. </if>
  115. <if test="promoterNickName != null and promoterNickName != ''">
  116. and t1.promoter_nick_name like concat('%', #{promoterNickName}, '%')
  117. </if>
  118. <if test="mediaId != null and mediaId != ''">
  119. and t1.media_id = #{mediaId}
  120. </if>
  121. </where>
  122. ) t
  123. order by ${parameter} ${orderBy}
  124. </select>
  125. <select id="selectAllPromoterList" resultType="com.alibaba.fastjson.JSONObject">
  126. SELECT *
  127. FROM (
  128. SELECT
  129. t1.promoter_id AS 'promoterId',
  130. (CASE WHEN t2.promoter_id IS NULL THEN 2 ELSE 1 END) AS 'status',
  131. IF(t0.promoter_name is null,t2.promoter_nick_name,t0.promoter_name) AS 'promoterNickName',
  132. IFNULL(t2.userName,'') AS 'userName',
  133. IFNULL(t2.commission_requirement,'') AS 'commissionRequirement',
  134. IF(t0.handurl is null,t2.promoter_url,t0.handurl) AS 'promoterUrl',
  135. t1.30day_gmv AS 'monthDayGmv',
  136. t1.30day_order_num AS 'monthDayOrderNum',+
  137. t1.valid_amount AS 'validAmount',
  138. t3.fans_number AS 'fansNumber',
  139. t3.video_sales AS 'videoSales',
  140. t3.avg_video_sales AS 'avgVideoSales',
  141. t3.total_sale AS 'totalSale',
  142. case
  143. WHEN t3.video_sales like '%万%'
  144. then SUBSTRING_INDEX(t3.video_sales,'-',-1)+0
  145. else SUBSTRING_INDEX(t3.video_sales,'-',-1)/10000 end as 'videoSalesOrder',
  146. case
  147. WHEN t3.avg_video_sales like '%万%'
  148. then SUBSTRING_INDEX(t3.avg_video_sales,'-',-1)+0
  149. else SUBSTRING_INDEX(t3.avg_video_sales,'-',-1)/10000 end as 'avgVideoSalesOrder'
  150. FROM
  151. promoter_oerder_amount t1
  152. LEFT JOIN promoter_info t0 ON t1.promoter_id = t0.promoter_id
  153. LEFT JOIN promoter_sales_info t3 ON t1.promoter_id = t3.promoter_id
  154. <choose>
  155. <when test="userId !=null and userId !='' ">
  156. RIGHT
  157. </when>
  158. <otherwise>
  159. LEFT
  160. </otherwise>
  161. </choose>
  162. JOIN (
  163. SELECT
  164. promoter_id,
  165. group_concat( user_name ) AS 'userName',
  166. fans_number, promoter_url,
  167. commission_requirement,
  168. promoter_nick_name,
  169. avg_video_sales,
  170. video_sales
  171. FROM kuaishou_promoter
  172. <where>
  173. <if test="userId != null ">
  174. and user_id = #{userId}
  175. </if>
  176. </where>
  177. GROUP BY promoter_id
  178. ) t2 ON t1.promoter_id = t2.promoter_id
  179. <where>
  180. <if test="promoterId != null ">
  181. and t1.promoter_id = #{promoterId}
  182. </if>
  183. <if test="promoterNickName != null and promoterNickName != ''">
  184. and t2.promoter_nick_name like concat('%', #{promoterNickName}, '%')
  185. </if>
  186. </where>
  187. ) t
  188. <where>
  189. <if test="status != null ">
  190. and `status` = #{status}
  191. </if>
  192. </where>
  193. order by ${parameter} ${orderBy}
  194. </select>
  195. <select id="selectKuaishouPromoterById" parameterType="Long" resultMap="KuaishouPromoterResult">
  196. <include refid="selectKuaishouPromoterVo"/>
  197. where id = #{id}
  198. </select>
  199. <select id="getFailInfo" resultMap="KuaishouPromoterResult">
  200. <include refid="selectKuaishouPromoterVo"/>
  201. where (promoter_nick_name = '' or promoter_nick_name is null)
  202. AND state =1
  203. </select>
  204. <select id="getBoundPromoterRoleKey" resultType="com.alibaba.fastjson.JSONObject">
  205. SELECT t1.user_id,
  206. t3.role_key,
  207. t1.user_name
  208. FROM kuaishou_promoter t1
  209. LEFT JOIN sys_user_role t2 ON t1.user_id = t2.user_id
  210. LEFT JOIN sys_role t3 ON t2.role_id = t3.role_id
  211. Where t1.promoter_id = #{promoterId}
  212. </select>
  213. <select id="selectPromoterIdList" resultType="String">
  214. select promoter_id
  215. from kuaishou_promoter
  216. <where>
  217. <if test="userList != null ">
  218. AND user_id in
  219. <foreach collection="userList" item="item" separator=","
  220. open="(" close=")">
  221. #{item}
  222. </foreach>
  223. </if>
  224. </where>
  225. </select>
  226. <select id="getOneByIdAndPromoterId" resultMap="KuaishouPromoterResult">
  227. <include refid="selectKuaishouPromoterVo"/>
  228. where promoter_id = #{promoterId}
  229. <if test="userId != null ">
  230. AND user_id = #{userId}
  231. </if>
  232. limit 1
  233. </select>
  234. <select id="getgetMonthPromoterTotal" resultType="com.alibaba.fastjson.JSONObject">
  235. SELECT t1.count,
  236. CONCAT(ROUND(t2.count / t1.count * 100, 2), '%') as 'rate'
  237. FROM
  238. (
  239. SELECT count(promoter_id) as 'count'
  240. FROM kuaishou_promoter
  241. WHERE DATE_FORMAT(create_time, '%Y-%m-%d') >= #{start}
  242. AND DATE_FORMAT(create_time, '%Y-%m-%d') &lt;= #{end}
  243. <if test="userList != null and userList.size() > 0 ">
  244. AND user_id in
  245. <foreach collection="userList" item="item" separator=","
  246. open="(" close=")">
  247. #{item}
  248. </foreach>
  249. </if>
  250. ) t1
  251. LEFT JOIN
  252. (SELECT count(promoter_id) as 'count'
  253. FROM kuaishou_promoter
  254. WHERE DATE_FORMAT(create_time, '%Y-%m-%d') = #{end}
  255. <if test="userList != null and userList.size() > 0 ">
  256. AND user_id in
  257. <foreach collection="userList" item="item" separator=","
  258. open="(" close=")">
  259. #{item}
  260. </foreach>
  261. </if>
  262. ) t2 ON 1 = 1
  263. </select>
  264. <insert id="insertKuaishouPromoter" parameterType="com.ruixuan.isc.entity.KuaishouPromoter" useGeneratedKeys="true"
  265. keyProperty="id">
  266. insert into kuaishou_promoter
  267. <trim prefix="(" suffix=")" suffixOverrides=",">
  268. <if test="userId != null">user_id,</if>
  269. <if test="mediaId != null">media_id,</if>
  270. <if test="userName != null">user_name,</if>
  271. <if test="promoterId != null">promoter_id,</if>
  272. <if test="promoterNickName != null">promoter_nick_name,</if>
  273. <if test="state != null">state,</if>
  274. <if test="province != null">province,</if>
  275. <if test="commissionRequirement != null">commission_requirement,</if>
  276. <if test="categoryRequirement != null">category_requirement,</if>
  277. <if test="createTime != null">create_time,</if>
  278. <if test="updateTime != null">update_time,</if>
  279. <if test="totalSale != null">total_sale,</if>
  280. <if test="fansNumber != null">fans_number,</if>
  281. <if test="promoterUrl != null">promoter_url,</if>
  282. <if test="phone != null">phone,</if>
  283. <if test="consignee != null">consignee,</if>
  284. <if test="promoterAddress != null">promoter_address,</if>
  285. </trim>
  286. <trim prefix="values (" suffix=")" suffixOverrides=",">
  287. <if test="userId != null">#{userId},</if>
  288. <if test="mediaId != null">#{mediaId},</if>
  289. <if test="userName != null">#{userName},</if>
  290. <if test="promoterId != null">#{promoterId},</if>
  291. <if test="promoterNickName != null">#{promoterNickName},</if>
  292. <if test="state != null">#{state},</if>
  293. <if test="province != null">#{province},</if>
  294. <if test="commissionRequirement != null">#{commissionRequirement},</if>
  295. <if test="categoryRequirement != null">#{categoryRequirement},</if>
  296. <if test="createTime != null">#{createTime},</if>
  297. <if test="updateTime != null">#{updateTime},</if>
  298. <if test="totalSale != null">#{totalSale},</if>
  299. <if test="fansNumber != null">#{fansNumber},</if>
  300. <if test="promoterUrl != null">#{promoterUrl},</if>
  301. <if test="phone != null">#{phone},</if>
  302. <if test="consignee != null">#{consignee},</if>
  303. <if test="promoterAddress != null">#{promoterAddress},</if>
  304. </trim>
  305. </insert>
  306. <insert id="addFollowUpRecords">
  307. insert into kuaishou_promoter_follow_up_record
  308. (promoter_id,
  309. user_id,
  310. txt)
  311. values (#{result.promoterId},
  312. #{result.userId},
  313. #{result.txt})
  314. </insert>
  315. <update id="updateFollowUpRecords">
  316. update kuaishou_promoter_follow_up_record
  317. Set txt =#{result.txt}
  318. where id = #{result.id}
  319. </update>
  320. <update id="updateKuaishouPromoter" parameterType="com.ruixuan.isc.entity.KuaishouPromoter">
  321. update kuaishou_promoter
  322. <trim prefix="SET" suffixOverrides=",">
  323. <if test="userId != null">user_id = #{userId},</if>
  324. <if test="mediaId != null">media_id = #{mediaId},</if>
  325. <if test="userName != null">user_name = #{userName},</if>
  326. <if test="promoterId != null">promoter_id = #{promoterId},</if>
  327. <if test="promoterNickName != null">promoter_nick_name = #{promoterNickName},</if>
  328. <if test="totalSale != null">total_sale = #{totalSale},</if>
  329. <if test="fansNumber != null">fans_number = #{fansNumber},</if>
  330. <if test="promoterUrl != null">promoter_url = #{promoterUrl},</if>
  331. <if test="phone != null">phone = #{phone},</if>
  332. <if test="consignee != null">consignee = #{consignee},</if>
  333. <if test="promoterAddress != null">promoter_address = #{promoterAddress},</if>
  334. <if test="state != null">state = #{state},</if>
  335. <if test="province != null">province = #{province},</if>
  336. <if test="commissionRequirement != null">commission_requirement = #{commissionRequirement},</if>
  337. <if test="categoryRequirement != null">category_requirement = #{categoryRequirement},</if>
  338. <if test="avgVideoSales != null">avg_video_sales = #{avgVideoSales},</if>
  339. <if test="videoSales != null">video_sales = #{videoSales},</if>
  340. <if test="createTime != null">create_time = #{createTime},</if>
  341. <if test="updateTime != null">update_time = #{updateTime},</if>
  342. </trim>
  343. where id = #{id}
  344. </update>
  345. <update id="updateKuaishouPromoterByPromoterId" parameterType="com.ruixuan.isc.entity.KuaishouPromoter">
  346. update kuaishou_promoter
  347. <trim prefix="SET" suffixOverrides=",">
  348. <if test="userId != null">user_id = #{userId},</if>
  349. <if test="mediaId != null">media_id = #{mediaId},</if>
  350. <if test="userName != null">user_name = #{userName},</if>
  351. <if test="promoterId != null">promoter_id = #{promoterId},</if>
  352. <if test="promoterNickName != null">promoter_nick_name = #{promoterNickName},</if>
  353. <if test="totalSale != null">total_sale = #{totalSale},</if>
  354. <if test="fansNumber != null">fans_number = #{fansNumber},</if>
  355. <if test="promoterUrl != null">promoter_url = #{promoterUrl},</if>
  356. <if test="phone != null">phone = #{phone},</if>
  357. <if test="consignee != null">consignee = #{consignee},</if>
  358. <if test="promoterAddress != null">promoter_address = #{promoterAddress},</if>
  359. <if test="state != null">state = #{state},</if>
  360. <if test="province != null">province = #{province},</if>
  361. <if test="commissionRequirement != null">commission_requirement = #{commissionRequirement},</if>
  362. <if test="categoryRequirement != null">category_requirement = #{categoryRequirement},</if>
  363. <if test="avgVideoSales != null">avg_video_sales = #{avgVideoSales},</if>
  364. <if test="videoSales != null">video_sales = #{videoSales},</if>
  365. <if test="createTime != null">create_time = #{createTime},</if>
  366. <if test="updateTime != null">update_time = #{updateTime},</if>
  367. <if test="followerIncr != null">follower_incr = #{followerIncr},</if>
  368. <if test="liveCount30 != null">live_count_30 = #{liveCount30},</if>
  369. <if test="awemeAvgDiggCount30 != null">aweme_avg_digg_count_30 = #{awemeAvgDiggCount30},</if>
  370. <if test="awemeDiggFollowerRation != null">aweme_digg_follower_ration = #{awemeDiggFollowerRation},</if>
  371. <if test="liveAverageUser30 != null">live_average_user_30 = #{liveAverageUser30},</if>
  372. </trim>
  373. where promoter_id = #{promoterId}
  374. </update>
  375. <delete id="deleteKuaishouPromoterById" parameterType="Long">
  376. delete
  377. from kuaishou_promoter
  378. where id = #{id}
  379. </delete>
  380. <delete id="deleteKuaishouPromoterByIds" parameterType="String">
  381. delete from kuaishou_promoter where id in
  382. <foreach item="id" collection="array" open="(" separator="," close=")">
  383. #{id}
  384. </foreach>
  385. </delete>
  386. <delete id="deletePromoterLabel" parameterType="String">
  387. delete
  388. from kuaishou_promoter_label_rel
  389. where promoter_id = #{promoterId}
  390. AND user_id = #{userId}
  391. </delete>
  392. <insert id="insertPromoterLabels">
  393. insert into kuaishou_promoter_label_rel
  394. (promoter_id,user_id, label_id)
  395. values
  396. <foreach collection="list" item="ent" separator=",">
  397. (#{ent.promoterId},#{ent.userId}, #{ent.labelId})
  398. </foreach>
  399. </insert>
  400. <select id="getNearlyMonthGmv" resultType="com.alibaba.fastjson.JSONObject">
  401. SELECT SUM(order_amount) as 'orderAmount', CONCAT(IFNULL(ROUND((SELECT COUNT(1)
  402. FROM kuaishou_item_collect_samples
  403. WHERE collect_sample_status = 7
  404. AND promoter_id = #{promoterId})
  405. / (SELECT COUNT(1)
  406. FROM kuaishou_item_collect_samples
  407. WHERE collect_sample_status!=1 AND collect_sample_status!=2 AND promoter_id = #{promoterId})*100,2), 0),
  408. '%') as 'operationCompletionRate'
  409. FROM kuaishou_supply_chain
  410. WHERE promoter_id = #{promoterId}
  411. AND FROM_UNIXTIME(order_create_time / 1000, '%Y-%m-%d') >= #{start}
  412. AND FROM_UNIXTIME(order_create_time / 1000, '%Y-%m-%d') &lt;= #{end}
  413. </select>
  414. <insert id="insertKuaishouPromoterRecord" parameterType="com.alibaba.fastjson.JSONObject" useGeneratedKeys="true"
  415. keyProperty="id">
  416. insert into kuaishou_promoter_record
  417. <trim prefix="(" suffix=")" suffixOverrides=",">
  418. <if test="promoterId != null">promoter_id,</if>
  419. <if test="userId != null">user_id,</if>
  420. <if test="operatorId != null">operator_id,</if>
  421. <if test="roleName != null">role_name,</if>
  422. <if test="roleKey != null">role_key,</if>
  423. </trim>
  424. <trim prefix="values (" suffix=")" suffixOverrides=",">
  425. <if test="promoterId != null">#{promoterId},</if>
  426. <if test="userId != null">#{userId},</if>
  427. <if test="operatorId != null">#{operatorId},</if>
  428. <if test="roleName != null">#{roleName},</if>
  429. <if test="roleKey != null">#{roleKey},</if>
  430. </trim>
  431. </insert>
  432. <select id="getFollowUpRecordsByUserId" resultType="com.alibaba.fastjson.JSONObject">
  433. SELECT id,
  434. txt
  435. FROM kuaishou_promoter_follow_up_record
  436. Where promoter_id = #{promoterId}
  437. AND user_id = #{userId}
  438. ORDER BY update_time DESC LIMIT 1
  439. </select>
  440. <select id="getFollowUpRecordListByPromoterId" resultType="com.alibaba.fastjson.JSONObject">
  441. SELECT t1.id,
  442. txt,
  443. t2.nick_name as 'userName',
  444. t1.update_time as 'updateTime'
  445. FROM kuaishou_promoter_follow_up_record t1
  446. LEFT JOIN sys_user t2 ON t1.user_id = t2.user_id
  447. Where t1.promoter_id = #{promoterId}
  448. <if test="id != null">
  449. AND t1.id != #{id}
  450. </if>
  451. ORDER BY t1.update_time DESC
  452. </select>
  453. <select id="getPromoterLabel" resultType="com.alibaba.fastjson.JSONObject">
  454. SELECT t2.id as 'labelId', t2.label_colour as 'labelColour', t2.label_name as 'labelName'
  455. FROM kuaishou_promoter_label_rel t1
  456. LEFT JOIN kuaishou_label t2 ON t1.label_id = t2.id
  457. WHERE t1.promoter_id = #{promoterId}
  458. AND user_id = #{userId}
  459. order by t2.id
  460. </select>
  461. <select id="getOnlyPromoterInfoByUserId" resultType="com.ruixuan.isc.entity.KuaishouPromoter">
  462. <include refid="selectKuaishouPromoterVo"/>
  463. where promoter_id = #{promoterId}
  464. <if test="userId != null ">
  465. AND user_id = #{userId}
  466. </if>
  467. limit 1
  468. </select>
  469. <select id="getUserPromotersCount" resultType="java.lang.Integer">
  470. select promoters_count
  471. from user_promoters_count
  472. where user_id = #{userId}
  473. </select>
  474. <select id="getBoundCount" resultType="java.lang.Integer">
  475. SELECT COUNT(1)
  476. FROM `kuaishou_promoter`
  477. WHERE user_id = #{userId}
  478. </select>
  479. <insert id="addPromotersCount">
  480. replace
  481. into user_promoters_count
  482. (user_id, promoters_count,media_id)
  483. values
  484. (
  485. #{userId},
  486. #{promotersCount},
  487. #{mediaId},
  488. )
  489. </insert>
  490. </mapper>