|
@@ -64,87 +64,92 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
sp_latest.bank_transaction_id,
|
|
sp_latest.bank_transaction_id,
|
|
|
CONCAT('store-',sp_latest.pay_code) as hfshh
|
|
CONCAT('store-',sp_latest.pay_code) as hfshh
|
|
|
FROM
|
|
FROM
|
|
|
- fs_store_order_scrm o
|
|
|
|
|
- left join ( SELECT fsois.*, ROW_NUMBER() OVER ( PARTITION BY fsois.order_id ORDER 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_user cu ON cu.user_id = o.company_user_id
|
|
|
|
|
- LEFT JOIN company c ON c.company_id = cu.company_id
|
|
|
|
|
- LEFT JOIN ( SELECT sp.*, ROW_NUMBER() OVER ( PARTITION BY sp.business_order_id ORDER BY sp.create_time DESC ) AS rn FROM fs_store_payment_scrm sp ) sp_latest ON sp_latest.business_order_id = o.id
|
|
|
|
|
- AND sp_latest.rn = 1
|
|
|
|
|
- LEFT JOIN fs_course_play_source_config csc ON csc.appid = sp_latest.app_id
|
|
|
|
|
- WHERE o.company_id IS NOT NULL
|
|
|
|
|
|
|
+ (
|
|
|
|
|
+ SELECT * FROM fs_store_order_scrm
|
|
|
|
|
+ WHERE company_id IS NOT NULL AND is_del = 0 AND is_sys_del = 0
|
|
|
<if test="maps.status != null and maps.status != ''">
|
|
<if test="maps.status != null and maps.status != ''">
|
|
|
- AND o.status = #{maps.status}
|
|
|
|
|
|
|
+ AND status = #{maps.status}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="maps.userId != null and maps.userId != ''">
|
|
<if test="maps.userId != null and maps.userId != ''">
|
|
|
- AND o.company_user_id = #{maps.userId}
|
|
|
|
|
- </if>
|
|
|
|
|
-
|
|
|
|
|
- <if test="maps.productId != null and maps.productId != ''">
|
|
|
|
|
- AND fspc.product_id = #{maps.productId}
|
|
|
|
|
|
|
+ AND company_user_id = #{maps.userId}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="maps.orderCode != null and maps.orderCode != ''">
|
|
<if test="maps.orderCode != null and maps.orderCode != ''">
|
|
|
- AND o.order_code LIKE CONCAT('%', #{maps.orderCode}, '%')
|
|
|
|
|
|
|
+ AND order_code LIKE CONCAT('%', #{maps.orderCode}, '%')
|
|
|
</if>
|
|
</if>
|
|
|
<if test="maps.orderCodeList != null and maps.orderCodeList != ''">
|
|
<if test="maps.orderCodeList != null and maps.orderCodeList != ''">
|
|
|
- AND FIND_IN_SET(o.order_code, #{maps.orderCodeList})
|
|
|
|
|
|
|
+ AND FIND_IN_SET(order_code, #{maps.orderCodeList})
|
|
|
</if>
|
|
</if>
|
|
|
<if test="maps.deliveryId != null and maps.deliveryId != ''">
|
|
<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 sp_latest.bank_transaction_id LIKE CONCAT('%', #{maps.bankTransactionId}, '%')
|
|
|
|
|
|
|
+ AND delivery_id LIKE CONCAT('%', #{maps.deliveryId}, '%')
|
|
|
</if>
|
|
</if>
|
|
|
<if test="maps.userPhone != null and maps.userPhone != ''">
|
|
<if test="maps.userPhone != null and maps.userPhone != ''">
|
|
|
- AND o.user_phone LIKE CONCAT('%', #{maps.userPhone}, '%')
|
|
|
|
|
|
|
+ AND user_phone LIKE CONCAT('%', #{maps.userPhone}, '%')
|
|
|
</if>
|
|
</if>
|
|
|
<if test="maps.userAddress != null and maps.userAddress != ''">
|
|
<if test="maps.userAddress != null and maps.userAddress != ''">
|
|
|
- AND o.user_address LIKE CONCAT('%', #{maps.userAddress}, '%')
|
|
|
|
|
|
|
+ AND user_address LIKE CONCAT('%', #{maps.userAddress}, '%')
|
|
|
</if>
|
|
</if>
|
|
|
<if test="maps.realName != null and maps.realName != ''">
|
|
<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.product_name LIKE CONCAT('%', #{maps.productName}, '%')
|
|
|
|
|
|
|
+ AND real_name LIKE CONCAT('%', #{maps.realName}, '%')
|
|
|
</if>
|
|
</if>
|
|
|
<if test="maps.deliveryStatus != null">
|
|
<if test="maps.deliveryStatus != null">
|
|
|
- AND o.delivery_status = #{maps.deliveryStatus}
|
|
|
|
|
|
|
+ AND delivery_status = #{maps.deliveryStatus}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="maps.deliveryPayStatus != null">
|
|
<if test="maps.deliveryPayStatus != null">
|
|
|
- AND o.delivery_pay_status = #{maps.deliveryPayStatus}
|
|
|
|
|
|
|
+ AND delivery_pay_status = #{maps.deliveryPayStatus}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="maps.payType != null and maps.payType != ''">
|
|
<if test="maps.payType != null and maps.payType != ''">
|
|
|
- AND o.pay_type = #{maps.payType}
|
|
|
|
|
|
|
+ AND pay_type = #{maps.payType}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="maps.companyId != null">
|
|
<if test="maps.companyId != null">
|
|
|
- AND o.company_id = #{maps.companyId}
|
|
|
|
|
|
|
+ AND company_id = #{maps.companyId}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="maps.deptId != null">
|
|
<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}, '%')
|
|
|
|
|
|
|
+ AND dept_id = #{maps.deptId}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="maps.createTimeRange != null and maps.createTimeRange != ''">
|
|
<if test="maps.createTimeRange != null and maps.createTimeRange != ''">
|
|
|
- AND o.create_time BETWEEN SUBSTRING_INDEX(#{maps.createTimeRange}, '--', 1) AND SUBSTRING_INDEX(#{maps.createTimeRange}, '--', -1)
|
|
|
|
|
|
|
+ AND create_time BETWEEN SUBSTRING_INDEX(#{maps.createTimeRange}, '--', 1) AND SUBSTRING_INDEX(#{maps.createTimeRange}, '--', -1)
|
|
|
</if>
|
|
</if>
|
|
|
<if test="maps.payTimeRange != null and maps.payTimeRange != ''">
|
|
<if test="maps.payTimeRange != null and maps.payTimeRange != ''">
|
|
|
- AND o.pay_time BETWEEN SUBSTRING_INDEX(#{maps.payTimeRange}, '--', 1) AND SUBSTRING_INDEX(#{maps.payTimeRange}, '--', -1)
|
|
|
|
|
|
|
+ AND pay_time BETWEEN SUBSTRING_INDEX(#{maps.payTimeRange}, '--', 1) AND SUBSTRING_INDEX(#{maps.payTimeRange}, '--', -1)
|
|
|
</if>
|
|
</if>
|
|
|
<if test="maps.deliverySendTimeRange != null and maps.deliverySendTimeRange != ''">
|
|
<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)
|
|
|
|
|
|
|
+ AND DATE(delivery_send_time) BETWEEN SUBSTRING_INDEX(#{maps.deliverySendTimeRange}, '--', 1) AND SUBSTRING_INDEX(#{maps.deliverySendTimeRange}, '--', -1)
|
|
|
</if>
|
|
</if>
|
|
|
<if test="maps.deliveryImportTimeRange != null and maps.deliveryImportTimeRange != ''">
|
|
<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)
|
|
|
|
|
|
|
+ AND DATE(delivery_import_time) BETWEEN SUBSTRING_INDEX(#{maps.deliveryImportTimeRange}, '--', 1) AND SUBSTRING_INDEX(#{maps.deliveryImportTimeRange}, '--', -1)
|
|
|
|
|
+ </if>
|
|
|
|
|
+ ORDER BY create_time DESC
|
|
|
|
|
+ limit 1000
|
|
|
|
|
+ ) o
|
|
|
|
|
+ left join ( SELECT fsois.*, ROW_NUMBER() OVER ( PARTITION BY fsois.order_id ORDER 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_user cu ON cu.user_id = o.company_user_id
|
|
|
|
|
+ LEFT JOIN company c ON c.company_id = cu.company_id
|
|
|
|
|
+ LEFT JOIN ( SELECT sp.*, ROW_NUMBER() OVER ( PARTITION BY sp.business_order_id ORDER BY sp.create_time DESC ) AS rn FROM fs_store_payment_scrm sp ) sp_latest ON sp_latest.business_order_id = o.id
|
|
|
|
|
+ AND sp_latest.rn = 1
|
|
|
|
|
+ LEFT JOIN fs_course_play_source_config csc ON csc.appid = sp_latest.app_id
|
|
|
|
|
+ WHERE 1=1
|
|
|
|
|
+ <!-- 需要 JOIN 后才能过滤的条件 -->
|
|
|
|
|
+ <if test="maps.productId != null and maps.productId != ''">
|
|
|
|
|
+ AND fspc.product_id = #{maps.productId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.bankTransactionId != null and maps.bankTransactionId != ''">
|
|
|
|
|
+ AND sp_latest.bank_transaction_id LIKE CONCAT('%', #{maps.bankTransactionId}, '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.productName != null and maps.productName != ''">
|
|
|
|
|
+ AND fspc.product_name LIKE CONCAT('%', #{maps.productName}, '%')
|
|
|
|
|
+ </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>
|
|
|
<if test="maps.appId != null and maps.appId != ''">
|
|
<if test="maps.appId != null and maps.appId != ''">
|
|
|
AND csc.appid = #{maps.appId}
|
|
AND csc.appid = #{maps.appId}
|
|
@@ -154,7 +159,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</if>
|
|
</if>
|
|
|
group by o.id
|
|
group by o.id
|
|
|
UNION ALL
|
|
UNION ALL
|
|
|
- -- 商城订单(没有company_user_id的商城订单)
|
|
|
|
|
|
|
+
|
|
|
SELECT
|
|
SELECT
|
|
|
o.id,
|
|
o.id,
|
|
|
'商城订单' AS order_type_name,
|
|
'商城订单' AS order_type_name,
|
|
@@ -213,86 +218,92 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
sp_latest.bank_transaction_id,
|
|
sp_latest.bank_transaction_id,
|
|
|
CONCAT('store-',sp_latest.pay_code) as hfshh
|
|
CONCAT('store-',sp_latest.pay_code) as hfshh
|
|
|
FROM
|
|
FROM
|
|
|
- fs_store_order_scrm o
|
|
|
|
|
- left join ( SELECT fsois.*, ROW_NUMBER() OVER ( PARTITION BY fsois.order_id ORDER 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_user cu ON cu.user_id = o.company_user_id
|
|
|
|
|
- LEFT JOIN company c ON c.company_id = cu.company_id
|
|
|
|
|
- LEFT JOIN ( SELECT sp.*, ROW_NUMBER() OVER ( PARTITION BY sp.business_order_id ORDER BY sp.create_time DESC ) AS rn FROM fs_store_payment_scrm sp ) sp_latest ON sp_latest.business_order_id = o.id
|
|
|
|
|
- AND sp_latest.rn = 1
|
|
|
|
|
- LEFT JOIN fs_course_play_source_config csc ON csc.appid = sp_latest.app_id
|
|
|
|
|
- WHERE o.company_id is null
|
|
|
|
|
|
|
+ (
|
|
|
|
|
+ SELECT * FROM fs_store_order_scrm
|
|
|
|
|
+ WHERE company_id IS NULL AND is_del = 0 AND is_sys_del = 0
|
|
|
<if test="maps.status != null and maps.status != ''">
|
|
<if test="maps.status != null and maps.status != ''">
|
|
|
- AND o.status = #{maps.status}
|
|
|
|
|
|
|
+ AND status = #{maps.status}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="maps.userId != null and maps.userId != ''">
|
|
<if test="maps.userId != null and maps.userId != ''">
|
|
|
- AND o.company_user_id = #{maps.userId}
|
|
|
|
|
- </if>
|
|
|
|
|
- <if test="maps.productId != null and maps.productId != ''">
|
|
|
|
|
- AND fspc.product_id = #{maps.productId}
|
|
|
|
|
|
|
+ AND company_user_id = #{maps.userId}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="maps.orderCode != null and maps.orderCode != ''">
|
|
<if test="maps.orderCode != null and maps.orderCode != ''">
|
|
|
- AND o.order_code LIKE CONCAT('%', #{maps.orderCode}, '%')
|
|
|
|
|
|
|
+ AND order_code LIKE CONCAT('%', #{maps.orderCode}, '%')
|
|
|
</if>
|
|
</if>
|
|
|
<if test="maps.orderCodeList != null and maps.orderCodeList != ''">
|
|
<if test="maps.orderCodeList != null and maps.orderCodeList != ''">
|
|
|
- AND FIND_IN_SET(o.order_code, #{maps.orderCodeList})
|
|
|
|
|
|
|
+ AND FIND_IN_SET(order_code, #{maps.orderCodeList})
|
|
|
</if>
|
|
</if>
|
|
|
<if test="maps.deliveryId != null and maps.deliveryId != ''">
|
|
<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 sp_latest.bank_transaction_id LIKE CONCAT('%', #{maps.bankTransactionId}, '%')
|
|
|
|
|
|
|
+ AND delivery_id LIKE CONCAT('%', #{maps.deliveryId}, '%')
|
|
|
</if>
|
|
</if>
|
|
|
<if test="maps.userPhone != null and maps.userPhone != ''">
|
|
<if test="maps.userPhone != null and maps.userPhone != ''">
|
|
|
- AND o.user_phone LIKE CONCAT('%', #{maps.userPhone}, '%')
|
|
|
|
|
|
|
+ AND user_phone LIKE CONCAT('%', #{maps.userPhone}, '%')
|
|
|
</if>
|
|
</if>
|
|
|
<if test="maps.userAddress != null and maps.userAddress != ''">
|
|
<if test="maps.userAddress != null and maps.userAddress != ''">
|
|
|
- AND o.user_address LIKE CONCAT('%', #{maps.userAddress}, '%')
|
|
|
|
|
|
|
+ AND user_address LIKE CONCAT('%', #{maps.userAddress}, '%')
|
|
|
</if>
|
|
</if>
|
|
|
<if test="maps.realName != null and maps.realName != ''">
|
|
<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}, '%')
|
|
|
|
|
|
|
+ AND real_name LIKE CONCAT('%', #{maps.realName}, '%')
|
|
|
</if>
|
|
</if>
|
|
|
<if test="maps.deliveryStatus != null">
|
|
<if test="maps.deliveryStatus != null">
|
|
|
- AND o.delivery_status = #{maps.deliveryStatus}
|
|
|
|
|
|
|
+ AND delivery_status = #{maps.deliveryStatus}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="maps.deliveryPayStatus != null">
|
|
<if test="maps.deliveryPayStatus != null">
|
|
|
- AND o.delivery_pay_status = #{maps.deliveryPayStatus}
|
|
|
|
|
|
|
+ AND delivery_pay_status = #{maps.deliveryPayStatus}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="maps.payType != null and maps.payType != ''">
|
|
<if test="maps.payType != null and maps.payType != ''">
|
|
|
- AND o.pay_type = #{maps.payType}
|
|
|
|
|
|
|
+ AND pay_type = #{maps.payType}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="maps.companyId != null">
|
|
<if test="maps.companyId != null">
|
|
|
- AND o.company_id = #{maps.companyId}
|
|
|
|
|
|
|
+ AND company_id = #{maps.companyId}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="maps.deptId != null">
|
|
<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}, '%')
|
|
|
|
|
|
|
+ AND dept_id = #{maps.deptId}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="maps.createTimeRange != null and maps.createTimeRange != ''">
|
|
<if test="maps.createTimeRange != null and maps.createTimeRange != ''">
|
|
|
- AND o.create_time BETWEEN SUBSTRING_INDEX(#{maps.createTimeRange}, '--', 1) AND SUBSTRING_INDEX(#{maps.createTimeRange}, '--', -1)
|
|
|
|
|
|
|
+ AND create_time BETWEEN SUBSTRING_INDEX(#{maps.createTimeRange}, '--', 1) AND SUBSTRING_INDEX(#{maps.createTimeRange}, '--', -1)
|
|
|
</if>
|
|
</if>
|
|
|
<if test="maps.payTimeRange != null and maps.payTimeRange != ''">
|
|
<if test="maps.payTimeRange != null and maps.payTimeRange != ''">
|
|
|
- AND o.pay_time BETWEEN SUBSTRING_INDEX(#{maps.payTimeRange}, '--', 1) AND SUBSTRING_INDEX(#{maps.payTimeRange}, '--', -1)
|
|
|
|
|
|
|
+ AND pay_time BETWEEN SUBSTRING_INDEX(#{maps.payTimeRange}, '--', 1) AND SUBSTRING_INDEX(#{maps.payTimeRange}, '--', -1)
|
|
|
</if>
|
|
</if>
|
|
|
<if test="maps.deliverySendTimeRange != null and maps.deliverySendTimeRange != ''">
|
|
<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)
|
|
|
|
|
|
|
+ AND DATE(delivery_send_time) BETWEEN SUBSTRING_INDEX(#{maps.deliverySendTimeRange}, '--', 1) AND SUBSTRING_INDEX(#{maps.deliverySendTimeRange}, '--', -1)
|
|
|
</if>
|
|
</if>
|
|
|
<if test="maps.deliveryImportTimeRange != null and maps.deliveryImportTimeRange != ''">
|
|
<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)
|
|
|
|
|
|
|
+ AND DATE(delivery_import_time) BETWEEN SUBSTRING_INDEX(#{maps.deliveryImportTimeRange}, '--', 1) AND SUBSTRING_INDEX(#{maps.deliveryImportTimeRange}, '--', -1)
|
|
|
|
|
+ </if>
|
|
|
|
|
+ ORDER BY create_time DESC
|
|
|
|
|
+ limit 1000
|
|
|
|
|
+ ) o
|
|
|
|
|
+ left join ( SELECT fsois.*, ROW_NUMBER() OVER ( PARTITION BY fsois.order_id ORDER 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_user cu ON cu.user_id = o.company_user_id
|
|
|
|
|
+ LEFT JOIN company c ON c.company_id = cu.company_id
|
|
|
|
|
+ LEFT JOIN ( SELECT sp.*, ROW_NUMBER() OVER ( PARTITION BY sp.business_order_id ORDER BY sp.create_time DESC ) AS rn FROM fs_store_payment_scrm sp ) sp_latest ON sp_latest.business_order_id = o.id
|
|
|
|
|
+ AND sp_latest.rn = 1
|
|
|
|
|
+ LEFT JOIN fs_course_play_source_config csc ON csc.appid = sp_latest.app_id
|
|
|
|
|
+ WHERE 1=1
|
|
|
|
|
+ <!-- 需要 JOIN 后才能过滤的条件 -->
|
|
|
|
|
+ <if test="maps.productId != null and maps.productId != ''">
|
|
|
|
|
+ AND fspc.product_id = #{maps.productId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.bankTransactionId != null and maps.bankTransactionId != ''">
|
|
|
|
|
+ AND sp_latest.bank_transaction_id LIKE CONCAT('%', #{maps.bankTransactionId}, '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.productName != null and maps.productName != ''">
|
|
|
|
|
+ AND o.item_json LIKE CONCAT('%', #{maps.productName}, '%')
|
|
|
|
|
+ </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>
|
|
|
<if test="maps.appId != null and maps.appId != ''">
|
|
<if test="maps.appId != null and maps.appId != ''">
|
|
|
AND csc.appid = #{maps.appId}
|
|
AND csc.appid = #{maps.appId}
|
|
@@ -361,7 +372,60 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
sp_latest.bank_transaction_id,
|
|
sp_latest.bank_transaction_id,
|
|
|
CONCAT('live-',sp_latest.pay_code) as hfshh
|
|
CONCAT('live-',sp_latest.pay_code) as hfshh
|
|
|
FROM
|
|
FROM
|
|
|
- live_order o
|
|
|
|
|
|
|
+ (
|
|
|
|
|
+ SELECT * FROM live_order
|
|
|
|
|
+ WHERE is_del = 0
|
|
|
|
|
+ <if test="maps.status != null and maps.status != ''">
|
|
|
|
|
+ AND status = #{maps.status}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.userId != null and maps.userId != ''">
|
|
|
|
|
+ AND company_user_id = #{maps.userId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.orderCode != null and maps.orderCode != ''">
|
|
|
|
|
+ AND order_code LIKE CONCAT('%', #{maps.orderCode}, '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.orderCodeList != null and maps.orderCodeList != ''">
|
|
|
|
|
+ AND FIND_IN_SET(order_code, #{maps.orderCodeList})
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.deliveryId != null and maps.deliveryId != ''">
|
|
|
|
|
+ AND delivery_sn LIKE CONCAT('%', #{maps.deliveryId}, '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.userPhone != null and maps.userPhone != ''">
|
|
|
|
|
+ AND user_phone LIKE CONCAT('%', #{maps.userPhone}, '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.userAddress != null and maps.userAddress != ''">
|
|
|
|
|
+ AND user_address LIKE CONCAT('%', #{maps.userAddress}, '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.realName != null and maps.realName != ''">
|
|
|
|
|
+ AND user_name LIKE CONCAT('%', #{maps.realName}, '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.deliveryStatus != null">
|
|
|
|
|
+ AND delivery_status = #{maps.deliveryStatus}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.deliveryPayStatus != null">
|
|
|
|
|
+ AND delivery_pay_status = #{maps.deliveryPayStatus}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.payType != null and maps.payType != ''">
|
|
|
|
|
+ AND pay_type = #{maps.payType}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.companyId != null">
|
|
|
|
|
+ AND company_id = #{maps.companyId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.deptId != null">
|
|
|
|
|
+ AND dept_id = #{maps.deptId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.createTimeRange != null and maps.createTimeRange != ''">
|
|
|
|
|
+ AND create_time BETWEEN SUBSTRING_INDEX(#{maps.createTimeRange}, '--', 1) AND SUBSTRING_INDEX(#{maps.createTimeRange}, '--', -1)
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.payTimeRange != null and maps.payTimeRange != ''">
|
|
|
|
|
+ AND 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(delivery_send_time) BETWEEN SUBSTRING_INDEX(#{maps.deliverySendTimeRange}, '--', 1) AND SUBSTRING_INDEX(#{maps.deliverySendTimeRange}, '--', -1)
|
|
|
|
|
+ </if>
|
|
|
|
|
+ ORDER BY create_time DESC
|
|
|
|
|
+ limit 1000
|
|
|
|
|
+ ) o
|
|
|
left join live_order_item loi on loi.order_id = o.order_id
|
|
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_user u ON o.user_id = u.user_id
|
|
|
|
|
|
|
@@ -378,80 +442,509 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
LEFT JOIN ( SELECT sp.*, ROW_NUMBER() OVER ( PARTITION BY sp.business_id ORDER BY sp.create_time DESC ) AS rn FROM live_order_payment sp ) sp_latest ON sp_latest.business_id = o.order_id
|
|
LEFT JOIN ( SELECT sp.*, ROW_NUMBER() OVER ( PARTITION BY sp.business_id ORDER BY sp.create_time DESC ) AS rn FROM live_order_payment sp ) sp_latest ON sp_latest.business_id = o.order_id
|
|
|
AND sp_latest.rn = 1
|
|
AND sp_latest.rn = 1
|
|
|
LEFT JOIN fs_course_play_source_config csc ON csc.appid = sp_latest.app_id
|
|
LEFT JOIN fs_course_play_source_config csc ON csc.appid = sp_latest.app_id
|
|
|
- WHERE o.is_del = 0
|
|
|
|
|
|
|
+ WHERE 1=1
|
|
|
|
|
+ <!-- 需要 JOIN 后才能过滤的条件 -->
|
|
|
|
|
+ <if test="maps.productId != null and maps.productId != ''">
|
|
|
|
|
+ AND fspc.product_id = #{maps.productId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.bankTransactionId != null and maps.bankTransactionId != ''">
|
|
|
|
|
+ AND sp_latest.bank_transaction_id LIKE CONCAT('%', #{maps.bankTransactionId}, '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.productName != null and maps.productName != ''">
|
|
|
|
|
+ AND o.item_json LIKE CONCAT('%', #{maps.productName}, '%')
|
|
|
|
|
+ </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.appId != null and maps.appId != ''">
|
|
|
|
|
+ AND csc.appid = #{maps.appId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.hfshh != null and maps.hfshh != ''">
|
|
|
|
|
+ AND CONCAT('live-',sp_latest.pay_code) = #{maps.hfshh}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ group by o.order_id
|
|
|
|
|
+ ) AS merged_orders
|
|
|
|
|
+ WHERE 1=1
|
|
|
|
|
+ <if test="maps.orderTypeFilter != null">
|
|
|
|
|
+ AND order_type = #{maps.orderTypeFilter}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.orderTypeFilter == null">
|
|
|
|
|
+ <!-- 如果 OrderTypeFilter 为空,只查询销售和直播订单,不查询商城订单 -->
|
|
|
|
|
+ AND order_type != 2
|
|
|
|
|
+ </if>
|
|
|
|
|
+ ORDER BY create_time DESC
|
|
|
|
|
+ <if test="maps.pageSize != null and maps.pageSize > 0">
|
|
|
|
|
+ LIMIT #{maps.pageSize}
|
|
|
|
|
+ <if test="maps.offset != null and maps.offset >= 0">
|
|
|
|
|
+ OFFSET #{maps.offset}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ </if>
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 查询销售订单列表(只查询销售订单,order_type = 1) -->
|
|
|
|
|
+ <select id="selectSalesOrderList" parameterType="com.fs.live.param.MergedOrderQueryParam" resultType="com.fs.live.vo.MergedOrderVO">
|
|
|
|
|
+ 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,
|
|
|
|
|
+ item_latest.json_info as item_json,
|
|
|
|
|
+ o.delivery_id,
|
|
|
|
|
+ o.delivery_sn as deliveryCode,
|
|
|
|
|
+ o.delivery_name as deliveryName,
|
|
|
|
|
+ o.finish_time,
|
|
|
|
|
+ o.create_time,
|
|
|
|
|
+ o.pay_time,
|
|
|
|
|
+ o.delivery_send_time,
|
|
|
|
|
+ o.total_num AS total_num,
|
|
|
|
|
+ o.deduction_price AS discount_money,
|
|
|
|
|
+ 1 AS order_type,
|
|
|
|
|
+ cu.phonenumber as salesPhone,
|
|
|
|
|
+ cu.create_time as salesCreateTime,
|
|
|
|
|
+ o.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,
|
|
|
|
|
+ COALESCE(fspc.cost, 0) 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(item_latest.json_info, '$.barCode')) SEPARATOR ',') AS barCode,
|
|
|
|
|
+ c.company_name,
|
|
|
|
|
+ cu.user_name AS sales_name,
|
|
|
|
|
+ cu.nick_name AS company_user_nick_name,
|
|
|
|
|
+ ifnull(u.nickname,u.nick_name) as 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,
|
|
|
|
|
+ CONCAT('store-',sp_latest.pay_code) as hfshh
|
|
|
|
|
+ FROM
|
|
|
|
|
+ (
|
|
|
|
|
+ SELECT * FROM fs_store_order_scrm
|
|
|
|
|
+ WHERE company_id IS NOT NULL AND is_del = 0 AND is_sys_del = 0
|
|
|
<if test="maps.status != null and maps.status != ''">
|
|
<if test="maps.status != null and maps.status != ''">
|
|
|
- AND o.status = #{maps.status}
|
|
|
|
|
|
|
+ AND status = #{maps.status}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="maps.userId != null and maps.userId != ''">
|
|
<if test="maps.userId != null and maps.userId != ''">
|
|
|
- AND o.company_user_id = #{maps.userId}
|
|
|
|
|
- </if>
|
|
|
|
|
- <if test="maps.productId != null and maps.productId != ''">
|
|
|
|
|
- AND fspc.product_id = #{maps.productId}
|
|
|
|
|
|
|
+ AND company_user_id = #{maps.userId}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="maps.orderCode != null and maps.orderCode != ''">
|
|
<if test="maps.orderCode != null and maps.orderCode != ''">
|
|
|
- AND o.order_code LIKE CONCAT('%', #{maps.orderCode}, '%')
|
|
|
|
|
|
|
+ AND order_code LIKE CONCAT('%', #{maps.orderCode}, '%')
|
|
|
</if>
|
|
</if>
|
|
|
<if test="maps.orderCodeList != null and maps.orderCodeList != ''">
|
|
<if test="maps.orderCodeList != null and maps.orderCodeList != ''">
|
|
|
- AND FIND_IN_SET(o.order_code, #{maps.orderCodeList})
|
|
|
|
|
|
|
+ AND FIND_IN_SET(order_code, #{maps.orderCodeList})
|
|
|
</if>
|
|
</if>
|
|
|
<if test="maps.deliveryId != null and maps.deliveryId != ''">
|
|
<if test="maps.deliveryId != null and maps.deliveryId != ''">
|
|
|
- AND o.delivery_sn LIKE CONCAT('%', #{maps.deliveryId}, '%')
|
|
|
|
|
|
|
+ AND delivery_id LIKE CONCAT('%', #{maps.deliveryId}, '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.userPhone != null and maps.userPhone != ''">
|
|
|
|
|
+ AND user_phone LIKE CONCAT('%', #{maps.userPhone}, '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.userAddress != null and maps.userAddress != ''">
|
|
|
|
|
+ AND user_address LIKE CONCAT('%', #{maps.userAddress}, '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.realName != null and maps.realName != ''">
|
|
|
|
|
+ AND real_name LIKE CONCAT('%', #{maps.realName}, '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.deliveryStatus != null">
|
|
|
|
|
+ AND delivery_status = #{maps.deliveryStatus}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.deliveryPayStatus != null">
|
|
|
|
|
+ AND delivery_pay_status = #{maps.deliveryPayStatus}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.payType != null and maps.payType != ''">
|
|
|
|
|
+ AND pay_type = #{maps.payType}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.companyId != null">
|
|
|
|
|
+ AND company_id = #{maps.companyId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.deptId != null">
|
|
|
|
|
+ AND dept_id = #{maps.deptId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.createTimeRange != null and maps.createTimeRange != ''">
|
|
|
|
|
+ AND create_time BETWEEN SUBSTRING_INDEX(#{maps.createTimeRange}, '--', 1) AND SUBSTRING_INDEX(#{maps.createTimeRange}, '--', -1)
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.payTimeRange != null and maps.payTimeRange != ''">
|
|
|
|
|
+ AND 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(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(delivery_import_time) BETWEEN SUBSTRING_INDEX(#{maps.deliveryImportTimeRange}, '--', 1) AND SUBSTRING_INDEX(#{maps.deliveryImportTimeRange}, '--', -1)
|
|
|
|
|
+ </if>
|
|
|
|
|
+ ORDER BY create_time DESC
|
|
|
|
|
+ <if test="maps.pageSize != null and maps.pageSize > 0">
|
|
|
|
|
+ LIMIT #{maps.pageSize}
|
|
|
|
|
+ <if test="maps.pageNum != null and maps.pageNum > 1">
|
|
|
|
|
+ OFFSET #{maps.offset}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ </if>
|
|
|
|
|
+ ) o
|
|
|
|
|
+ LEFT JOIN ( SELECT fsois.*, ROW_NUMBER() OVER ( PARTITION BY fsois.order_id ORDER 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_user cu ON cu.user_id = o.company_user_id
|
|
|
|
|
+ LEFT JOIN company c ON c.company_id = cu.company_id
|
|
|
|
|
+ LEFT JOIN ( SELECT sp.*, ROW_NUMBER() OVER ( PARTITION BY sp.business_order_id ORDER BY sp.create_time DESC ) AS rn FROM fs_store_payment_scrm sp ) sp_latest ON sp_latest.business_order_id = o.id AND sp_latest.rn = 1
|
|
|
|
|
+ LEFT JOIN fs_course_play_source_config csc ON csc.appid = sp_latest.app_id
|
|
|
|
|
+ WHERE 1=1
|
|
|
|
|
+ <!-- 需要 JOIN 后才能过滤的条件 -->
|
|
|
|
|
+ <if test="maps.productId != null and maps.productId != ''">
|
|
|
|
|
+ AND fspc.product_id = #{maps.productId}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="maps.bankTransactionId != null and maps.bankTransactionId != ''">
|
|
<if test="maps.bankTransactionId != null and maps.bankTransactionId != ''">
|
|
|
AND sp_latest.bank_transaction_id LIKE CONCAT('%', #{maps.bankTransactionId}, '%')
|
|
AND sp_latest.bank_transaction_id LIKE CONCAT('%', #{maps.bankTransactionId}, '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.productName != null and maps.productName != ''">
|
|
|
|
|
+ AND fspc.product_name LIKE CONCAT('%', #{maps.productName}, '%')
|
|
|
|
|
+ </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.appId != null and maps.appId != ''">
|
|
|
|
|
+ AND csc.appid = #{maps.appId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.hfshh != null and maps.hfshh != ''">
|
|
|
|
|
+ AND CONCAT('store-',sp_latest.pay_code) = #{maps.hfshh}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ GROUP BY o.id
|
|
|
|
|
+ ORDER BY o.create_time DESC
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 查询商城订单列表(只查询商城订单,order_type = 2) -->
|
|
|
|
|
+ <select id="selectStoreOrderList" parameterType="com.fs.live.param.MergedOrderQueryParam" resultType="com.fs.live.vo.MergedOrderVO">
|
|
|
|
|
+ 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,
|
|
|
|
|
+ item_latest.json_info as item_json,
|
|
|
|
|
+ o.delivery_id,
|
|
|
|
|
+ o.delivery_sn as deliveryCode,
|
|
|
|
|
+ o.delivery_name as deliveryName,
|
|
|
|
|
+ o.finish_time,
|
|
|
|
|
+ o.create_time,
|
|
|
|
|
+ o.pay_time,
|
|
|
|
|
+ o.delivery_send_time,
|
|
|
|
|
+ o.total_num AS total_num,
|
|
|
|
|
+ o.deduction_price AS discount_money,
|
|
|
|
|
+ 2 AS order_type,
|
|
|
|
|
+ cu.phonenumber as salesPhone,
|
|
|
|
|
+ cu.create_time as salesCreateTime,
|
|
|
|
|
+ o.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,
|
|
|
|
|
+ COALESCE(fspc.cost, 0) 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(item_latest.json_info, '$.barCode')) SEPARATOR ',') AS barCode,
|
|
|
|
|
+ c.company_name,
|
|
|
|
|
+ cu.user_name AS sales_name,
|
|
|
|
|
+ cu.nick_name AS company_user_nick_name,
|
|
|
|
|
+ ifnull(u.nickname,u.nick_name) as 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,
|
|
|
|
|
+ CONCAT('store-',sp_latest.pay_code) as hfshh
|
|
|
|
|
+ FROM
|
|
|
|
|
+ (
|
|
|
|
|
+ SELECT * FROM fs_store_order_scrm
|
|
|
|
|
+ WHERE company_id IS NULL AND is_del = 0 AND is_sys_del = 0
|
|
|
|
|
+ <if test="maps.status != null and maps.status != ''">
|
|
|
|
|
+ AND status = #{maps.status}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.userId != null and maps.userId != ''">
|
|
|
|
|
+ AND company_user_id = #{maps.userId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.orderCode != null and maps.orderCode != ''">
|
|
|
|
|
+ AND order_code LIKE CONCAT('%', #{maps.orderCode}, '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.orderCodeList != null and maps.orderCodeList != ''">
|
|
|
|
|
+ AND FIND_IN_SET(order_code, #{maps.orderCodeList})
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.deliveryId != null and maps.deliveryId != ''">
|
|
|
|
|
+ AND delivery_id LIKE CONCAT('%', #{maps.deliveryId}, '%')
|
|
|
</if>
|
|
</if>
|
|
|
<if test="maps.userPhone != null and maps.userPhone != ''">
|
|
<if test="maps.userPhone != null and maps.userPhone != ''">
|
|
|
- AND o.user_phone LIKE CONCAT('%', #{maps.userPhone}, '%')
|
|
|
|
|
|
|
+ AND user_phone LIKE CONCAT('%', #{maps.userPhone}, '%')
|
|
|
</if>
|
|
</if>
|
|
|
<if test="maps.userAddress != null and maps.userAddress != ''">
|
|
<if test="maps.userAddress != null and maps.userAddress != ''">
|
|
|
- AND o.user_address LIKE CONCAT('%', #{maps.userAddress}, '%')
|
|
|
|
|
|
|
+ AND user_address LIKE CONCAT('%', #{maps.userAddress}, '%')
|
|
|
</if>
|
|
</if>
|
|
|
<if test="maps.realName != null and maps.realName != ''">
|
|
<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}, '%')
|
|
|
|
|
|
|
+ AND real_name LIKE CONCAT('%', #{maps.realName}, '%')
|
|
|
</if>
|
|
</if>
|
|
|
<if test="maps.deliveryStatus != null">
|
|
<if test="maps.deliveryStatus != null">
|
|
|
- AND o.delivery_status = #{maps.deliveryStatus}
|
|
|
|
|
|
|
+ AND delivery_status = #{maps.deliveryStatus}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="maps.deliveryPayStatus != null">
|
|
<if test="maps.deliveryPayStatus != null">
|
|
|
- AND o.delivery_pay_status = #{maps.deliveryPayStatus}
|
|
|
|
|
|
|
+ AND delivery_pay_status = #{maps.deliveryPayStatus}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="maps.payType != null and maps.payType != ''">
|
|
<if test="maps.payType != null and maps.payType != ''">
|
|
|
- AND o.pay_type = #{maps.payType}
|
|
|
|
|
|
|
+ AND pay_type = #{maps.payType}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="maps.companyId != null">
|
|
<if test="maps.companyId != null">
|
|
|
- AND o.company_id = #{maps.companyId}
|
|
|
|
|
|
|
+ AND company_id = #{maps.companyId}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="maps.deptId != null">
|
|
<if test="maps.deptId != null">
|
|
|
- AND o.dept_id = #{maps.deptId}
|
|
|
|
|
|
|
+ AND dept_id = #{maps.deptId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.createTimeRange != null and maps.createTimeRange != ''">
|
|
|
|
|
+ AND create_time BETWEEN SUBSTRING_INDEX(#{maps.createTimeRange}, '--', 1) AND SUBSTRING_INDEX(#{maps.createTimeRange}, '--', -1)
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.payTimeRange != null and maps.payTimeRange != ''">
|
|
|
|
|
+ AND 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(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(delivery_import_time) BETWEEN SUBSTRING_INDEX(#{maps.deliveryImportTimeRange}, '--', 1) AND SUBSTRING_INDEX(#{maps.deliveryImportTimeRange}, '--', -1)
|
|
|
|
|
+ </if>
|
|
|
|
|
+ ORDER BY create_time DESC
|
|
|
|
|
+ <if test="maps.pageSize != null and maps.pageSize > 0">
|
|
|
|
|
+ LIMIT #{maps.pageSize}
|
|
|
|
|
+ <if test="maps.pageNum != null and maps.pageNum > 1">
|
|
|
|
|
+ OFFSET #{maps.offset}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ </if>
|
|
|
|
|
+ ) o
|
|
|
|
|
+ LEFT JOIN ( SELECT fsois.*, ROW_NUMBER() OVER ( PARTITION BY fsois.order_id ORDER 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_user cu ON cu.user_id = o.company_user_id
|
|
|
|
|
+ LEFT JOIN company c ON c.company_id = cu.company_id
|
|
|
|
|
+ LEFT JOIN ( SELECT sp.*, ROW_NUMBER() OVER ( PARTITION BY sp.business_order_id ORDER BY sp.create_time DESC ) AS rn FROM fs_store_payment_scrm sp ) sp_latest ON sp_latest.business_order_id = o.id AND sp_latest.rn = 1
|
|
|
|
|
+ LEFT JOIN fs_course_play_source_config csc ON csc.appid = sp_latest.app_id
|
|
|
|
|
+ WHERE 1=1
|
|
|
|
|
+ <!-- 需要 JOIN 后才能过滤的条件 -->
|
|
|
|
|
+ <if test="maps.productId != null and maps.productId != ''">
|
|
|
|
|
+ AND fspc.product_id = #{maps.productId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.bankTransactionId != null and maps.bankTransactionId != ''">
|
|
|
|
|
+ AND sp_latest.bank_transaction_id LIKE CONCAT('%', #{maps.bankTransactionId}, '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.productName != null and maps.productName != ''">
|
|
|
|
|
+ AND o.item_json LIKE CONCAT('%', #{maps.productName}, '%')
|
|
|
</if>
|
|
</if>
|
|
|
<if test="maps.salesName != null and maps.salesName != ''">
|
|
<if test="maps.salesName != null and maps.salesName != ''">
|
|
|
AND cu.user_name LIKE CONCAT('%', #{maps.salesName}, '%')
|
|
AND cu.user_name LIKE CONCAT('%', #{maps.salesName}, '%')
|
|
|
</if>
|
|
</if>
|
|
|
<if test="maps.companyUserNickName != null and maps.companyUserNickName != ''">
|
|
<if test="maps.companyUserNickName != null and maps.companyUserNickName != ''">
|
|
|
AND cu.nick_name LIKE CONCAT('%', #{maps.companyUserNickName}, '%')
|
|
AND cu.nick_name LIKE CONCAT('%', #{maps.companyUserNickName}, '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.appId != null and maps.appId != ''">
|
|
|
|
|
+ AND csc.appid = #{maps.appId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.hfshh != null and maps.hfshh != ''">
|
|
|
|
|
+ AND CONCAT('store-',sp_latest.pay_code) = #{maps.hfshh}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ GROUP BY o.id
|
|
|
|
|
+ ORDER BY o.create_time DESC
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 查询直播订单列表(只查询直播订单,order_type = 3) -->
|
|
|
|
|
+ <select id="selectLiveOrderList" parameterType="com.fs.live.param.MergedOrderQueryParam" resultType="com.fs.live.vo.MergedOrderVO">
|
|
|
|
|
+ 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,
|
|
|
|
|
+ loi.json_info as item_json,
|
|
|
|
|
+ o.delivery_sn AS delivery_id,
|
|
|
|
|
+ o.delivery_code as deliveryCode,
|
|
|
|
|
+ o.delivery_name as deliveryName,
|
|
|
|
|
+ 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,
|
|
|
|
|
+ o.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,
|
|
|
|
|
+ COALESCE(fspc.cost, 0) as cost,
|
|
|
|
|
+ o.pay_postage 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,
|
|
|
|
|
+ ifnull(u.nickname,u.nick_name) as 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,
|
|
|
|
|
+ CONCAT('live-',sp_latest.pay_code) as hfshh
|
|
|
|
|
+ FROM
|
|
|
|
|
+ (
|
|
|
|
|
+ SELECT * FROM live_order
|
|
|
|
|
+ WHERE is_del = 0
|
|
|
|
|
+ <if test="maps.status != null and maps.status != ''">
|
|
|
|
|
+ AND status = #{maps.status}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.userId != null and maps.userId != ''">
|
|
|
|
|
+ AND company_user_id = #{maps.userId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.orderCode != null and maps.orderCode != ''">
|
|
|
|
|
+ AND order_code LIKE CONCAT('%', #{maps.orderCode}, '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.orderCodeList != null and maps.orderCodeList != ''">
|
|
|
|
|
+ AND FIND_IN_SET(order_code, #{maps.orderCodeList})
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.deliveryId != null and maps.deliveryId != ''">
|
|
|
|
|
+ AND delivery_sn LIKE CONCAT('%', #{maps.deliveryId}, '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.userPhone != null and maps.userPhone != ''">
|
|
|
|
|
+ AND user_phone LIKE CONCAT('%', #{maps.userPhone}, '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.userAddress != null and maps.userAddress != ''">
|
|
|
|
|
+ AND user_address LIKE CONCAT('%', #{maps.userAddress}, '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.realName != null and maps.realName != ''">
|
|
|
|
|
+ AND user_name LIKE CONCAT('%', #{maps.realName}, '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.deliveryStatus != null">
|
|
|
|
|
+ AND delivery_status = #{maps.deliveryStatus}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.deliveryPayStatus != null">
|
|
|
|
|
+ AND delivery_pay_status = #{maps.deliveryPayStatus}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.payType != null and maps.payType != ''">
|
|
|
|
|
+ AND pay_type = #{maps.payType}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.companyId != null">
|
|
|
|
|
+ AND company_id = #{maps.companyId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.deptId != null">
|
|
|
|
|
+ AND dept_id = #{maps.deptId}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="maps.createTimeRange != null and maps.createTimeRange != ''">
|
|
<if test="maps.createTimeRange != null and maps.createTimeRange != ''">
|
|
|
- AND o.create_time BETWEEN SUBSTRING_INDEX(#{maps.createTimeRange}, '--', 1) AND SUBSTRING_INDEX(#{maps.createTimeRange}, '--', -1)
|
|
|
|
|
|
|
+ AND create_time BETWEEN SUBSTRING_INDEX(#{maps.createTimeRange}, '--', 1) AND SUBSTRING_INDEX(#{maps.createTimeRange}, '--', -1)
|
|
|
</if>
|
|
</if>
|
|
|
<if test="maps.payTimeRange != null and maps.payTimeRange != ''">
|
|
<if test="maps.payTimeRange != null and maps.payTimeRange != ''">
|
|
|
- AND o.pay_time BETWEEN SUBSTRING_INDEX(#{maps.payTimeRange}, '--', 1) AND SUBSTRING_INDEX(#{maps.payTimeRange}, '--', -1)
|
|
|
|
|
|
|
+ AND pay_time BETWEEN SUBSTRING_INDEX(#{maps.payTimeRange}, '--', 1) AND SUBSTRING_INDEX(#{maps.payTimeRange}, '--', -1)
|
|
|
</if>
|
|
</if>
|
|
|
<if test="maps.deliverySendTimeRange != null and maps.deliverySendTimeRange != ''">
|
|
<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)
|
|
|
|
|
|
|
+ AND DATE(delivery_send_time) BETWEEN SUBSTRING_INDEX(#{maps.deliverySendTimeRange}, '--', 1) AND SUBSTRING_INDEX(#{maps.deliverySendTimeRange}, '--', -1)
|
|
|
</if>
|
|
</if>
|
|
|
- <if test="maps.hfshh != null and maps.hfshh != ''">
|
|
|
|
|
- AND CONCAT('store-',sp_latest.pay_code) = #{maps.hfshh}
|
|
|
|
|
|
|
+ ORDER BY create_time DESC
|
|
|
|
|
+ <if test="maps.pageSize != null and maps.pageSize > 0">
|
|
|
|
|
+ LIMIT #{maps.pageSize}
|
|
|
|
|
+ <if test="maps.pageNum != null and maps.pageNum > 1">
|
|
|
|
|
+ OFFSET #{maps.offset}
|
|
|
</if>
|
|
</if>
|
|
|
- group by o.order_id
|
|
|
|
|
- ) AS merged_orders
|
|
|
|
|
|
|
+ </if>
|
|
|
|
|
+ ) 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_user cu ON cu.user_id = o.company_user_id
|
|
|
|
|
+ LEFT JOIN company c ON c.company_id = cu.company_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_id ORDER BY sp.create_time DESC ) AS rn FROM live_order_payment sp ) sp_latest ON sp_latest.business_id = CAST(o.order_id AS CHAR) AND sp_latest.rn = 1
|
|
|
|
|
+ LEFT JOIN fs_course_play_source_config csc ON csc.appid = sp_latest.app_id
|
|
|
WHERE 1=1
|
|
WHERE 1=1
|
|
|
- <if test="maps.orderTypeFilter != null">
|
|
|
|
|
- AND order_type = #{maps.orderTypeFilter}
|
|
|
|
|
|
|
+ <!-- 需要 JOIN 后才能过滤的条件 -->
|
|
|
|
|
+ <if test="maps.productId != null and maps.productId != ''">
|
|
|
|
|
+ AND fspc.product_id = #{maps.productId}
|
|
|
</if>
|
|
</if>
|
|
|
- ORDER BY create_time DESC
|
|
|
|
|
|
|
+ <if test="maps.bankTransactionId != null and maps.bankTransactionId != ''">
|
|
|
|
|
+ AND sp_latest.bank_transaction_id LIKE CONCAT('%', #{maps.bankTransactionId}, '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.productName != null and maps.productName != ''">
|
|
|
|
|
+ AND o.item_json LIKE CONCAT('%', #{maps.productName}, '%')
|
|
|
|
|
+ </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.appId != null and maps.appId != ''">
|
|
|
|
|
+ AND csc.appid = #{maps.appId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.hfshh != null and maps.hfshh != ''">
|
|
|
|
|
+ AND CONCAT('live-',sp_latest.pay_code) = #{maps.hfshh}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ GROUP BY o.order_id
|
|
|
|
|
+ ORDER BY o.create_time DESC
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
<!-- 查询合并的售后列表(商城售后+直播售后) -->
|
|
<!-- 查询合并的售后列表(商城售后+直播售后) -->
|
|
@@ -535,5 +1028,294 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
ORDER BY createTime DESC
|
|
ORDER BY createTime DESC
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
|
|
+ <!-- 统计合并订单总数 -->
|
|
|
|
|
+ <select id="countMergedOrderList" parameterType="com.fs.live.param.MergedOrderQueryParam" resultType="long">
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ <choose>
|
|
|
|
|
+ <when test="maps.orderTypeFilter != null and maps.orderTypeFilter == 1">
|
|
|
|
|
+ <!-- 只统计销售订单 -->
|
|
|
|
|
+ (SELECT COUNT(DISTINCT o.id)
|
|
|
|
|
+ FROM fs_store_order_scrm o
|
|
|
|
|
+ WHERE o.company_id IS NOT NULL AND o.is_del = 0 AND o.is_sys_del = 0
|
|
|
|
|
+ <if test="maps.status != null and maps.status != ''">
|
|
|
|
|
+ AND o.status = #{maps.status}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.userId != null and maps.userId != ''">
|
|
|
|
|
+ AND o.company_user_id = #{maps.userId}
|
|
|
|
|
+ </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.userPhone != null and maps.userPhone != ''">
|
|
|
|
|
+ AND o.user_phone LIKE CONCAT('%', #{maps.userPhone}, '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.userAddress != null and maps.userAddress != ''">
|
|
|
|
|
+ AND o.user_address LIKE CONCAT('%', #{maps.userAddress}, '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.realName != null and maps.realName != ''">
|
|
|
|
|
+ AND o.real_name LIKE CONCAT('%', #{maps.realName}, '%')
|
|
|
|
|
+ </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.createTimeRange != null and maps.createTimeRange != ''">
|
|
|
|
|
+ AND 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 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>
|
|
|
|
|
+ )
|
|
|
|
|
+ </when>
|
|
|
|
|
+ <when test="maps.orderTypeFilter != null and maps.orderTypeFilter == 2">
|
|
|
|
|
+ <!-- 只统计商城订单 -->
|
|
|
|
|
+ (SELECT COUNT(DISTINCT o.id)
|
|
|
|
|
+ FROM fs_store_order_scrm o
|
|
|
|
|
+ WHERE o.company_id IS NULL AND o.is_del = 0 AND o.is_sys_del = 0
|
|
|
|
|
+ <if test="maps.status != null and maps.status != ''">
|
|
|
|
|
+ AND o.status = #{maps.status}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.userId != null and maps.userId != ''">
|
|
|
|
|
+ AND o.company_user_id = #{maps.userId}
|
|
|
|
|
+ </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.userPhone != null and maps.userPhone != ''">
|
|
|
|
|
+ AND o.user_phone LIKE CONCAT('%', #{maps.userPhone}, '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.userAddress != null and maps.userAddress != ''">
|
|
|
|
|
+ AND o.user_address LIKE CONCAT('%', #{maps.userAddress}, '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.realName != null and maps.realName != ''">
|
|
|
|
|
+ AND o.real_name LIKE CONCAT('%', #{maps.realName}, '%')
|
|
|
|
|
+ </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.createTimeRange != null and maps.createTimeRange != ''">
|
|
|
|
|
+ AND 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 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>
|
|
|
|
|
+ )
|
|
|
|
|
+ </when>
|
|
|
|
|
+ <when test="maps.orderTypeFilter != null and maps.orderTypeFilter == 3">
|
|
|
|
|
+ <!-- 只统计直播订单 -->
|
|
|
|
|
+ (SELECT COUNT(DISTINCT o.order_id)
|
|
|
|
|
+ FROM live_order o
|
|
|
|
|
+ WHERE o.is_del = 0
|
|
|
|
|
+ <if test="maps.status != null and maps.status != ''">
|
|
|
|
|
+ AND o.status = #{maps.status}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.userId != null and maps.userId != ''">
|
|
|
|
|
+ AND o.company_user_id = #{maps.userId}
|
|
|
|
|
+ </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.userAddress != null and maps.userAddress != ''">
|
|
|
|
|
+ AND o.user_address LIKE CONCAT('%', #{maps.userAddress}, '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.realName != null and maps.realName != ''">
|
|
|
|
|
+ AND o.user_name LIKE CONCAT('%', #{maps.realName}, '%')
|
|
|
|
|
+ </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.createTimeRange != null and maps.createTimeRange != ''">
|
|
|
|
|
+ AND 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 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>
|
|
|
|
|
+ )
|
|
|
|
|
+ </when>
|
|
|
|
|
+ <otherwise>
|
|
|
|
|
+ <!-- 如果 OrderTypeFilter 为空,只统计销售和直播订单,不统计商城订单 -->
|
|
|
|
|
+ (SELECT COUNT(DISTINCT o.id)
|
|
|
|
|
+ FROM fs_store_order_scrm o
|
|
|
|
|
+ WHERE o.company_id IS NOT NULL AND o.is_del = 0 AND o.is_sys_del = 0
|
|
|
|
|
+ <if test="maps.status != null and maps.status != ''">
|
|
|
|
|
+ AND o.status = #{maps.status}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.userId != null and maps.userId != ''">
|
|
|
|
|
+ AND o.company_user_id = #{maps.userId}
|
|
|
|
|
+ </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.userPhone != null and maps.userPhone != ''">
|
|
|
|
|
+ AND o.user_phone LIKE CONCAT('%', #{maps.userPhone}, '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.userAddress != null and maps.userAddress != ''">
|
|
|
|
|
+ AND o.user_address LIKE CONCAT('%', #{maps.userAddress}, '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.realName != null and maps.realName != ''">
|
|
|
|
|
+ AND o.real_name LIKE CONCAT('%', #{maps.realName}, '%')
|
|
|
|
|
+ </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.createTimeRange != null and maps.createTimeRange != ''">
|
|
|
|
|
+ AND 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 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>
|
|
|
|
|
+ ) +
|
|
|
|
|
+ (SELECT COUNT(DISTINCT o.order_id)
|
|
|
|
|
+ FROM live_order o
|
|
|
|
|
+ WHERE o.is_del = 0
|
|
|
|
|
+ <if test="maps.status != null and maps.status != ''">
|
|
|
|
|
+ AND o.status = #{maps.status}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.userId != null and maps.userId != ''">
|
|
|
|
|
+ AND o.company_user_id = #{maps.userId}
|
|
|
|
|
+ </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.userAddress != null and maps.userAddress != ''">
|
|
|
|
|
+ AND o.user_address LIKE CONCAT('%', #{maps.userAddress}, '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.realName != null and maps.realName != ''">
|
|
|
|
|
+ AND o.user_name LIKE CONCAT('%', #{maps.realName}, '%')
|
|
|
|
|
+ </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.createTimeRange != null and maps.createTimeRange != ''">
|
|
|
|
|
+ AND 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 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>
|
|
|
|
|
+ )
|
|
|
|
|
+ </otherwise>
|
|
|
|
|
+ </choose>
|
|
|
|
|
+ AS total_count
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
</mapper>
|
|
</mapper>
|
|
|
|
|
|