|
@@ -14,6 +14,7 @@
|
|
|
<where>
|
|
|
oi.sales_status = 1
|
|
|
AND sales_shipping_status > 0
|
|
|
+ AND sales_batch_id != 'KS00000000000001'
|
|
|
<if test="salesShippingStatus !=null">
|
|
|
AND sales_shipping_status = #{salesShippingStatus}
|
|
|
</if>
|
|
@@ -45,6 +46,7 @@
|
|
|
<where>
|
|
|
oi.sales_status = 1
|
|
|
AND sales_shipping_status > 0
|
|
|
+ AND sales_batch_id != 'KS00000000000001'
|
|
|
<if test="salesShippingStatus !=null">
|
|
|
AND sales_shipping_status = #{salesShippingStatus}
|
|
|
</if>
|
|
@@ -64,6 +66,273 @@
|
|
|
GROUP BY li.logistics_rst_code
|
|
|
</select>
|
|
|
|
|
|
+ <select id="getSendNum" resultType="PostOrderNum" parameterType="SalesOrder" >
|
|
|
+ SELECT
|
|
|
+ li.logistics_id AS logisticsId,
|
|
|
+ li.logistics_name AS logisticsName,
|
|
|
+ li.logistics_rst_code AS logisticsRstCode,
|
|
|
+ COUNT(oi.sales_id) AS logisticsSendNum
|
|
|
+ FROM tb_rst_logistics_info li
|
|
|
+ LEFT JOIN tb_rst_sales_order_info oi ON li.logistics_rst_code = oi.sales_post_firm
|
|
|
+ <where>
|
|
|
+ oi.sales_status = 1
|
|
|
+ AND sales_shipping_status > 0
|
|
|
+ AND sales_batch_id != 'KS00000000000001'
|
|
|
+ <if test="salesShippingStatus !=null">
|
|
|
+ AND sales_shipping_status = #{salesShippingStatus}
|
|
|
+ </if>
|
|
|
+ <if test="salesOrderStatus !=null">
|
|
|
+ AND sales_order_status = #{salesOrderStatus}
|
|
|
+ </if>
|
|
|
+ <if test="salesDeliver !=null">
|
|
|
+ AND sales_deliver = #{salesDeliver}
|
|
|
+ </if>
|
|
|
+ <if test="startDate != null and startDate != ''">
|
|
|
+ AND sales_create_time <![CDATA[>=]]> #{startDate}
|
|
|
+ </if>
|
|
|
+ <if test="endDate != null and endDate != ''">
|
|
|
+ AND sales_create_time <![CDATA[<=]]> #{endDate}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ GROUP BY li.logistics_rst_code
|
|
|
+ </select>
|
|
|
|
|
|
|
|
|
+ <select id="getDeliverNum" resultType="PostOrderNum" parameterType="SalesOrder" >
|
|
|
+ SELECT
|
|
|
+ li.logistics_id AS logisticsId,
|
|
|
+ li.logistics_name AS logisticsName,
|
|
|
+ li.logistics_rst_code AS logisticsRstCode,
|
|
|
+ COUNT(oi.sales_id) AS logisticsDeliverNum
|
|
|
+ FROM tb_rst_logistics_info li
|
|
|
+ LEFT JOIN tb_rst_sales_order_info oi ON li.logistics_rst_code = oi.sales_post_firm
|
|
|
+ <where>
|
|
|
+ oi.sales_status = 1
|
|
|
+ AND sales_shipping_status > 0
|
|
|
+ AND sales_batch_id != 'KS00000000000001'
|
|
|
+ <if test="salesShippingStatus !=null">
|
|
|
+ AND sales_shipping_status = #{salesShippingStatus}
|
|
|
+ </if>
|
|
|
+ <if test="salesOrderStatus !=null">
|
|
|
+ AND sales_order_status = #{salesOrderStatus}
|
|
|
+ </if>
|
|
|
+ <if test="salesDeliver !=null">
|
|
|
+ AND sales_deliver = #{salesDeliver}
|
|
|
+ </if>
|
|
|
+ <if test="startDate != null and startDate != ''">
|
|
|
+ AND sales_create_time <![CDATA[>=]]> #{startDate}
|
|
|
+ </if>
|
|
|
+ <if test="endDate != null and endDate != ''">
|
|
|
+ AND sales_create_time <![CDATA[<=]]> #{endDate}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ GROUP BY li.logistics_rst_code
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+ <!-- 按照批次查询订单项,并下载,订单列表主要按照订单项来排列 -->
|
|
|
+ <select id="listSalesOrderAndItemNum" parameterType="SalesOrder" resultType="Integer">
|
|
|
+ SELECT
|
|
|
+ COUNT(soi.item_id)
|
|
|
+ FROM
|
|
|
+ tb_rst_sales_order_info t
|
|
|
+ LEFT JOIN tb_rst_store_info si ON t.sales_store_id = si.store_id
|
|
|
+ LEFT JOIN tb_rst_sales_order_item soi ON t.sales_id = soi.item_order_id
|
|
|
+ <where>
|
|
|
+ <if test="isCustmerAddOrder !=null and isCustmerAddOrder == 2">
|
|
|
+ AND sales_batch_id != 'KS00000000000001'
|
|
|
+ </if>
|
|
|
+ <if test="salesIsDownload !=null and salesIsDownload !=''">
|
|
|
+ AND sales_is_download = #{salesIsDownload}
|
|
|
+ </if>
|
|
|
+ <if test="salesShippingStatus !=null">
|
|
|
+ AND sales_shipping_status = #{salesShippingStatus}
|
|
|
+ </if>
|
|
|
+ <if test="salesStatus !=null">
|
|
|
+ AND sales_status = #{salesStatus}
|
|
|
+ </if>
|
|
|
+ <if test="salesOrderStatus !=null">
|
|
|
+ AND sales_order_status = #{salesOrderStatus}
|
|
|
+ </if>
|
|
|
+ <if test="salesDeliver !=null">
|
|
|
+ AND sales_deliver = #{salesDeliver}
|
|
|
+ </if>
|
|
|
+ <if test="salesStoreId !=null and salesStoreId !=''">
|
|
|
+ AND sales_store_id = #{salesStoreId}
|
|
|
+ </if>
|
|
|
+ <if test="salesPostFirm !=null and salesPostFirm !=''">
|
|
|
+ AND sales_post_firm = #{salesPostFirm}
|
|
|
+ </if>
|
|
|
+ <if test="salesCompanyId !=null and salesCompanyId !=''">
|
|
|
+ AND sales_company_id = #{salesCompanyId}
|
|
|
+ </if>
|
|
|
+ <if test="salesId !=null">
|
|
|
+ AND sales_id = #{salesId}
|
|
|
+ </if>
|
|
|
+ <if test="salesOrderId !=null and salesOrderId !=''">
|
|
|
+ AND sales_orderId = #{salesOrderId}
|
|
|
+ </if>
|
|
|
+ <if test="salesDealCode !=null and salesDealCode !=''">
|
|
|
+ AND sales_deal_code = #{salesDealCode}
|
|
|
+ </if>
|
|
|
+ <if test="salesAddressTel !=null and salesAddressTel !=''">
|
|
|
+ AND sales_address_tel like CONCAT('%',#{salesAddressTel},'%')
|
|
|
+ </if>
|
|
|
+ <if test="salesAddressName !=null and salesAddressName !=''">
|
|
|
+ AND sales_address_name like CONCAT('%',#{salesAddressName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="salesBatchId !=null and salesBatchId !=''">
|
|
|
+ AND sales_batch_id = #{salesBatchId}
|
|
|
+ </if>
|
|
|
+ <if test="salesAddressInfo !=null and salesAddressInfo !=''">
|
|
|
+ AND sales_address_info like CONCAT('%',#{salesAddressInfo},'%')
|
|
|
+ </if>
|
|
|
+ <if test="itemProductName !=null and itemProductName !=''">
|
|
|
+ AND oi.item_product_color like CONCAT('%',#{itemProductName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="salesAdminId != null ">
|
|
|
+ AND sales_admin_id = #{salesAdminId}
|
|
|
+ </if>
|
|
|
+ <if test="salesAddType != null ">
|
|
|
+ AND sales_add_type = #{salesAddType}
|
|
|
+ </if>
|
|
|
+ <if test="itemProductName !=null and itemProductName !=''">
|
|
|
+ AND (soi.item_product_color like CONCAT('%',#{itemProductName},'%') OR soi.item_product_name LIKE CONCAT('%',#{itemProductName},'%'))
|
|
|
+ </if>
|
|
|
+ <if test="colorId !=null and colorId !=''">
|
|
|
+ AND soi.item_color_id = #{colorId}
|
|
|
+ </if>
|
|
|
+ <if test="orderDateType == null or orderDateType == 1">
|
|
|
+ <if test="startDate != null and startDate != ''">
|
|
|
+ AND sales_create_time <![CDATA[>=]]> #{startDate}
|
|
|
+ </if>
|
|
|
+ <if test="endDate != null and endDate != ''">
|
|
|
+ AND sales_create_time <![CDATA[<=]]> #{endDate}
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="orderDateType != null and orderDateType == 2">
|
|
|
+ <if test="startDate != null and startDate != ''">
|
|
|
+ AND sales_send_time <![CDATA[>=]]> #{startDate}
|
|
|
+ </if>
|
|
|
+ <if test="endDate != null and endDate != ''">
|
|
|
+ AND sales_send_time <![CDATA[<=]]> #{endDate}
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="orderDateType != null and orderDateType == 3">
|
|
|
+ <if test="startDate != null and startDate != ''">
|
|
|
+ AND sales_deliver_time <![CDATA[>=]]> #{startDate}
|
|
|
+ </if>
|
|
|
+ <if test="endDate != null and endDate != ''">
|
|
|
+ AND sales_deliver_time <![CDATA[<=]]> #{endDate}
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+ <!-- 按照批次查询订单项,并下载,订单列表主要按照订单项来排列 -->
|
|
|
+ <select id="listSalesOrderAndItem" parameterType="SalesOrder" resultType="SalesOrder">
|
|
|
+ SELECT
|
|
|
+ t.*,
|
|
|
+ soi.*,
|
|
|
+ trsc.company_name companyName,
|
|
|
+ si.store_name storeName,
|
|
|
+ ci.customer_is_solve customerIsSolve
|
|
|
+ FROM
|
|
|
+ tb_rst_sales_order_info t
|
|
|
+ LEFT JOIN tb_rst_sales_company trsc ON t.sales_company_id = trsc.company_id
|
|
|
+ LEFT JOIN tb_rst_store_info si ON t.sales_store_id = si.store_id
|
|
|
+ LEFT JOIN tb_rst_sales_order_item soi ON t.sales_id = soi.item_order_id
|
|
|
+ LEFT JOIN tb_rst_customer_info ci ON t.sales_customer_id = ci.customer_id
|
|
|
+ <where>
|
|
|
+ <if test="isCustmerAddOrder !=null and isCustmerAddOrder == 2">
|
|
|
+ AND sales_batch_id != 'KS00000000000001'
|
|
|
+ </if>
|
|
|
+ <if test="salesIsDownload !=null and salesIsDownload !=''">
|
|
|
+ AND sales_is_download = #{salesIsDownload}
|
|
|
+ </if>
|
|
|
+ <if test="salesShippingStatus !=null">
|
|
|
+ AND sales_shipping_status = #{salesShippingStatus}
|
|
|
+ </if>
|
|
|
+ <if test="salesStatus !=null">
|
|
|
+ AND sales_status = #{salesStatus}
|
|
|
+ </if>
|
|
|
+ <if test="salesOrderStatus !=null">
|
|
|
+ AND sales_order_status = #{salesOrderStatus}
|
|
|
+ </if>
|
|
|
+ <if test="salesDeliver !=null">
|
|
|
+ AND sales_deliver = #{salesDeliver}
|
|
|
+ </if>
|
|
|
+ <if test="salesStoreId !=null and salesStoreId !=''">
|
|
|
+ AND sales_store_id = #{salesStoreId}
|
|
|
+ </if>
|
|
|
+ <if test="salesPostFirm !=null and salesPostFirm !=''">
|
|
|
+ AND sales_post_firm = #{salesPostFirm}
|
|
|
+ </if>
|
|
|
+ <if test="salesCompanyId !=null and salesCompanyId !=''">
|
|
|
+ AND sales_company_id = #{salesCompanyId}
|
|
|
+ </if>
|
|
|
+ <if test="salesId !=null">
|
|
|
+ AND sales_id = #{salesId}
|
|
|
+ </if>
|
|
|
+ <if test="salesOrderId !=null and salesOrderId !=''">
|
|
|
+ AND sales_orderId = #{salesOrderId}
|
|
|
+ </if>
|
|
|
+ <if test="salesDealCode !=null and salesDealCode !=''">
|
|
|
+ AND sales_deal_code = #{salesDealCode}
|
|
|
+ </if>
|
|
|
+ <if test="salesAddressTel !=null and salesAddressTel !=''">
|
|
|
+ AND sales_address_tel like CONCAT('%',#{salesAddressTel},'%')
|
|
|
+ </if>
|
|
|
+ <if test="salesAddressName !=null and salesAddressName !=''">
|
|
|
+ AND sales_address_name like CONCAT('%',#{salesAddressName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="salesBatchId !=null and salesBatchId !=''">
|
|
|
+ AND sales_batch_id = #{salesBatchId}
|
|
|
+ </if>
|
|
|
+ <if test="salesAddressInfo !=null and salesAddressInfo !=''">
|
|
|
+ AND sales_address_info like CONCAT('%',#{salesAddressInfo},'%')
|
|
|
+ </if>
|
|
|
+ <if test="itemProductName !=null and itemProductName !=''">
|
|
|
+ AND oi.item_product_color like CONCAT('%',#{itemProductName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="salesAdminId != null ">
|
|
|
+ AND sales_admin_id = #{salesAdminId}
|
|
|
+ </if>
|
|
|
+ <if test="salesAddType != null ">
|
|
|
+ AND sales_add_type = #{salesAddType}
|
|
|
+ </if>
|
|
|
+ <if test="itemProductName !=null and itemProductName !=''">
|
|
|
+ AND (soi.item_product_color like CONCAT('%',#{itemProductName},'%') OR soi.item_product_name LIKE CONCAT('%',#{itemProductName},'%'))
|
|
|
+ </if>
|
|
|
+ <if test="colorId !=null and colorId !=''">
|
|
|
+ AND soi.item_color_id = #{colorId}
|
|
|
+ </if>
|
|
|
+ <if test="orderDateType == null or orderDateType == 1">
|
|
|
+ <if test="startDate != null and startDate != ''">
|
|
|
+ AND sales_create_time <![CDATA[>=]]> #{startDate}
|
|
|
+ </if>
|
|
|
+ <if test="endDate != null and endDate != ''">
|
|
|
+ AND sales_create_time <![CDATA[<=]]> #{endDate}
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="orderDateType != null and orderDateType == 2">
|
|
|
+ <if test="startDate != null and startDate != ''">
|
|
|
+ AND sales_send_time <![CDATA[>=]]> #{startDate}
|
|
|
+ </if>
|
|
|
+ <if test="endDate != null and endDate != ''">
|
|
|
+ AND sales_send_time <![CDATA[<=]]> #{endDate}
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="orderDateType != null and orderDateType == 3">
|
|
|
+ <if test="startDate != null and startDate != ''">
|
|
|
+ AND sales_deliver_time <![CDATA[>=]]> #{startDate}
|
|
|
+ </if>
|
|
|
+ <if test="endDate != null and endDate != ''">
|
|
|
+ AND sales_deliver_time <![CDATA[<=]]> #{endDate}
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
</mapper>
|