|
|
@@ -0,0 +1,403 @@
|
|
|
+<?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.fs.hisStore.mapper.MergedOrderMapper">
|
|
|
+
|
|
|
+ <select id="selectMergedOrderList" parameterType="com.fs.live.param.MergedOrderQueryParam" resultType="com.fs.live.vo.MergedOrderVO">
|
|
|
+ SELECT * FROM (
|
|
|
+ SELECT
|
|
|
+ o.id,
|
|
|
+ '销售订单' AS order_type_name,
|
|
|
+ NULL AS order_id,
|
|
|
+ NULL AS live_id,
|
|
|
+ NULL AS after_sales_id,
|
|
|
+ o.order_code,
|
|
|
+ o.pay_price,
|
|
|
+ o.pay_money,
|
|
|
+ o.STATUS,
|
|
|
+ o.is_package,
|
|
|
+ o.package_json,
|
|
|
+ o.item_json,
|
|
|
+ o.delivery_id,
|
|
|
+ o.finish_time,
|
|
|
+ o.create_time,
|
|
|
+ o.pay_time,
|
|
|
+ o.delivery_send_time,
|
|
|
+ NULL AS total_num,
|
|
|
+ NULL AS discount_money,
|
|
|
+ 1 AS order_type,
|
|
|
+
|
|
|
+ cu.phonenumber as salesPhone,
|
|
|
+ cu.create_time as salesCreateTime,
|
|
|
+ u.user_id as userId,
|
|
|
+ u.order_count as userOrderCount,
|
|
|
+ u.total_amount as userTotalAmount,
|
|
|
+ u.level as userLevel,
|
|
|
+ fspc.product_id as productId,
|
|
|
+ fspc.product_name as productName,
|
|
|
+ fspc.cost as cost,
|
|
|
+ o.pay_postage as payDelivery,
|
|
|
+ o.coupon_price as discountMoney,
|
|
|
+ fspc.prescribe_spec as productSpec,
|
|
|
+ fss.store_id as storeId,
|
|
|
+ fss.store_name as storeName,
|
|
|
+ fspcs.cate_name as cateName,
|
|
|
+ GROUP_CONCAT(JSON_UNQUOTE(JSON_EXTRACT(o.item_json, '$.barCode')) SEPARATOR ',') AS barCode,
|
|
|
+
|
|
|
+ c.company_name,
|
|
|
+ cu.user_name AS sales_name,
|
|
|
+ cu.nick_name AS company_user_nick_name,
|
|
|
+ u.nickname,
|
|
|
+ u.phone,
|
|
|
+ o.real_name,
|
|
|
+ o.user_phone,
|
|
|
+ o.user_address,
|
|
|
+ o.pay_type,
|
|
|
+ o.delivery_status,
|
|
|
+ o.delivery_pay_status,
|
|
|
+ o.total_price,
|
|
|
+ csc.NAME AS mini_program_name,
|
|
|
+ sp_latest.bank_transaction_id
|
|
|
+ FROM
|
|
|
+ fs_store_order_scrm o
|
|
|
+ left join ( SELECT fsois.*, ROW_NUMBER() OVER ( PARTITION BY fsois.item_id ) AS rn FROM fs_store_order_item_scrm fsois ) item_latest ON item_latest.order_id = o.id and item_latest.rn = 1
|
|
|
+ LEFT JOIN fs_user u ON o.user_id = u.user_id
|
|
|
+
|
|
|
+ LEFT JOIN fs_store_product_scrm fspc ON fspc.product_id = item_latest.product_id
|
|
|
+ LEFT JOIN fs_store_scrm fss ON fspc.store_id = fss.store_id
|
|
|
+ left join fs_store_product_category_scrm fspcs on fspc.cate_id = fspcs.cate_id
|
|
|
+
|
|
|
+ LEFT JOIN company c ON c.company_id = o.company_id
|
|
|
+ LEFT JOIN company_user cu ON cu.user_id = o.company_user_id
|
|
|
+ LEFT JOIN ( SELECT sp.*, ROW_NUMBER() OVER ( PARTITION BY sp.business_code ORDER BY sp.create_time DESC ) AS rn FROM fs_store_payment_scrm sp ) sp_latest ON sp_latest.business_code = o.order_code
|
|
|
+ AND sp_latest.rn = 1
|
|
|
+ LEFT JOIN fs_course_play_source_config csc ON csc.appid = sp_latest.app_id
|
|
|
+ WHERE o.is_del = 0 AND o.is_sys_del = 0 AND o.company_user_id IS NOT NULL AND o.company_user_id != 0
|
|
|
+ <if test="maps.status != null and maps.status != ''">
|
|
|
+ AND o.status = #{maps.status}
|
|
|
+ </if>
|
|
|
+ <if test="maps.orderCode != null and maps.orderCode != ''">
|
|
|
+ AND o.order_code LIKE CONCAT('%', #{maps.orderCode}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.orderCodeList != null and maps.orderCodeList != ''">
|
|
|
+ AND FIND_IN_SET(o.order_code, #{maps.orderCodeList})
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryId != null and maps.deliveryId != ''">
|
|
|
+ AND o.delivery_id LIKE CONCAT('%', #{maps.deliveryId}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.bankTransactionId != null and maps.bankTransactionId != ''">
|
|
|
+ AND o.bank_transaction_id LIKE CONCAT('%', #{maps.bankTransactionId}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.userPhone != null and maps.userPhone != ''">
|
|
|
+ AND o.user_phone LIKE CONCAT('%', #{maps.userPhone}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.realName != null and maps.realName != ''">
|
|
|
+ AND o.real_name LIKE CONCAT('%', #{maps.realName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.productName != null and maps.productName != ''">
|
|
|
+ AND fspc.productName LIKE CONCAT('%', #{maps.productName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryStatus != null">
|
|
|
+ AND o.delivery_status = #{maps.deliveryStatus}
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryPayStatus != null">
|
|
|
+ AND o.delivery_pay_status = #{maps.deliveryPayStatus}
|
|
|
+ </if>
|
|
|
+ <if test="maps.payType != null and maps.payType != ''">
|
|
|
+ AND o.pay_type = #{maps.payType}
|
|
|
+ </if>
|
|
|
+ <if test="maps.companyId != null">
|
|
|
+ AND o.company_id = #{maps.companyId}
|
|
|
+ </if>
|
|
|
+ <if test="maps.deptId != null">
|
|
|
+ AND o.dept_id = #{maps.deptId}
|
|
|
+ </if>
|
|
|
+ <if test="maps.salesName != null and maps.salesName != ''">
|
|
|
+ AND cu.user_name LIKE CONCAT('%', #{maps.salesName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.companyUserNickName != null and maps.companyUserNickName != ''">
|
|
|
+ AND cu.nick_name LIKE CONCAT('%', #{maps.companyUserNickName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.createTimeRange != null and maps.createTimeRange != ''">
|
|
|
+ AND DATE(o.create_time) BETWEEN SUBSTRING_INDEX(#{maps.createTimeRange}, '--', 1) AND SUBSTRING_INDEX(#{maps.createTimeRange}, '--', -1)
|
|
|
+ </if>
|
|
|
+ <if test="maps.payTimeRange != null and maps.payTimeRange != ''">
|
|
|
+ AND DATE(o.pay_time) BETWEEN SUBSTRING_INDEX(#{maps.payTimeRange}, '--', 1) AND SUBSTRING_INDEX(#{maps.payTimeRange}, '--', -1)
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliverySendTimeRange != null and maps.deliverySendTimeRange != ''">
|
|
|
+ AND DATE(o.delivery_send_time) BETWEEN SUBSTRING_INDEX(#{maps.deliverySendTimeRange}, '--', 1) AND SUBSTRING_INDEX(#{maps.deliverySendTimeRange}, '--', -1)
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryImportTimeRange != null and maps.deliveryImportTimeRange != ''">
|
|
|
+ AND DATE(o.delivery_import_time) BETWEEN SUBSTRING_INDEX(#{maps.deliveryImportTimeRange}, '--', 1) AND SUBSTRING_INDEX(#{maps.deliveryImportTimeRange}, '--', -1)
|
|
|
+ </if>
|
|
|
+ <if test="maps.appId != null and maps.appId != ''">
|
|
|
+ AND csc.appid = #{maps.appId}
|
|
|
+ </if>
|
|
|
+ group by o.id
|
|
|
+ UNION ALL
|
|
|
+ -- 商城订单(没有company_user_id的商城订单)
|
|
|
+ SELECT
|
|
|
+ o.id,
|
|
|
+ '商城订单' AS order_type_name,
|
|
|
+ NULL AS order_id,
|
|
|
+ NULL AS live_id,
|
|
|
+ NULL AS after_sales_id,
|
|
|
+ o.order_code,
|
|
|
+ o.pay_price,
|
|
|
+ o.pay_money,
|
|
|
+ o.STATUS,
|
|
|
+ o.is_package,
|
|
|
+ o.package_json,
|
|
|
+ o.item_json,
|
|
|
+ o.delivery_id,
|
|
|
+ o.finish_time,
|
|
|
+ o.create_time,
|
|
|
+ o.pay_time,
|
|
|
+ o.delivery_send_time,
|
|
|
+ NULL AS total_num,
|
|
|
+ NULL AS discount_money,
|
|
|
+ 2 AS order_type,
|
|
|
+
|
|
|
+ cu.phonenumber as salesPhone,
|
|
|
+ cu.create_time as salesCreateTime,
|
|
|
+ u.user_id as userId,
|
|
|
+ u.order_count as userOrderCount,
|
|
|
+ u.total_amount as userTotalAmount,
|
|
|
+ u.level as userLevel,
|
|
|
+ fspc.product_id as productId,
|
|
|
+ fspc.product_name as productName,
|
|
|
+ fspc.prescribe_spec as productSpec,
|
|
|
+ fspc.cost as cost,
|
|
|
+ o.pay_postage as payDelivery,
|
|
|
+ o.coupon_price as discountMoney,
|
|
|
+ fss.store_id as storeId,
|
|
|
+ fss.store_name as storeName,
|
|
|
+ fspcs.cate_name as cateName,
|
|
|
+ GROUP_CONCAT(JSON_UNQUOTE(JSON_EXTRACT(o.item_json, '$.barCode')) SEPARATOR ',') AS barCode,
|
|
|
+
|
|
|
+ c.company_name,
|
|
|
+ cu.user_name AS sales_name,
|
|
|
+ cu.nick_name AS company_user_nick_name,
|
|
|
+ u.nickname,
|
|
|
+ u.phone,
|
|
|
+ o.real_name,
|
|
|
+ o.user_phone,
|
|
|
+ o.user_address,
|
|
|
+ o.pay_type,
|
|
|
+ o.delivery_status,
|
|
|
+ o.delivery_pay_status,
|
|
|
+ o.total_price,
|
|
|
+ csc.NAME AS mini_program_name,
|
|
|
+ sp_latest.bank_transaction_id
|
|
|
+ FROM
|
|
|
+ fs_store_order_scrm o
|
|
|
+ left join ( SELECT fsois.*, ROW_NUMBER() OVER ( PARTITION BY fsois.item_id ) AS rn FROM fs_store_order_item_scrm fsois ) item_latest ON item_latest.order_id = o.id
|
|
|
+ LEFT JOIN fs_user u ON o.user_id = u.user_id
|
|
|
+
|
|
|
+ LEFT JOIN fs_store_product_scrm fspc ON fspc.product_id = item_latest.product_id
|
|
|
+ LEFT JOIN fs_store_scrm fss ON fspc.store_id = fss.store_id
|
|
|
+ left join fs_store_product_category_scrm fspcs on fspc.cate_id = fspcs.cate_id
|
|
|
+
|
|
|
+ LEFT JOIN company c ON c.company_id = o.company_id
|
|
|
+ LEFT JOIN company_user cu ON cu.user_id = o.company_user_id
|
|
|
+ LEFT JOIN ( SELECT sp.*, ROW_NUMBER() OVER ( PARTITION BY sp.business_code ORDER BY sp.create_time DESC ) AS rn FROM fs_store_payment_scrm sp ) sp_latest ON sp_latest.business_code = o.order_code
|
|
|
+ AND sp_latest.rn = 1
|
|
|
+ LEFT JOIN fs_course_play_source_config csc ON csc.appid = sp_latest.app_id
|
|
|
+ WHERE o.is_del = 0 AND o.is_sys_del = 0 AND (o.company_user_id IS NULL OR o.company_user_id = 0)
|
|
|
+ <if test="maps.status != null and maps.status != ''">
|
|
|
+ AND o.status = #{maps.status}
|
|
|
+ </if>
|
|
|
+ <if test="maps.orderCode != null and maps.orderCode != ''">
|
|
|
+ AND o.order_code LIKE CONCAT('%', #{maps.orderCode}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.orderCodeList != null and maps.orderCodeList != ''">
|
|
|
+ AND FIND_IN_SET(o.order_code, #{maps.orderCodeList})
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryId != null and maps.deliveryId != ''">
|
|
|
+ AND o.delivery_id LIKE CONCAT('%', #{maps.deliveryId}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.bankTransactionId != null and maps.bankTransactionId != ''">
|
|
|
+ AND o.bank_transaction_id LIKE CONCAT('%', #{maps.bankTransactionId}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.userPhone != null and maps.userPhone != ''">
|
|
|
+ AND o.user_phone LIKE CONCAT('%', #{maps.userPhone}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.realName != null and maps.realName != ''">
|
|
|
+ AND o.real_name LIKE CONCAT('%', #{maps.realName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.productName != null and maps.productName != ''">
|
|
|
+ AND o.item_json LIKE CONCAT('%', #{maps.productName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryStatus != null">
|
|
|
+ AND o.delivery_status = #{maps.deliveryStatus}
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryPayStatus != null">
|
|
|
+ AND o.delivery_pay_status = #{maps.deliveryPayStatus}
|
|
|
+ </if>
|
|
|
+ <if test="maps.payType != null and maps.payType != ''">
|
|
|
+ AND o.pay_type = #{maps.payType}
|
|
|
+ </if>
|
|
|
+ <if test="maps.companyId != null">
|
|
|
+ AND o.company_id = #{maps.companyId}
|
|
|
+ </if>
|
|
|
+ <if test="maps.deptId != null">
|
|
|
+ AND o.dept_id = #{maps.deptId}
|
|
|
+ </if>
|
|
|
+ <if test="maps.salesName != null and maps.salesName != ''">
|
|
|
+ AND cu.user_name LIKE CONCAT('%', #{maps.salesName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.companyUserNickName != null and maps.companyUserNickName != ''">
|
|
|
+ AND cu.nick_name LIKE CONCAT('%', #{maps.companyUserNickName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.createTimeRange != null and maps.createTimeRange != ''">
|
|
|
+ AND DATE(o.create_time) BETWEEN SUBSTRING_INDEX(#{maps.createTimeRange}, '--', 1) AND SUBSTRING_INDEX(#{maps.createTimeRange}, '--', -1)
|
|
|
+ </if>
|
|
|
+ <if test="maps.payTimeRange != null and maps.payTimeRange != ''">
|
|
|
+ AND DATE(o.pay_time) BETWEEN SUBSTRING_INDEX(#{maps.payTimeRange}, '--', 1) AND SUBSTRING_INDEX(#{maps.payTimeRange}, '--', -1)
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliverySendTimeRange != null and maps.deliverySendTimeRange != ''">
|
|
|
+ AND DATE(o.delivery_send_time) BETWEEN SUBSTRING_INDEX(#{maps.deliverySendTimeRange}, '--', 1) AND SUBSTRING_INDEX(#{maps.deliverySendTimeRange}, '--', -1)
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryImportTimeRange != null and maps.deliveryImportTimeRange != ''">
|
|
|
+ AND DATE(o.delivery_import_time) BETWEEN SUBSTRING_INDEX(#{maps.deliveryImportTimeRange}, '--', 1) AND SUBSTRING_INDEX(#{maps.deliveryImportTimeRange}, '--', -1)
|
|
|
+ </if>
|
|
|
+ <if test="maps.appId != null and maps.appId != ''">
|
|
|
+ AND csc.appid = #{maps.appId}
|
|
|
+ </if>
|
|
|
+ group by o.id
|
|
|
+ UNION ALL
|
|
|
+ -- 直播订单
|
|
|
+ SELECT NULL AS
|
|
|
+ id,
|
|
|
+ '直播订单' AS order_type_name,
|
|
|
+ o.order_id,
|
|
|
+ o.live_id,
|
|
|
+ a.id AS after_sales_id,
|
|
|
+ o.order_code,
|
|
|
+ o.pay_price,
|
|
|
+ o.pay_money,
|
|
|
+ o.STATUS,
|
|
|
+ NULL AS is_package,
|
|
|
+ NULL AS package_json,
|
|
|
+ o.item_json,
|
|
|
+ o.delivery_sn AS delivery_id,
|
|
|
+ o.finish_time,
|
|
|
+ o.create_time,
|
|
|
+ o.pay_time,
|
|
|
+ o.delivery_send_time,
|
|
|
+ o.total_num,
|
|
|
+ o.discount_money,
|
|
|
+ 3 AS order_type,
|
|
|
+
|
|
|
+ cu.phonenumber as salesPhone,
|
|
|
+ cu.create_time as salesCreateTime,
|
|
|
+ u.user_id as userId,
|
|
|
+ u.order_count as userOrderCount,
|
|
|
+ u.total_amount as userTotalAmount,
|
|
|
+ u.level as userLevel,
|
|
|
+ fspc.product_id as productId,
|
|
|
+ fspc.product_name as productName,
|
|
|
+ fspc.prescribe_spec as productSpec,
|
|
|
+ fspc.cost as cost,
|
|
|
+ o.pay_delivery as payDelivery,
|
|
|
+ o.discount_money as discountMoney,
|
|
|
+ fss.store_id as storeId,
|
|
|
+ fss.store_name as storeName,
|
|
|
+ fspcs.cate_name as cateName,
|
|
|
+ GROUP_CONCAT(JSON_UNQUOTE(JSON_EXTRACT(loi.json_info, '$.barCode')) SEPARATOR ',') AS barCode,
|
|
|
+
|
|
|
+ c.company_name,
|
|
|
+ cu.user_name AS sales_name,
|
|
|
+ cu.nick_name AS company_user_nick_name,
|
|
|
+ u.nickname,
|
|
|
+ u.phone,
|
|
|
+ o.user_name AS real_name,
|
|
|
+ o.user_phone,
|
|
|
+ o.user_address,
|
|
|
+ o.pay_type,
|
|
|
+ o.delivery_status,
|
|
|
+ o.delivery_pay_status,
|
|
|
+ o.total_price,
|
|
|
+ csc.NAME AS mini_program_name,
|
|
|
+ sp_latest.bank_transaction_id
|
|
|
+ FROM
|
|
|
+ live_order o
|
|
|
+ left join live_order_item loi on loi.order_id = o.order_id
|
|
|
+ LEFT JOIN fs_user u ON o.user_id = u.user_id
|
|
|
+
|
|
|
+ LEFT JOIN fs_store_product_scrm fspc ON fspc.product_id = o.product_id
|
|
|
+ LEFT JOIN fs_store_scrm fss ON fspc.store_id = fss.store_id
|
|
|
+ left join fs_store_product_category_scrm fspcs on fspc.cate_id = fspcs.cate_id
|
|
|
+
|
|
|
+
|
|
|
+ LEFT JOIN company c ON c.company_id = o.company_id
|
|
|
+ LEFT JOIN company_user cu ON cu.user_id = o.company_user_id
|
|
|
+ LEFT JOIN ( SELECT t.*, ROW_NUMBER() OVER ( PARTITION BY t.order_id ORDER BY t.create_time DESC ) AS rn FROM live_after_sales t ) a ON o.order_id = a.order_id
|
|
|
+ AND a.rn = 1
|
|
|
+ LEFT JOIN ( SELECT sp.*, ROW_NUMBER() OVER ( PARTITION BY sp.business_code ORDER BY sp.create_time DESC ) AS rn FROM live_order_payment sp ) sp_latest ON sp_latest.business_code = o.order_code
|
|
|
+ AND sp_latest.rn = 1
|
|
|
+ LEFT JOIN fs_course_play_source_config csc ON csc.appid = sp_latest.app_id
|
|
|
+ WHERE o.is_del = 0
|
|
|
+ <if test="maps.status != null and maps.status != ''">
|
|
|
+ AND o.status = #{maps.status}
|
|
|
+ </if>
|
|
|
+ <if test="maps.orderCode != null and maps.orderCode != ''">
|
|
|
+ AND o.order_code LIKE CONCAT('%', #{maps.orderCode}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.orderCodeList != null and maps.orderCodeList != ''">
|
|
|
+ AND FIND_IN_SET(o.order_code, #{maps.orderCodeList})
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryId != null and maps.deliveryId != ''">
|
|
|
+ AND o.delivery_sn LIKE CONCAT('%', #{maps.deliveryId}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.userPhone != null and maps.userPhone != ''">
|
|
|
+ AND o.user_phone LIKE CONCAT('%', #{maps.userPhone}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.realName != null and maps.realName != ''">
|
|
|
+ AND o.user_name LIKE CONCAT('%', #{maps.realName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.productName != null and maps.productName != ''">
|
|
|
+ AND o.item_json LIKE CONCAT('%', #{maps.productName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryStatus != null">
|
|
|
+ AND o.delivery_status = #{maps.deliveryStatus}
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliveryPayStatus != null">
|
|
|
+ AND o.delivery_pay_status = #{maps.deliveryPayStatus}
|
|
|
+ </if>
|
|
|
+ <if test="maps.payType != null and maps.payType != ''">
|
|
|
+ AND o.pay_type = #{maps.payType}
|
|
|
+ </if>
|
|
|
+ <if test="maps.companyId != null">
|
|
|
+ AND o.company_id = #{maps.companyId}
|
|
|
+ </if>
|
|
|
+ <if test="maps.deptId != null">
|
|
|
+ AND o.dept_id = #{maps.deptId}
|
|
|
+ </if>
|
|
|
+ <if test="maps.salesName != null and maps.salesName != ''">
|
|
|
+ AND cu.user_name LIKE CONCAT('%', #{maps.salesName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.companyUserNickName != null and maps.companyUserNickName != ''">
|
|
|
+ AND cu.nick_name LIKE CONCAT('%', #{maps.companyUserNickName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.createTimeRange != null and maps.createTimeRange != ''">
|
|
|
+ AND DATE(o.create_time) BETWEEN SUBSTRING_INDEX(#{maps.createTimeRange}, '--', 1) AND SUBSTRING_INDEX(#{maps.createTimeRange}, '--', -1)
|
|
|
+ </if>
|
|
|
+ <if test="maps.payTimeRange != null and maps.payTimeRange != ''">
|
|
|
+ AND DATE(o.pay_time) BETWEEN SUBSTRING_INDEX(#{maps.payTimeRange}, '--', 1) AND SUBSTRING_INDEX(#{maps.payTimeRange}, '--', -1)
|
|
|
+ </if>
|
|
|
+ <if test="maps.deliverySendTimeRange != null and maps.deliverySendTimeRange != ''">
|
|
|
+ AND DATE(o.delivery_send_time) BETWEEN SUBSTRING_INDEX(#{maps.deliverySendTimeRange}, '--', 1) AND SUBSTRING_INDEX(#{maps.deliverySendTimeRange}, '--', -1)
|
|
|
+ </if>
|
|
|
+ group by o.order_id
|
|
|
+ ) AS merged_orders
|
|
|
+ WHERE 1=1
|
|
|
+ <if test="maps.orderTypeFilter != null">
|
|
|
+ AND order_type = #{maps.orderTypeFilter}
|
|
|
+ </if>
|
|
|
+ ORDER BY create_time DESC
|
|
|
+ </select>
|
|
|
+
|
|
|
+</mapper>
|
|
|
+
|