kmall_order.xml 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.emato.ccnet.mapper.kmall.KmallOrderMapper">
  4. <resultMap id="wayBill" type="com.emato.ccnet.domain.kmall.WayBill">
  5. <result property="orderNo" column="order_no"/>
  6. <result property="sellerId" column="seller_id"/>
  7. <result property="sellerName" column="seller_name"/>
  8. <result property="createTime" column="create_time"/>
  9. <result property="payTime" column="pay_time"/>
  10. <result property="trueName" column="true_name"/>
  11. <result property="idType" column="id_type"/>
  12. <result property="idCode" column="id_code"/>
  13. <result property="mobile" column="mobile"/>
  14. <result property="telphone" column="telphone"/>
  15. <result property="acceptName" column="accept_name"/>
  16. <result property="acceptMobile" column="accept_mobile"/>
  17. <result property="acceptTelphone" column="accept_telephone"/>
  18. <result property="country" column="country"/>
  19. <result property="province" column="province"/>
  20. <result property="provinceName" column="province_name"/>
  21. <result property="city" column="city"/>
  22. <result property="cityName" column="city_name"/>
  23. <result property="area" column="area"/>
  24. <result property="areaName" column="area_name"/>
  25. <result property="address" column="address"/>
  26. <result property="zip" column="zip"/>
  27. <result property="tradeNo" column="trade_no"/>
  28. <result property="realAmount" column="real_amount"/>
  29. <result property="realFreight" column="real_freight"/>
  30. </resultMap>
  31. <resultMap id="payBill" type="com.emato.ccnet.domain.kmall.PayBill">
  32. <result property="orderNo" column="order_no"/>
  33. <result property="sellerId" column="seller_id"/>
  34. <result property="sellerName" column="seller_name"/>
  35. <result property="createTime" column="create_time"/>
  36. <result property="tradeNo" column="trade_no"/>
  37. <result property="realAmount" column="real_amount"/>
  38. <result property="trueName" column="true_name"/>
  39. <result property="idCode" column="id_code"/>
  40. </resultMap>
  41. <resultMap id="orderBill" type="com.emato.ccnet.domain.kmall.OrderBill">
  42. <result property="orderNo" column="order_no"/>
  43. <result property="sellerId" column="seller_id"/>
  44. <result property="sellerName" column="seller_name"/>
  45. <result property="createTime" column="create_time"/>
  46. <result property="tradeNo" column="trade_no"/>
  47. <result property="realAmount" column="real_amount"/>
  48. <result property="userId" column="user_id"/>
  49. <result property="trueName" column="true_name"/>
  50. <result property="idType" column="id_type"/>
  51. <result property="idCode" column="id_code"/>
  52. <result property="acceptName" column="accept_name"/>
  53. <result property="telphone" column="telphone"/>
  54. <result property="address" column="address"/>
  55. <result property="costPrice" column="cost_price"/>
  56. </resultMap>
  57. <resultMap id="orderGoods" type="com.emato.ccnet.domain.kmall.OrderGoods">
  58. <result property="orderNo" column="order_no"/>
  59. <result property="goodsNo" column="goods_no"/>
  60. <result property="goodsNums" column="goods_nums"/>
  61. <result property="sellPrice" column="cost_price"/>
  62. <result property="sellTotalPice" column="sell_total_pice"/>
  63. <result property="name" column="name"/>
  64. <result property="content" column="content"/>
  65. </resultMap>
  66. <!-- 获取电子订单数据 -->
  67. <select id="getOrderBills" parameterType="hashMap" resultMap="orderBill">
  68. SELECT tio.order_no, tio.seller_id, tis.seller_name, tio.create_time, tio.trade_no,
  69. tio.real_amount, tio.user_id, tim.true_name, tim.id_type, tim.id_code, tio.accept_name,
  70. tio.mobile, tio.address,tig.cost_price
  71. FROM iwebshop_order tio
  72. LEFT OUTER JOIN iwebshop_seller tis ON tio.seller_id = tis.id
  73. LEFT OUTER JOIN iwebshop_order_cus tioc ON tio.order_no = tioc.order_no
  74. LEFT OUTER JOIN iwebshop_member tim ON tio.user_id = tim.user_id
  75. LEFT OUTER JOIN iwebshop_order_goods tiog ON tio.id = tiog.order_id
  76. LEFT OUTER JOIN iwebshop_goods tig ON tiog.goods_id = tig.id
  77. <where>
  78. tio.trade_no IS NOT NULL
  79. AND tio.pay_status='1'
  80. AND tioc.cus_order_flag='0'
  81. AND tioc.cus_pay_bill_flag='2'
  82. </where>
  83. ORDER BY tio.id limit #{number}
  84. </select>
  85. <!-- 获取运单数据-->
  86. <select id="getWaybills" parameterType="hashMap" resultMap="wayBill">
  87. SELECT tio.order_no, tio.seller_id, tis.seller_name, tio.create_time,tio.pay_time, tim.true_name, tim.id_type, tim.id_code,
  88. tim.mobile, tim.telephone,tim.zip, tio.accept_name, tio.mobile AS accept_mobile, tio.telphone AS accept_telephone,
  89. tio.country, tio.province, t2.area_name AS province_name, tio.city, t3.area_name AS city_name, tio.area,
  90. t4.area_name, CONCAT(t4.area_name, tio.address) AS address, tio.trade_no, tio.real_amount, tio.real_freight
  91. FROM iwebshop_order tio
  92. LEFT OUTER JOIN iwebshop_order_cus tioc ON tio.order_no = tioc.order_no
  93. LEFT OUTER JOIN iwebshop_member tim ON tio.user_id = tim.user_id
  94. LEFT OUTER JOIN iwebshop_seller tis ON tio.seller_id = tis.id
  95. LEFT OUTER JOIN iwebshop_areas t2 ON tio.province = t2.area_id
  96. LEFT OUTER JOIN iwebshop_areas t3 ON tio.city = t3.area_id
  97. LEFT OUTER JOIN iwebshop_areas t4 ON tio.area = t4.area_id
  98. LEFT OUTER JOIN iwebshop_order_goods tiog ON tio.id = tiog.order_id
  99. LEFT OUTER JOIN iwebshop_goods tig ON tiog.goods_id = tig.id
  100. <where>
  101. tio.trade_no IS NOT NULL AND tioc.cus_waybill_flag = '0' AND tio.pay_status = '1' AND tioc.cus_order_flag='2'
  102. </where>
  103. ORDER BY tio.id limit #{number}
  104. </select>
  105. <!-- 获取支付数据 -->
  106. <select id="getPayBills" parameterType="hashMap" resultMap="payBill">
  107. SELECT tio.order_no,tio.seller_id,tis.seller_name,tio.create_time,tio.trade_no,tio.real_amount,
  108. tim.true_name, tim.id_type
  109. FROM iwebshop_order tio
  110. LEFT OUTER JOIN iwebshop_seller tis ON tio.seller_id = tis.id
  111. LEFT OUTER JOIN iwebshop_order_cus tioc ON tio.order_no=tioc.order_no
  112. LEFT OUTER JOIN iwebshop_member tim ON tio.user_id=tim.user_id
  113. <where>
  114. tio.trade_no IS NOT NULL AND tio.pay_status='1' AND tioc.cus_pay_bill_flag='0'
  115. </where>
  116. ORDER BY tio.id limit #{number}
  117. </select>
  118. <!--商品详情-->
  119. <select id="getOrderGoods" parameterType="java.lang.String" resultMap="orderGoods">
  120. SELECT t.order_no, t2.goods_no, t2.cost_price,t1.goods_nums,
  121. t2.cost_price*t1.goods_nums AS sell_total_pice, t2.name,t2.content
  122. FROM iwebshop_order t
  123. LEFT OUTER JOIN iwebshop_order_goods t1 ON t.id=t1.order_id
  124. LEFT OUTER JOIN iwebshop_goods t2 ON t1.goods_id=t2.id
  125. LEFT OUTER JOIN iwebshop_order_cus t3 ON t.order_no=t3.order_no
  126. <where>
  127. t.trade_no IS NOT NULL
  128. AND t.order_no = #{orderNo}
  129. </where>
  130. ORDER BY t.id
  131. </select>
  132. <!-- 批量量更新订单推海关标识 -->
  133. <update id="updateCusKmallOrderStatusBatch" parameterType="List">
  134. UPDATE iwebshop_order_cus
  135. <trim prefix="set" suffixOverrides=",">
  136. <trim prefix="cus_order_flag =case" suffix="end,">
  137. <foreach collection="list" item="i" index="idx">
  138. <if test="i.cusOrderFlag !=null and i.cusOrderFlag !=''">
  139. when order_no=#{i.orderNo} then #{i.cusOrderFlag}
  140. </if>
  141. </foreach>
  142. </trim>
  143. <trim prefix="cus_waybill_flag =case" suffix="end,">
  144. <foreach collection="list" item="i" index="idx">
  145. <if test="i.cusWaybillFlag !=null and i.cusWaybillFlag !=''">
  146. when order_no=#{i.orderNo} then #{i.cusWaybillFlag}
  147. </if>
  148. </foreach>
  149. </trim>
  150. <trim prefix="cus_pay_bill_flag =case" suffix="end,">
  151. <foreach collection="list" item="i" index="idx">
  152. <if test="i.cusPayBillFlag !=null and i.cusPayBillFlag !=''">
  153. when order_no=#{i.orderNo} then #{i.cusPayBillFlag}
  154. </if>
  155. </foreach>
  156. </trim>
  157. </trim>
  158. <where>
  159. <if test="list != null and list.size()>0">
  160. <foreach collection="list" item="i" index="index" separator="or" >
  161. order_no=#{i.orderNo}
  162. </foreach>
  163. </if>
  164. </where>
  165. </update>
  166. <update id="updateCusKmallOrderStatus" parameterType="hashMap">
  167. UPDATE iwebshop_order_cus
  168. <set>
  169. <if test="cusOrderFlag !=null and cusOrderFlag !=''">
  170. cus_order_flag = #{cusOrderFlag}
  171. </if>
  172. <if test="cusWaybillFlag !=null and cusWaybillFlag !=''">
  173. cus_waybill_flag = #{cusWaybillFlag}
  174. </if>
  175. <if test="cusPayBillFlag !=null and cusPayBillFlag !=''">
  176. cus_pay_bill_flag = #{cusPayBillFlag}
  177. </if>
  178. </set>
  179. <where>
  180. order_no=#{orderNo}
  181. </where>
  182. </update>
  183. </mapper>