KuaishouPromoterMapper.xml 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  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. </select>
  62. <select id="selectKuaishouPromoterById" parameterType="Long" resultMap="KuaishouPromoterResult">
  63. <include refid="selectKuaishouPromoterVo"/>
  64. where id = #{id}
  65. </select>
  66. <select id="getOneByIdAndPromoterId" resultMap="KuaishouPromoterResult">
  67. <include refid="selectKuaishouPromoterVo"/>
  68. where promoter_id = #{promoterId}
  69. <if test="userId != null ">
  70. AND user_id = #{userId}
  71. </if>
  72. </select>
  73. <insert id="insertKuaishouPromoter" parameterType="com.ruixuan.isc.entity.KuaishouPromoter" useGeneratedKeys="true"
  74. keyProperty="id">
  75. insert into kuaishou_promoter
  76. <trim prefix="(" suffix=")" suffixOverrides=",">
  77. <if test="userId != null">user_id,</if>
  78. <if test="userName != null">user_name,</if>
  79. <if test="promoterId != null">promoter_id,</if>
  80. <if test="promoterNickName != null">promoter_nick_name,</if>
  81. <if test="state != null">state,</if>
  82. <if test="province != null">province,</if>
  83. <if test="commissionRequirement != null">commission_requirement,</if>
  84. <if test="categoryRequirement != null">category_requirement,</if>
  85. <if test="createTime != null">create_time,</if>
  86. <if test="updateTime != null">update_time,</if>
  87. <if test="totalSale != null">total_sale,</if>
  88. <if test="fansNumber != null">fans_number,</if>
  89. <if test="promoterUrl != null">promoter_url,</if>
  90. <if test="phone != null">phone,</if>
  91. <if test="consignee != null">consignee,</if>
  92. <if test="promoterAddress != null">promoter_address,</if>
  93. </trim>
  94. <trim prefix="values (" suffix=")" suffixOverrides=",">
  95. <if test="userId != null">#{userId},</if>
  96. <if test="userName != null">#{userName},</if>
  97. <if test="promoterId != null">#{promoterId},</if>
  98. <if test="promoterNickName != null">#{promoterNickName},</if>
  99. <if test="state != null">#{state},</if>
  100. <if test="province != null">#{province},</if>
  101. <if test="commissionRequirement != null">#{commissionRequirement},</if>
  102. <if test="categoryRequirement != null">#{categoryRequirement},</if>
  103. <if test="createTime != null">#{createTime},</if>
  104. <if test="updateTime != null">#{updateTime},</if>
  105. <if test="totalSale != null">#{totalSale},</if>
  106. <if test="fansNumber != null">#{fansNumber},</if>
  107. <if test="promoterUrl != null">#{promoterUrl},</if>
  108. <if test="phone != null">#{phone},</if>
  109. <if test="consignee != null">#{consignee},</if>
  110. <if test="promoterAddress != null">#{promoterAddress},</if>
  111. </trim>
  112. </insert>
  113. <update id="updateKuaishouPromoter" parameterType="com.ruixuan.isc.entity.KuaishouPromoter">
  114. update kuaishou_promoter
  115. <trim prefix="SET" suffixOverrides=",">
  116. <if test="userId != null">user_id = #{userId},</if>
  117. <if test="userName != null">user_name = #{userName},</if>
  118. <if test="promoterId != null">promoter_id = #{promoterId},</if>
  119. <if test="promoterNickName != null">promoter_nick_name = #{promoterNickName},</if>
  120. <if test="totalSale != null">total_sale = #{totalSale},</if>
  121. <if test="fansNumber != null">fans_number = #{fansNumber},</if>
  122. <if test="promoterUrl != null">promoter_url = #{promoterUrl},</if>
  123. <if test="phone != null">phone = #{phone},</if>
  124. <if test="consignee != null">consignee = #{consignee},</if>
  125. <if test="promoterAddress != null">promoter_address = #{promoterAddress},</if>
  126. <if test="state != null">state = #{state},</if>
  127. <if test="province != null">province = #{province},</if>
  128. <if test="commissionRequirement != null">commission_requirement = #{commissionRequirement},</if>
  129. <if test="categoryRequirement != null">category_requirement = #{categoryRequirement},</if>
  130. <if test="createTime != null">create_time = #{createTime},</if>
  131. <if test="updateTime != null">update_time = #{updateTime},</if>
  132. </trim>
  133. where id = #{id}
  134. </update>
  135. <delete id="deleteKuaishouPromoterById" parameterType="Long">
  136. delete
  137. from kuaishou_promoter
  138. where id = #{id}
  139. </delete>
  140. <delete id="deleteKuaishouPromoterByIds" parameterType="String">
  141. delete from kuaishou_promoter where id in
  142. <foreach item="id" collection="array" open="(" separator="," close=")">
  143. #{id}
  144. </foreach>
  145. </delete>
  146. <select id="getNearlyMonthGmv" resultType="com.alibaba.fastjson.JSONObject">
  147. SELECT SUM(order_amount) as 'orderAmount', CONCAT(IFNULL(ROUND((SELECT COUNT(1)
  148. FROM kuaishou_item_collect_samples
  149. WHERE collect_sample_status = 7
  150. AND promoter_id = #{promoterId})
  151. / (SELECT COUNT(1)
  152. FROM kuaishou_item_collect_samples
  153. WHERE collect_sample_status!=1 AND collect_sample_status!=2 AND promoter_id = #{promoterId})*100,2), 0),
  154. '%') as 'operationCompletionRate'
  155. FROM kuaishou_supply_chain
  156. WHERE promoter_id = #{promoterId}
  157. AND FROM_UNIXTIME(order_create_time / 1000, '%Y-%m-%d') >= #{start}
  158. AND FROM_UNIXTIME(order_create_time / 1000, '%Y-%m-%d') &lt;= #{end}
  159. </select>
  160. </mapper>