123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper
- PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.emato.biz.mapper.mall.SalesDetailMapper">
- <!-- 记录请求操作日志 -->
- <insert id="insertSalesDataReqLog">
- insert into mall_sales_detail_log(
- msg,
- tran_direction,
- msg_date
- ) VALUES (
- <if test="reqData != null and reqData != ''">#{reqData},</if>
- <if test="merchSn != null and merchSn != ''">#{merchSn},</if>
- sysdate()
- )
- </insert>
- <!-- 查询销售数据 -->
- <select id="selectSalesDetailData" resultType="com.emato.biz.domain.mall.NewSystemFormatEntiy" parameterType="com.emato.biz.domain.mall.SalesDataReqVO">
- SELECT
- merch_sn,
- merch_sn_name,
- third_merch_sn,
- third_merch_sn_name,
- receipt_no,
- store_name,
- store_name_sn,
- cash_register_no,
- time_stamp,
- staff_id,
- staff_name,
- pay_flag,
- order_status,
- order_sn_wx,
- order_sn_ali,
- hs_code,
- hs_code_name,
- ematou_code,
- plu,
- mychem_id,
- product_name_en,
- product_name_cn,
- barcode,
- pack_size,
- product_spec,
- brand,
- edlp,
- current_price,
- cost_price,
- tax_rate,
- product_category,
- supplier_name,
- transaction_type,
- sale_return_type,
- remark
- FROM
- mall_sales_detail_data
- <where>
- <if test="orderNo != null and orderNo != '' ">
- AND receipt_no = #{orderNo}
- </if>
- <if test="ematouCode != null and ematouCode != '' ">
- AND ematou_code = #{ematouCode}
- </if>
- <if test="starTime != null and starTime != '' ">
- AND time_stamp > #{starTime}
- </if>
- <if test="endTime != null and endTime != '' ">
- AND time_stamp <= #{endTime}
- </if>
- <if test="orderStatus != null and orderStatus != '' ">
- AND order_status <= #{orderStatus}
- </if>
- </where>
- <if test="offset != null and limit != null">
- limit #{offset}, #{limit}
- </if>
- </select>
- <!-- 查询销售数据条数 -->
- <select id="selectSalesDetailDataTotal" resultType="int">
- SELECT
- COUNT(1)
- FROM
- mall_sales_detail_data
- <where>
- <if test="orderNo != null and orderNo != '' ">
- AND receipt_no = #{orderNo}
- </if>
- <if test="starTime != null and starTime != '' ">
- AND time_stamp > #{starTime}
- </if>
- <if test="endTime != null and endTime != '' ">
- AND time_stamp <= #{endTime}
- </if>
- <if test="endTime != null and endTime != '' ">
- AND time_stamp <= #{endTime}
- </if>
- <if test="orderStatus != null and orderStatus != '' ">
- AND order_status <= #{orderStatus}
- </if>
- </where>
- </select>
- <!-- 接收kmall数据-->
- <insert id="insertSalesDetaiDate" parameterType="com.emato.biz.domain.mall.NewSystemFormatEntiy">
- insert into mall_sales_detail_data(
- <if test="merchSn != null">merch_sn,</if>
- <if test="merchSnName != null">merch_sn_name,</if>
- <if test="thirdMerchSn != null">third_merch_sn,</if>
- <if test="thirdMerchSnName != null">third_merch_sn_name,</if>
- <if test="receiptNo != null">receipt_no,</if>
- <if test="storeName != null">store_name,</if>
- <if test="storeNameSn != null">store_name_sn,</if>
- <if test="cashRegisterNo != null">cash_register_no,</if>
- <if test="timeStampDetails != null">time_stamp,</if>
- <if test="staffID != null">staff_id,</if>
- <if test="staffName != null">staff_name,</if>
- <if test="payFlag != null">pay_flag,</if>
- <if test="orderStatus != null">order_status,</if>
- <if test="orderSnWx != null">order_sn_wx,</if>
- <if test="orderSnAli != null">order_sn_ali,</if>
- <if test="hsCode != null">hs_code,</if>
- <if test="hsCodeName != null">hs_code_name,</if>
- <if test="ematouCode != null">ematou_code,</if>
- <if test="plu != null">plu,</if>
- <if test="mychemID != null">mychem_id,</if>
- <if test="productNameEN != null">product_name_en,</if>
- <if test="productNameCN != null">product_name_cn,</if>
- <if test="barcode != null">barcode,</if>
- <if test="packSize != null">pack_size,</if>
- <if test="productSpecification != null">product_spec,</if>
- <if test="brand != null">brand,</if>
- <if test="edlp != null">edlp,</if>
- <if test="currentPrice != null">current_price,</if>
- <if test="costPrice != null">cost_price,</if>
- <if test="taxRate != null">tax_rate,</if>
- <if test="productCategory != null">product_category,</if>
- <if test="supplierName != null">supplier_name,</if>
- <if test="transactionType != null">transaction_type,</if>
- <if test="saleReturnType != null">sale_return_type,</if>
- <if test="remark != null">remark,</if>
- <if test="createSn != null">creater_sn,</if>
- <if test="createTime != null">create_time</if>
- )values(
- <if test="merchSn != null">#{merchSn},</if>
- <if test="merchSnName != null">#{merchSnName},</if>
- <if test="thirdMerchSn != null">#{thirdMerchSn},</if>
- <if test="thirdMerchSnName != null">#{thirdMerchSnName},</if>
- <if test="receiptNo != null">#{receiptNo},</if>
- <if test="storeName != null">#{storeName},</if>
- <if test="storeNameSn != null">#{storeNameSn},</if>
- <if test="cashRegisterNo != null">#{cashRegisterNo},</if>
- <if test="timeStampDetails != null">#{timeStampDetails},</if>
- <if test="staffID != null">#{staffID},</if>
- <if test="staffName != null">#{staffName},</if>
- <if test="payFlag != null">#{payFlag},</if>
- <if test="orderStatus != null">#{orderStatus},</if>
- <if test="orderSnWx != null">#{orderSnWx},</if>
- <if test="orderSnAli != null">#{orderSnAli},</if>
- <if test="hsCode != null">#{hsCode},</if>
- <if test="hsCodeName != null">#{hsCodeName},</if>
- <if test="ematouCode != null">#{ematouCode},</if>
- <if test="plu != null">#{plu},</if>
- <if test="mychemID != null">#{mychemID},</if>
- <if test="productNameEN != null">#{productNameEN},</if>
- <if test="productNameCN != null">#{productNameCN},</if>
- <if test="barcode != null">#{barcode},</if>
- <if test="packSize != null">#{packSize},</if>
- <if test="productSpecification != null">#{productSpecification},</if>
- <if test="brand != null">#{brand},</if>
- <if test="edlp != null">#{edlp},</if>
- <if test="currentPrice != null">#{currentPrice},</if>
- <if test="costPrice != null">#{costPrice},</if>
- <if test="taxRate != null">#{taxRate},</if>
- <if test="productCategory != null">#{productCategory},</if>
- <if test="supplierName != null">#{supplierName},</if>
- <if test="transactionType != null">#{transactionType},</if>
- <if test="saleReturnType != null">#{saleReturnType},</if>
- <if test="remark != null">#{remark},</if>
- <if test="createSn != null">#{createSn},</if>
- <if test="createTime != null">#{createTime}</if>
- )
- </insert>
- <!-- 外部接口查询订单信息-->
- <select id="getSalesDetaiData" parameterType="java.util.Map" resultType="com.emato.biz.domain.mall.NewSystemFormatEntiy">
- SELECT
- merch_sn,
- merch_sn_name,
- third_merch_sn,
- third_merch_sn_name,
- receipt_no,
- store_name,
- store_name_sn,
- cash_register_no,
- time_stamp,
- staff_id,
- staff_name,
- pay_flag,
- order_status,
- order_sn_wx,
- order_sn_ali,
- hs_code,
- hs_code_name,
- ematou_code,
- plu,
- mychem_id,
- product_name_en,
- product_name_cn,
- barcode,
- pack_size,
- product_spec,
- brand,
- edlp,
- current_price,
- cost_price,
- tax_rate,
- product_category,
- supplier_name,
- transaction_type,
- sale_return_type,
- remark,
- create_time
- FROM
- mall_sales_detail_data
- WHERE
- STR_TO_DATE(create_time, '%Y-%m-%d %H:%i:%s')
- BETWEEN
- <if test="starTime !=null and starTime !=''">
- STR_TO_DATE(#{starTime}, '%Y-%m-%d %H:%i:%s')
- </if>
- <if test="endTime !=null and endTime !=''">
- AND STR_TO_DATE(#{endTime}, '%Y-%m-%d %H:%i:%s')
- </if>
- <if test="orderStatus !=null and orderStatus !=''">
- AND order_status = #{orderStatus}
- </if>
- <if test="pageIndex != null and pageSize != null">
- limit #{pageIndex}, #{pageSize}
- </if>
- </select>
- <!-- 记录外部调用接口入参-->
- <insert id="pullQueryData" parameterType="java.util.Map">
- insert into mall_sales_detail_log
- <if test="msg != null and msg != '' ">msg,</if>
- <if test="tranDirection != null and tranDirection != '' ">tran_direction,</if>
- datasyn_time
- )values(
- <if test="msg != null and msg != ''">#{msg},</if>
- <if test="tranDirection != null and tranDirection != ''">#{tranDirection},</if>
- sysdate()
- )
- </insert>
- <update id="updateSalesDetailData" parameterType="com.emato.biz.domain.mall.NewSystemFormatEntiy">
- update mall_sales_detail_data
- <set>
- <if test="merchSn != null">`merch_sn` = #{merchSn},</if>
- <if test="merchSnName != null">`merch_sn_name` = #{merchSnName},</if>
- <if test="thirdMerchSn != null">`third_merch_sn` = #{thirdMerchSn},</if>
- <if test="thirdMerchSnName != null">`third_merch_sn_name` = #{thirdMerchSnName},</if>
- <if test="storeName != null">`store_name` = #{storeName},</if>
- <if test="storeNameSn != null">`store_name_sn` = #{storeNameSn},</if>
- <if test="cashRegisterNo != null">`cash_register_no` = #{cashRegisterNo},</if>
- <if test="timeStampDetails != null">`time_stamp` = #{timeStampDetails},</if>
- <if test="staffID != null">`staff_id` = #{staffID},</if>
- <if test="staffName != null">`staff_name` = #{staffName},</if>
- <if test="payFlag != null">`pay_flag` = #{payFlag},</if>
- <if test="orderStatus != null">`order_status` = #{orderStatus},</if>
- <if test="orderSnWx != null">`order_sn_wx` = #{orderSnWx},</if>
- <if test="orderSnAli != null">`order_sn_ali` = #{orderSnAli},</if>
- <if test="hsCode != null">`hs_code` = #{hsCode},</if>
- <if test="hsCodeName != null">`hs_code_name` = #{hsCodeName},</if>
- <if test="ematouCode != null">`ematou_code` = #{ematouCode},</if>
- <if test="plu != null">`plu` = #{plu},</if>
- <if test="mychemID != null">`mychem_id` = #{mychemID},</if>
- <if test="productNameEN != null">`product_name_en` = #{productNameEN},</if>
- <if test="productNameCN != null">`product_name_cn` = #{productNameCN},</if>
- <if test="barcode != null">`barcode` = #{barcode},</if>
- <if test="packSize != null">`pack_size` = #{packSize},</if>
- <if test="productSpecification != null">`product_spec` = #{productSpecification},</if>
- <if test="brand != null">`brand` = #{brand},</if>
- <if test="edlp != null">`edlp` = #{edlp},</if>
- <if test="currentPrice != null">`current_price` = #{currentPrice},</if>
- <if test="costPrice != null">`cost_price` = #{costPrice},</if>
- <if test="taxPrice != null">`tax_price` = #{taxPrice},</if>
- <if test="taxRate != null">`tax_rate` = #{taxRate},</if>
- <if test="productCategory != null">`product_category` = #{productCategory},</if>
- <if test="supplierName != null">`supplier_name` = #{supplierName},</if>
- <if test="transactionType != null">`transaction_type` = #{transactionType},</if>
- <if test="saleReturnType != null">`sale_return_type` = #{saleReturnType},</if>
- <if test="remark != null">`remark` = #{remark},</if>
- <if test="moderSn != null">`moder_sn` = #{moderSn},</if>
- <if test="modTime != null">`mod_time` = #{modTime},</if>
- </set>
- WHERE
- receipt_no = #{receiptNo}
- AND ematou_code = #{ematouCode}
- </update>
- </mapper>
|