OmsOrderMapper.xml 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952
  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.chelvc.cloud.vehicle.server.dao.OmsOrderMapper">
  6. <resultMap type="com.chelvc.cloud.vehicle.server.entity.OmsOrder" id="OmsOrderResult">
  7. <result property="id" column="id" />
  8. <result property="userId" column="user_id" />
  9. <result property="couponId" column="coupon_id" />
  10. <result property="orderSn" column="order_sn" />
  11. <result property="createTime" column="create_time" />
  12. <result property="memberUsername" column="member_username" />
  13. <result property="totalAmount" column="total_amount" />
  14. <result property="payAmount" column="pay_amount" />
  15. <result property="freightAmount" column="freight_amount" />
  16. <result property="promotionAmount" column="promotion_amount" />
  17. <result property="integrationAmount" column="integration_amount" />
  18. <result property="couponAmount" column="coupon_amount" />
  19. <result property="discountAmount" column="discount_amount" />
  20. <result property="payType" column="pay_type" />
  21. <result property="sourceType" column="source_type" />
  22. <result property="status" column="status" />
  23. <result property="orderType" column="order_type" />
  24. <result property="deliveryCompany" column="delivery_company" />
  25. <result property="deliverySn" column="delivery_sn" />
  26. <result property="autoConfirmDay" column="auto_confirm_day" />
  27. <result property="integration" column="integration" />
  28. <result property="growth" column="growth" />
  29. <result property="promotionInfo" column="promotion_info" />
  30. <result property="billType" column="bill_type" />
  31. <result property="billHeader" column="bill_header" />
  32. <result property="billContent" column="bill_content" />
  33. <result property="billReceiverPhone" column="bill_receiver_phone" />
  34. <result property="billReceiverEmail" column="bill_receiver_email" />
  35. <result property="receiverName" column="receiver_name" />
  36. <result property="receiverPhone" column="receiver_phone" />
  37. <result property="receiverPostCode" column="receiver_post_code" />
  38. <result property="receiverProvince" column="receiver_province" />
  39. <result property="receiverCity" column="receiver_city" />
  40. <result property="receiverRegion" column="receiver_region" />
  41. <result property="receiverDetailAddress" column="receiver_detail_address" />
  42. <result property="note" column="note" />
  43. <result property="confirmStatus" column="confirm_status" />
  44. <result property="deleteStatus" column="delete_status" />
  45. <result property="useIntegration" column="use_integration" />
  46. <result property="paymentTime" column="payment_time" />
  47. <result property="deliveryTime" column="delivery_time" />
  48. <result property="receiveTime" column="receive_time" />
  49. <result property="commentTime" column="comment_time" />
  50. </resultMap>
  51. <sql id="selectOmsOrderVo">
  52. select id, user_id, coupon_id, order_sn, create_time, member_username, total_amount, pay_amount, freight_amount, promotion_amount, integration_amount, coupon_amount, discount_amount, pay_type, source_type, status, order_type, delivery_company, delivery_sn, auto_confirm_day, integration, growth, promotion_info, bill_type, bill_header, bill_content, bill_receiver_phone, bill_receiver_email, receiver_name, receiver_phone, receiver_post_code, receiver_province, receiver_city, receiver_region, receiver_detail_address, note, confirm_status, delete_status, use_integration, payment_time, delivery_time, receive_time, comment_time from oms_order
  53. </sql>
  54. <select id="selectOmsOrderList" parameterType="com.chelvc.cloud.vehicle.server.entity.OmsOrder" resultMap="OmsOrderResult">
  55. <include refid="selectOmsOrderVo"/>
  56. <where>
  57. <if test="userId != null "> and user_id = #{userId}</if>
  58. <if test="couponId != null "> and coupon_id = #{couponId}</if>
  59. <if test="orderSn != null and orderSn != ''"> and order_sn = #{orderSn}</if>
  60. <if test="memberUsername != null and memberUsername != ''"> and member_username like concat('%', #{memberUsername}, '%')</if>
  61. <if test="totalAmount != null "> and total_amount = #{totalAmount}</if>
  62. <if test="payAmount != null "> and pay_amount = #{payAmount}</if>
  63. <if test="freightAmount != null "> and freight_amount = #{freightAmount}</if>
  64. <if test="promotionAmount != null "> and promotion_amount = #{promotionAmount}</if>
  65. <if test="integrationAmount != null "> and integration_amount = #{integrationAmount}</if>
  66. <if test="couponAmount != null "> and coupon_amount = #{couponAmount}</if>
  67. <if test="discountAmount != null "> and discount_amount = #{discountAmount}</if>
  68. <if test="payType != null "> and pay_type = #{payType}</if>
  69. <if test="sourceType != null "> and source_type = #{sourceType}</if>
  70. <if test="status != null "> and status = #{status}</if>
  71. <if test="orderType != null "> and order_type = #{orderType}</if>
  72. <if test="deliveryCompany != null and deliveryCompany != ''"> and delivery_company = #{deliveryCompany}</if>
  73. <if test="deliverySn != null and deliverySn != ''"> and delivery_sn = #{deliverySn}</if>
  74. <if test="autoConfirmDay != null "> and auto_confirm_day = #{autoConfirmDay}</if>
  75. <if test="integration != null "> and integration = #{integration}</if>
  76. <if test="growth != null "> and growth = #{growth}</if>
  77. <if test="promotionInfo != null and promotionInfo != ''"> and promotion_info = #{promotionInfo}</if>
  78. <if test="billType != null "> and bill_type = #{billType}</if>
  79. <if test="billHeader != null and billHeader != ''"> and bill_header = #{billHeader}</if>
  80. <if test="billContent != null and billContent != ''"> and bill_content = #{billContent}</if>
  81. <if test="billReceiverPhone != null and billReceiverPhone != ''"> and bill_receiver_phone = #{billReceiverPhone}</if>
  82. <if test="billReceiverEmail != null and billReceiverEmail != ''"> and bill_receiver_email = #{billReceiverEmail}</if>
  83. <if test="receiverName != null and receiverName != ''"> and receiver_name like concat('%', #{receiverName}, '%')</if>
  84. <if test="receiverPhone != null and receiverPhone != ''"> and receiver_phone = #{receiverPhone}</if>
  85. <if test="receiverPostCode != null and receiverPostCode != ''"> and receiver_post_code = #{receiverPostCode}</if>
  86. <if test="receiverProvince != null and receiverProvince != ''"> and receiver_province = #{receiverProvince}</if>
  87. <if test="receiverCity != null and receiverCity != ''"> and receiver_city = #{receiverCity}</if>
  88. <if test="receiverRegion != null and receiverRegion != ''"> and receiver_region = #{receiverRegion}</if>
  89. <if test="receiverDetailAddress != null and receiverDetailAddress != ''"> and receiver_detail_address = #{receiverDetailAddress}</if>
  90. <if test="note != null and note != ''"> and note = #{note}</if>
  91. <if test="confirmStatus != null "> and confirm_status = #{confirmStatus}</if>
  92. <if test="deleteStatus != null "> and delete_status = #{deleteStatus}</if>
  93. <if test="useIntegration != null "> and use_integration = #{useIntegration}</if>
  94. <if test="paymentTime != null "> and payment_time = #{paymentTime}</if>
  95. <if test="deliveryTime != null "> and delivery_time = #{deliveryTime}</if>
  96. <if test="receiveTime != null "> and receive_time = #{receiveTime}</if>
  97. <if test="commentTime != null "> and comment_time = #{commentTime}</if>
  98. <if test="modifyTime != null "> and modify_time = #{modifyTime}</if>
  99. </where>
  100. </select>
  101. <select id="selectOmsOrderById" parameterType="Long" resultMap="OmsOrderResult">
  102. <include refid="selectOmsOrderVo"/>
  103. where id = #{id}
  104. </select>
  105. <insert id="insertOmsOrder" parameterType="com.chelvc.cloud.vehicle.server.entity.OmsOrder" useGeneratedKeys="true" keyProperty="id">
  106. insert into oms_order
  107. <trim prefix="(" suffix=")" suffixOverrides=",">
  108. <if test="userId != null">user_id,</if>
  109. <if test="couponId != null">coupon_id,</if>
  110. <if test="orderSn != null">order_sn,</if>
  111. <if test="createTime != null">create_time,</if>
  112. <if test="memberUsername != null">member_username,</if>
  113. <if test="totalAmount != null">total_amount,</if>
  114. <if test="payAmount != null">pay_amount,</if>
  115. <if test="freightAmount != null">freight_amount,</if>
  116. <if test="promotionAmount != null">promotion_amount,</if>
  117. <if test="integrationAmount != null">integration_amount,</if>
  118. <if test="couponAmount != null">coupon_amount,</if>
  119. <if test="discountAmount != null">discount_amount,</if>
  120. <if test="payType != null">pay_type,</if>
  121. <if test="sourceType != null">source_type,</if>
  122. <if test="status != null">status,</if>
  123. <if test="orderType != null">order_type,</if>
  124. <if test="deliveryCompany != null">delivery_company,</if>
  125. <if test="deliverySn != null">delivery_sn,</if>
  126. <if test="autoConfirmDay != null">auto_confirm_day,</if>
  127. <if test="integration != null">integration,</if>
  128. <if test="growth != null">growth,</if>
  129. <if test="promotionInfo != null">promotion_info,</if>
  130. <if test="billType != null">bill_type,</if>
  131. <if test="billHeader != null">bill_header,</if>
  132. <if test="billContent != null">bill_content,</if>
  133. <if test="billReceiverPhone != null">bill_receiver_phone,</if>
  134. <if test="billReceiverEmail != null">bill_receiver_email,</if>
  135. <if test="receiverName != null and receiverName != ''">receiver_name,</if>
  136. <if test="receiverPhone != null and receiverPhone != ''">receiver_phone,</if>
  137. <if test="receiverPostCode != null">receiver_post_code,</if>
  138. <if test="receiverProvince != null">receiver_province,</if>
  139. <if test="receiverCity != null">receiver_city,</if>
  140. <if test="receiverRegion != null">receiver_region,</if>
  141. <if test="receiverDetailAddress != null">receiver_detail_address,</if>
  142. <if test="note != null">note,</if>
  143. <if test="confirmStatus != null">confirm_status,</if>
  144. <if test="deleteStatus != null">delete_status,</if>
  145. <if test="useIntegration != null">use_integration,</if>
  146. <if test="paymentTime != null">payment_time,</if>
  147. <if test="deliveryTime != null">delivery_time,</if>
  148. <if test="receiveTime != null">receive_time,</if>
  149. <if test="commentTime != null">comment_time,</if>
  150. <if test="modifyTime != null">modify_time,</if>
  151. </trim>
  152. <trim prefix="values (" suffix=")" suffixOverrides=",">
  153. <if test="userId != null">#{userId},</if>
  154. <if test="couponId != null">#{couponId},</if>
  155. <if test="orderSn != null">#{orderSn},</if>
  156. <if test="createTime != null">#{createTime},</if>
  157. <if test="memberUsername != null">#{memberUsername},</if>
  158. <if test="totalAmount != null">#{totalAmount},</if>
  159. <if test="payAmount != null">#{payAmount},</if>
  160. <if test="freightAmount != null">#{freightAmount},</if>
  161. <if test="promotionAmount != null">#{promotionAmount},</if>
  162. <if test="integrationAmount != null">#{integrationAmount},</if>
  163. <if test="couponAmount != null">#{couponAmount},</if>
  164. <if test="discountAmount != null">#{discountAmount},</if>
  165. <if test="payType != null">#{payType},</if>
  166. <if test="sourceType != null">#{sourceType},</if>
  167. <if test="status != null">#{status},</if>
  168. <if test="orderType != null">#{orderType},</if>
  169. <if test="deliveryCompany != null">#{deliveryCompany},</if>
  170. <if test="deliverySn != null">#{deliverySn},</if>
  171. <if test="autoConfirmDay != null">#{autoConfirmDay},</if>
  172. <if test="integration != null">#{integration},</if>
  173. <if test="growth != null">#{growth},</if>
  174. <if test="promotionInfo != null">#{promotionInfo},</if>
  175. <if test="billType != null">#{billType},</if>
  176. <if test="billHeader != null">#{billHeader},</if>
  177. <if test="billContent != null">#{billContent},</if>
  178. <if test="billReceiverPhone != null">#{billReceiverPhone},</if>
  179. <if test="billReceiverEmail != null">#{billReceiverEmail},</if>
  180. <if test="receiverName != null and receiverName != ''">#{receiverName},</if>
  181. <if test="receiverPhone != null and receiverPhone != ''">#{receiverPhone},</if>
  182. <if test="receiverPostCode != null">#{receiverPostCode},</if>
  183. <if test="receiverProvince != null">#{receiverProvince},</if>
  184. <if test="receiverCity != null">#{receiverCity},</if>
  185. <if test="receiverRegion != null">#{receiverRegion},</if>
  186. <if test="receiverDetailAddress != null">#{receiverDetailAddress},</if>
  187. <if test="note != null">#{note},</if>
  188. <if test="confirmStatus != null">#{confirmStatus},</if>
  189. <if test="deleteStatus != null">#{deleteStatus},</if>
  190. <if test="useIntegration != null">#{useIntegration},</if>
  191. <if test="paymentTime != null">#{paymentTime},</if>
  192. <if test="deliveryTime != null">#{deliveryTime},</if>
  193. <if test="receiveTime != null">#{receiveTime},</if>
  194. <if test="commentTime != null">#{commentTime},</if>
  195. <if test="modifyTime != null">#{modifyTime},</if>
  196. </trim>
  197. </insert>
  198. <update id="updateOmsOrder" parameterType="com.chelvc.cloud.vehicle.server.entity.OmsOrder">
  199. update oms_order
  200. <trim prefix="SET" suffixOverrides=",">
  201. <if test="userId != null">user_id = #{userId},</if>
  202. <if test="couponId != null">coupon_id = #{couponId},</if>
  203. <if test="orderSn != null">order_sn = #{orderSn},</if>
  204. <if test="createTime != null">create_time = #{createTime},</if>
  205. <if test="memberUsername != null">member_username = #{memberUsername},</if>
  206. <if test="totalAmount != null">total_amount = #{totalAmount},</if>
  207. <if test="payAmount != null">pay_amount = #{payAmount},</if>
  208. <if test="freightAmount != null">freight_amount = #{freightAmount},</if>
  209. <if test="promotionAmount != null">promotion_amount = #{promotionAmount},</if>
  210. <if test="integrationAmount != null">integration_amount = #{integrationAmount},</if>
  211. <if test="couponAmount != null">coupon_amount = #{couponAmount},</if>
  212. <if test="discountAmount != null">discount_amount = #{discountAmount},</if>
  213. <if test="payType != null">pay_type = #{payType},</if>
  214. <if test="sourceType != null">source_type = #{sourceType},</if>
  215. <if test="status != null">status = #{status},</if>
  216. <if test="orderType != null">order_type = #{orderType},</if>
  217. <if test="deliveryCompany != null">delivery_company = #{deliveryCompany},</if>
  218. <if test="deliverySn != null">delivery_sn = #{deliverySn},</if>
  219. <if test="autoConfirmDay != null">auto_confirm_day = #{autoConfirmDay},</if>
  220. <if test="integration != null">integration = #{integration},</if>
  221. <if test="growth != null">growth = #{growth},</if>
  222. <if test="promotionInfo != null">promotion_info = #{promotionInfo},</if>
  223. <if test="billType != null">bill_type = #{billType},</if>
  224. <if test="billHeader != null">bill_header = #{billHeader},</if>
  225. <if test="billContent != null">bill_content = #{billContent},</if>
  226. <if test="billReceiverPhone != null">bill_receiver_phone = #{billReceiverPhone},</if>
  227. <if test="billReceiverEmail != null">bill_receiver_email = #{billReceiverEmail},</if>
  228. <if test="receiverName != null and receiverName != ''">receiver_name = #{receiverName},</if>
  229. <if test="receiverPhone != null and receiverPhone != ''">receiver_phone = #{receiverPhone},</if>
  230. <if test="receiverPostCode != null">receiver_post_code = #{receiverPostCode},</if>
  231. <if test="receiverProvince != null">receiver_province = #{receiverProvince},</if>
  232. <if test="receiverCity != null">receiver_city = #{receiverCity},</if>
  233. <if test="receiverRegion != null">receiver_region = #{receiverRegion},</if>
  234. <if test="receiverDetailAddress != null">receiver_detail_address = #{receiverDetailAddress},</if>
  235. <if test="note != null">note = #{note},</if>
  236. <if test="confirmStatus != null">confirm_status = #{confirmStatus},</if>
  237. <if test="deleteStatus != null">delete_status = #{deleteStatus},</if>
  238. <if test="useIntegration != null">use_integration = #{useIntegration},</if>
  239. <if test="paymentTime != null">payment_time = #{paymentTime},</if>
  240. <if test="deliveryTime != null">delivery_time = #{deliveryTime},</if>
  241. <if test="receiveTime != null">receive_time = #{receiveTime},</if>
  242. <if test="commentTime != null">comment_time = #{commentTime},</if>
  243. <if test="modifyTime != null">modify_time = #{modifyTime},</if>
  244. </trim>
  245. where id = #{id}
  246. </update>
  247. <delete id="deleteOmsOrderById" parameterType="Long">
  248. delete from oms_order where id = #{id}
  249. </delete>
  250. <delete id="deleteOmsOrderByIds" parameterType="String">
  251. delete from oms_order where id in
  252. <foreach item="id" collection="array" open="(" separator="," close=")">
  253. #{id}
  254. </foreach>
  255. </delete>
  256. <select id="countByExample" parameterType="com.chelvc.cloud.vehicle.api.dto.OmsOrderExampleDTO" resultType="java.lang.Long">
  257. select count(*) from oms_order
  258. <if test="_parameter != null">
  259. <include refid="Example_Where_Clause" />
  260. </if>
  261. </select>
  262. <sql id="Example_Where_Clause">
  263. <where>
  264. <foreach collection="oredCriteria" item="criteria" separator="or">
  265. <if test="criteria.valid">
  266. <trim prefix="(" prefixOverrides="and" suffix=")">
  267. <foreach collection="criteria.criteria" item="criterion">
  268. <choose>
  269. <when test="criterion.noValue">
  270. and ${criterion.condition}
  271. </when>
  272. <when test="criterion.singleValue">
  273. and ${criterion.condition} #{criterion.value}
  274. </when>
  275. <when test="criterion.betweenValue">
  276. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  277. </when>
  278. <when test="criterion.listValue">
  279. and ${criterion.condition}
  280. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  281. #{listItem}
  282. </foreach>
  283. </when>
  284. </choose>
  285. </foreach>
  286. </trim>
  287. </if>
  288. </foreach>
  289. </where>
  290. </sql>
  291. <delete id="deleteByExample" parameterType="com.chelvc.cloud.vehicle.api.dto.OmsOrderExampleDTO">
  292. delete from oms_order
  293. <if test="_parameter != null">
  294. <include refid="Example_Where_Clause" />
  295. </if>
  296. </delete>
  297. <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
  298. delete from oms_order
  299. where id = #{id,jdbcType=BIGINT}
  300. </delete>
  301. <insert id="insertSelective" parameterType="com.chelvc.cloud.vehicle.server.entity.OmsOrder">
  302. <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
  303. SELECT LAST_INSERT_ID()
  304. </selectKey>
  305. insert into oms_order
  306. <trim prefix="(" suffix=")" suffixOverrides=",">
  307. <if test="memberId != null">
  308. member_id,
  309. </if>
  310. <if test="couponId != null">
  311. coupon_id,
  312. </if>
  313. <if test="orderSn != null">
  314. order_sn,
  315. </if>
  316. <if test="createTime != null">
  317. create_time,
  318. </if>
  319. <if test="memberUsername != null">
  320. member_username,
  321. </if>
  322. <if test="totalAmount != null">
  323. total_amount,
  324. </if>
  325. <if test="payAmount != null">
  326. pay_amount,
  327. </if>
  328. <if test="freightAmount != null">
  329. freight_amount,
  330. </if>
  331. <if test="promotionAmount != null">
  332. promotion_amount,
  333. </if>
  334. <if test="integrationAmount != null">
  335. integration_amount,
  336. </if>
  337. <if test="couponAmount != null">
  338. coupon_amount,
  339. </if>
  340. <if test="discountAmount != null">
  341. discount_amount,
  342. </if>
  343. <if test="payType != null">
  344. pay_type,
  345. </if>
  346. <if test="sourceType != null">
  347. source_type,
  348. </if>
  349. <if test="status != null">
  350. status,
  351. </if>
  352. <if test="orderType != null">
  353. order_type,
  354. </if>
  355. <if test="deliveryCompany != null">
  356. delivery_company,
  357. </if>
  358. <if test="deliverySn != null">
  359. delivery_sn,
  360. </if>
  361. <if test="autoConfirmDay != null">
  362. auto_confirm_day,
  363. </if>
  364. <if test="integration != null">
  365. integration,
  366. </if>
  367. <if test="growth != null">
  368. growth,
  369. </if>
  370. <if test="promotionInfo != null">
  371. promotion_info,
  372. </if>
  373. <if test="billType != null">
  374. bill_type,
  375. </if>
  376. <if test="billHeader != null">
  377. bill_header,
  378. </if>
  379. <if test="billContent != null">
  380. bill_content,
  381. </if>
  382. <if test="billReceiverPhone != null">
  383. bill_receiver_phone,
  384. </if>
  385. <if test="billReceiverEmail != null">
  386. bill_receiver_email,
  387. </if>
  388. <if test="receiverName != null">
  389. receiver_name,
  390. </if>
  391. <if test="receiverPhone != null">
  392. receiver_phone,
  393. </if>
  394. <if test="receiverPostCode != null">
  395. receiver_post_code,
  396. </if>
  397. <if test="receiverProvince != null">
  398. receiver_province,
  399. </if>
  400. <if test="receiverCity != null">
  401. receiver_city,
  402. </if>
  403. <if test="receiverRegion != null">
  404. receiver_region,
  405. </if>
  406. <if test="receiverDetailAddress != null">
  407. receiver_detail_address,
  408. </if>
  409. <if test="note != null">
  410. note,
  411. </if>
  412. <if test="confirmStatus != null">
  413. confirm_status,
  414. </if>
  415. <if test="deleteStatus != null">
  416. delete_status,
  417. </if>
  418. <if test="useIntegration != null">
  419. use_integration,
  420. </if>
  421. <if test="paymentTime != null">
  422. payment_time,
  423. </if>
  424. <if test="deliveryTime != null">
  425. delivery_time,
  426. </if>
  427. <if test="receiveTime != null">
  428. receive_time,
  429. </if>
  430. <if test="commentTime != null">
  431. comment_time,
  432. </if>
  433. <if test="modifyTime != null">
  434. modify_time,
  435. </if>
  436. </trim>
  437. <trim prefix="values (" suffix=")" suffixOverrides=",">
  438. <if test="memberId != null">
  439. #{memberId,jdbcType=BIGINT},
  440. </if>
  441. <if test="couponId != null">
  442. #{couponId,jdbcType=BIGINT},
  443. </if>
  444. <if test="orderSn != null">
  445. #{orderSn,jdbcType=VARCHAR},
  446. </if>
  447. <if test="createTime != null">
  448. #{createTime,jdbcType=TIMESTAMP},
  449. </if>
  450. <if test="memberUsername != null">
  451. #{memberUsername,jdbcType=VARCHAR},
  452. </if>
  453. <if test="totalAmount != null">
  454. #{totalAmount,jdbcType=DECIMAL},
  455. </if>
  456. <if test="payAmount != null">
  457. #{payAmount,jdbcType=DECIMAL},
  458. </if>
  459. <if test="freightAmount != null">
  460. #{freightAmount,jdbcType=DECIMAL},
  461. </if>
  462. <if test="promotionAmount != null">
  463. #{promotionAmount,jdbcType=DECIMAL},
  464. </if>
  465. <if test="integrationAmount != null">
  466. #{integrationAmount,jdbcType=DECIMAL},
  467. </if>
  468. <if test="couponAmount != null">
  469. #{couponAmount,jdbcType=DECIMAL},
  470. </if>
  471. <if test="discountAmount != null">
  472. #{discountAmount,jdbcType=DECIMAL},
  473. </if>
  474. <if test="payType != null">
  475. #{payType,jdbcType=INTEGER},
  476. </if>
  477. <if test="sourceType != null">
  478. #{sourceType,jdbcType=INTEGER},
  479. </if>
  480. <if test="status != null">
  481. #{status,jdbcType=INTEGER},
  482. </if>
  483. <if test="orderType != null">
  484. #{orderType,jdbcType=INTEGER},
  485. </if>
  486. <if test="deliveryCompany != null">
  487. #{deliveryCompany,jdbcType=VARCHAR},
  488. </if>
  489. <if test="deliverySn != null">
  490. #{deliverySn,jdbcType=VARCHAR},
  491. </if>
  492. <if test="autoConfirmDay != null">
  493. #{autoConfirmDay,jdbcType=INTEGER},
  494. </if>
  495. <if test="integration != null">
  496. #{integration,jdbcType=INTEGER},
  497. </if>
  498. <if test="growth != null">
  499. #{growth,jdbcType=INTEGER},
  500. </if>
  501. <if test="promotionInfo != null">
  502. #{promotionInfo,jdbcType=VARCHAR},
  503. </if>
  504. <if test="billType != null">
  505. #{billType,jdbcType=INTEGER},
  506. </if>
  507. <if test="billHeader != null">
  508. #{billHeader,jdbcType=VARCHAR},
  509. </if>
  510. <if test="billContent != null">
  511. #{billContent,jdbcType=VARCHAR},
  512. </if>
  513. <if test="billReceiverPhone != null">
  514. #{billReceiverPhone,jdbcType=VARCHAR},
  515. </if>
  516. <if test="billReceiverEmail != null">
  517. #{billReceiverEmail,jdbcType=VARCHAR},
  518. </if>
  519. <if test="receiverName != null">
  520. #{receiverName,jdbcType=VARCHAR},
  521. </if>
  522. <if test="receiverPhone != null">
  523. #{receiverPhone,jdbcType=VARCHAR},
  524. </if>
  525. <if test="receiverPostCode != null">
  526. #{receiverPostCode,jdbcType=VARCHAR},
  527. </if>
  528. <if test="receiverProvince != null">
  529. #{receiverProvince,jdbcType=VARCHAR},
  530. </if>
  531. <if test="receiverCity != null">
  532. #{receiverCity,jdbcType=VARCHAR},
  533. </if>
  534. <if test="receiverRegion != null">
  535. #{receiverRegion,jdbcType=VARCHAR},
  536. </if>
  537. <if test="receiverDetailAddress != null">
  538. #{receiverDetailAddress,jdbcType=VARCHAR},
  539. </if>
  540. <if test="note != null">
  541. #{note,jdbcType=VARCHAR},
  542. </if>
  543. <if test="confirmStatus != null">
  544. #{confirmStatus,jdbcType=INTEGER},
  545. </if>
  546. <if test="deleteStatus != null">
  547. #{deleteStatus,jdbcType=INTEGER},
  548. </if>
  549. <if test="useIntegration != null">
  550. #{useIntegration,jdbcType=INTEGER},
  551. </if>
  552. <if test="paymentTime != null">
  553. #{paymentTime,jdbcType=TIMESTAMP},
  554. </if>
  555. <if test="deliveryTime != null">
  556. #{deliveryTime,jdbcType=TIMESTAMP},
  557. </if>
  558. <if test="receiveTime != null">
  559. #{receiveTime,jdbcType=TIMESTAMP},
  560. </if>
  561. <if test="commentTime != null">
  562. #{commentTime,jdbcType=TIMESTAMP},
  563. </if>
  564. <if test="modifyTime != null">
  565. #{modifyTime,jdbcType=TIMESTAMP},
  566. </if>
  567. </trim>
  568. </insert>
  569. <sql id="Base_Column_List">
  570. id, member_id, coupon_id, order_sn, create_time, member_username, total_amount, pay_amount,
  571. freight_amount, promotion_amount, integration_amount, coupon_amount, discount_amount,
  572. pay_type, source_type, status, order_type, delivery_company, delivery_sn, auto_confirm_day,
  573. integration, growth, promotion_info, bill_type, bill_header, bill_content, bill_receiver_phone,
  574. bill_receiver_email, receiver_name, receiver_phone, receiver_post_code, receiver_province,
  575. receiver_city, receiver_region, receiver_detail_address, note, confirm_status, delete_status,
  576. use_integration, payment_time, delivery_time, receive_time, comment_time, modify_time
  577. </sql>
  578. <select id="selectByExample" parameterType="com.chelvc.cloud.vehicle.api.dto.OmsOrderExampleDTO" resultMap="OmsOrderResult">
  579. select
  580. <if test="distinct">
  581. distinct
  582. </if>
  583. <include refid="Base_Column_List" />
  584. from oms_order
  585. <if test="_parameter != null">
  586. <include refid="Example_Where_Clause" />
  587. </if>
  588. <if test="orderByClause != null">
  589. order by ${orderByClause}
  590. </if>
  591. </select>
  592. <update id="updateByExampleSelective" parameterType="map">
  593. update oms_order
  594. <set>
  595. <if test="record.id != null">
  596. id = #{record.id,jdbcType=BIGINT},
  597. </if>
  598. <if test="record.memberId != null">
  599. member_id = #{record.memberId,jdbcType=BIGINT},
  600. </if>
  601. <if test="record.couponId != null">
  602. coupon_id = #{record.couponId,jdbcType=BIGINT},
  603. </if>
  604. <if test="record.orderSn != null">
  605. order_sn = #{record.orderSn,jdbcType=VARCHAR},
  606. </if>
  607. <if test="record.createTime != null">
  608. create_time = #{record.createTime,jdbcType=TIMESTAMP},
  609. </if>
  610. <if test="record.memberUsername != null">
  611. member_username = #{record.memberUsername,jdbcType=VARCHAR},
  612. </if>
  613. <if test="record.totalAmount != null">
  614. total_amount = #{record.totalAmount,jdbcType=DECIMAL},
  615. </if>
  616. <if test="record.payAmount != null">
  617. pay_amount = #{record.payAmount,jdbcType=DECIMAL},
  618. </if>
  619. <if test="record.freightAmount != null">
  620. freight_amount = #{record.freightAmount,jdbcType=DECIMAL},
  621. </if>
  622. <if test="record.promotionAmount != null">
  623. promotion_amount = #{record.promotionAmount,jdbcType=DECIMAL},
  624. </if>
  625. <if test="record.integrationAmount != null">
  626. integration_amount = #{record.integrationAmount,jdbcType=DECIMAL},
  627. </if>
  628. <if test="record.couponAmount != null">
  629. coupon_amount = #{record.couponAmount,jdbcType=DECIMAL},
  630. </if>
  631. <if test="record.discountAmount != null">
  632. discount_amount = #{record.discountAmount,jdbcType=DECIMAL},
  633. </if>
  634. <if test="record.payType != null">
  635. pay_type = #{record.payType,jdbcType=INTEGER},
  636. </if>
  637. <if test="record.sourceType != null">
  638. source_type = #{record.sourceType,jdbcType=INTEGER},
  639. </if>
  640. <if test="record.status != null">
  641. status = #{record.status,jdbcType=INTEGER},
  642. </if>
  643. <if test="record.orderType != null">
  644. order_type = #{record.orderType,jdbcType=INTEGER},
  645. </if>
  646. <if test="record.deliveryCompany != null">
  647. delivery_company = #{record.deliveryCompany,jdbcType=VARCHAR},
  648. </if>
  649. <if test="record.deliverySn != null">
  650. delivery_sn = #{record.deliverySn,jdbcType=VARCHAR},
  651. </if>
  652. <if test="record.autoConfirmDay != null">
  653. auto_confirm_day = #{record.autoConfirmDay,jdbcType=INTEGER},
  654. </if>
  655. <if test="record.integration != null">
  656. integration = #{record.integration,jdbcType=INTEGER},
  657. </if>
  658. <if test="record.growth != null">
  659. growth = #{record.growth,jdbcType=INTEGER},
  660. </if>
  661. <if test="record.promotionInfo != null">
  662. promotion_info = #{record.promotionInfo,jdbcType=VARCHAR},
  663. </if>
  664. <if test="record.billType != null">
  665. bill_type = #{record.billType,jdbcType=INTEGER},
  666. </if>
  667. <if test="record.billHeader != null">
  668. bill_header = #{record.billHeader,jdbcType=VARCHAR},
  669. </if>
  670. <if test="record.billContent != null">
  671. bill_content = #{record.billContent,jdbcType=VARCHAR},
  672. </if>
  673. <if test="record.billReceiverPhone != null">
  674. bill_receiver_phone = #{record.billReceiverPhone,jdbcType=VARCHAR},
  675. </if>
  676. <if test="record.billReceiverEmail != null">
  677. bill_receiver_email = #{record.billReceiverEmail,jdbcType=VARCHAR},
  678. </if>
  679. <if test="record.receiverName != null">
  680. receiver_name = #{record.receiverName,jdbcType=VARCHAR},
  681. </if>
  682. <if test="record.receiverPhone != null">
  683. receiver_phone = #{record.receiverPhone,jdbcType=VARCHAR},
  684. </if>
  685. <if test="record.receiverPostCode != null">
  686. receiver_post_code = #{record.receiverPostCode,jdbcType=VARCHAR},
  687. </if>
  688. <if test="record.receiverProvince != null">
  689. receiver_province = #{record.receiverProvince,jdbcType=VARCHAR},
  690. </if>
  691. <if test="record.receiverCity != null">
  692. receiver_city = #{record.receiverCity,jdbcType=VARCHAR},
  693. </if>
  694. <if test="record.receiverRegion != null">
  695. receiver_region = #{record.receiverRegion,jdbcType=VARCHAR},
  696. </if>
  697. <if test="record.receiverDetailAddress != null">
  698. receiver_detail_address = #{record.receiverDetailAddress,jdbcType=VARCHAR},
  699. </if>
  700. <if test="record.note != null">
  701. note = #{record.note,jdbcType=VARCHAR},
  702. </if>
  703. <if test="record.confirmStatus != null">
  704. confirm_status = #{record.confirmStatus,jdbcType=INTEGER},
  705. </if>
  706. <if test="record.deleteStatus != null">
  707. delete_status = #{record.deleteStatus,jdbcType=INTEGER},
  708. </if>
  709. <if test="record.useIntegration != null">
  710. use_integration = #{record.useIntegration,jdbcType=INTEGER},
  711. </if>
  712. <if test="record.paymentTime != null">
  713. payment_time = #{record.paymentTime,jdbcType=TIMESTAMP},
  714. </if>
  715. <if test="record.deliveryTime != null">
  716. delivery_time = #{record.deliveryTime,jdbcType=TIMESTAMP},
  717. </if>
  718. <if test="record.receiveTime != null">
  719. receive_time = #{record.receiveTime,jdbcType=TIMESTAMP},
  720. </if>
  721. <if test="record.commentTime != null">
  722. comment_time = #{record.commentTime,jdbcType=TIMESTAMP},
  723. </if>
  724. <if test="record.modifyTime != null">
  725. modify_time = #{record.modifyTime,jdbcType=TIMESTAMP},
  726. </if>
  727. </set>
  728. <if test="_parameter != null">
  729. <include refid="Update_By_Example_Where_Clause" />
  730. </if>
  731. </update>
  732. <sql id="Update_By_Example_Where_Clause">
  733. <where>
  734. <foreach collection="example.oredCriteria" item="criteria" separator="or">
  735. <if test="criteria.valid">
  736. <trim prefix="(" prefixOverrides="and" suffix=")">
  737. <foreach collection="criteria.criteria" item="criterion">
  738. <choose>
  739. <when test="criterion.noValue">
  740. and ${criterion.condition}
  741. </when>
  742. <when test="criterion.singleValue">
  743. and ${criterion.condition} #{criterion.value}
  744. </when>
  745. <when test="criterion.betweenValue">
  746. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  747. </when>
  748. <when test="criterion.listValue">
  749. and ${criterion.condition}
  750. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  751. #{listItem}
  752. </foreach>
  753. </when>
  754. </choose>
  755. </foreach>
  756. </trim>
  757. </if>
  758. </foreach>
  759. </where>
  760. </sql>
  761. <update id="updateByExample" parameterType="map">
  762. update oms_order
  763. set id = #{record.id,jdbcType=BIGINT},
  764. member_id = #{record.memberId,jdbcType=BIGINT},
  765. coupon_id = #{record.couponId,jdbcType=BIGINT},
  766. order_sn = #{record.orderSn,jdbcType=VARCHAR},
  767. create_time = #{record.createTime,jdbcType=TIMESTAMP},
  768. member_username = #{record.memberUsername,jdbcType=VARCHAR},
  769. total_amount = #{record.totalAmount,jdbcType=DECIMAL},
  770. pay_amount = #{record.payAmount,jdbcType=DECIMAL},
  771. freight_amount = #{record.freightAmount,jdbcType=DECIMAL},
  772. promotion_amount = #{record.promotionAmount,jdbcType=DECIMAL},
  773. integration_amount = #{record.integrationAmount,jdbcType=DECIMAL},
  774. coupon_amount = #{record.couponAmount,jdbcType=DECIMAL},
  775. discount_amount = #{record.discountAmount,jdbcType=DECIMAL},
  776. pay_type = #{record.payType,jdbcType=INTEGER},
  777. source_type = #{record.sourceType,jdbcType=INTEGER},
  778. status = #{record.status,jdbcType=INTEGER},
  779. order_type = #{record.orderType,jdbcType=INTEGER},
  780. delivery_company = #{record.deliveryCompany,jdbcType=VARCHAR},
  781. delivery_sn = #{record.deliverySn,jdbcType=VARCHAR},
  782. auto_confirm_day = #{record.autoConfirmDay,jdbcType=INTEGER},
  783. integration = #{record.integration,jdbcType=INTEGER},
  784. growth = #{record.growth,jdbcType=INTEGER},
  785. promotion_info = #{record.promotionInfo,jdbcType=VARCHAR},
  786. bill_type = #{record.billType,jdbcType=INTEGER},
  787. bill_header = #{record.billHeader,jdbcType=VARCHAR},
  788. bill_content = #{record.billContent,jdbcType=VARCHAR},
  789. bill_receiver_phone = #{record.billReceiverPhone,jdbcType=VARCHAR},
  790. bill_receiver_email = #{record.billReceiverEmail,jdbcType=VARCHAR},
  791. receiver_name = #{record.receiverName,jdbcType=VARCHAR},
  792. receiver_phone = #{record.receiverPhone,jdbcType=VARCHAR},
  793. receiver_post_code = #{record.receiverPostCode,jdbcType=VARCHAR},
  794. receiver_province = #{record.receiverProvince,jdbcType=VARCHAR},
  795. receiver_city = #{record.receiverCity,jdbcType=VARCHAR},
  796. receiver_region = #{record.receiverRegion,jdbcType=VARCHAR},
  797. receiver_detail_address = #{record.receiverDetailAddress,jdbcType=VARCHAR},
  798. note = #{record.note,jdbcType=VARCHAR},
  799. confirm_status = #{record.confirmStatus,jdbcType=INTEGER},
  800. delete_status = #{record.deleteStatus,jdbcType=INTEGER},
  801. use_integration = #{record.useIntegration,jdbcType=INTEGER},
  802. payment_time = #{record.paymentTime,jdbcType=TIMESTAMP},
  803. delivery_time = #{record.deliveryTime,jdbcType=TIMESTAMP},
  804. receive_time = #{record.receiveTime,jdbcType=TIMESTAMP},
  805. comment_time = #{record.commentTime,jdbcType=TIMESTAMP},
  806. modify_time = #{record.modifyTime,jdbcType=TIMESTAMP}
  807. <if test="_parameter != null">
  808. <include refid="Update_By_Example_Where_Clause" />
  809. </if>
  810. </update>
  811. <!-- <resultMap id="orderDetailMap" type="com.chelvc.cloud.vehicle.api.dto.OmsOrderDetailDTO"-->
  812. <!-- extends="com.chelvc.cloud.vehicle.server.dao.OmsOrderMapper.BaseResultMap">-->
  813. <!-- <collection property="orderItemList" columnPrefix="ot_"-->
  814. <!-- resultMap="com.chelvc.cloud.vehicle.server.dao.OmsOrderItemMapper.BaseResultMap">-->
  815. <!-- </collection>-->
  816. <!-- </resultMap>-->
  817. <select id="getDetail" resultType="com.chelvc.cloud.vehicle.api.dto.OmsOrderItemDTO">
  818. SELECT
  819. o.id,
  820. o.order_sn,
  821. o.coupon_id,
  822. o.integration,
  823. o.user_id,
  824. ot.id ot_id,
  825. ot.goods_name ot_goods_name,
  826. ot.goods_sku_id ot_goods_sku_id,
  827. ot.goods_sku_code ot_goods_sku_code,
  828. ot.goods_quantity ot_goods_quantity
  829. FROM
  830. oms_order o
  831. LEFT JOIN oms_order_item ot ON o.id = ot.order_id
  832. WHERE
  833. o.id = #{orderId}
  834. </select>
  835. <update id="updateSkuStock">
  836. UPDATE pms_sku_stock
  837. SET
  838. stock = CASE id
  839. <foreach collection="itemList" item="item">
  840. WHEN #{item.goodsSkuId} THEN stock - #{item.goodsQuantity}
  841. </foreach>
  842. END,
  843. lock_stock = CASE id
  844. <foreach collection="itemList" item="item">
  845. WHEN #{item.goodsSkuId} THEN lock_stock - #{item.goodsQuantity}
  846. </foreach>
  847. END
  848. WHERE
  849. id IN
  850. <foreach collection="itemList" item="item" separator="," open="(" close=")">
  851. #{item.goodsSkuId}
  852. </foreach>
  853. </update>
  854. <select id="getTimeOutOrders" resultType="com.chelvc.cloud.vehicle.api.dto.OmsOrderDetailDTO">
  855. SELECT
  856. o.id,
  857. o.order_sn,
  858. o.coupon_id,
  859. o.integration,
  860. o.member_id,
  861. o.use_integration,
  862. ot.id ot_id,
  863. ot.product_name ot_product_name,
  864. ot.product_sku_id ot_product_sku_id,
  865. ot.product_sku_code ot_product_sku_code,
  866. ot.product_quantity ot_product_quantity
  867. FROM
  868. oms_order o
  869. LEFT JOIN oms_order_item ot ON o.id = ot.order_id
  870. WHERE
  871. o.status = 0
  872. AND o.create_time &lt; date_add(NOW(), INTERVAL -#{minute} MINUTE);
  873. </select>
  874. <update id="updateOrderStatus">
  875. update oms_order
  876. set status=#{status}
  877. where id in
  878. <foreach collection="ids" item="id" separator="," open="(" close=")">
  879. #{id}
  880. </foreach>
  881. </update>
  882. <update id="releaseSkuStockLock">
  883. UPDATE pms_sku_stock
  884. SET
  885. lock_stock = CASE id
  886. <foreach collection="itemList" item="item">
  887. WHEN #{item.productSkuId} THEN lock_stock - #{item.productQuantity}
  888. </foreach>
  889. END
  890. WHERE
  891. id IN
  892. <foreach collection="itemList" item="item" separator="," open="(" close=")">
  893. #{item.productSkuId}
  894. </foreach>
  895. </update>
  896. <select id="getOrderQuantity" resultType="java.util.Map">
  897. SELECT
  898. count( 0 ) orderCount,
  899. sum( pay_amount ) amount
  900. FROM
  901. oms_order
  902. WHERE
  903. STATUS = '3'
  904. AND DATE_FORMAT( payment_time, 'yyyyMMdd' ) = DATE_FORMAT(
  905. now(),
  906. 'yyyyMMdd')
  907. </select>
  908. <select id="queryAmountByLastMonth" resultType="java.math.BigDecimal">
  909. select
  910. count(pay_amount)
  911. from
  912. oms_order
  913. where
  914. merchant_id = #{merchantId}
  915. and
  916. status = 3
  917. and
  918. payment_time between #{startLocalTime} and #{endLocalTime}
  919. </select>
  920. </mapper>