1
0

SalesDetailMapper.xml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  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.emato.biz.mapper.mall.SalesDetailMapper">
  6. <!-- 记录请求操作日志 -->
  7. <insert id="insertSalesDataReqLog">
  8. insert into mall_sales_detail_log(
  9. msg,
  10. tran_direction,
  11. msg_date
  12. ) VALUES (
  13. <if test="reqData != null and reqData != ''">#{reqData},</if>
  14. <if test="merchSn != null and merchSn != ''">#{merchSn},</if>
  15. sysdate()
  16. )
  17. </insert>
  18. <!-- 查询销售数据 -->
  19. <select id="selectSalesDetailData" resultType="com.emato.biz.domain.mall.NewSystemFormatEntiy" parameterType="com.emato.biz.domain.mall.SalesDataReqVO">
  20. SELECT
  21. merch_sn,
  22. merch_sn_name,
  23. third_merch_sn,
  24. third_merch_sn_name,
  25. receipt_no,
  26. store_name,
  27. store_name_sn,
  28. cash_register_no,
  29. time_stamp,
  30. staff_id,
  31. staff_name,
  32. pay_flag,
  33. order_status,
  34. order_sn_wx,
  35. order_sn_ali,
  36. hs_code,
  37. hs_code_name,
  38. ematou_code,
  39. plu,
  40. mychem_id,
  41. product_name_en,
  42. product_name_cn,
  43. barcode,
  44. pack_size,
  45. product_spec,
  46. brand,
  47. edlp,
  48. current_price,
  49. cost_price,
  50. tax_rate,
  51. product_category,
  52. supplier_name,
  53. transaction_type,
  54. sale_return_type,
  55. remark
  56. FROM
  57. mall_sales_detail_data
  58. <where>
  59. <if test="orderNo != null and orderNo != '' ">
  60. AND receipt_no = #{orderNo}
  61. </if>
  62. <if test="ematouCode != null and ematouCode != '' ">
  63. AND ematou_code = #{ematouCode}
  64. </if>
  65. <if test="starTime != null and starTime != '' ">
  66. AND time_stamp &gt; #{starTime}
  67. </if>
  68. <if test="endTime != null and endTime != '' ">
  69. AND time_stamp &lt;= #{endTime}
  70. </if>
  71. <if test="orderStatus != null and orderStatus != '' ">
  72. AND order_status &lt;= #{orderStatus}
  73. </if>
  74. </where>
  75. <if test="offset != null and limit != null">
  76. limit #{offset}, #{limit}
  77. </if>
  78. </select>
  79. <!-- 查询销售数据条数 -->
  80. <select id="selectSalesDetailDataTotal" resultType="int">
  81. SELECT
  82. COUNT(1)
  83. FROM
  84. mall_sales_detail_data
  85. <where>
  86. <if test="orderNo != null and orderNo != '' ">
  87. AND receipt_no = #{orderNo}
  88. </if>
  89. <if test="starTime != null and starTime != '' ">
  90. AND time_stamp &gt; #{starTime}
  91. </if>
  92. <if test="endTime != null and endTime != '' ">
  93. AND time_stamp &lt;= #{endTime}
  94. </if>
  95. <if test="endTime != null and endTime != '' ">
  96. AND time_stamp &lt;= #{endTime}
  97. </if>
  98. <if test="orderStatus != null and orderStatus != '' ">
  99. AND order_status &lt;= #{orderStatus}
  100. </if>
  101. </where>
  102. </select>
  103. <!-- 接收kmall数据-->
  104. <insert id="insertSalesDetaiDate" parameterType="com.emato.biz.domain.mall.NewSystemFormatEntiy">
  105. insert into mall_sales_detail_data(
  106. <if test="merchSn != null">merch_sn,</if>
  107. <if test="merchSnName != null">merch_sn_name,</if>
  108. <if test="thirdMerchSn != null">third_merch_sn,</if>
  109. <if test="thirdMerchSnName != null">third_merch_sn_name,</if>
  110. <if test="receiptNo != null">receipt_no,</if>
  111. <if test="storeName != null">store_name,</if>
  112. <if test="storeNameSn != null">store_name_sn,</if>
  113. <if test="cashRegisterNo != null">cash_register_no,</if>
  114. <if test="timeStampDetails != null">time_stamp,</if>
  115. <if test="staffID != null">staff_id,</if>
  116. <if test="staffName != null">staff_name,</if>
  117. <if test="payFlag != null">pay_flag,</if>
  118. <if test="orderStatus != null">order_status,</if>
  119. <if test="orderSnWx != null">order_sn_wx,</if>
  120. <if test="orderSnAli != null">order_sn_ali,</if>
  121. <if test="hsCode != null">hs_code,</if>
  122. <if test="hsCodeName != null">hs_code_name,</if>
  123. <if test="ematouCode != null">ematou_code,</if>
  124. <if test="plu != null">plu,</if>
  125. <if test="mychemID != null">mychem_id,</if>
  126. <if test="productNameEN != null">product_name_en,</if>
  127. <if test="productNameCN != null">product_name_cn,</if>
  128. <if test="barcode != null">barcode,</if>
  129. <if test="packSize != null">pack_size,</if>
  130. <if test="productSpecification != null">product_spec,</if>
  131. <if test="brand != null">brand,</if>
  132. <if test="edlp != null">edlp,</if>
  133. <if test="currentPrice != null">current_price,</if>
  134. <if test="costPrice != null">cost_price,</if>
  135. <if test="taxRate != null">tax_rate,</if>
  136. <if test="productCategory != null">product_category,</if>
  137. <if test="supplierName != null">supplier_name,</if>
  138. <if test="transactionType != null">transaction_type,</if>
  139. <if test="saleReturnType != null">sale_return_type,</if>
  140. <if test="remark != null">remark,</if>
  141. <if test="createSn != null">creater_sn,</if>
  142. <if test="createTime != null">create_time</if>
  143. )values(
  144. <if test="merchSn != null">#{merchSn},</if>
  145. <if test="merchSnName != null">#{merchSnName},</if>
  146. <if test="thirdMerchSn != null">#{thirdMerchSn},</if>
  147. <if test="thirdMerchSnName != null">#{thirdMerchSnName},</if>
  148. <if test="receiptNo != null">#{receiptNo},</if>
  149. <if test="storeName != null">#{storeName},</if>
  150. <if test="storeNameSn != null">#{storeNameSn},</if>
  151. <if test="cashRegisterNo != null">#{cashRegisterNo},</if>
  152. <if test="timeStampDetails != null">#{timeStampDetails},</if>
  153. <if test="staffID != null">#{staffID},</if>
  154. <if test="staffName != null">#{staffName},</if>
  155. <if test="payFlag != null">#{payFlag},</if>
  156. <if test="orderStatus != null">#{orderStatus},</if>
  157. <if test="orderSnWx != null">#{orderSnWx},</if>
  158. <if test="orderSnAli != null">#{orderSnAli},</if>
  159. <if test="hsCode != null">#{hsCode},</if>
  160. <if test="hsCodeName != null">#{hsCodeName},</if>
  161. <if test="ematouCode != null">#{ematouCode},</if>
  162. <if test="plu != null">#{plu},</if>
  163. <if test="mychemID != null">#{mychemID},</if>
  164. <if test="productNameEN != null">#{productNameEN},</if>
  165. <if test="productNameCN != null">#{productNameCN},</if>
  166. <if test="barcode != null">#{barcode},</if>
  167. <if test="packSize != null">#{packSize},</if>
  168. <if test="productSpecification != null">#{productSpecification},</if>
  169. <if test="brand != null">#{brand},</if>
  170. <if test="edlp != null">#{edlp},</if>
  171. <if test="currentPrice != null">#{currentPrice},</if>
  172. <if test="costPrice != null">#{costPrice},</if>
  173. <if test="taxRate != null">#{taxRate},</if>
  174. <if test="productCategory != null">#{productCategory},</if>
  175. <if test="supplierName != null">#{supplierName},</if>
  176. <if test="transactionType != null">#{transactionType},</if>
  177. <if test="saleReturnType != null">#{saleReturnType},</if>
  178. <if test="remark != null">#{remark},</if>
  179. <if test="createSn != null">#{createSn},</if>
  180. <if test="createTime != null">#{createTime}</if>
  181. )
  182. </insert>
  183. <!-- 外部接口查询订单信息-->
  184. <select id="getSalesDetaiData" parameterType="java.util.Map" resultType="com.emato.biz.domain.mall.NewSystemFormatEntiy">
  185. SELECT
  186. merch_sn,
  187. merch_sn_name,
  188. third_merch_sn,
  189. third_merch_sn_name,
  190. receipt_no,
  191. store_name,
  192. store_name_sn,
  193. cash_register_no,
  194. time_stamp,
  195. staff_id,
  196. staff_name,
  197. pay_flag,
  198. order_status,
  199. order_sn_wx,
  200. order_sn_ali,
  201. hs_code,
  202. hs_code_name,
  203. ematou_code,
  204. plu,
  205. mychem_id,
  206. product_name_en,
  207. product_name_cn,
  208. barcode,
  209. pack_size,
  210. product_spec,
  211. brand,
  212. edlp,
  213. current_price,
  214. cost_price,
  215. tax_rate,
  216. product_category,
  217. supplier_name,
  218. transaction_type,
  219. sale_return_type,
  220. remark,
  221. create_time
  222. FROM
  223. mall_sales_detail_data
  224. WHERE
  225. STR_TO_DATE(create_time, '%Y-%m-%d %H:%i:%s')
  226. BETWEEN
  227. <if test="starTime !=null and starTime !=''">
  228. STR_TO_DATE(#{starTime}, '%Y-%m-%d %H:%i:%s')
  229. </if>
  230. <if test="endTime !=null and endTime !=''">
  231. AND STR_TO_DATE(#{endTime}, '%Y-%m-%d %H:%i:%s')
  232. </if>
  233. <if test="orderStatus !=null and orderStatus !=''">
  234. AND order_status = #{orderStatus}
  235. </if>
  236. <if test="pageIndex != null and pageSize != null">
  237. limit #{pageIndex}, #{pageSize}
  238. </if>
  239. </select>
  240. <!-- 记录外部调用接口入参-->
  241. <insert id="pullQueryData" parameterType="java.util.Map">
  242. insert into mall_sales_detail_log
  243. <if test="msg != null and msg != '' ">msg,</if>
  244. <if test="tranDirection != null and tranDirection != '' ">tran_direction,</if>
  245. datasyn_time
  246. )values(
  247. <if test="msg != null and msg != ''">#{msg},</if>
  248. <if test="tranDirection != null and tranDirection != ''">#{tranDirection},</if>
  249. sysdate()
  250. )
  251. </insert>
  252. <update id="updateSalesDetailData" parameterType="com.emato.biz.domain.mall.NewSystemFormatEntiy">
  253. update mall_sales_detail_data
  254. <set>
  255. <if test="merchSn != null">`merch_sn` = #{merchSn},</if>
  256. <if test="merchSnName != null">`merch_sn_name` = #{merchSnName},</if>
  257. <if test="thirdMerchSn != null">`third_merch_sn` = #{thirdMerchSn},</if>
  258. <if test="thirdMerchSnName != null">`third_merch_sn_name` = #{thirdMerchSnName},</if>
  259. <if test="storeName != null">`store_name` = #{storeName},</if>
  260. <if test="storeNameSn != null">`store_name_sn` = #{storeNameSn},</if>
  261. <if test="cashRegisterNo != null">`cash_register_no` = #{cashRegisterNo},</if>
  262. <if test="timeStampDetails != null">`time_stamp` = #{timeStampDetails},</if>
  263. <if test="staffID != null">`staff_id` = #{staffID},</if>
  264. <if test="staffName != null">`staff_name` = #{staffName},</if>
  265. <if test="payFlag != null">`pay_flag` = #{payFlag},</if>
  266. <if test="orderStatus != null">`order_status` = #{orderStatus},</if>
  267. <if test="orderSnWx != null">`order_sn_wx` = #{orderSnWx},</if>
  268. <if test="orderSnAli != null">`order_sn_ali` = #{orderSnAli},</if>
  269. <if test="hsCode != null">`hs_code` = #{hsCode},</if>
  270. <if test="hsCodeName != null">`hs_code_name` = #{hsCodeName},</if>
  271. <if test="ematouCode != null">`ematou_code` = #{ematouCode},</if>
  272. <if test="plu != null">`plu` = #{plu},</if>
  273. <if test="mychemID != null">`mychem_id` = #{mychemID},</if>
  274. <if test="productNameEN != null">`product_name_en` = #{productNameEN},</if>
  275. <if test="productNameCN != null">`product_name_cn` = #{productNameCN},</if>
  276. <if test="barcode != null">`barcode` = #{barcode},</if>
  277. <if test="packSize != null">`pack_size` = #{packSize},</if>
  278. <if test="productSpecification != null">`product_spec` = #{productSpecification},</if>
  279. <if test="brand != null">`brand` = #{brand},</if>
  280. <if test="edlp != null">`edlp` = #{edlp},</if>
  281. <if test="currentPrice != null">`current_price` = #{currentPrice},</if>
  282. <if test="costPrice != null">`cost_price` = #{costPrice},</if>
  283. <if test="taxPrice != null">`tax_price` = #{taxPrice},</if>
  284. <if test="taxRate != null">`tax_rate` = #{taxRate},</if>
  285. <if test="productCategory != null">`product_category` = #{productCategory},</if>
  286. <if test="supplierName != null">`supplier_name` = #{supplierName},</if>
  287. <if test="transactionType != null">`transaction_type` = #{transactionType},</if>
  288. <if test="saleReturnType != null">`sale_return_type` = #{saleReturnType},</if>
  289. <if test="remark != null">`remark` = #{remark},</if>
  290. <if test="moderSn != null">`moder_sn` = #{moderSn},</if>
  291. <if test="modTime != null">`mod_time` = #{modTime},</if>
  292. </set>
  293. WHERE
  294. receipt_no = #{receiptNo}
  295. AND ematou_code = #{ematouCode}
  296. </update>
  297. </mapper>