| 
					
				 | 
			
			
				@@ -0,0 +1,313 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+<?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.kmall.admin.dao.SalesDetailMapper"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+<!--    抓取订单销售明细数据--> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <select id="querySalesSystemFormatList" resultType="com.kmall.admin.dto.NewSystemFormatEntiy"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        SELECT distinct 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        o.id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        g.goods_id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        o.order_sn as receiptNo, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        u.username as cashRegisterNo, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        o.create_time as timeStampDetails, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        u.username as staffID, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        u.username as staffName, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        gs.hs_code as hsCode, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        gs.hs_code_name as hsCodeName, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        gs.goods_sn as ematouCode, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        gs.plu as plu, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        gs.mychem_id as mychemID, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        gs.english_name as productNameEN, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        gs.name as productNameCN, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        gs.prod_barcode as barcode, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        gs.ciq_prod_model as packSize, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        gs.goods_number as goodsNumber, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        uc.name as productSpecification, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        b.name as brand, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        gs.daily_price as edlp, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        sr.bottom_line_price as costPrice, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        sr.bottom_line_price*gs.goods_number as primeCost, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        g.number as unitSold, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        g.actual_payment_amount as totalSalesInclTax, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        gs.goods_rate as taxRate, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        '专柜单品' as productCategory, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        sup.child_supplier_name as supplierName, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        '300' as orderStatus, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        g.tax_price as taxPrice, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        s.store_name as storeName, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        s.store_number as storeNameSn, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        o.pay_flag as payFlag, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        o.pay_transaction_id as orderSnWx, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        o.ali_trade_no as orderSnAli 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        FROM 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        mall_order o 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        LEFT JOIN mall_order_goods g ON o.id = g.order_id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        left join mall_store s on o.store_id = s.id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        LEFT JOIN mall_goods gs ON g.goods_id = gs.id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        left join mall_sale_record record on record.order_sn = o.order_sn 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        LEFT JOIN sys_user u ON record.saller_id = u.user_id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        left join sys_cus_unit_code uc on uc.code = gs.unit_code 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        left join mall_product_store_rela sr on sr.goods_id=gs.id and sr.store_id = o.store_id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        left join mall_brand b on b.id=sr.brand_id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        left join mall_supplier sup on gs.supplier_id = sup.id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        WHERE 1=1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <if test="orderSn != null and orderSn.trim() != ''"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            AND o.order_sn LIKE concat('%',#{orderSn},'%') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <choose> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <when test="orderStatus != null and orderStatus.trim() != ''"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                AND o.order_status = #{orderStatus} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </when> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <otherwise> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                AND o.order_status in ('401','300') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </otherwise> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </choose> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <if test="isOnfiilineOrder != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            AND o.is_onffline_order = #{isOnfiilineOrder} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <if test="startTime != null and startTime != ''"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            AND o.add_time <![CDATA[ >  ]]> STR_TO_DATE(#{startTime}, '%Y-%m-%d %H:%i:%s') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <if test="endTime != null and endTime != ''"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            AND o.add_time <![CDATA[ <  ]]>  STR_TO_DATE(#{endTime}, '%Y-%m-%d %H:%i:%s') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <if test="storeName != null and storeName != ''"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            AND s.store_name LIKE concat('%',#{storeName},'%') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        union 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        SELECT distinct 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        o.id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        g.goods_id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        o.order_sn as receiptNo, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        u.username as cashRegisterNo, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        mor.refund_time as timeStampDetails, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        u.username as staffID, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        u.username as staffName, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        gs.hs_code as hsCode, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        gs.hs_code_name as hsCodeName, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        gs.goods_sn as ematouCode, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        gs.plu as plu, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        gs.mychem_id as mychemID, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        gs.english_name as productNameEN, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        gs.name as productNameCN, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        gs.prod_barcode as barcode, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        gs.ciq_prod_model as packSize, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        gs.goods_number as goodsNumber, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        uc.name as productSpecification, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        b.name as brand, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        gs.daily_price as edlp, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        sr.bottom_line_price as costPrice, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        sr.bottom_line_price*gs.goods_number as primeCost, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        g.number as unitSold, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        g.actual_payment_amount as totalSalesInclTax, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        gs.goods_rate as taxRate, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        '专柜单品' as productCategory, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        sup.child_supplier_name as supplierName, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        o.order_status as orderStatus, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        g.tax_price as taxPrice, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        s.store_name as storeName, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        s.store_number as storeNameSn, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        o.pay_flag as payFlag, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        o.pay_transaction_id as orderSnWx, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        o.ali_trade_no as orderSnAli 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        FROM 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        mall_order o 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        LEFT JOIN mall_order_goods g ON o.id = g.order_id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        left join mall_store s on o.store_id = s.id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        LEFT JOIN mall_goods gs ON g.goods_id = gs.id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        left join mall_sale_record record on record.order_sn = o.order_sn 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        LEFT JOIN sys_user u ON record.saller_id = u.user_id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        left join sys_cus_unit_code uc on uc.code = gs.unit_code 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        left join mall_product_store_rela sr on sr.goods_id=gs.id and sr.store_id = o.store_id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        left join mall_brand b on b.id=sr.brand_id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        left join mall_supplier sup on gs.supplier_id = sup.id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        left join mall_order_refund mor on mor.out_refund_no = o.order_sn 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        WHERE 1=1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <if test="orderSn != null and orderSn.trim() != ''"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            AND o.order_sn LIKE concat('%',#{orderSn},'%') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <choose> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <when test="orderStatus != null and orderStatus.trim() != ''"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                AND o.order_status = #{orderStatus} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </when> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <otherwise> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                AND o.order_status = '401' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </otherwise> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </choose> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <if test="isOnfiilineOrder != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            AND o.is_onffline_order = #{isOnfiilineOrder} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <if test="startTime != null and startTime != ''"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            AND mor.create_time <![CDATA[ >  ]]> STR_TO_DATE(#{startTime}, '%Y-%m-%d %H:%i:%s') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <if test="endTime != null and endTime != ''"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            AND mor.create_time <![CDATA[ <  ]]> STR_TO_DATE(#{endTime}, '%Y-%m-%d %H:%i:%s') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <if test="storeName != null and storeName != ''"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            AND s.store_name LIKE concat('%',#{storeName},'%') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    </select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <!--记录推送数据--> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <insert id="writebackSalesDet" parameterType="com.kmall.admin.dto.NewSystemFormatEntiy"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        insert into mall_sales_detail_data_log 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <trim prefix="(" suffix=")" suffixOverrides=","> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <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">ash_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="salesDetStatus != null">det_status,</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="salesDetMsg != null">det_msg,</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            det_date 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </trim> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <trim prefix="values (" suffix=")" suffixOverrides=","> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <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="salesDetStatus != null">#{salesDetStatus},</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="salesDetMsg != null">#{salesDetMsg},</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            sysdate() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </trim> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    </insert> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <!-- 根据key,查询value --> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <select id="querySalesByKey" parameterType="string" resultType="string"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		select value from sys_config where `key` = #{key} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	</select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+<!--    查询商户名称和第三方商户信息--> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <select id="queryMerch" parameterType="java.lang.String" resultType="com.kmall.admin.dto.NewSystemFormatEntiy"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        SELECT 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            mall.merch_name as merchSnName, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            biz.third_party_merch_code as thirdMerchSn, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            biz.third_party_merch_name as thirdMerchSnName 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        FROM 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            mall_merch mall 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        LEFT JOIN third_merchant_biz biz ON mall.merch_sn = biz.merch_sn 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        WHERE 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            mall.merch_sn = #{merchSn} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    </select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <!--数据重推--> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <select id="querySalesAgain"  parameterType="java.util.Map" resultType="com.kmall.admin.dto.NewSystemFormatEntiy"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        SELECT 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        merch_sn, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        merch_sn_name, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        third_merch_sn, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        third_merch_sn_name, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        receipt_no, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        store_name, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        store_name_sn, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        ash_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_log 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        WHERE 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <if test="startTime != null and startTime != ''"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            det_date > STR_TO_DATE(#{startTime}, '%Y-%m-%d %H:%i:%s') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <if test="endTime != null and endTime != ''"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            AND det_date <= STR_TO_DATE(#{endTime}, '%Y-%m-%d %H:%i:%s') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            AND det_status = 2 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    </select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+</mapper> 
			 |