MallMngChangeMapper.xml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  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.MallMngChangeMapper">
  6. <resultMap type="MallMngChange" id="MallMngChangeResult">
  7. <result property="id" column="id" />
  8. <result property="changeNum" column="change_num" />
  9. <result property="originalNum" column="original_num" />
  10. <result property="validNum" column="valid_num" />
  11. <result property="thirdPartyMerchCode" column="third_party_merch_code" />
  12. <result property="merchSn" column="merch_sn" />
  13. <result property="isValid" column="is_valid" />
  14. <result property="createrSn" column="creater_sn" />
  15. <result property="createTime" column="create_time" />
  16. <result property="moderSn" column="moder_sn" />
  17. <result property="modTime" column="mod_time" />
  18. <result property="tstm" column="tstm" />
  19. <result property="goodsId" column="goods_id" />
  20. <result property="changeType" column="change_type" />
  21. <result property="changeReason" column="change_reason" />
  22. </resultMap>
  23. <sql id="selectMallMngChangeVo">
  24. select id, change_num, original_num, valid_num, third_party_merch_code, merch_sn, is_valid, creater_sn, create_time, moder_sn, mod_time, tstm, goods_id, change_type, change_reason from mall_mng_change
  25. </sql>
  26. <select id="selectMallMngChangeList" parameterType="MallMngChange" resultMap="MallMngChangeResult">
  27. <include refid="selectMallMngChangeVo"/>
  28. <where>
  29. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode != ''"> and third_party_merch_code = #{thirdPartyMerchCode}</if>
  30. <if test="merchSn != null and merchSn != ''"> and merch_sn = #{merchSn}</if>
  31. <if test="isValid != null and isValid != ''"> and is_valid = #{isValid}</if>
  32. <if test="goodsId != null "> and goods_id = #{goodsId}</if>
  33. <if test="changeType != null and changeType != ''"> and change_type = #{changeType}</if>
  34. <if test="changeReason != null and changeReason != ''"> and change_reason = #{changeReason}</if>
  35. </where>
  36. </select>
  37. <select id="selectMallMngChangeById" parameterType="Long" resultMap="MallMngChangeResult">
  38. <include refid="selectMallMngChangeVo"/>
  39. where id = #{id}
  40. </select>
  41. <insert id="insertMallMngChange" parameterType="MallMngChange">
  42. insert into mall_mng_change
  43. <trim prefix="(" suffix=")" suffixOverrides=",">
  44. <if test="id != null">id,</if>
  45. <if test="changeNum != null">change_num,</if>
  46. <if test="originalNum != null">original_num,</if>
  47. <if test="validNum != null">valid_num,</if>
  48. <if test="thirdPartyMerchCode != null">third_party_merch_code,</if>
  49. <if test="merchSn != null">merch_sn,</if>
  50. <if test="isValid != null">is_valid,</if>
  51. <if test="createrSn != null">creater_sn,</if>
  52. <if test="createTime != null">create_time,</if>
  53. <if test="moderSn != null">moder_sn,</if>
  54. <if test="modTime != null">mod_time,</if>
  55. <if test="tstm != null">tstm,</if>
  56. <if test="goodsId != null">goods_id,</if>
  57. <if test="changeType != null">change_type,</if>
  58. <if test="changeReason != null">change_reason,</if>
  59. </trim>
  60. <trim prefix="values (" suffix=")" suffixOverrides=",">
  61. <if test="id != null">#{id},</if>
  62. <if test="changeNum != null">#{changeNum},</if>
  63. <if test="originalNum != null">#{originalNum},</if>
  64. <if test="validNum != null">#{validNum},</if>
  65. <if test="thirdPartyMerchCode != null">#{thirdPartyMerchCode},</if>
  66. <if test="merchSn != null">#{merchSn},</if>
  67. <if test="isValid != null">#{isValid},</if>
  68. <if test="createrSn != null">#{createrSn},</if>
  69. <if test="createTime != null">#{createTime},</if>
  70. <if test="moderSn != null">#{moderSn},</if>
  71. <if test="modTime != null">#{modTime},</if>
  72. <if test="tstm != null">#{tstm},</if>
  73. <if test="goodsId != null">#{goodsId},</if>
  74. <if test="changeType != null">#{changeType},</if>
  75. <if test="changeReason != null">#{changeReason},</if>
  76. </trim>
  77. </insert>
  78. <update id="updateMallMngChange" parameterType="MallMngChange">
  79. update mall_mng_change
  80. <trim prefix="SET" suffixOverrides=",">
  81. <if test="changeNum != null">change_num = #{changeNum},</if>
  82. <if test="originalNum != null">original_num = #{originalNum},</if>
  83. <if test="validNum != null">valid_num = #{validNum},</if>
  84. <if test="thirdPartyMerchCode != null">third_party_merch_code = #{thirdPartyMerchCode},</if>
  85. <if test="merchSn != null">merch_sn = #{merchSn},</if>
  86. <if test="isValid != null">is_valid = #{isValid},</if>
  87. <if test="createrSn != null">creater_sn = #{createrSn},</if>
  88. <if test="createTime != null">create_time = #{createTime},</if>
  89. <if test="moderSn != null">moder_sn = #{moderSn},</if>
  90. <if test="modTime != null">mod_time = #{modTime},</if>
  91. <if test="tstm != null">tstm = #{tstm},</if>
  92. <if test="goodsId != null">goods_id = #{goodsId},</if>
  93. <if test="changeType != null">change_type = #{changeType},</if>
  94. <if test="changeReason != null">change_reason = #{changeReason},</if>
  95. </trim>
  96. where id = #{id}
  97. </update>
  98. <delete id="deleteMallMngChangeById" parameterType="Long">
  99. delete from mall_mng_change where id = #{id}
  100. </delete>
  101. <delete id="deleteMallMngChangeByIds" parameterType="String">
  102. delete from mall_mng_change where id in
  103. <foreach item="id" collection="array" open="(" separator="," close=")">
  104. #{id}
  105. </foreach>
  106. </delete>
  107. <!-- 接收kmall数据-->
  108. <insert id="pushSalesDetaiDate" parameterType="NewSystemFormatEntiy">
  109. insert into mall_sales_detail_data
  110. <trim prefix="(" suffix=")" suffixOverrides=",">
  111. <if test="merchSn != null">merch_sn,</if>
  112. <if test="merchSnName != null">merch_sn_name,</if>
  113. <if test="thirdMerchSn != null">third_merch_sn,</if>
  114. <if test="thirdMerchSnName != null">third_merch_sn_name,</if>
  115. <if test="receiptNo != null">receipt_no,</if>
  116. <if test="storeName != null">store_name,</if>
  117. <if test="storeNameSn != null">store_name_sn,</if>
  118. <if test="cashRegisterNo != null">cash_register_no,</if>
  119. <if test="timeStampDetails != null">time_stamp,</if>
  120. <if test="staffID != null">staff_id,</if>
  121. <if test="staffName != null">staff_name,</if>
  122. <if test="payFlag != null">pay_flag,</if>
  123. <if test="orderStatus != null">order_status,</if>
  124. <if test="orderSnWx != null">order_sn_wx,</if>
  125. <if test="orderSnAli != null">order_sn_ali,</if>
  126. <if test="hsCode != null">hs_code,</if>
  127. <if test="hsCodeName != null">hs_code_name,</if>
  128. <if test="ematouCode != null">ematou_code,</if>
  129. <if test="plu != null">plu,</if>
  130. <if test="mychemID != null">mychem_id,</if>
  131. <if test="productNameEN != null">product_name_en,</if>
  132. <if test="productNameCN != null">product_name_cn,</if>
  133. <if test="barcode != null">barcode,</if>
  134. <if test="packSize != null">pack_size,</if>
  135. <if test="productSpecification != null">product_spec,</if>
  136. <if test="brand != null">brand,</if>
  137. <if test="edlp != null">edlp,</if>
  138. <if test="currentPrice != null">current_price,</if>
  139. <if test="costPrice != null">cost_price,</if>
  140. <if test="taxRate != null">tax_rate,</if>
  141. <if test="taxPrice != null">tax_price,</if>
  142. <if test="productCategory != null">product_category,</if>
  143. <if test="supplierName != null">supplier_name,</if>
  144. <if test="transactionType != null">transaction_type,</if>
  145. <if test="saleReturnType != null">sale_return_type,</if>
  146. <if test="remark != null">remark,</if>
  147. </trim>
  148. <trim prefix="values (" suffix=")" suffixOverrides=",">
  149. <if test="merchSn != null">#{merchSn},</if>
  150. <if test="merchSnName != null">#{merchSnName},</if>
  151. <if test="thirdMerchSn != null">#{thirdMerchSn},</if>
  152. <if test="thirdMerchSnName != null">#{thirdMerchSnName},</if>
  153. <if test="receiptNo != null">#{receiptNo},</if>
  154. <if test="storeName != null">#{storeName},</if>
  155. <if test="storeNameSn != null">#{storeNameSn},</if>
  156. <if test="cashRegisterNo != null">#{cashRegisterNo},</if>
  157. <if test="timeStampDetails != null">#{timeStampDetails},</if>
  158. <if test="staffID != null">#{staffID},</if>
  159. <if test="staffName != null">#{staffName},</if>
  160. <if test="payFlag != null">#{payFlag},</if>
  161. <if test="orderStatus != null">#{orderStatus},</if>
  162. <if test="orderSnWx != null">#{orderSnWx},</if>
  163. <if test="orderSnAli != null">#{orderSnAli},</if>
  164. <if test="hsCode != null">#{hsCode},</if>
  165. <if test="hsCodeName != null">#{hsCodeName},</if>
  166. <if test="ematouCode != null">#{ematouCode},</if>
  167. <if test="plu != null">#{plu},</if>
  168. <if test="mychemID != null">#{mychemID},</if>
  169. <if test="productNameEN != null">#{productNameEN},</if>
  170. <if test="productNameCN != null">#{productNameCN},</if>
  171. <if test="barcode != null">#{barcode},</if>
  172. <if test="packSize != null">#{packSize},</if>
  173. <if test="productSpecification != null">#{productSpecification},</if>
  174. <if test="brand != null">#{brand},</if>
  175. <if test="edlp != null">#{edlp},</if>
  176. <if test="currentPrice != null">#{currentPrice},</if>
  177. <if test="costPrice != null">#{costPrice},</if>
  178. <if test="taxRate != null">#{taxRate},</if>
  179. <if test="taxPrice != null">#{taxPrice},</if>
  180. <if test="productCategory != null">#{productCategory},</if>
  181. <if test="supplierName != null">#{supplierName},</if>
  182. <if test="transactionType != null">#{transactionType},</if>
  183. <if test="saleReturnType != null">#{saleReturnType},</if>
  184. <if test="remark != null">#{remark},</if>
  185. </trim>
  186. </insert>
  187. <!-- 外部接口查询订单信息-->
  188. <select id="getSalesDetaiData" parameterType="java.util.Map" resultType="com.emato.biz.domain.mall.PushSystemOdOderVo">
  189. SELECT
  190. merch_sn_name as merchSnName,
  191. third_merch_sn_name as thirdMerchSnName,
  192. receipt_no as receiptNo,
  193. store_name as storeName,
  194. store_name_sn as storeNameSn,
  195. cash_register_no as cashRegisterNo,
  196. time_stamp as timeStampDetails,
  197. staff_id as staffID,
  198. staff_name as staffName,
  199. pay_flag as payFlag,
  200. order_status as orderStatus,
  201. order_sn_wx as orderSnWx,
  202. order_sn_ali as orderSnAli,
  203. hs_code as hsCode,
  204. hs_code_name as hsCodeName,
  205. ematou_code as ematouCode,
  206. plu as plu,
  207. mychem_id as mychemID,
  208. product_name_en as productNameEN,
  209. product_name_cn as productNameCN,
  210. barcode as barcode,
  211. pack_size as packSize,
  212. product_spec as productSpecification,
  213. brand as brand,
  214. edlp as edlp,
  215. current_price as currentPrice,
  216. cost_price as costPrice,
  217. tax_rate as taxRate,
  218. tax_price as taxPrice,
  219. product_category as productCategory,
  220. supplier_name as supplierName,
  221. transaction_type as transactionType,
  222. sale_return_type as saleReturnType,
  223. remark
  224. FROM
  225. mall_sales_detail_data
  226. WHERE
  227. <if test="starTime != null and starTime != ''">
  228. time_stamp &gt; STR_TO_DATE(#{starTime}, '%Y-%m-%d %H:%i:%s')
  229. </if>
  230. <if test="endTime != null and endTime != ''">
  231. AND time_stamp &lt;= 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="orderNo !=null and orderNo !=''">
  237. AND receipt_no = #{orderNo}
  238. </if>
  239. <if test="offset != null and limit != null">
  240. limit #{offset}, #{limit}
  241. </if>
  242. </select>
  243. <select id="getTotalRecord" parameterType="java.util.Map" resultType="java.lang.Integer">
  244. SELECT
  245. count(*)
  246. FROM
  247. mall_sales_detail_data
  248. WHERE
  249. <if test="starTime != null and starTime != ''">
  250. time_stamp &gt; STR_TO_DATE(#{starTime}, '%Y-%m-%d %H:%i:%s')
  251. </if>
  252. <if test="endTime != null and endTime != ''">
  253. AND time_stamp &lt;= STR_TO_DATE(#{endTime}, '%Y-%m-%d %H:%i:%s')
  254. </if>
  255. </select>
  256. <!-- 记录外部调用接口入参-->
  257. <insert id="pullQueryData" parameterType="java.lang.String">
  258. insert into mall_sales_detail_log(
  259. <if test="msg != null and msg != '' ">msg,</if>
  260. <if test="tranDirection != null and tranDirection != '' ">tran_direction,</if>
  261. msg_date
  262. )values(
  263. <if test="msg != null and msg != ''">#{msg},</if>
  264. <if test="tranDirection != null and tranDirection != ''">#{tranDirection},</if>
  265. sysdate()
  266. )
  267. </insert>
  268. </mapper>