KuaishouPromoterMapper.xml 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  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="userName" column="user_name"/>
  10. <result property="promoterId" column="promoter_id"/>
  11. <result property="promoterNickName" column="promoter_nick_name"/>
  12. <result property="state" column="state"/>
  13. <result property="province" column="province"/>
  14. <result property="commissionRequirement" column="commission_requirement"/>
  15. <result property="categoryRequirement" column="category_requirement"/>
  16. <result property="createTime" column="create_time"/>
  17. <result property="promoterUrl" column="promoter_url"/>
  18. <result property="totalSale" column="total_sale"/>
  19. <result property="fansNumber" column="fans_number"/>
  20. <result property="phone" column="phone"/>
  21. <result property="consignee" column="consignee"/>
  22. <result property="promoterAddress" column="promoter_address"/>
  23. <result property="updateTime" column="update_time"/>
  24. </resultMap>
  25. <sql id="selectKuaishouPromoterVo">
  26. select id,
  27. user_id,
  28. user_name,
  29. promoter_id,
  30. promoter_nick_name,
  31. `state`,
  32. province,
  33. commission_requirement,
  34. category_requirement,
  35. promoter_url,
  36. phone,
  37. consignee,
  38. promoter_address,
  39. total_sale,
  40. fans_number,
  41. create_time,
  42. update_time
  43. from kuaishou_promoter
  44. </sql>
  45. <select id="selectKuaishouPromoterList" resultMap="KuaishouPromoterResult">
  46. <include refid="selectKuaishouPromoterVo"/>
  47. <where>
  48. <if test="userList != null and userList.size() > 0 ">
  49. and user_id in
  50. <foreach collection="userList" item="userId" open="(" separator="," close=")">
  51. #{userId}
  52. </foreach>
  53. </if>
  54. <if test="promoterId != null ">
  55. and promoter_id = #{promoterId}
  56. </if>
  57. <if test="promoterNickName != null and promoterNickName != ''">
  58. and promoter_nick_name like concat('%', #{promoterNickName}, '%')
  59. </if>
  60. </where>
  61. order by create_time desc
  62. </select>
  63. <select id="selectKuaishouPromoterById" parameterType="Long" resultMap="KuaishouPromoterResult">
  64. <include refid="selectKuaishouPromoterVo"/>
  65. where id = #{id}
  66. </select>
  67. <select id="getOneByIdAndPromoterId" resultMap="KuaishouPromoterResult">
  68. <include refid="selectKuaishouPromoterVo"/>
  69. where promoter_id = #{promoterId}
  70. <if test="userId != null ">
  71. AND user_id = #{userId}
  72. </if>
  73. limit 1
  74. </select>
  75. <insert id="insertKuaishouPromoter" parameterType="com.ruixuan.isc.entity.KuaishouPromoter" useGeneratedKeys="true"
  76. keyProperty="id">
  77. insert into kuaishou_promoter
  78. <trim prefix="(" suffix=")" suffixOverrides=",">
  79. <if test="userId != null">user_id,</if>
  80. <if test="userName != null">user_name,</if>
  81. <if test="promoterId != null">promoter_id,</if>
  82. <if test="promoterNickName != null">promoter_nick_name,</if>
  83. <if test="state != null">state,</if>
  84. <if test="province != null">province,</if>
  85. <if test="commissionRequirement != null">commission_requirement,</if>
  86. <if test="categoryRequirement != null">category_requirement,</if>
  87. <if test="createTime != null">create_time,</if>
  88. <if test="updateTime != null">update_time,</if>
  89. <if test="totalSale != null">total_sale,</if>
  90. <if test="fansNumber != null">fans_number,</if>
  91. <if test="promoterUrl != null">promoter_url,</if>
  92. <if test="phone != null">phone,</if>
  93. <if test="consignee != null">consignee,</if>
  94. <if test="promoterAddress != null">promoter_address,</if>
  95. </trim>
  96. <trim prefix="values (" suffix=")" suffixOverrides=",">
  97. <if test="userId != null">#{userId},</if>
  98. <if test="userName != null">#{userName},</if>
  99. <if test="promoterId != null">#{promoterId},</if>
  100. <if test="promoterNickName != null">#{promoterNickName},</if>
  101. <if test="state != null">#{state},</if>
  102. <if test="province != null">#{province},</if>
  103. <if test="commissionRequirement != null">#{commissionRequirement},</if>
  104. <if test="categoryRequirement != null">#{categoryRequirement},</if>
  105. <if test="createTime != null">#{createTime},</if>
  106. <if test="updateTime != null">#{updateTime},</if>
  107. <if test="totalSale != null">#{totalSale},</if>
  108. <if test="fansNumber != null">#{fansNumber},</if>
  109. <if test="promoterUrl != null">#{promoterUrl},</if>
  110. <if test="phone != null">#{phone},</if>
  111. <if test="consignee != null">#{consignee},</if>
  112. <if test="promoterAddress != null">#{promoterAddress},</if>
  113. </trim>
  114. </insert>
  115. <update id="updateKuaishouPromoter" parameterType="com.ruixuan.isc.entity.KuaishouPromoter">
  116. update kuaishou_promoter
  117. <trim prefix="SET" suffixOverrides=",">
  118. <if test="userId != null">user_id = #{userId},</if>
  119. <if test="userName != null">user_name = #{userName},</if>
  120. <if test="promoterId != null">promoter_id = #{promoterId},</if>
  121. <if test="promoterNickName != null">promoter_nick_name = #{promoterNickName},</if>
  122. <if test="totalSale != null">total_sale = #{totalSale},</if>
  123. <if test="fansNumber != null">fans_number = #{fansNumber},</if>
  124. <if test="promoterUrl != null">promoter_url = #{promoterUrl},</if>
  125. <if test="phone != null">phone = #{phone},</if>
  126. <if test="consignee != null">consignee = #{consignee},</if>
  127. <if test="promoterAddress != null">promoter_address = #{promoterAddress},</if>
  128. <if test="state != null">state = #{state},</if>
  129. <if test="province != null">province = #{province},</if>
  130. <if test="commissionRequirement != null">commission_requirement = #{commissionRequirement},</if>
  131. <if test="categoryRequirement != null">category_requirement = #{categoryRequirement},</if>
  132. <if test="createTime != null">create_time = #{createTime},</if>
  133. <if test="updateTime != null">update_time = #{updateTime},</if>
  134. </trim>
  135. where id = #{id}
  136. </update>
  137. <delete id="deleteKuaishouPromoterById" parameterType="Long">
  138. delete
  139. from kuaishou_promoter
  140. where id = #{id}
  141. </delete>
  142. <delete id="deleteKuaishouPromoterByIds" parameterType="String">
  143. delete from kuaishou_promoter where id in
  144. <foreach item="id" collection="array" open="(" separator="," close=")">
  145. #{id}
  146. </foreach>
  147. </delete>
  148. <select id="getNearlyMonthGmv" resultType="com.alibaba.fastjson.JSONObject">
  149. SELECT SUM(order_amount) as 'orderAmount', CONCAT(IFNULL(ROUND((SELECT COUNT(1)
  150. FROM kuaishou_item_collect_samples
  151. WHERE collect_sample_status = 7
  152. AND promoter_id = #{promoterId})
  153. / (SELECT COUNT(1)
  154. FROM kuaishou_item_collect_samples
  155. WHERE collect_sample_status!=1 AND collect_sample_status!=2 AND promoter_id = #{promoterId})*100,2), 0),
  156. '%') as 'operationCompletionRate'
  157. FROM kuaishou_supply_chain
  158. WHERE promoter_id = #{promoterId}
  159. AND FROM_UNIXTIME(order_create_time / 1000, '%Y-%m-%d') >= #{start}
  160. AND FROM_UNIXTIME(order_create_time / 1000, '%Y-%m-%d') &lt;= #{end}
  161. </select>
  162. <insert id="insertKuaishouPromoterRecord" parameterType="com.alibaba.fastjson.JSONObject" useGeneratedKeys="true"
  163. keyProperty="id">
  164. insert into kuaishou_promoter_record
  165. <trim prefix="(" suffix=")" suffixOverrides=",">
  166. <if test="promoterId != null">promoter_id,</if>
  167. <if test="userId != null">user_id,</if>
  168. <if test="operatorId != null">operator_id,</if>
  169. </trim>
  170. <trim prefix="values (" suffix=")" suffixOverrides=",">
  171. <if test="promoterId != null">#{promoterId},</if>
  172. <if test="userId != null">#{userId},</if>
  173. <if test="operatorId != null">#{operatorId},</if>
  174. </trim>
  175. </insert>
  176. </mapper>