LiveAfterSalesMapper.xml 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  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.fs.live.mapper.LiveAfterSalesMapper">
  6. <resultMap type="LiveAfterSales" id="LiveAfterSalesResult">
  7. <result property="id" column="id" />
  8. <result property="liveId" column="live_id" />
  9. <result property="storeId" column="store_id" />
  10. <result property="orderId" column="order_id" />
  11. <result property="refundAmount" column="refund_amount" />
  12. <result property="refundType" column="refund_type" />
  13. <result property="reasons" column="reasons" />
  14. <result property="explains" column="explains" />
  15. <result property="explainImg" column="explain_img" />
  16. <result property="deliveryCode" column="delivery_code" />
  17. <result property="deliverySn" column="delivery_sn" />
  18. <result property="deliveryName" column="delivery_name" />
  19. <result property="status" column="status" />
  20. <result property="salesStatus" column="sales_status" />
  21. <result property="orderStatus" column="order_status" />
  22. <result property="createTime" column="create_time" />
  23. <result property="isDel" column="is_del" />
  24. <result property="userId" column="user_id" />
  25. <result property="consignee" column="consignee" />
  26. <result property="phoneNumber" column="phone_number" />
  27. <result property="address" column="address" />
  28. <result property="companyId" column="company_id" />
  29. <result property="companyUserId" column="company_user_id" />
  30. <result property="deptId" column="dept_id" />
  31. </resultMap>
  32. <sql id="selectLiveAfterSalesVo">
  33. select id, live_id, store_id, order_id, refund_amount, refund_type, reasons, explains, explain_img, delivery_code, delivery_sn, delivery_name, status, sales_status, order_status, create_time, is_del, user_id, consignee, phone_number, address, company_id, company_user_id, dept_id from live_after_sales
  34. </sql>
  35. <select id="selectLiveAfterSalesList" parameterType="LiveAfterSales" resultMap="LiveAfterSalesResult">
  36. <include refid="selectLiveAfterSalesVo"/>
  37. <where>
  38. <if test="liveId != null "> and live_id = #{liveId}</if>
  39. <if test="storeId != null "> and store_id = #{storeId}</if>
  40. <if test="orderId != null "> and order_id = #{orderId}</if>
  41. <if test="refundAmount != null "> and refund_amount = #{refundAmount}</if>
  42. <if test="refundType != null "> and refund_type = #{refundType}</if>
  43. <if test="reasons != null and reasons != ''"> and reasons = #{reasons}</if>
  44. <if test="explains != null and explains != ''"> and explains = #{explains}</if>
  45. <if test="explainImg != null and explainImg != ''"> and explain_img = #{explainImg}</if>
  46. <if test="deliveryCode != null and deliveryCode != ''"> and delivery_code = #{deliveryCode}</if>
  47. <if test="deliverySn != null and deliverySn != ''"> and delivery_sn = #{deliverySn}</if>
  48. <if test="deliveryName != null and deliveryName != ''"> and delivery_name like concat('%', #{deliveryName}, '%')</if>
  49. <if test="status != null "> and status = #{status}</if>
  50. <if test="salesStatus != null "> and sales_status = #{salesStatus}</if>
  51. <if test="orderStatus != null "> and order_status = #{orderStatus}</if>
  52. <if test="isDel != null and isDel != ''"> and is_del = #{isDel}</if>
  53. <if test="userId != null "> and user_id = #{userId}</if>
  54. <if test="consignee != null and consignee != ''"> and consignee = #{consignee}</if>
  55. <if test="phoneNumber != null and phoneNumber != ''"> and phone_number = #{phoneNumber}</if>
  56. <if test="address != null and address != ''"> and address = #{address}</if>
  57. <if test="companyId != null "> and company_id = #{companyId}</if>
  58. <if test="companyUserId != null "> and company_user_id = #{companyUserId}</if>
  59. <if test="deptId != null "> and dept_id = #{deptId}</if>
  60. </where>
  61. </select>
  62. <select id="selectLiveAfterSalesVoList" parameterType="com.fs.live.vo.LiveAfterSalesVo" resultType="com.fs.live.vo.LiveAfterSalesVo">
  63. select las.id, las.live_id, las.store_id, las.refund_amount,
  64. las.refund_type, las.reasons, las.explains, las.explain_img, las.delivery_code, las.delivery_sn, las.delivery_name, las.status, las.sales_status,
  65. las.order_status, las.create_time, las.is_del, las.user_id, las.consignee, las.phone_number, las.address, las.company_id, las.company_user_id, las.dept_id,
  66. cu.nick_name as company_user_nick_name, c.company_name,lo.order_id,lo.order_code,lo.user_phone,lo.item_json,lo.pay_time as orderPayTime,
  67. lo.user_address,lo.user_name,lo.pay_price,lo.total_postage,lop.bank_serial_no,lo.delivery_sn as orderDeliveryId,lo.delivery_name as orderDeliveryName,
  68. lo.delivery_code as orderDeliverySn,lo.status as orderStatus,lop.bank_transaction_id,lo.pay_money,lop.pay_code as payCode
  69. from live_after_sales las
  70. left join live_order lo on lo.order_id = las.order_id
  71. left join company_user cu on cu.user_id = las.company_user_id
  72. left join company c on c.company_id = cu.company_id
  73. left join live_order_payment lop on lop.business_id = lo.order_id and lop.status in (1,-1)
  74. <if test="productName != null and productName != ''">
  75. left join live_order_item loi on loi.order_id = lo.order_id
  76. </if>
  77. <where>
  78. <if test="hfOrderCode != null and hfOrderCode != ''"> and lop.pay_code = #{hfOrderCode}</if>
  79. <if test="liveId != null and liveId != ''"> and las.live_id = #{liveId}</if>
  80. <if test="companyUserNickName != null and companyUserNickName != ''"> and cu.nick_name like concat(#{companyUserNickName},'%')</if>
  81. <if test="storeId != null and storeId != ''"> and las.store_id = #{storeId}</if>
  82. <if test="orderCode != null and orderCode != ''"> and lo.order_code = #{orderCode}</if>
  83. <if test="productNameQuery != null and productNameQuery != ''"> and JSON_UNQUOTE(JSON_EXTRACT(loi.json_info, '$.productName')) like concat('%', #{productNameQuery}, '%')</if>
  84. <if test="refundAmount != null "> and las.refund_amount = #{refundAmount}</if>
  85. <if test="refundType != null "> and las.refund_type = #{refundType}</if>
  86. <if test="status != null "> and las.status = #{status}</if>
  87. <if test="salesStatus != null "> and las.sales_status = #{salesStatus}</if>
  88. <if test="orderStatus != null "> and las.order_status = #{orderStatus}</if>
  89. <if test="reasons != null and reasons != ''"> and las.reasons = #{reasons}</if>
  90. <if test="explains != null and explains != ''"> and las.explains = #{explains}</if>
  91. <if test="explainImg != null and explainImg != ''"> and las.explain_img = #{explainImg}</if>
  92. <if test="deliveryCode != null and deliveryCode != ''"> and las.delivery_code = #{deliveryCode}</if>
  93. <if test="deliverySn != null and deliverySn != ''"> and las.delivery_sn = #{deliverySn}</if>
  94. <if test="deliveryName != null and deliveryName != ''"> and las.delivery_name like concat('%', #{deliveryName}, '%')</if>
  95. <if test="status != null "> and las.status = #{status}</if>
  96. <if test="salesStatus != null "> and las.sales_status = #{salesStatus}</if>
  97. <if test="orderStatus != null "> and las.order_status = #{orderStatus}</if>
  98. <if test="deliveryStatus != null and deliveryStatus!= ''"> and las.order_status = #{deliveryStatus}</if>
  99. <if test="isDel != null and isDel != ''"> and las.is_del = #{isDel}</if>
  100. <if test="userId != null "> and las.user_id = #{userId}</if>
  101. <if test="consignee != null and consignee != ''"> and las.consignee = #{consignee}</if>
  102. <if test="phoneNumber != null and phoneNumber != ''"> and las.phone_number = #{phoneNumber}</if>
  103. <if test="address != null and address != ''"> and las.address = #{address}</if>
  104. <if test="companyId != null "> and las.company_id = #{companyId}</if>
  105. <if test="companyUserId != null "> and las.company_user_id = #{companyUserId}</if>
  106. <if test="deptId != null "> and cu.dept_id = #{deptId}</if>
  107. <if test="userPhone != null "> and lo.user_phone like concat(#{userPhone},'%')</if>
  108. </where>
  109. <if test="productName != null and productName != ''">
  110. group by las.id
  111. </if>
  112. order by las.create_time desc
  113. </select>
  114. <select id="selectLiveAfterSalesVoListExport" parameterType="com.fs.live.vo.LiveAfterSalesVo" resultType="com.fs.live.vo.LiveAfterSalesVo">
  115. select las.id, las.live_id, las.store_id, las.refund_amount,
  116. las.refund_type, las.reasons, las.explains, las.explain_img, las.delivery_code, las.delivery_sn, las.delivery_name, las.status, las.sales_status,
  117. las.order_status, las.create_time, las.is_del, las.user_id, las.consignee, las.phone_number, las.address, las.company_id, las.company_user_id, las.dept_id,
  118. cu.nick_name as company_user_nick_name, c.company_name,lo.order_id,lo.order_code,lo.user_phone,lo.item_json,lo.pay_time as orderPayTime,
  119. lo.user_address,lo.user_name,lo.pay_price,lo.total_postage,lop.bank_serial_no,lo.delivery_sn as orderDeliveryId,lo.delivery_name as orderDeliveryName,
  120. lo.delivery_code as orderDeliverySn,lo.status as orderStatus,lop.bank_transaction_id,lo.pay_money,lop.pay_code as payCode
  121. from live_after_sales las
  122. left join live_order lo on lo.order_id = las.order_id
  123. left join company_user cu on cu.user_id = las.company_user_id
  124. left join company c on c.company_id = cu.company_id
  125. left join live_order_payment lop on lop.business_id = lo.order_id and lop.status in (1,-1)
  126. <if test="productName != null and productName != ''">
  127. left join live_order_item loi on loi.order_id = lo.order_id
  128. </if>
  129. where 1=1 and las.status =4 and lop.bank_transaction_id is not null
  130. <if test="hfOrderCode != null and hfOrderCode != ''"> and lop.pay_code = #{hfOrderCode}</if>
  131. <if test="liveId != null and liveId != ''"> and las.live_id = #{liveId}</if>
  132. <if test="companyUserNickName != null and companyUserNickName != ''"> and cu.nick_name like concat(#{companyUserNickName},'%')</if>
  133. <if test="storeId != null and storeId != ''"> and las.store_id = #{storeId}</if>
  134. <if test="orderCode != null and orderCode != ''"> and lo.order_code = #{orderCode}</if>
  135. <if test="productNameQuery != null and productNameQuery != ''"> and JSON_UNQUOTE(JSON_EXTRACT(loi.json_info, '$.productName')) like concat('%', #{productNameQuery}, '%')</if>
  136. <if test="refundAmount != null "> and las.refund_amount = #{refundAmount}</if>
  137. <if test="refundType != null "> and las.refund_type = #{refundType}</if>
  138. <if test="status != null "> and las.status = #{status}</if>
  139. <if test="salesStatus != null "> and las.sales_status = #{salesStatus}</if>
  140. <if test="orderStatus != null "> and las.order_status = #{orderStatus}</if>
  141. <if test="reasons != null and reasons != ''"> and las.reasons = #{reasons}</if>
  142. <if test="explains != null and explains != ''"> and las.explains = #{explains}</if>
  143. <if test="explainImg != null and explainImg != ''"> and las.explain_img = #{explainImg}</if>
  144. <if test="deliveryCode != null and deliveryCode != ''"> and las.delivery_code = #{deliveryCode}</if>
  145. <if test="deliverySn != null and deliverySn != ''"> and las.delivery_sn = #{deliverySn}</if>
  146. <if test="deliveryName != null and deliveryName != ''"> and las.delivery_name like concat('%', #{deliveryName}, '%')</if>
  147. <if test="status != null "> and las.status = #{status}</if>
  148. <if test="salesStatus != null "> and las.sales_status = #{salesStatus}</if>
  149. <if test="orderStatus != null "> and las.order_status = #{orderStatus}</if>
  150. <if test="deliveryStatus != null and deliveryStatus!= ''"> and las.order_status = #{deliveryStatus}</if>
  151. <if test="isDel != null and isDel != ''"> and las.is_del = #{isDel}</if>
  152. <if test="userId != null "> and las.user_id = #{userId}</if>
  153. <if test="consignee != null and consignee != ''"> and las.consignee = #{consignee}</if>
  154. <if test="phoneNumber != null and phoneNumber != ''"> and las.phone_number = #{phoneNumber}</if>
  155. <if test="address != null and address != ''"> and las.address = #{address}</if>
  156. <if test="companyId != null "> and las.company_id = #{companyId}</if>
  157. <if test="companyUserId != null "> and las.company_user_id = #{companyUserId}</if>
  158. <if test="deptId != null "> and cu.dept_id = #{deptId}</if>
  159. <if test="userPhone != null "> and lo.user_phone like concat(#{userPhone},'%')</if>
  160. <if test="productName != null and productName != ''">
  161. group by las.id
  162. </if>
  163. order by las.create_time desc
  164. </select>
  165. <select id="selectLiveAfterSalesById" parameterType="Long" resultMap="LiveAfterSalesResult">
  166. <include refid="selectLiveAfterSalesVo"/>
  167. where id = #{id}
  168. order by create_time desc
  169. </select>
  170. <insert id="insertLiveAfterSales" parameterType="LiveAfterSales" useGeneratedKeys="true" keyProperty="id">
  171. insert into live_after_sales
  172. <trim prefix="(" suffix=")" suffixOverrides=",">
  173. <if test="liveId != null">live_id,</if>
  174. <if test="storeId != null">store_id,</if>
  175. <if test="orderId != null">order_id,</if>
  176. <if test="refundAmount != null">refund_amount,</if>
  177. <if test="refundType != null">refund_type,</if>
  178. <if test="reasons != null">reasons,</if>
  179. <if test="explains != null">explains,</if>
  180. <if test="explainImg != null">explain_img,</if>
  181. <if test="deliveryCode != null">delivery_code,</if>
  182. <if test="deliverySn != null">delivery_sn,</if>
  183. <if test="deliveryName != null">delivery_name,</if>
  184. <if test="status != null">status,</if>
  185. <if test="salesStatus != null">sales_status,</if>
  186. <if test="orderStatus != null">order_status,</if>
  187. <if test="createTime != null">create_time,</if>
  188. <if test="isDel != null">is_del,</if>
  189. <if test="userId != null">user_id,</if>
  190. <if test="consignee != null">consignee,</if>
  191. <if test="phoneNumber != null">phone_number,</if>
  192. <if test="address != null">address,</if>
  193. <if test="companyId != null">company_id,</if>
  194. <if test="companyUserId != null">company_user_id,</if>
  195. <if test="deptId != null">dept_id,</if>
  196. </trim>
  197. <trim prefix="values (" suffix=")" suffixOverrides=",">
  198. <if test="liveId != null">#{liveId},</if>
  199. <if test="storeId != null">#{storeId},</if>
  200. <if test="orderId != null">#{orderId},</if>
  201. <if test="refundAmount != null">#{refundAmount},</if>
  202. <if test="refundType != null">#{refundType},</if>
  203. <if test="reasons != null">#{reasons},</if>
  204. <if test="explains != null">#{explains},</if>
  205. <if test="explainImg != null">#{explainImg},</if>
  206. <if test="deliveryCode != null">#{deliveryCode},</if>
  207. <if test="deliverySn != null">#{deliverySn},</if>
  208. <if test="deliveryName != null">#{deliveryName},</if>
  209. <if test="status != null">#{status},</if>
  210. <if test="salesStatus != null">#{salesStatus},</if>
  211. <if test="orderStatus != null">#{orderStatus},</if>
  212. <if test="createTime != null">#{createTime},</if>
  213. <if test="isDel != null">#{isDel},</if>
  214. <if test="userId != null">#{userId},</if>
  215. <if test="consignee != null">#{consignee},</if>
  216. <if test="phoneNumber != null">#{phoneNumber},</if>
  217. <if test="address != null">#{address},</if>
  218. <if test="companyId != null">#{companyId},</if>
  219. <if test="companyUserId != null">#{companyUserId},</if>
  220. <if test="deptId != null">#{deptId},</if>
  221. </trim>
  222. </insert>
  223. <update id="updateLiveAfterSales" parameterType="LiveAfterSales">
  224. update live_after_sales
  225. <trim prefix="SET" suffixOverrides=",">
  226. <if test="liveId != null">live_id = #{liveId},</if>
  227. <if test="storeId != null">store_id = #{storeId},</if>
  228. <if test="orderId != null">order_id = #{orderId},</if>
  229. <if test="refundAmount != null">refund_amount = #{refundAmount},</if>
  230. <if test="refundType != null">refund_type = #{refundType},</if>
  231. <if test="reasons != null">reasons = #{reasons},</if>
  232. <if test="explains != null">explains = #{explains},</if>
  233. <if test="explainImg != null">explain_img = #{explainImg},</if>
  234. <if test="deliveryCode != null">delivery_code = #{deliveryCode},</if>
  235. <if test="deliverySn != null">delivery_sn = #{deliverySn},</if>
  236. <if test="deliveryName != null">delivery_name = #{deliveryName},</if>
  237. <if test="status != null">status = #{status},</if>
  238. <if test="salesStatus != null">sales_status = #{salesStatus},</if>
  239. <if test="orderStatus != null">order_status = #{orderStatus},</if>
  240. <if test="createTime != null">create_time = #{createTime},</if>
  241. <if test="isDel != null">is_del = #{isDel},</if>
  242. <if test="userId != null">user_id = #{userId},</if>
  243. <if test="consignee != null">consignee = #{consignee},</if>
  244. <if test="phoneNumber != null">phone_number = #{phoneNumber},</if>
  245. <if test="address != null">address = #{address},</if>
  246. <if test="companyId != null">company_id = #{companyId},</if>
  247. <if test="companyUserId != null">company_user_id = #{companyUserId},</if>
  248. <if test="deptId != null">dept_id = #{deptId},</if>
  249. </trim>
  250. where id = #{id}
  251. </update>
  252. <delete id="deleteLiveAfterSalesById" parameterType="Long">
  253. delete from live_after_sales where id = #{id}
  254. </delete>
  255. <delete id="deleteLiveAfterSalesByIds" parameterType="String">
  256. delete from live_after_sales where id in
  257. <foreach item="id" collection="array" open="(" separator="," close=")">
  258. #{id}
  259. </foreach>
  260. </delete>
  261. </mapper>