KuaishouPromoterMapper.xml 47 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081
  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. <result property="imageUrl" column="image_url"/>
  37. </resultMap>
  38. <sql id="selectKuaishouPromoterVo">
  39. select id,
  40. media_id,
  41. user_id,
  42. user_name,
  43. promoter_id,
  44. promoter_nick_name,
  45. `state`,
  46. province,
  47. commission_requirement,
  48. category_requirement,
  49. promoter_url,
  50. phone,
  51. consignee,
  52. promoter_address,
  53. total_sale,
  54. fans_number,
  55. avg_video_sales,
  56. video_sales,
  57. image_url,
  58. create_time,
  59. update_time
  60. from kuaishou_promoter
  61. </sql>
  62. <select id="selectKuaishouPromoterList" resultMap="KuaishouPromoterResult">
  63. SELECT
  64. t1.id,
  65. t1.user_id,
  66. t1.media_id,
  67. t1.user_name,
  68. t1.promoter_id,
  69. t1.promoter_nick_name,
  70. t1.`state`,
  71. t1.province,
  72. t1.commission_requirement,
  73. t1.category_requirement,
  74. t1.promoter_url,
  75. t1.phone,
  76. t1.consignee,
  77. t1.promoter_address,
  78. t1.image_url,
  79. if(t1.media_id = 1, t1.total_sale,t3.total_sale ) as 'total_sale',
  80. if(t1.media_id = 1, t1.fans_number,t3.fans_number ) as 'fans_number',
  81. if(t1.media_id = 1, t1.avg_video_sales,t3.avg_video_sales ) as 'avg_video_sales',
  82. if(t1.media_id = 1,t1.video_sales ,t3.video_sales ) as 'video_sales',
  83. t1.create_time,
  84. t2.30day_gmv,
  85. t2.30day_order_num,
  86. t1.follower_incr,
  87. t1.live_count_30,
  88. t1.aweme_avg_digg_count_30,
  89. t1.aweme_digg_follower_ration,
  90. t1.live_average_user_30,
  91. case
  92. WHEN t3.total_sale like '%万%'
  93. then SUBSTRING_INDEX(t3.total_sale,'-',-1)+0
  94. else SUBSTRING_INDEX(t3.total_sale,'-',-1)/10000 end as 'totalSaleOrder',
  95. case
  96. WHEN t3.video_sales like '%万%'
  97. then SUBSTRING_INDEX(t3.video_sales,'-',-1)+0
  98. else SUBSTRING_INDEX(t3.video_sales,'-',-1)/10000 end as 'videoSalesOrder',
  99. case
  100. WHEN t3.avg_video_sales like '%万%'
  101. then SUBSTRING_INDEX(t3.avg_video_sales,'-',-1)+0
  102. else SUBSTRING_INDEX(t3.avg_video_sales,'-',-1)/10000 end as 'avgVideoSalesOrder',
  103. t4.rule_id,
  104. t4.rule_name
  105. FROM
  106. kuaishou_promoter t1
  107. LEFT JOIN promoter_oerder_amount t2 on t1.promoter_id = t2.promoter_id
  108. LEFT JOIN promoter_sales_info t3 ON t1.promoter_id = t3.promoter_id
  109. left join promoter_bind_rule t4 on t1.promoter_id = t4.promoter_id
  110. <where>
  111. <if test="userList != null and userList.size() > 0 ">
  112. and t1.user_id in
  113. <foreach collection="userList" item="userId" open="(" separator="," close=")">
  114. #{userId}
  115. </foreach>
  116. </if>
  117. <if test="promoterId != null ">
  118. and t1.promoter_id = #{promoterId}
  119. </if>
  120. <if test="promoterNickName != null and promoterNickName != ''">
  121. and t1.promoter_nick_name like concat('%', #{promoterNickName}, '%')
  122. </if>
  123. <if test="mediaId != null and mediaId != ''">
  124. and t1.media_id = #{mediaId}
  125. </if>
  126. <if test="searchPhone != null and searchPhone == 1">
  127. and t1.phone != ''
  128. </if>
  129. <if test="searchPhone != null and searchPhone == 2">
  130. and t1.phone = ''
  131. </if>
  132. </where>
  133. order by ${parameter} ${orderBy}
  134. </select>
  135. <select id="selectKuaishouPromoterList3" resultType="com.ruixuan.isc.entity.JYKuaishouPromoter">
  136. SELECT
  137. t1.id,
  138. t1.user_id,
  139. t1.type,
  140. t1.media_id,
  141. t1.user_name,
  142. t1.promoter_id,
  143. t1.promoter_nick_name,
  144. t1.`state`,
  145. t1.province,
  146. t1.commission_requirement,
  147. t1.category_requirement,
  148. t1.promoter_url,
  149. t1.phone,
  150. t1.consignee,
  151. t1.promoter_address,
  152. t1.expert_mentor_id,
  153. t1.expert_mentor_name,
  154. t1.expert_business_id,
  155. t1.expert_business_name,
  156. if(t1.media_id = 1, t1.total_sale,t3.total_sale ) as 'total_sale',
  157. if(t1.media_id = 1, t1.fans_number,t3.fans_number ) as 'fans_number',
  158. if(t1.media_id = 1, t1.avg_video_sales,t3.avg_video_sales ) as 'avg_video_sales',
  159. if(t1.media_id = 1,t1.video_sales ,t3.video_sales ) as 'video_sales',
  160. t1.create_time,
  161. t2.30day_gmv,
  162. t2.30day_order_num,
  163. t1.follower_incr,
  164. t1.live_count_30,
  165. t1.aweme_avg_digg_count_30,
  166. t1.aweme_digg_follower_ration,
  167. t1.live_average_user_30,
  168. case
  169. WHEN t3.total_sale like '%万%'
  170. then SUBSTRING_INDEX(t3.total_sale,'-',-1)+0
  171. else SUBSTRING_INDEX(t3.total_sale,'-',-1)/10000 end as 'totalSaleOrder',
  172. case
  173. WHEN t3.video_sales like '%万%'
  174. then SUBSTRING_INDEX(t3.video_sales,'-',-1)+0
  175. else SUBSTRING_INDEX(t3.video_sales,'-',-1)/10000 end as 'videoSalesOrder',
  176. case
  177. WHEN t3.avg_video_sales like '%万%'
  178. then SUBSTRING_INDEX(t3.avg_video_sales,'-',-1)+0
  179. else SUBSTRING_INDEX(t3.avg_video_sales,'-',-1)/10000 end as 'avgVideoSalesOrder',
  180. t4.rule_id,
  181. t4.rule_name
  182. FROM
  183. jy_kuaishou_promoter t1
  184. LEFT JOIN promoter_oerder_amount t2 on t1.promoter_id = t2.promoter_id
  185. LEFT JOIN promoter_sales_info t3 ON t1.promoter_id = t3.promoter_id
  186. left join promoter_bind_rule t4 on t1.promoter_id = t4.promoter_id
  187. <where>
  188. <if test="userList != null and userList.size() > 0 ">
  189. and t1.user_id in
  190. <foreach collection="userList" item="userId" open="(" separator="," close=")">
  191. #{userId}
  192. </foreach>
  193. </if>
  194. <if test="promoterId != null ">
  195. and t1.promoter_id = #{promoterId}
  196. </if>
  197. <if test="promoterNickName != null and promoterNickName != ''">
  198. and t1.promoter_nick_name like concat('%', #{promoterNickName}, '%')
  199. </if>
  200. <if test="mediaId != null and mediaId != ''">
  201. and t1.media_id = #{mediaId}
  202. </if>
  203. <if test="type != null and type != ''">
  204. and t1.type = #{type}
  205. </if>
  206. <if test="expertMentorId != null and expertMentorId != ''">
  207. and t1.expert_mentor_id = #{expertMentorId}
  208. </if>
  209. <if test="expertBusinessId != null and expertBusinessId != ''">
  210. and t1.expert_business_id = #{expertBusinessId}
  211. </if>
  212. </where>
  213. order by ${parameter} ${orderBy}
  214. </select>
  215. <select id="selectAllPromoterList" resultType="com.alibaba.fastjson.JSONObject">
  216. SELECT *
  217. FROM (
  218. SELECT
  219. t1.promoter_id AS 'promoterId',
  220. (CASE WHEN t2.promoter_id IS NULL THEN 2 ELSE 1 END) AS 'status',
  221. IF(t0.promoter_name is null,t2.promoter_nick_name,t0.promoter_name) AS 'promoterNickName',
  222. IFNULL(t2.userName,'') AS 'userName',
  223. IFNULL(t2.commission_requirement,'') AS 'commissionRequirement',
  224. IF(t0.handurl is null,t2.promoter_url,t0.handurl) AS 'promoterUrl',
  225. t1.30day_gmv AS 'monthDayGmv',
  226. t1.30day_order_num AS 'monthDayOrderNum',+
  227. t1.valid_amount AS 'validAmount',
  228. t3.fans_number AS 'fansNumber',
  229. t3.video_sales AS 'videoSales',
  230. t3.avg_video_sales AS 'avgVideoSales',
  231. t3.total_sale AS 'totalSale',
  232. case
  233. WHEN t3.video_sales like '%万%'
  234. then SUBSTRING_INDEX(t3.video_sales,'-',-1)+0
  235. else SUBSTRING_INDEX(t3.video_sales,'-',-1)/10000 end as 'videoSalesOrder',
  236. case
  237. WHEN t3.avg_video_sales like '%万%'
  238. then SUBSTRING_INDEX(t3.avg_video_sales,'-',-1)+0
  239. else SUBSTRING_INDEX(t3.avg_video_sales,'-',-1)/10000 end as 'avgVideoSalesOrder'
  240. FROM
  241. promoter_oerder_amount t1
  242. LEFT JOIN promoter_info t0 ON t1.promoter_id = t0.promoter_id
  243. LEFT JOIN promoter_sales_info t3 ON t1.promoter_id = t3.promoter_id
  244. <choose>
  245. <when test="userId !=null and userId !='' ">
  246. RIGHT
  247. </when>
  248. <otherwise>
  249. LEFT
  250. </otherwise>
  251. </choose>
  252. JOIN (
  253. SELECT
  254. promoter_id,
  255. group_concat( user_name ) AS 'userName',
  256. fans_number, promoter_url,
  257. commission_requirement,
  258. promoter_nick_name,
  259. avg_video_sales,
  260. video_sales
  261. FROM kuaishou_promoter
  262. <where>
  263. <if test="userId != null ">
  264. and user_id = #{userId}
  265. </if>
  266. </where>
  267. GROUP BY promoter_id
  268. ) t2 ON t1.promoter_id = t2.promoter_id
  269. <where>
  270. <if test="promoterId != null ">
  271. and t1.promoter_id = #{promoterId}
  272. </if>
  273. <if test="promoterNickName != null and promoterNickName != ''">
  274. and t0.promoter_name like concat('%', #{promoterNickName}, '%')
  275. </if>
  276. </where>
  277. ) t
  278. <where>
  279. <if test="status != null ">
  280. and `status` = #{status}
  281. </if>
  282. </where>
  283. order by ${parameter} ${orderBy}
  284. </select>
  285. <select id="selectKuaishouPromoterById" parameterType="Long" resultMap="KuaishouPromoterResult">
  286. <include refid="selectKuaishouPromoterVo"/>
  287. where id = #{id}
  288. </select>
  289. <select id="selectKuaishouPromoterById3" parameterType="Long"
  290. resultType="com.ruixuan.isc.entity.JYKuaishouPromoter">
  291. select id,
  292. media_id,
  293. user_id,
  294. user_name,
  295. promoter_id,
  296. promoter_nick_name,
  297. `state`,
  298. province,
  299. commission_requirement,
  300. category_requirement,
  301. promoter_url,
  302. phone,
  303. consignee,
  304. promoter_address,
  305. total_sale,
  306. fans_number,
  307. avg_video_sales,
  308. video_sales,
  309. create_time,
  310. update_time
  311. from jy_kuaishou_promoter
  312. where id = #{id}
  313. </select>
  314. <select id="getFailInfo" resultMap="KuaishouPromoterResult">
  315. <include refid="selectKuaishouPromoterVo"/>
  316. where (promoter_nick_name = '' or promoter_nick_name is null)
  317. AND state =1
  318. AND media_id = 2
  319. </select>
  320. <select id="getFailInfo3" resultType="com.ruixuan.isc.entity.JYKuaishouPromoter">
  321. select id,
  322. media_id,
  323. user_id,
  324. user_name,
  325. promoter_id,
  326. promoter_nick_name,
  327. `state`,
  328. province,
  329. commission_requirement,
  330. category_requirement,
  331. promoter_url,
  332. phone,
  333. consignee,
  334. promoter_address,
  335. total_sale,
  336. fans_number,
  337. avg_video_sales,
  338. video_sales,
  339. create_time,
  340. update_time
  341. from jy_kuaishou_promoter
  342. where (promoter_nick_name = '' or promoter_nick_name is null)
  343. AND state = 1
  344. AND media_id = 2
  345. </select>
  346. <select id="getBoundPromoterRoleKey" resultType="com.alibaba.fastjson.JSONObject">
  347. SELECT t1.user_id,
  348. t3.role_key,
  349. t1.user_name
  350. FROM kuaishou_promoter t1
  351. LEFT JOIN sys_user_role t2 ON t1.user_id = t2.user_id
  352. LEFT JOIN sys_role t3 ON t2.role_id = t3.role_id
  353. Where t1.promoter_id = #{promoterId}
  354. </select>
  355. <select id="selectPromoterIdList" resultType="String">
  356. select promoter_id
  357. from kuaishou_promoter
  358. <where>
  359. <if test="userList != null ">
  360. AND user_id in
  361. <foreach collection="userList" item="item" separator=","
  362. open="(" close=")">
  363. #{item}
  364. </foreach>
  365. </if>
  366. <if test="mediaId != null ">
  367. AND media_id =#{mediaId}
  368. </if>
  369. </where>
  370. </select>
  371. <select id="selectPromoterIdListByTime" resultType="String">
  372. select promoter_id
  373. from promoter_bind_channel_date
  374. WHERE stat_date >= #{startDate}
  375. AND stat_date &lt;= #{endDate}
  376. <if test="userList != null ">
  377. AND user_id in
  378. <foreach collection="userList" item="item" separator=","
  379. open="(" close=")">
  380. #{item}
  381. </foreach>
  382. </if>
  383. </select>
  384. <select id="getOneByIdAndPromoterId" resultMap="KuaishouPromoterResult">
  385. <include refid="selectKuaishouPromoterVo"/>
  386. where promoter_id = #{promoterId}
  387. <if test="userId != null ">
  388. AND user_id = #{userId}
  389. </if>
  390. limit 1
  391. </select>
  392. <select id="getOneByIdAndPromoterId3" resultType="com.ruixuan.isc.entity.JYKuaishouPromoter">
  393. select
  394. id,
  395. media_id,
  396. `type`,
  397. user_id,
  398. user_name,
  399. promoter_id,
  400. promoter_nick_name,
  401. `state`,
  402. province,
  403. commission_requirement,
  404. category_requirement,
  405. promoter_url,
  406. phone,
  407. consignee,
  408. promoter_address,
  409. total_sale,
  410. fans_number,
  411. avg_video_sales,
  412. video_sales,
  413. create_time,
  414. update_time
  415. from jy_kuaishou_promoter
  416. where promoter_id = #{promoterId}
  417. <if test="userId != null ">
  418. AND user_id = #{userId}
  419. </if>
  420. limit 1
  421. </select>
  422. <select id="getgetMonthPromoterTotal" resultType="com.alibaba.fastjson.JSONObject">
  423. SELECT t1.count,
  424. CONCAT(ROUND(t2.count / t1.count * 100, 2), '%') as 'rate'
  425. FROM
  426. (
  427. SELECT count(promoter_id) as 'count'
  428. FROM kuaishou_promoter
  429. WHERE DATE_FORMAT(create_time, '%Y-%m-%d') >= #{start}
  430. AND DATE_FORMAT(create_time, '%Y-%m-%d') &lt;= #{end}
  431. AND media_id = #{mediaId}
  432. <if test="userList != null and userList.size() > 0 ">
  433. AND user_id in
  434. <foreach collection="userList" item="item" separator=","
  435. open="(" close=")">
  436. #{item}
  437. </foreach>
  438. </if>
  439. ) t1
  440. LEFT JOIN
  441. (SELECT count(promoter_id) as 'count'
  442. FROM kuaishou_promoter
  443. WHERE DATE_FORMAT(create_time, '%Y-%m-%d') = #{end}
  444. AND media_id = #{mediaId}
  445. <if test="userList != null and userList.size() > 0 ">
  446. AND user_id in
  447. <foreach collection="userList" item="item" separator=","
  448. open="(" close=")">
  449. #{item}
  450. </foreach>
  451. </if>
  452. ) t2 ON 1 = 1
  453. </select>
  454. <insert id="insertKuaishouPromoter" parameterType="com.ruixuan.isc.entity.KuaishouPromoter" useGeneratedKeys="true"
  455. keyProperty="id">
  456. insert into kuaishou_promoter
  457. <trim prefix="(" suffix=")" suffixOverrides=",">
  458. <if test="userId != null">user_id,</if>
  459. <if test="mediaId != null">media_id,</if>
  460. <if test="userName != null">user_name,</if>
  461. <if test="promoterId != null">promoter_id,</if>
  462. <if test="promoterNickName != null">promoter_nick_name,</if>
  463. <if test="state != null">state,</if>
  464. <if test="province != null">province,</if>
  465. <if test="commissionRequirement != null">commission_requirement,</if>
  466. <if test="categoryRequirement != null">category_requirement,</if>
  467. <if test="createTime != null">create_time,</if>
  468. <if test="updateTime != null">update_time,</if>
  469. <if test="totalSale != null">total_sale,</if>
  470. <if test="fansNumber != null">fans_number,</if>
  471. <if test="promoterUrl != null">promoter_url,</if>
  472. <if test="phone != null">phone,</if>
  473. <if test="consignee != null">consignee,</if>
  474. <if test="promoterAddress != null">promoter_address,</if>
  475. <if test="imageUrl != null">image_url,</if>
  476. </trim>
  477. <trim prefix="values (" suffix=")" suffixOverrides=",">
  478. <if test="userId != null">#{userId},</if>
  479. <if test="mediaId != null">#{mediaId},</if>
  480. <if test="userName != null">#{userName},</if>
  481. <if test="promoterId != null">#{promoterId},</if>
  482. <if test="promoterNickName != null">#{promoterNickName},</if>
  483. <if test="state != null">#{state},</if>
  484. <if test="province != null">#{province},</if>
  485. <if test="commissionRequirement != null">#{commissionRequirement},</if>
  486. <if test="categoryRequirement != null">#{categoryRequirement},</if>
  487. <if test="createTime != null">#{createTime},</if>
  488. <if test="updateTime != null">#{updateTime},</if>
  489. <if test="totalSale != null">#{totalSale},</if>
  490. <if test="fansNumber != null">#{fansNumber},</if>
  491. <if test="promoterUrl != null">#{promoterUrl},</if>
  492. <if test="phone != null">#{phone},</if>
  493. <if test="consignee != null">#{consignee},</if>
  494. <if test="promoterAddress != null">#{promoterAddress},</if>
  495. <if test="imageUrl != null">#{imageUrl},</if>
  496. </trim>
  497. </insert>
  498. <insert id="insertKuaishouPromoter3" parameterType="com.ruixuan.isc.entity.JYKuaishouPromoter"
  499. useGeneratedKeys="true"
  500. keyProperty="id">
  501. insert into jy_kuaishou_promoter
  502. <trim prefix="(" suffix=")" suffixOverrides=",">
  503. <if test="userId != null">user_id,</if>
  504. <if test="mediaId != null">media_id,</if>
  505. <if test="type != null">type,</if>
  506. <if test="userName != null">user_name,</if>
  507. <if test="promoterId != null">promoter_id,</if>
  508. <if test="promoterNickName != null">promoter_nick_name,</if>
  509. <if test="state != null">state,</if>
  510. <if test="province != null">province,</if>
  511. <if test="commissionRequirement != null">commission_requirement,</if>
  512. <if test="categoryRequirement != null">category_requirement,</if>
  513. <if test="createTime != null">create_time,</if>
  514. <if test="updateTime != null">update_time,</if>
  515. <if test="totalSale != null">total_sale,</if>
  516. <if test="fansNumber != null">fans_number,</if>
  517. <if test="promoterUrl != null">promoter_url,</if>
  518. <if test="phone != null">phone,</if>
  519. <if test="consignee != null">consignee,</if>
  520. <if test="promoterAddress != null">promoter_address,</if>
  521. <if test="expertMentorId != null">expert_mentor_id,</if>
  522. <if test="expertMentorName != null">expert_mentor_name,</if>
  523. <if test="expertBusinessId != null">expert_business_id,</if>
  524. <if test="expertBusinessName != null">expert_business_name,</if>
  525. </trim>
  526. <trim prefix="values (" suffix=")" suffixOverrides=",">
  527. <if test="userId != null">#{userId},</if>
  528. <if test="mediaId != null">#{mediaId},</if>
  529. <if test="type != null">#{type},</if>
  530. <if test="userName != null">#{userName},</if>
  531. <if test="promoterId != null">#{promoterId},</if>
  532. <if test="promoterNickName != null">#{promoterNickName},</if>
  533. <if test="state != null">#{state},</if>
  534. <if test="province != null">#{province},</if>
  535. <if test="commissionRequirement != null">#{commissionRequirement},</if>
  536. <if test="categoryRequirement != null">#{categoryRequirement},</if>
  537. <if test="createTime != null">#{createTime},</if>
  538. <if test="updateTime != null">#{updateTime},</if>
  539. <if test="totalSale != null">#{totalSale},</if>
  540. <if test="fansNumber != null">#{fansNumber},</if>
  541. <if test="promoterUrl != null">#{promoterUrl},</if>
  542. <if test="phone != null">#{phone},</if>
  543. <if test="consignee != null">#{consignee},</if>
  544. <if test="promoterAddress != null">#{promoterAddress},</if>
  545. <if test="expertMentorId != null">#{expertMentorId},</if>
  546. <if test="expertMentorName != null">#{expertMentorName},</if>
  547. <if test="expertBusinessId != null">#{expertBusinessId},</if>
  548. <if test="expertBusinessName != null">#{expertBusinessName},</if>
  549. </trim>
  550. </insert>
  551. <insert id="addFollowUpRecords">
  552. insert into kuaishou_promoter_follow_up_record
  553. (promoter_id,
  554. user_id,
  555. txt)
  556. values (#{result.promoterId},
  557. #{result.userId},
  558. #{result.txt})
  559. </insert>
  560. <update id="updateFollowUpRecords">
  561. update kuaishou_promoter_follow_up_record
  562. Set txt =#{result.txt}
  563. where id = #{result.id}
  564. </update>
  565. <update id="updateKuaishouPromoter" parameterType="com.ruixuan.isc.entity.KuaishouPromoter">
  566. update kuaishou_promoter
  567. <trim prefix="SET" suffixOverrides=",">
  568. <if test="userId != null">user_id = #{userId},</if>
  569. <if test="mediaId != null">media_id = #{mediaId},</if>
  570. <if test="userName != null">user_name = #{userName},</if>
  571. <if test="promoterId != null">promoter_id = #{promoterId},</if>
  572. <if test="promoterNickName != null">promoter_nick_name = #{promoterNickName},</if>
  573. <if test="totalSale != null">total_sale = #{totalSale},</if>
  574. <if test="fansNumber != null">fans_number = #{fansNumber},</if>
  575. <if test="promoterUrl != null">promoter_url = #{promoterUrl},</if>
  576. <if test="phone != null">phone = #{phone},</if>
  577. <if test="consignee != null">consignee = #{consignee},</if>
  578. <if test="promoterAddress != null">promoter_address = #{promoterAddress},</if>
  579. <if test="state != null">state = #{state},</if>
  580. <if test="province != null">province = #{province},</if>
  581. <if test="commissionRequirement != null">commission_requirement = #{commissionRequirement},</if>
  582. <if test="categoryRequirement != null">category_requirement = #{categoryRequirement},</if>
  583. <if test="avgVideoSales != null">avg_video_sales = #{avgVideoSales},</if>
  584. <if test="videoSales != null">video_sales = #{videoSales},</if>
  585. <if test="imageUrl != null">image_url = #{imageUrl},</if>
  586. <if test="createTime != null">create_time = #{createTime},</if>
  587. <if test="updateTime != null">update_time = #{updateTime},</if>
  588. </trim>
  589. where id = #{id}
  590. </update>
  591. <update id="updateKuaishouPromoter3" parameterType="com.ruixuan.isc.entity.JYKuaishouPromoter">
  592. update jy_kuaishou_promoter
  593. <trim prefix="SET" suffixOverrides=",">
  594. <if test="userId != null">user_id = #{userId},</if>
  595. <if test="mediaId != null">media_id = #{mediaId},</if>
  596. <if test="type != null">type = #{type},</if>
  597. <if test="userName != null">user_name = #{userName},</if>
  598. <if test="promoterId != null">promoter_id = #{promoterId},</if>
  599. <if test="promoterNickName != null">promoter_nick_name = #{promoterNickName},</if>
  600. <if test="totalSale != null">total_sale = #{totalSale},</if>
  601. <if test="fansNumber != null">fans_number = #{fansNumber},</if>
  602. <if test="promoterUrl != null">promoter_url = #{promoterUrl},</if>
  603. <if test="phone != null">phone = #{phone},</if>
  604. <if test="consignee != null">consignee = #{consignee},</if>
  605. <if test="promoterAddress != null">promoter_address = #{promoterAddress},</if>
  606. <if test="state != null">state = #{state},</if>
  607. <if test="province != null">province = #{province},</if>
  608. <if test="commissionRequirement != null">commission_requirement = #{commissionRequirement},</if>
  609. <if test="categoryRequirement != null">category_requirement = #{categoryRequirement},</if>
  610. <if test="avgVideoSales != null">avg_video_sales = #{avgVideoSales},</if>
  611. <if test="videoSales != null">video_sales = #{videoSales},</if>
  612. <if test="expertMentorId != null">expert_mentor_id = #{expertMentorId},</if>
  613. <if test="expertMentorName != null">expert_mentor_name = #{expertMentorName},</if>
  614. <if test="expertBusinessId != null">expert_business_id = #{expertBusinessId},</if>
  615. <if test="expertBusinessName != null">expert_business_name = #{expertBusinessName},</if>
  616. <if test="createTime != null">create_time = #{createTime},</if>
  617. <if test="updateTime != null">update_time = #{updateTime},</if>
  618. </trim>
  619. where id = #{id}
  620. </update>
  621. <update id="updateKuaishouPromoterByPromoterId" parameterType="com.ruixuan.isc.entity.KuaishouPromoter">
  622. update kuaishou_promoter
  623. <trim prefix="SET" suffixOverrides=",">
  624. <if test="userId != null">user_id = #{userId},</if>
  625. <if test="mediaId != null">media_id = #{mediaId},</if>
  626. <if test="userName != null">user_name = #{userName},</if>
  627. <if test="promoterId != null">promoter_id = #{promoterId},</if>
  628. <if test="promoterNickName != null">promoter_nick_name = #{promoterNickName},</if>
  629. <if test="totalSale != null">total_sale = #{totalSale},</if>
  630. <if test="fansNumber != null">fans_number = #{fansNumber},</if>
  631. <if test="promoterUrl != null">promoter_url = #{promoterUrl},</if>
  632. <if test="phone != null">phone = #{phone},</if>
  633. <if test="consignee != null">consignee = #{consignee},</if>
  634. <if test="promoterAddress != null">promoter_address = #{promoterAddress},</if>
  635. <if test="state != null">state = #{state},</if>
  636. <if test="province != null">province = #{province},</if>
  637. <if test="commissionRequirement != null">commission_requirement = #{commissionRequirement},</if>
  638. <if test="categoryRequirement != null">category_requirement = #{categoryRequirement},</if>
  639. <if test="avgVideoSales != null">avg_video_sales = #{avgVideoSales},</if>
  640. <if test="videoSales != null">video_sales = #{videoSales},</if>
  641. <if test="createTime != null">create_time = #{createTime},</if>
  642. <if test="updateTime != null">update_time = #{updateTime},</if>
  643. <if test="followerIncr != null">follower_incr = #{followerIncr},</if>
  644. <if test="liveCount30 != null">live_count_30 = #{liveCount30},</if>
  645. <if test="awemeAvgDiggCount30 != null">aweme_avg_digg_count_30 = #{awemeAvgDiggCount30},</if>
  646. <if test="awemeDiggFollowerRation != null">aweme_digg_follower_ration = #{awemeDiggFollowerRation},</if>
  647. <if test="liveAverageUser30 != null">live_average_user_30 = #{liveAverageUser30},</if>
  648. <if test="imageUrl != null">image_url = #{imageUrl},</if>
  649. </trim>
  650. where promoter_id = #{promoterId}
  651. </update>
  652. <update id="updateKuaishouPromoterByPromoterId3" parameterType="com.ruixuan.isc.entity.JYKuaishouPromoter">
  653. update jy_kuaishou_promoter
  654. <trim prefix="SET" suffixOverrides=",">
  655. <if test="userId != null">user_id = #{userId},</if>
  656. <if test="type != null">`type` = #{type},</if>
  657. <if test="mediaId != null">media_id = #{mediaId},</if>
  658. <if test="userName != null">user_name = #{userName},</if>
  659. <if test="promoterId != null">promoter_id = #{promoterId},</if>
  660. <if test="promoterNickName != null">promoter_nick_name = #{promoterNickName},</if>
  661. <if test="totalSale != null">total_sale = #{totalSale},</if>
  662. <if test="fansNumber != null">fans_number = #{fansNumber},</if>
  663. <if test="promoterUrl != null">promoter_url = #{promoterUrl},</if>
  664. <if test="phone != null">phone = #{phone},</if>
  665. <if test="consignee != null">consignee = #{consignee},</if>
  666. <if test="promoterAddress != null">promoter_address = #{promoterAddress},</if>
  667. <if test="state != null">`state` = #{state},</if>
  668. <if test="province != null">province = #{province},</if>
  669. <if test="commissionRequirement != null">commission_requirement = #{commissionRequirement},</if>
  670. <if test="categoryRequirement != null">category_requirement = #{categoryRequirement},</if>
  671. <if test="avgVideoSales != null">avg_video_sales = #{avgVideoSales},</if>
  672. <if test="videoSales != null">video_sales = #{videoSales},</if>
  673. <if test="createTime != null">create_time = #{createTime},</if>
  674. <if test="updateTime != null">update_time = #{updateTime},</if>
  675. <if test="followerIncr != null">follower_incr = #{followerIncr},</if>
  676. <if test="liveCount30 != null">live_count_30 = #{liveCount30},</if>
  677. <if test="awemeAvgDiggCount30 != null">aweme_avg_digg_count_30 = #{awemeAvgDiggCount30},</if>
  678. <if test="awemeDiggFollowerRation != null">aweme_digg_follower_ration = #{awemeDiggFollowerRation},</if>
  679. <if test="liveAverageUser30 != null">live_average_user_30 = #{liveAverageUser30},</if>
  680. </trim>
  681. where promoter_id = #{promoterId}
  682. </update>
  683. <delete id="deleteKuaishouPromoterById" parameterType="Long">
  684. delete
  685. from kuaishou_promoter
  686. where id = #{id}
  687. </delete>
  688. <delete id="deleteKuaishouPromoterById3" parameterType="Long">
  689. delete
  690. from jy_kuaishou_promoter
  691. where id = #{id}
  692. </delete>
  693. <select id="getMiaogousiInfoFailInfo" resultType="com.ruixuan.isc.entity.JYKuaishouPromoter">
  694. select id,
  695. media_id,
  696. user_id,
  697. user_name,
  698. promoter_id,
  699. promoter_nick_name,
  700. `state`,
  701. province,
  702. commission_requirement,
  703. category_requirement,
  704. promoter_url,
  705. phone,
  706. consignee,
  707. promoter_address,
  708. total_sale,
  709. fans_number,
  710. avg_video_sales,
  711. video_sales,
  712. create_time,
  713. update_time
  714. from miaogousi.kuaishou_promoter
  715. where (promoter_nick_name = '' or promoter_nick_name is null)
  716. AND state = 1
  717. AND media_id = 2
  718. </select>
  719. <update id="updateMiaogousiKuaishouPromoterByPromoterId" parameterType="com.ruixuan.isc.entity.KuaishouPromoter">
  720. update miaogousi.kuaishou_promoter
  721. <trim prefix="SET" suffixOverrides=",">
  722. <if test="userId != null">user_id = #{userId},</if>
  723. <if test="mediaId != null">media_id = #{mediaId},</if>
  724. <if test="userName != null">user_name = #{userName},</if>
  725. <if test="promoterId != null">promoter_id = #{promoterId},</if>
  726. <if test="promoterNickName != null">promoter_nick_name = #{promoterNickName},</if>
  727. <if test="totalSale != null">total_sale = #{totalSale},</if>
  728. <if test="fansNumber != null">fans_number = #{fansNumber},</if>
  729. <if test="promoterUrl != null">promoter_url = #{promoterUrl},</if>
  730. <if test="phone != null">phone = #{phone},</if>
  731. <if test="consignee != null">consignee = #{consignee},</if>
  732. <if test="promoterAddress != null">promoter_address = #{promoterAddress},</if>
  733. <if test="state != null">state = #{state},</if>
  734. <if test="province != null">province = #{province},</if>
  735. <if test="commissionRequirement != null">commission_requirement = #{commissionRequirement},</if>
  736. <if test="categoryRequirement != null">category_requirement = #{categoryRequirement},</if>
  737. <if test="avgVideoSales != null">avg_video_sales = #{avgVideoSales},</if>
  738. <if test="videoSales != null">video_sales = #{videoSales},</if>
  739. <if test="createTime != null">create_time = #{createTime},</if>
  740. <if test="updateTime != null">update_time = #{updateTime},</if>
  741. <if test="followerIncr != null">follower_incr = #{followerIncr},</if>
  742. <if test="liveCount30 != null">live_count_30 = #{liveCount30},</if>
  743. <if test="awemeAvgDiggCount30 != null">aweme_avg_digg_count_30 = #{awemeAvgDiggCount30},</if>
  744. <if test="awemeDiggFollowerRation != null">aweme_digg_follower_ration = #{awemeDiggFollowerRation},</if>
  745. <if test="liveAverageUser30 != null">live_average_user_30 = #{liveAverageUser30},</if>
  746. </trim>
  747. where promoter_id = #{promoterId}
  748. </update>
  749. <select id="getRocketFailInfo" resultType="com.ruixuan.isc.entity.JYKuaishouPromoter">
  750. select id,
  751. media_id,
  752. user_id,
  753. user_name,
  754. promoter_id,
  755. promoter_nick_name,
  756. `state`,
  757. province,
  758. commission_requirement,
  759. category_requirement,
  760. promoter_url,
  761. phone,
  762. consignee,
  763. promoter_address,
  764. total_sale,
  765. fans_number,
  766. avg_video_sales,
  767. video_sales,
  768. create_time,
  769. update_time
  770. from rocket.kuaishou_promoter
  771. where (promoter_nick_name = '' or promoter_nick_name is null)
  772. AND state = 1
  773. AND media_id = 2
  774. </select>
  775. <update id="updateRocketKuaishouPromoterByPromoterId" parameterType="com.ruixuan.isc.entity.KuaishouPromoter">
  776. update rocket.kuaishou_promoter
  777. <trim prefix="SET" suffixOverrides=",">
  778. <if test="userId != null">user_id = #{userId},</if>
  779. <if test="mediaId != null">media_id = #{mediaId},</if>
  780. <if test="userName != null">user_name = #{userName},</if>
  781. <if test="promoterId != null">promoter_id = #{promoterId},</if>
  782. <if test="promoterNickName != null">promoter_nick_name = #{promoterNickName},</if>
  783. <if test="totalSale != null">total_sale = #{totalSale},</if>
  784. <if test="fansNumber != null">fans_number = #{fansNumber},</if>
  785. <if test="promoterUrl != null">promoter_url = #{promoterUrl},</if>
  786. <if test="phone != null">phone = #{phone},</if>
  787. <if test="consignee != null">consignee = #{consignee},</if>
  788. <if test="promoterAddress != null">promoter_address = #{promoterAddress},</if>
  789. <if test="state != null">state = #{state},</if>
  790. <if test="province != null">province = #{province},</if>
  791. <if test="commissionRequirement != null">commission_requirement = #{commissionRequirement},</if>
  792. <if test="categoryRequirement != null">category_requirement = #{categoryRequirement},</if>
  793. <if test="avgVideoSales != null">avg_video_sales = #{avgVideoSales},</if>
  794. <if test="videoSales != null">video_sales = #{videoSales},</if>
  795. <if test="createTime != null">create_time = #{createTime},</if>
  796. <if test="updateTime != null">update_time = #{updateTime},</if>
  797. <if test="followerIncr != null">follower_incr = #{followerIncr},</if>
  798. <if test="liveCount30 != null">live_count_30 = #{liveCount30},</if>
  799. <if test="awemeAvgDiggCount30 != null">aweme_avg_digg_count_30 = #{awemeAvgDiggCount30},</if>
  800. <if test="awemeDiggFollowerRation != null">aweme_digg_follower_ration = #{awemeDiggFollowerRation},</if>
  801. <if test="liveAverageUser30 != null">live_average_user_30 = #{liveAverageUser30},</if>
  802. </trim>
  803. where promoter_id = #{promoterId}
  804. </update>
  805. <select id="getYufuFailInfo" resultType="com.ruixuan.isc.entity.JYKuaishouPromoter">
  806. select id,
  807. media_id,
  808. user_id,
  809. user_name,
  810. promoter_id,
  811. promoter_nick_name,
  812. `state`,
  813. province,
  814. commission_requirement,
  815. category_requirement,
  816. promoter_url,
  817. phone,
  818. consignee,
  819. promoter_address,
  820. total_sale,
  821. fans_number,
  822. avg_video_sales,
  823. video_sales,
  824. create_time,
  825. update_time
  826. from yufu.kuaishou_promoter
  827. where (promoter_nick_name = '' or promoter_nick_name is null)
  828. AND state = 1
  829. AND media_id = 2
  830. </select>
  831. <update id="updateYufuKuaishouPromoterByPromoterId" parameterType="com.ruixuan.isc.entity.KuaishouPromoter">
  832. update yufu.kuaishou_promoter
  833. <trim prefix="SET" suffixOverrides=",">
  834. <if test="userId != null">user_id = #{userId},</if>
  835. <if test="mediaId != null">media_id = #{mediaId},</if>
  836. <if test="userName != null">user_name = #{userName},</if>
  837. <if test="promoterId != null">promoter_id = #{promoterId},</if>
  838. <if test="promoterNickName != null">promoter_nick_name = #{promoterNickName},</if>
  839. <if test="totalSale != null">total_sale = #{totalSale},</if>
  840. <if test="fansNumber != null">fans_number = #{fansNumber},</if>
  841. <if test="promoterUrl != null">promoter_url = #{promoterUrl},</if>
  842. <if test="phone != null">phone = #{phone},</if>
  843. <if test="consignee != null">consignee = #{consignee},</if>
  844. <if test="promoterAddress != null">promoter_address = #{promoterAddress},</if>
  845. <if test="state != null">state = #{state},</if>
  846. <if test="province != null">province = #{province},</if>
  847. <if test="commissionRequirement != null">commission_requirement = #{commissionRequirement},</if>
  848. <if test="categoryRequirement != null">category_requirement = #{categoryRequirement},</if>
  849. <if test="avgVideoSales != null">avg_video_sales = #{avgVideoSales},</if>
  850. <if test="videoSales != null">video_sales = #{videoSales},</if>
  851. <if test="createTime != null">create_time = #{createTime},</if>
  852. <if test="updateTime != null">update_time = #{updateTime},</if>
  853. <if test="followerIncr != null">follower_incr = #{followerIncr},</if>
  854. <if test="liveCount30 != null">live_count_30 = #{liveCount30},</if>
  855. <if test="awemeAvgDiggCount30 != null">aweme_avg_digg_count_30 = #{awemeAvgDiggCount30},</if>
  856. <if test="awemeDiggFollowerRation != null">aweme_digg_follower_ration = #{awemeDiggFollowerRation},</if>
  857. <if test="liveAverageUser30 != null">live_average_user_30 = #{liveAverageUser30},</if>
  858. </trim>
  859. where promoter_id = #{promoterId}
  860. </update>
  861. <delete id="deleteKuaishouPromoterByIds" parameterType="String">
  862. delete from kuaishou_promoter where id in
  863. <foreach item="id" collection="array" open="(" separator="," close=")">
  864. #{id}
  865. </foreach>
  866. </delete>
  867. <delete id="deletePromoterLabel" parameterType="String">
  868. delete
  869. from kuaishou_promoter_label_rel
  870. where promoter_id = #{promoterId}
  871. AND user_id = #{userId}
  872. </delete>
  873. <insert id="insertPromoterLabels">
  874. insert into kuaishou_promoter_label_rel
  875. (promoter_id,user_id, label_id)
  876. values
  877. <foreach collection="list" item="ent" separator=",">
  878. (#{ent.promoterId},#{ent.userId}, #{ent.labelId})
  879. </foreach>
  880. </insert>
  881. <select id="getNearlyMonthGmv" resultType="com.alibaba.fastjson.JSONObject">
  882. SELECT SUM(order_amount) as 'orderAmount', CONCAT(IFNULL(ROUND((SELECT COUNT(1)
  883. FROM kuaishou_item_collect_samples
  884. WHERE collect_sample_status = 7
  885. AND promoter_id = #{promoterId})
  886. / (SELECT COUNT(1)
  887. FROM kuaishou_item_collect_samples
  888. WHERE collect_sample_status!=1 AND collect_sample_status!=2 AND promoter_id = #{promoterId})*100,2), 0),
  889. '%') as 'operationCompletionRate'
  890. FROM kuaishou_supply_chain
  891. WHERE promoter_id = #{promoterId}
  892. AND FROM_UNIXTIME(order_create_time / 1000, '%Y-%m-%d') >= #{start}
  893. AND FROM_UNIXTIME(order_create_time / 1000, '%Y-%m-%d') &lt;= #{end}
  894. </select>
  895. <insert id="insertKuaishouPromoterRecord" parameterType="com.alibaba.fastjson.JSONObject" useGeneratedKeys="true"
  896. keyProperty="id">
  897. insert into kuaishou_promoter_record
  898. <trim prefix="(" suffix=")" suffixOverrides=",">
  899. <if test="promoterId != null">promoter_id,</if>
  900. <if test="userId != null">user_id,</if>
  901. <if test="operatorId != null">operator_id,</if>
  902. <if test="roleName != null">role_name,</if>
  903. <if test="roleKey != null">role_key,</if>
  904. </trim>
  905. <trim prefix="values (" suffix=")" suffixOverrides=",">
  906. <if test="promoterId != null">#{promoterId},</if>
  907. <if test="userId != null">#{userId},</if>
  908. <if test="operatorId != null">#{operatorId},</if>
  909. <if test="roleName != null">#{roleName},</if>
  910. <if test="roleKey != null">#{roleKey},</if>
  911. </trim>
  912. </insert>
  913. <select id="getFollowUpRecordsByUserId" resultType="com.alibaba.fastjson.JSONObject">
  914. SELECT id,
  915. txt
  916. FROM kuaishou_promoter_follow_up_record
  917. Where promoter_id = #{promoterId}
  918. AND user_id = #{userId}
  919. ORDER BY update_time DESC LIMIT 1
  920. </select>
  921. <select id="getFollowUpRecordListByPromoterId" resultType="com.alibaba.fastjson.JSONObject">
  922. SELECT t1.id,
  923. txt,
  924. t2.nick_name as 'userName',
  925. t1.update_time as 'updateTime'
  926. FROM kuaishou_promoter_follow_up_record t1
  927. LEFT JOIN sys_user t2 ON t1.user_id = t2.user_id
  928. Where t1.promoter_id = #{promoterId}
  929. <if test="id != null">
  930. AND t1.id != #{id}
  931. </if>
  932. ORDER BY t1.update_time DESC
  933. </select>
  934. <select id="getPromoterLabel" resultType="com.alibaba.fastjson.JSONObject">
  935. SELECT t2.id as 'labelId', t2.label_colour as 'labelColour', t2.label_name as 'labelName'
  936. FROM kuaishou_promoter_label_rel t1
  937. LEFT JOIN kuaishou_label t2 ON t1.label_id = t2.id
  938. WHERE t1.promoter_id = #{promoterId}
  939. AND user_id = #{userId}
  940. order by t2.id
  941. </select>
  942. <select id="getOnlyPromoterInfoByUserId" resultType="com.ruixuan.isc.entity.KuaishouPromoter">
  943. <include refid="selectKuaishouPromoterVo"/>
  944. where promoter_id = #{promoterId}
  945. <if test="userId != null ">
  946. AND user_id = #{userId}
  947. </if>
  948. limit 1
  949. </select>
  950. <select id="getUserPromotersCount" resultType="java.lang.Integer">
  951. select promoters_count
  952. from user_promoters_count
  953. where user_id = #{userId}
  954. AND media_id = #{mediaId}
  955. </select>
  956. <select id="getBoundCount" resultType="java.lang.Integer">
  957. SELECT COUNT(1)
  958. FROM `kuaishou_promoter`
  959. WHERE user_id = #{userId}
  960. </select>
  961. <select id="getRuleName" resultType="java.lang.String" parameterType="java.lang.Long">
  962. select rule_name
  963. from kuaishou_settlement_rules
  964. where id = #{ruleId}
  965. </select>
  966. <select id="selectKuaishouRulePromoterById" resultType="com.alibaba.fastjson.JSONObject"
  967. parameterType="java.lang.Long">
  968. select promoter_id as 'promoterId', promoter_nick_name as 'promoterName', t2.user_id as 'userId', group_concat(t1.user_name) as 'userName'
  969. from kuaishou_promoter t1
  970. left join sys_user_role t2 on t1.user_id = t2.user_id
  971. where promoter_id = #{promoterId}
  972. and media_id = 2
  973. and t2.role_id not in (210114, 210115)
  974. and t2.user_id not in (270128)
  975. group by promoter_id
  976. </select>
  977. <select id="jyExpertMentorList" resultType="com.alibaba.fastjson.JSONObject">
  978. select t3.user_id as 'userId', t3.nick_name as 'userName',t3.status as 'status'
  979. from sys_user_role t1
  980. left join sys_role t2 on t1.role_id = t2.role_id
  981. left join sys_user t3 on t1.user_id = t3.user_id
  982. where t2.role_key = 'jy_expert_mentor'
  983. order by t3.create_time desc
  984. </select>
  985. <select id="jyExpertBusiness" resultType="com.alibaba.fastjson.JSONObject">
  986. select t3.user_id as 'userId', t3.nick_name as 'userName',t3.status as 'status'
  987. from sys_user_role t1
  988. left join sys_role t2 on t1.role_id = t2.role_id
  989. left join sys_user t3 on t1.user_id = t3.user_id
  990. where t2.role_key = 'jy_expert_business'
  991. order by t3.create_time desc
  992. </select>
  993. <insert id="addPromotersCount">
  994. replace
  995. into user_promoters_count
  996. (user_id, promoters_count,media_id)
  997. values
  998. (
  999. #{userId},
  1000. #{promotersCount},
  1001. #{mediaId}
  1002. )
  1003. </insert>
  1004. <insert id="addRule">
  1005. replace
  1006. into
  1007. promoter_bind_rule(promoter_id,rule_id,rule_name,create_time,update_time)
  1008. values
  1009. (
  1010. #{promoterId},
  1011. #{ruleId},
  1012. #{ruleName},
  1013. now
  1014. (
  1015. ),
  1016. now
  1017. (
  1018. )
  1019. )
  1020. </insert>
  1021. </mapper>