LiveOrderMapper.xml 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653
  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.LiveOrderMapper">
  6. <resultMap type="LiveOrder" id="LiveOrderResult">
  7. <result property="orderId" column="order_id" />
  8. <result property="liveId" column="live_id" />
  9. <result property="storeId" column="store_id" />
  10. <result property="orderCode" column="order_code" />
  11. <result property="userId" column="user_id" />
  12. <result property="userName" column="user_name" />
  13. <result property="userPhone" column="user_phone" />
  14. <result property="userAddress" column="user_address" />
  15. <result property="cartId" column="cart_id" />
  16. <result property="totalNum" column="total_num" />
  17. <result property="totalPrice" column="total_price" />
  18. <result property="payPrice" column="pay_price" />
  19. <result property="payMoney" column="pay_money" />
  20. <result property="isPay" column="is_pay" />
  21. <result property="payTime" column="pay_time" />
  22. <result property="payType" column="pay_type" />
  23. <result property="createTime" column="create_time" />
  24. <result property="updateTime" column="update_time" />
  25. <result property="status" column="status" />
  26. <result property="refundStatus" column="refund_status" />
  27. <result property="refundImg" column="refund_img" />
  28. <result property="refundExplain" column="refund_explain" />
  29. <result property="refundTime" column="refund_time" />
  30. <result property="refundReason" column="refund_reason" />
  31. <result property="refundMoney" column="refund_money" />
  32. <result property="deliveryCode" column="delivery_code" />
  33. <result property="deliveryName" column="delivery_name" />
  34. <result property="deliverySn" column="delivery_sn" />
  35. <result property="remark" column="remark" />
  36. <result property="isDel" column="is_del" />
  37. <result property="costPrice" column="cost_price" />
  38. <result property="verifyCode" column="verify_code" />
  39. <result property="shippingType" column="shipping_type" />
  40. <result property="isChannel" column="is_channel" />
  41. <result property="finishTime" column="finish_time" />
  42. <result property="deliveryTime" column="delivery_time" />
  43. <result property="tuiMoney" column="tui_money" />
  44. <result property="tuiMoneyStatus" column="tui_money_status" />
  45. <result property="tuiUserId" column="tui_user_id" />
  46. <result property="itemJson" column="item_json" />
  47. <result property="discountMoney" column="discount_money" />
  48. <result property="userCouponId" column="user_coupon_id" />
  49. <result property="companyId" column="company_id" />
  50. <result property="companyUserId" column="company_user_id" />
  51. <result property="storeHouseCode" column="store_house_code" />
  52. <result property="extendOrderId" column="extend_order_id" />
  53. <result property="payDelivery" column="pay_delivery" />
  54. <result property="payRemain" column="pay_remain" />
  55. <result property="deliveryStatus" column="delivery_status" />
  56. <result property="deliveryPayStatus" column="delivery_pay_status" />
  57. <result property="deliveryPayTime" column="delivery_pay_time" />
  58. <result property="deliveryType" column="delivery_type" />
  59. <result property="deliveryPayMoney" column="delivery_pay_money" />
  60. <result property="deliveryImportTime" column="delivery_import_time" />
  61. <result property="deliverySendTime" column="delivery_send_time" />
  62. <result property="isAfterSales" column="is_after_sales" />
  63. <result property="deptId" column="dept_id" />
  64. <result property="channel" column="channel" />
  65. <result property="source" column="source" />
  66. <result property="billPrice" column="bill_price" />
  67. <result property="totalPostage" column="total_postage" />
  68. <result property="payPostage" column="pay_postage" />
  69. <result property="gainIntegral" column="gain_integral" />
  70. <result property="useIntegral" column="use_integral" />
  71. <result property="payIntegral" column="pay_integral" />
  72. <result property="backIntegral" column="back_integral" />
  73. <result property="isEditMoney" column="is_edit_money" />
  74. <result property="orderName" column="order_name" />
  75. <result property="productIntroduce" column="product_introduce" />
  76. <result property="companyUserName" column="company_user_name" />
  77. <result property="companyName" column="company_name" />
  78. <result property="appUserId" column="app_user_id" />
  79. <result property="appDeptName" column="app_dept_name" />
  80. <result property="appCompanyUserId" column="app_company_user_id" />
  81. <result property="appCompanyUserName" column="app_company_user_name" />
  82. <result property="customerId" column="customer_id" />
  83. </resultMap>
  84. <sql id="selectLiveOrderVo">
  85. SELECT
  86. a.order_id,a.live_id, a.product_id, a.order_name, a.store_id, a.order_code, a.user_id, a.user_name,
  87. a.user_phone, a.user_address, a.cart_id, a.total_num, a.total_price, a.pay_price, a.pay_money, a.is_pay,
  88. a.pay_time, a.pay_type, a.create_time, a.update_time, a.STATUS, a.refund_status, a.refund_img, a.refund_explain,
  89. a.refund_time, a.refund_reason, a.refund_money, a.delivery_code, a.delivery_name, a.delivery_sn,
  90. a.remark, a.is_del, a.cost_price, a.verify_code, a.shipping_type, a.is_channel, a.finish_time,
  91. a.delivery_time, a.tui_money, a.tui_money_status, a.tui_user_id, a.item_json, a.discount_money,
  92. a.user_coupon_id, a.company_id, a.company_user_id, a.store_house_code, a.extend_order_id, a.pay_delivery,
  93. a.pay_remain, a.delivery_status, a.delivery_pay_status, a.delivery_pay_time, a.delivery_type,
  94. a.delivery_pay_money, a.delivery_import_time, a.delivery_send_time, a.is_after_sales, a.dept_id,
  95. a.channel, a.source, a.bill_price, a.total_postage, a.pay_postage, a.gain_integral,
  96. a.use_integral, a.pay_integral, a.back_integral, a.is_edit_money, b.product_info as product_introduce,a.customer_id
  97. FROM
  98. live_order a LEFT JOIN fs_store_product b ON a.product_id = b.product_id
  99. </sql>
  100. <select id="selectLiveOrderList" parameterType="LiveOrder" resultMap="LiveOrderResult">
  101. SELECT
  102. c.company_name,cu.user_name as company_user_name,a.order_id,a.live_id, a.product_id, a.order_name, a.store_id, a.order_code, a.user_id, a.user_name,
  103. a.user_phone, a.user_address, a.cart_id, a.total_num, a.total_price, a.pay_price, a.pay_money, a.is_pay,
  104. a.pay_time, a.pay_type, a.create_time, a.update_time, a.STATUS, a.refund_status, a.refund_img, a.refund_explain,
  105. a.refund_time, a.refund_reason, a.refund_money, a.delivery_code, a.delivery_name, a.delivery_sn,
  106. a.remark, a.is_del, a.cost_price, a.verify_code, a.shipping_type, a.is_channel, a.finish_time,
  107. a.delivery_time, a.tui_money, a.tui_money_status, a.tui_user_id, a.item_json, a.discount_money,
  108. a.user_coupon_id, a.company_id, a.company_user_id, a.store_house_code, a.extend_order_id, a.pay_delivery,
  109. a.pay_remain, a.delivery_status, a.delivery_pay_status, a.delivery_pay_time, a.delivery_type,
  110. a.delivery_pay_money, a.delivery_import_time, a.delivery_send_time, a.is_after_sales, a.dept_id,
  111. a.channel, a.source, a.bill_price, a.total_postage, a.pay_postage, a.gain_integral,
  112. a.use_integral, a.pay_integral, a.back_integral, a.is_edit_money, b.product_info as product_introduce,a.customer_id,
  113. fu.app_user_id, fu.app_dept_name, fu.app_company_user_id, fu.app_company_user_name,
  114. b.product_name as product_name,'0' as delivery_collection_amount
  115. FROM
  116. live_order a LEFT JOIN fs_store_product b ON a.product_id = b.product_id
  117. left join company_user cu on a.company_user_id = cu.user_id
  118. left join company c on a.company_id = c.company_id
  119. left join fs_user fu on a.user_id = fu.user_id
  120. <where>
  121. <if test="liveId != null "> and live_id = #{liveId}</if>
  122. <if test="storeId != null "> and store_id = #{storeId}</if>
  123. <if test="orderCode != null and orderCode != ''"> and a.order_code = #{orderCode}</if>
  124. <if test="userId != null and userId != ''"> and a.user_id = #{userId}</if>
  125. <if test="appUserId != null"> and fu.app_user_id = #{appUserId}</if>
  126. <if test="appDeptName != null and appDeptName != ''"> and fu.app_dept_name like concat('%', #{appDeptName}, '%')</if>
  127. <if test="appCompanyUserId != null"> and fu.app_company_user_id = #{appCompanyUserId}</if>
  128. <if test="appCompanyUserName != null and appCompanyUserName != ''"> and fu.app_company_user_name like concat('%', #{appCompanyUserName}, '%')</if>
  129. <if test="userName != null and userName != ''"> and a.user_name like concat('%', #{userName}, '%')</if>
  130. <if test="userPhone != null and userPhone != ''"> and a.user_phone = #{userPhone}</if>
  131. <if test="userAddress != null and userAddress != ''"> and a.user_address = #{userAddress}</if>
  132. <if test="cartId != null and cartId != ''"> and cart_id = #{cartId}</if>
  133. <if test="totalNum != null and totalNum != ''"> and total_num = #{totalNum}</if>
  134. <if test="totalPrice != null "> and total_price = #{totalPrice}</if>
  135. <if test="payPrice != null "> and a.pay_price = #{payPrice}</if>
  136. <if test="payMoney != null "> and a.pay_money = #{payMoney}</if>
  137. <if test="isPay != null and isPay != ''"> and a.is_pay = #{isPay}</if>
  138. <if test="payTime != null "> and pay_time = #{payTime}</if>
  139. <if test="payType != null and payType != ''"> and pay_type = #{payType}</if>
  140. <if test="status != null "> and a.status = #{status}</if>
  141. <if test="refundStatus != null and refundStatus != ''"> and refund_status = #{refundStatus}</if>
  142. <if test="refundImg != null and refundImg != ''"> and refund_img = #{refundImg}</if>
  143. <if test="refundExplain != null and refundExplain != ''"> and refund_explain = #{refundExplain}</if>
  144. <if test="refundTime != null "> and refund_time = #{refundTime}</if>
  145. <if test="refundReason != null and refundReason != ''"> and refund_reason = #{refundReason}</if>
  146. <if test="refundMoney != null "> and refund_money = #{refundMoney}</if>
  147. <if test="deliveryCode != null and deliveryCode != ''"> and a.delivery_code = #{deliveryCode}</if>
  148. <if test="deliveryName != null and deliveryName != ''"> and a.delivery_name like concat('%', #{deliveryName}, '%')</if>
  149. <if test="deliverySn != null and deliverySn != ''"> and a.delivery_sn = #{deliverySn}</if>
  150. <if test="isDel != null and isDel != ''"> and is_del = #{isDel}</if>
  151. <if test="costPrice != null "> and cost_price = #{costPrice}</if>
  152. <if test="verifyCode != null and verifyCode != ''"> and verify_code = #{verifyCode}</if>
  153. <if test="shippingType != null "> and shipping_type = #{shippingType}</if>
  154. <if test="isChannel != null and isChannel != ''"> and is_channel = #{isChannel}</if>
  155. <if test="deliveryTime != null and deliveryTime != ''"> and a.delivery_time = #{deliveryTime}</if>
  156. <if test="tuiMoney != null "> and tui_money = #{tuiMoney}</if>
  157. <if test="tuiMoneyStatus != null "> and tui_money_status = #{tuiMoneyStatus}</if>
  158. <if test="tuiUserId != null "> and tui_user_id = #{tuiUserId}</if>
  159. <if test="itemJson != null and itemJson != ''"> and item_json = #{itemJson}</if>
  160. <if test="discountMoney != null "> and discount_money = #{discountMoney}</if>
  161. <if test="userCouponId != null "> and user_coupon_id = #{userCouponId}</if>
  162. <if test="companyId != null "> and a.company_id = #{companyId}</if>
  163. <if test="companyUserId != null "> and a.company_user_id = #{companyUserId}</if>
  164. <if test="storeHouseCode != null and storeHouseCode != ''"> and store_house_code = #{storeHouseCode}</if>
  165. <if test="extendOrderId != null and extendOrderId != ''"> and extend_order_id = #{extendOrderId}</if>
  166. <if test="payDelivery != null "> and pay_delivery = #{payDelivery}</if>
  167. <if test="payRemain != null "> and pay_remain = #{payRemain}</if>
  168. <if test="deliveryStatus != null "> and delivery_status = #{deliveryStatus}</if>
  169. <if test="deliveryPayStatus != null "> and delivery_pay_status = #{deliveryPayStatus}</if>
  170. <if test="deliveryPayTime != null and deliveryPayTime != ''"> and delivery_pay_time = #{deliveryPayTime}</if>
  171. <if test="deliveryType != null and deliveryType != ''"> and delivery_type = #{deliveryType}</if>
  172. <if test="deliveryPayMoney != null "> and delivery_pay_money = #{deliveryPayMoney}</if>
  173. <if test="deliveryImportTime != null "> and delivery_import_time = #{deliveryImportTime}</if>
  174. <if test="deliverySendTimeStart != null and deliverySendTimeEnd != null and deliverySendTimeStart != '' and deliverySendTimeEnd!= ''">
  175. and a.delivery_send_time between CONCAT(#{deliverySendTimeStart}, ' 00:00:00') and CONCAT(#{deliverySendTimeEnd}, ' 23:59:59')
  176. </if>
  177. <if test="payStartTime != null and payStartTime != ''">
  178. and a.pay_time &gt;= CONCAT(#{payStartTime}, ' 00:00:00')
  179. </if>
  180. <if test="payEndTime != null and payEndTime != ''">
  181. and a.pay_time &lt;= CONCAT(#{payEndTime}, ' 23:59:59')
  182. </if>
  183. <if test="createTimeStart != null and createTimeEnd != null and createTimeStart != '' and createTimeEnd != ''">
  184. and a.create_time between CONCAT(#{createTimeStart}, ' 00:00:00') and CONCAT(#{createTimeEnd}, ' 23:59:59')
  185. </if>
  186. <if test="finishTimeStart != null and finishTimeEnd != null and finishTimeStart != '' and finishTimeEnd!=''">
  187. and a.finish_time between CONCAT(#{finishTimeStart}, ' 00:00:00') and CONCAT(#{finishTimeEnd}, ' 23:59:59')
  188. </if>
  189. <if test="isAfterSales != null "> and is_after_sales = #{isAfterSales}</if>
  190. <if test="deptId != null "> and cu.dept_id = #{deptId}</if>
  191. <if test="channel != null and channel != ''"> and channel = #{channel}</if>
  192. <if test="source != null "> and source = #{source}</if>
  193. <if test="billPrice != null "> and bill_price = #{billPrice}</if>
  194. <if test="totalPostage != null "> and total_postage = #{totalPostage}</if>
  195. <if test="payPostage != null "> and pay_postage = #{payPostage}</if>
  196. <if test="gainIntegral != null "> and gain_integral = #{gainIntegral}</if>
  197. <if test="useIntegral != null "> and use_integral = #{useIntegral}</if>
  198. <if test="payIntegral != null "> and pay_integral = #{payIntegral}</if>
  199. <if test="backIntegral != null "> and back_integral = #{backIntegral}</if>
  200. <if test="isEditMoney != null "> and is_edit_money = #{isEditMoney}</if>
  201. <if test="orderName != null "> and order_name = #{orderName}</if>
  202. <if test="companyUserName != null and companyUserName != ''"> and cu.user_name like concat(#{companyUserName},'%')</if>
  203. </where>
  204. order by a.create_time desc
  205. </select>
  206. <select id="selectLiveOrderByOrderId" parameterType="String" resultMap="LiveOrderResult">
  207. SELECT
  208. c.company_name,cu.user_name as company_user_name,a.order_id,a.live_id, a.product_id, a.order_name, a.store_id, a.order_code, a.user_id, a.user_name,
  209. a.user_phone, a.user_address, a.cart_id, a.total_num, a.total_price, a.pay_price, a.pay_money, a.is_pay,
  210. a.pay_time, a.pay_type, a.create_time, a.update_time, a.STATUS, a.refund_status, a.refund_img, a.refund_explain,
  211. a.refund_time, a.refund_reason, a.refund_money, a.delivery_code, a.delivery_name, a.delivery_sn,
  212. a.remark, a.is_del, a.cost_price, a.verify_code, a.shipping_type, a.is_channel, a.finish_time,
  213. a.delivery_time, a.tui_money, a.tui_money_status, a.tui_user_id, a.item_json, a.discount_money,
  214. a.user_coupon_id, a.company_id, a.company_user_id, a.store_house_code, a.extend_order_id, a.pay_delivery,a.pay_postage,
  215. a.pay_remain, a.delivery_status, a.delivery_pay_status, a.delivery_pay_time, a.delivery_type,
  216. a.delivery_pay_money, a.delivery_import_time, a.delivery_send_time, a.is_after_sales, a.dept_id,
  217. a.channel, a.source, a.bill_price, a.total_postage, a.pay_postage, a.gain_integral,
  218. a.use_integral, a.pay_integral, a.back_integral, a.is_edit_money, b.product_info as product_introduce,a.customer_id
  219. FROM
  220. live_order a LEFT JOIN fs_store_product b ON a.product_id = b.product_id
  221. left join company_user cu on a.company_user_id = cu.user_id
  222. left join company c on a.company_id = c.company_id
  223. where a.order_id = #{orderId}
  224. order by a.create_time desc
  225. </select>
  226. <insert id="insertLiveOrder" parameterType="LiveOrder" useGeneratedKeys="true" keyProperty="orderId">
  227. insert into live_order
  228. <trim prefix="(" suffix=")" suffixOverrides=",">
  229. <if test="liveId != null">live_id,</if>
  230. <if test="storeId != null">store_id,</if>
  231. <if test="orderCode != null and orderCode != ''">order_code,</if>
  232. <if test="userId != null and userId != ''">user_id,</if>
  233. <if test="userName != null">user_name,</if>
  234. <if test="userPhone != null">user_phone,</if>
  235. <if test="userAddress != null">user_address,</if>
  236. <if test="cartId != null">cart_id,</if>
  237. <if test="totalNum != null and totalNum != ''">total_num,</if>
  238. <if test="totalPrice != null">total_price,</if>
  239. <if test="payPrice != null">pay_price,</if>
  240. <if test="payMoney != null">pay_money,</if>
  241. <if test="isPay != null">is_pay,</if>
  242. <if test="payTime != null">pay_time,</if>
  243. <if test="payType != null">pay_type,</if>
  244. <if test="createTime != null">create_time,</if>
  245. <if test="updateTime != null">update_time,</if>
  246. <if test="status != null">status,</if>
  247. <if test="refundStatus != null">refund_status,</if>
  248. <if test="refundImg != null">refund_img,</if>
  249. <if test="refundExplain != null">refund_explain,</if>
  250. <if test="refundTime != null">refund_time,</if>
  251. <if test="refundReason != null">refund_reason,</if>
  252. <if test="refundMoney != null">refund_money,</if>
  253. <if test="deliveryCode != null">delivery_code,</if>
  254. <if test="deliveryName != null">delivery_name,</if>
  255. <if test="deliverySn != null">delivery_sn,</if>
  256. <if test="remark != null">remark,</if>
  257. <if test="isDel != null">is_del,</if>
  258. <if test="costPrice != null">cost_price,</if>
  259. <if test="verifyCode != null">verify_code,</if>
  260. <if test="shippingType != null">shipping_type,</if>
  261. <if test="isChannel != null">is_channel,</if>
  262. <if test="finishTime != null">finish_time,</if>
  263. <if test="deliveryTime != null">delivery_time,</if>
  264. <if test="tuiMoney != null">tui_money,</if>
  265. <if test="tuiMoneyStatus != null">tui_money_status,</if>
  266. <if test="tuiUserId != null">tui_user_id,</if>
  267. <if test="itemJson != null">item_json,</if>
  268. <if test="discountMoney != null">discount_money,</if>
  269. <if test="userCouponId != null">user_coupon_id,</if>
  270. <if test="companyId != null">company_id,</if>
  271. <if test="companyUserId != null">company_user_id,</if>
  272. <if test="storeHouseCode != null">store_house_code,</if>
  273. <if test="extendOrderId != null">extend_order_id,</if>
  274. <if test="payDelivery != null">pay_delivery,</if>
  275. <if test="payRemain != null">pay_remain,</if>
  276. <if test="deliveryStatus != null">delivery_status,</if>
  277. <if test="deliveryPayStatus != null">delivery_pay_status,</if>
  278. <if test="deliveryPayTime != null">delivery_pay_time,</if>
  279. <if test="deliveryType != null">delivery_type,</if>
  280. <if test="deliveryPayMoney != null">delivery_pay_money,</if>
  281. <if test="deliveryImportTime != null">delivery_import_time,</if>
  282. <if test="deliverySendTime != null">delivery_send_time,</if>
  283. <if test="isAfterSales != null">is_after_sales,</if>
  284. <if test="deptId != null">dept_id,</if>
  285. <if test="channel != null">channel,</if>
  286. <if test="source != null">source,</if>
  287. <if test="billPrice != null">bill_price,</if>
  288. <if test="totalPostage != null">total_postage,</if>
  289. <if test="payPostage != null">pay_postage,</if>
  290. <if test="gainIntegral != null">gain_integral,</if>
  291. <if test="useIntegral != null">use_integral,</if>
  292. <if test="payIntegral != null">pay_integral,</if>
  293. <if test="backIntegral != null">back_integral,</if>
  294. <if test="isEditMoney != null">is_edit_money,</if>
  295. <if test="productId != null">product_id,</if>
  296. <if test="customerId != null">customer_id,</if>
  297. </trim>
  298. <trim prefix="values (" suffix=")" suffixOverrides=",">
  299. <if test="liveId != null">#{liveId},</if>
  300. <if test="storeId != null">#{storeId},</if>
  301. <if test="orderCode != null and orderCode != ''">#{orderCode},</if>
  302. <if test="userId != null and userId != ''">#{userId},</if>
  303. <if test="userName != null">#{userName},</if>
  304. <if test="userPhone != null">#{userPhone},</if>
  305. <if test="userAddress != null">#{userAddress},</if>
  306. <if test="cartId != null">#{cartId},</if>
  307. <if test="totalNum != null and totalNum != ''">#{totalNum},</if>
  308. <if test="totalPrice != null">#{totalPrice},</if>
  309. <if test="payPrice != null">#{payPrice},</if>
  310. <if test="payMoney != null">#{payMoney},</if>
  311. <if test="isPay != null">#{isPay},</if>
  312. <if test="payTime != null">#{payTime},</if>
  313. <if test="payType != null">#{payType},</if>
  314. <if test="createTime != null">#{createTime},</if>
  315. <if test="updateTime != null">#{updateTime},</if>
  316. <if test="status != null">#{status},</if>
  317. <if test="refundStatus != null">#{refundStatus},</if>
  318. <if test="refundImg != null">#{refundImg},</if>
  319. <if test="refundExplain != null">#{refundExplain},</if>
  320. <if test="refundTime != null">#{refundTime},</if>
  321. <if test="refundReason != null">#{refundReason},</if>
  322. <if test="refundMoney != null">#{refundMoney},</if>
  323. <if test="deliveryCode != null">#{deliveryCode},</if>
  324. <if test="deliveryName != null">#{deliveryName},</if>
  325. <if test="deliverySn != null">#{deliverySn},</if>
  326. <if test="remark != null">#{remark},</if>
  327. <if test="isDel != null">#{isDel},</if>
  328. <if test="costPrice != null">#{costPrice},</if>
  329. <if test="verifyCode != null">#{verifyCode},</if>
  330. <if test="shippingType != null">#{shippingType},</if>
  331. <if test="isChannel != null">#{isChannel},</if>
  332. <if test="finishTime != null">#{finishTime},</if>
  333. <if test="deliveryTime != null">#{deliveryTime},</if>
  334. <if test="tuiMoney != null">#{tuiMoney},</if>
  335. <if test="tuiMoneyStatus != null">#{tuiMoneyStatus},</if>
  336. <if test="tuiUserId != null">#{tuiUserId},</if>
  337. <if test="itemJson != null">#{itemJson},</if>
  338. <if test="discountMoney != null">#{discountMoney},</if>
  339. <if test="userCouponId != null">#{userCouponId},</if>
  340. <if test="companyId != null">#{companyId},</if>
  341. <if test="companyUserId != null">#{companyUserId},</if>
  342. <if test="storeHouseCode != null">#{storeHouseCode},</if>
  343. <if test="extendOrderId != null">#{extendOrderId},</if>
  344. <if test="payDelivery != null">#{payDelivery},</if>
  345. <if test="payRemain != null">#{payRemain},</if>
  346. <if test="deliveryStatus != null">#{deliveryStatus},</if>
  347. <if test="deliveryPayStatus != null">#{deliveryPayStatus},</if>
  348. <if test="deliveryPayTime != null">#{deliveryPayTime},</if>
  349. <if test="deliveryType != null">#{deliveryType},</if>
  350. <if test="deliveryPayMoney != null">#{deliveryPayMoney},</if>
  351. <if test="deliveryImportTime != null">#{deliveryImportTime},</if>
  352. <if test="deliverySendTime != null">#{deliverySendTime},</if>
  353. <if test="isAfterSales != null">#{isAfterSales},</if>
  354. <if test="deptId != null">#{deptId},</if>
  355. <if test="channel != null">#{channel},</if>
  356. <if test="source != null">#{source},</if>
  357. <if test="billPrice != null">#{billPrice},</if>
  358. <if test="totalPostage != null">#{totalPostage},</if>
  359. <if test="payPostage != null">#{payPostage},</if>
  360. <if test="gainIntegral != null">#{gainIntegral},</if>
  361. <if test="useIntegral != null">#{useIntegral},</if>
  362. <if test="payIntegral != null">#{payIntegral},</if>
  363. <if test="backIntegral != null">#{backIntegral},</if>
  364. <if test="isEditMoney != null">#{isEditMoney},</if>
  365. <if test="productId != null">#{productId},</if>
  366. <if test="customerId != null">#{customerId},</if>
  367. </trim>
  368. </insert>
  369. <update id="updateLiveOrder" parameterType="LiveOrder">
  370. update live_order
  371. <trim prefix="SET" suffixOverrides=",">
  372. <if test="liveId != null">live_id = #{liveId},</if>
  373. <if test="storeId != null">store_id = #{storeId},</if>
  374. <if test="orderCode != null and orderCode != ''">order_code = #{orderCode},</if>
  375. <if test="userId != null and userId != ''">user_id = #{userId},</if>
  376. <if test="userName != null">user_name = #{userName},</if>
  377. <if test="userPhone != null">user_phone = #{userPhone},</if>
  378. <if test="userAddress != null">user_address = #{userAddress},</if>
  379. <if test="cartId != null">cart_id = #{cartId},</if>
  380. <if test="totalNum != null and totalNum != ''">total_num = #{totalNum},</if>
  381. <if test="totalPrice != null">total_price = #{totalPrice},</if>
  382. <if test="payPrice != null">pay_price = #{payPrice},</if>
  383. <if test="payMoney != null">pay_money = #{payMoney},</if>
  384. <if test="isPay != null">is_pay = #{isPay},</if>
  385. <if test="payTime != null">pay_time = #{payTime},</if>
  386. <if test="payType != null">pay_type = #{payType},</if>
  387. <if test="createTime != null">create_time = #{createTime},</if>
  388. <if test="updateTime != null">update_time = #{updateTime},</if>
  389. <if test="status != null">status = #{status},</if>
  390. <if test="refundStatus != null">refund_status = #{refundStatus},</if>
  391. <if test="refundImg != null">refund_img = #{refundImg},</if>
  392. <if test="refundExplain != null">refund_explain = #{refundExplain},</if>
  393. <if test="refundTime != null">refund_time = #{refundTime},</if>
  394. <if test="refundReason != null">refund_reason = #{refundReason},</if>
  395. <if test="refundMoney != null">refund_money = #{refundMoney},</if>
  396. <if test="deliveryCode != null">delivery_code = #{deliveryCode},</if>
  397. <if test="deliveryName != null">delivery_name = #{deliveryName},</if>
  398. <if test="deliverySn != null">delivery_sn = #{deliverySn},</if>
  399. <if test="remark != null">remark = #{remark},</if>
  400. <if test="isDel != null">is_del = #{isDel},</if>
  401. <if test="costPrice != null">cost_price = #{costPrice},</if>
  402. <if test="verifyCode != null">verify_code = #{verifyCode},</if>
  403. <if test="shippingType != null">shipping_type = #{shippingType},</if>
  404. <if test="isChannel != null">is_channel = #{isChannel},</if>
  405. <if test="finishTime != null">finish_time = #{finishTime},</if>
  406. <if test="deliveryTime != null">delivery_time = #{deliveryTime},</if>
  407. <if test="tuiMoney != null">tui_money = #{tuiMoney},</if>
  408. <if test="tuiMoneyStatus != null">tui_money_status = #{tuiMoneyStatus},</if>
  409. <if test="tuiUserId != null">tui_user_id = #{tuiUserId},</if>
  410. <if test="itemJson != null">item_json = #{itemJson},</if>
  411. <if test="discountMoney != null">discount_money = #{discountMoney},</if>
  412. <if test="userCouponId != null">user_coupon_id = #{userCouponId},</if>
  413. <if test="companyId != null">company_id = #{companyId},</if>
  414. <if test="companyUserId != null">company_user_id = #{companyUserId},</if>
  415. <if test="storeHouseCode != null">store_house_code = #{storeHouseCode},</if>
  416. <if test="extendOrderId != null">extend_order_id = #{extendOrderId},</if>
  417. <if test="payDelivery != null">pay_delivery = #{payDelivery},</if>
  418. <if test="payRemain != null">pay_remain = #{payRemain},</if>
  419. <if test="deliveryStatus != null">delivery_status = #{deliveryStatus},</if>
  420. <if test="deliveryPayStatus != null">delivery_pay_status = #{deliveryPayStatus},</if>
  421. <if test="deliveryPayTime != null">delivery_pay_time = #{deliveryPayTime},</if>
  422. <if test="deliveryType != null">delivery_type = #{deliveryType},</if>
  423. <if test="deliveryPayMoney != null">delivery_pay_money = #{deliveryPayMoney},</if>
  424. <if test="deliveryImportTime != null">delivery_import_time = #{deliveryImportTime},</if>
  425. <if test="deliverySendTime != null">delivery_send_time = #{deliverySendTime},</if>
  426. <if test="isAfterSales != null">is_after_sales = #{isAfterSales},</if>
  427. <if test="deptId != null">dept_id = #{deptId},</if>
  428. <if test="channel != null">channel = #{channel},</if>
  429. <if test="source != null">source = #{source},</if>
  430. <if test="billPrice != null">bill_price = #{billPrice},</if>
  431. <if test="totalPostage != null">total_postage = #{totalPostage},</if>
  432. <if test="payPostage != null">pay_postage = #{payPostage},</if>
  433. <if test="gainIntegral != null">gain_integral = #{gainIntegral},</if>
  434. <if test="useIntegral != null">use_integral = #{useIntegral},</if>
  435. <if test="payIntegral != null">pay_integral = #{payIntegral},</if>
  436. <if test="backIntegral != null">back_integral = #{backIntegral},</if>
  437. <if test="isEditMoney != null">is_edit_money = #{isEditMoney},</if>
  438. <if test="customerId != null">customer_id = #{customerId},</if>
  439. </trim>
  440. where order_id = #{orderId}
  441. </update>
  442. <update id="updateBatchLiveOrder" parameterType="java.util.List">
  443. <foreach collection="list" item="item" separator=";">
  444. update live_order
  445. set total_price = #{item.totalPrice},
  446. pay_price = #{item.payPrice},
  447. pay_money = #{item.payMoney},
  448. pay_delivery = #{item.payDelivery},
  449. pay_postage = #{item.payPostage},
  450. store_id = #{item.storeId}
  451. where order_id = #{item.orderId}
  452. </foreach>
  453. </update>
  454. <delete id="deleteLiveOrderByOrderId" parameterType="String">
  455. delete from live_order where order_id = #{orderId}
  456. </delete>
  457. <delete id="deleteLiveOrderByOrderIds" parameterType="String">
  458. delete from live_order where order_id in
  459. <foreach item="orderId" collection="array" open="(" separator="," close=")">
  460. #{orderId}
  461. </foreach>
  462. </delete>
  463. <select id="getLiveOrderTimeGranularity" parameterType="com.fs.live.vo.LiveOrderVo" resultMap="LiveOrderResult">
  464. <include refid="selectLiveOrderVo"/>
  465. where 1=1
  466. <if test="timeOptions != 'all'">and a.create_time >= #{createTime}</if>
  467. <if test="liveId != null">and a.live_id = #{liveId}</if>
  468. order by a.create_time desc
  469. </select>
  470. <select id="selectFsOutDateOrder" resultType="com.fs.live.domain.LiveOrder">
  471. <![CDATA[
  472. SELECT *
  473. FROM live_order
  474. WHERE status = 1
  475. AND create_time < DATE_SUB(NOW(), INTERVAL 1800 MINUTE)
  476. ]]>
  477. </select>
  478. <insert id="insertLiveOrderTest">
  479. insert into live_order_test
  480. <trim prefix="(" suffix=")" suffixOverrides=",">
  481. <if test="liveId != null">live_id,</if>
  482. <if test="storeId != null">store_id,</if>
  483. <if test="orderCode != null and orderCode != ''">order_code,</if>
  484. <if test="userId != null and userId != ''">user_id,</if>
  485. <if test="userName != null">user_name,</if>
  486. <if test="userPhone != null">user_phone,</if>
  487. <if test="userAddress != null">user_address,</if>
  488. <if test="cartId != null">cart_id,</if>
  489. <if test="totalNum != null and totalNum != ''">total_num,</if>
  490. <if test="totalPrice != null">total_price,</if>
  491. <if test="payPrice != null">pay_price,</if>
  492. <if test="payMoney != null">pay_money,</if>
  493. <if test="isPay != null">is_pay,</if>
  494. <if test="payTime != null">pay_time,</if>
  495. <if test="payType != null">pay_type,</if>
  496. <if test="createTime != null">create_time,</if>
  497. <if test="updateTime != null">update_time,</if>
  498. <if test="status != null">status,</if>
  499. <if test="refundStatus != null">refund_status,</if>
  500. <if test="refundImg != null">refund_img,</if>
  501. <if test="refundExplain != null">refund_explain,</if>
  502. <if test="refundTime != null">refund_time,</if>
  503. <if test="refundReason != null">refund_reason,</if>
  504. <if test="refundMoney != null">refund_money,</if>
  505. <if test="deliveryCode != null">delivery_code,</if>
  506. <if test="deliveryName != null">delivery_name,</if>
  507. <if test="deliverySn != null">delivery_sn,</if>
  508. <if test="remark != null">remark,</if>
  509. <if test="isDel != null">is_del,</if>
  510. <if test="costPrice != null">cost_price,</if>
  511. <if test="verifyCode != null">verify_code,</if>
  512. <if test="shippingType != null">shipping_type,</if>
  513. <if test="isChannel != null">is_channel,</if>
  514. <if test="finishTime != null">finish_time,</if>
  515. <if test="deliveryTime != null">delivery_time,</if>
  516. <if test="tuiMoney != null">tui_money,</if>
  517. <if test="tuiMoneyStatus != null">tui_money_status,</if>
  518. <if test="tuiUserId != null">tui_user_id,</if>
  519. <if test="itemJson != null">item_json,</if>
  520. <if test="discountMoney != null">discount_money,</if>
  521. <if test="userCouponId != null">user_coupon_id,</if>
  522. <if test="companyId != null">company_id,</if>
  523. <if test="companyUserId != null">company_user_id,</if>
  524. <if test="storeHouseCode != null">store_house_code,</if>
  525. <if test="extendOrderId != null">extend_order_id,</if>
  526. <if test="payDelivery != null">pay_delivery,</if>
  527. <if test="payRemain != null">pay_remain,</if>
  528. <if test="deliveryStatus != null">delivery_status,</if>
  529. <if test="deliveryPayStatus != null">delivery_pay_status,</if>
  530. <if test="deliveryPayTime != null">delivery_pay_time,</if>
  531. <if test="deliveryType != null">delivery_type,</if>
  532. <if test="deliveryPayMoney != null">delivery_pay_money,</if>
  533. <if test="deliveryImportTime != null">delivery_import_time,</if>
  534. <if test="deliverySendTime != null">delivery_send_time,</if>
  535. <if test="isAfterSales != null">is_after_sales,</if>
  536. <if test="deptId != null">dept_id,</if>
  537. <if test="channel != null">channel,</if>
  538. <if test="source != null">source,</if>
  539. <if test="billPrice != null">bill_price,</if>
  540. <if test="totalPostage != null">total_postage,</if>
  541. <if test="payPostage != null">pay_postage,</if>
  542. <if test="gainIntegral != null">gain_integral,</if>
  543. <if test="useIntegral != null">use_integral,</if>
  544. <if test="payIntegral != null">pay_integral,</if>
  545. <if test="backIntegral != null">back_integral,</if>
  546. <if test="isEditMoney != null">is_edit_money,</if>
  547. <if test="productId != null">product_id,</if>
  548. <if test="customerId != null">customer_id,</if>
  549. </trim>
  550. <trim prefix="values (" suffix=")" suffixOverrides=",">
  551. <if test="liveId != null">#{liveId},</if>
  552. <if test="storeId != null">#{storeId},</if>
  553. <if test="orderCode != null and orderCode != ''">#{orderCode},</if>
  554. <if test="userId != null and userId != ''">#{userId},</if>
  555. <if test="userName != null">#{userName},</if>
  556. <if test="userPhone != null">#{userPhone},</if>
  557. <if test="userAddress != null">#{userAddress},</if>
  558. <if test="cartId != null">#{cartId},</if>
  559. <if test="totalNum != null and totalNum != ''">#{totalNum},</if>
  560. <if test="totalPrice != null">#{totalPrice},</if>
  561. <if test="payPrice != null">#{payPrice},</if>
  562. <if test="payMoney != null">#{payMoney},</if>
  563. <if test="isPay != null">#{isPay},</if>
  564. <if test="payTime != null">#{payTime},</if>
  565. <if test="payType != null">#{payType},</if>
  566. <if test="createTime != null">#{createTime},</if>
  567. <if test="updateTime != null">#{updateTime},</if>
  568. <if test="status != null">#{status},</if>
  569. <if test="refundStatus != null">#{refundStatus},</if>
  570. <if test="refundImg != null">#{refundImg},</if>
  571. <if test="refundExplain != null">#{refundExplain},</if>
  572. <if test="refundTime != null">#{refundTime},</if>
  573. <if test="refundReason != null">#{refundReason},</if>
  574. <if test="refundMoney != null">#{refundMoney},</if>
  575. <if test="deliveryCode != null">#{deliveryCode},</if>
  576. <if test="deliveryName != null">#{deliveryName},</if>
  577. <if test="deliverySn != null">#{deliverySn},</if>
  578. <if test="remark != null">#{remark},</if>
  579. <if test="isDel != null">#{isDel},</if>
  580. <if test="costPrice != null">#{costPrice},</if>
  581. <if test="verifyCode != null">#{verifyCode},</if>
  582. <if test="shippingType != null">#{shippingType},</if>
  583. <if test="isChannel != null">#{isChannel},</if>
  584. <if test="finishTime != null">#{finishTime},</if>
  585. <if test="deliveryTime != null">#{deliveryTime},</if>
  586. <if test="tuiMoney != null">#{tuiMoney},</if>
  587. <if test="tuiMoneyStatus != null">#{tuiMoneyStatus},</if>
  588. <if test="tuiUserId != null">#{tuiUserId},</if>
  589. <if test="itemJson != null">#{itemJson},</if>
  590. <if test="discountMoney != null">#{discountMoney},</if>
  591. <if test="userCouponId != null">#{userCouponId},</if>
  592. <if test="companyId != null">#{companyId},</if>
  593. <if test="companyUserId != null">#{companyUserId},</if>
  594. <if test="storeHouseCode != null">#{storeHouseCode},</if>
  595. <if test="extendOrderId != null">#{extendOrderId},</if>
  596. <if test="payDelivery != null">#{payDelivery},</if>
  597. <if test="payRemain != null">#{payRemain},</if>
  598. <if test="deliveryStatus != null">#{deliveryStatus},</if>
  599. <if test="deliveryPayStatus != null">#{deliveryPayStatus},</if>
  600. <if test="deliveryPayTime != null">#{deliveryPayTime},</if>
  601. <if test="deliveryType != null">#{deliveryType},</if>
  602. <if test="deliveryPayMoney != null">#{deliveryPayMoney},</if>
  603. <if test="deliveryImportTime != null">#{deliveryImportTime},</if>
  604. <if test="deliverySendTime != null">#{deliverySendTime},</if>
  605. <if test="isAfterSales != null">#{isAfterSales},</if>
  606. <if test="deptId != null">#{deptId},</if>
  607. <if test="channel != null">#{channel},</if>
  608. <if test="source != null">#{source},</if>
  609. <if test="billPrice != null">#{billPrice},</if>
  610. <if test="totalPostage != null">#{totalPostage},</if>
  611. <if test="payPostage != null">#{payPostage},</if>
  612. <if test="gainIntegral != null">#{gainIntegral},</if>
  613. <if test="useIntegral != null">#{useIntegral},</if>
  614. <if test="payIntegral != null">#{payIntegral},</if>
  615. <if test="backIntegral != null">#{backIntegral},</if>
  616. <if test="isEditMoney != null">#{isEditMoney},</if>
  617. <if test="productId != null">#{productId},</if>
  618. <if test="customerId != null">#{customerId},</if>
  619. </trim>
  620. </insert>
  621. <select id="selectOrderCodeMapByOrderIds" resultType="java.util.HashMap">
  622. select
  623. order_id,
  624. order_code
  625. from live_order
  626. where order_id in
  627. <foreach collection="orderIds" item="id" open="(" separator="," close=")">
  628. #{id}
  629. </foreach>
  630. </select>
  631. <update id="updateUpdateTimeByExtendIds">
  632. UPDATE live_order SET update_time = NOW()
  633. WHERE extend_order_id IN
  634. <foreach item="item" collection="batch" open="(" separator="," close=")">
  635. #{item}
  636. </foreach>
  637. </update>
  638. </mapper>