|
@@ -18,7 +18,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
o.STATUS,
|
|
o.STATUS,
|
|
|
o.is_package,
|
|
o.is_package,
|
|
|
o.package_json,
|
|
o.package_json,
|
|
|
- o.item_json,
|
|
|
|
|
|
|
+ item_latest.json_info as item_json,
|
|
|
o.delivery_id,
|
|
o.delivery_id,
|
|
|
o.delivery_sn as deliveryCode,
|
|
o.delivery_sn as deliveryCode,
|
|
|
o.delivery_name as deliveryName,
|
|
o.delivery_name as deliveryName,
|
|
@@ -27,22 +27,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
o.create_time,
|
|
o.create_time,
|
|
|
o.pay_time,
|
|
o.pay_time,
|
|
|
o.delivery_send_time,
|
|
o.delivery_send_time,
|
|
|
- NULL AS total_num,
|
|
|
|
|
- NULL AS discount_money,
|
|
|
|
|
|
|
+ o.total_num AS total_num,
|
|
|
|
|
+ o.deduction_price AS discount_money,
|
|
|
1 AS order_type,
|
|
1 AS order_type,
|
|
|
|
|
|
|
|
cu.phonenumber as salesPhone,
|
|
cu.phonenumber as salesPhone,
|
|
|
cu.create_time as salesCreateTime,
|
|
cu.create_time as salesCreateTime,
|
|
|
- u.user_id as userId,
|
|
|
|
|
|
|
+ o.user_id as userId,
|
|
|
u.order_count as userOrderCount,
|
|
u.order_count as userOrderCount,
|
|
|
u.total_amount as userTotalAmount,
|
|
u.total_amount as userTotalAmount,
|
|
|
u.level as userLevel,
|
|
u.level as userLevel,
|
|
|
fspc.product_id as productId,
|
|
fspc.product_id as productId,
|
|
|
fspc.product_name as productName,
|
|
fspc.product_name as productName,
|
|
|
- fspc.cost as cost,
|
|
|
|
|
|
|
+ fspc.prescribe_spec as productSpec,
|
|
|
|
|
+ COALESCE(fspc.cost, 0) as cost,
|
|
|
o.pay_postage as payDelivery,
|
|
o.pay_postage as payDelivery,
|
|
|
o.coupon_price as discountMoney,
|
|
o.coupon_price as discountMoney,
|
|
|
- fspc.prescribe_spec as productSpec,
|
|
|
|
|
fss.store_id as storeId,
|
|
fss.store_id as storeId,
|
|
|
fss.store_name as storeName,
|
|
fss.store_name as storeName,
|
|
|
fspcs.cate_name as cateName,
|
|
fspcs.cate_name as cateName,
|
|
@@ -51,7 +51,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
c.company_name,
|
|
c.company_name,
|
|
|
cu.user_name AS sales_name,
|
|
cu.user_name AS sales_name,
|
|
|
cu.nick_name AS company_user_nick_name,
|
|
cu.nick_name AS company_user_nick_name,
|
|
|
- u.nickname,
|
|
|
|
|
|
|
+ ifnull(u.nickname,u.nick_name) as nickname,
|
|
|
u.phone,
|
|
u.phone,
|
|
|
o.real_name,
|
|
o.real_name,
|
|
|
o.user_phone,
|
|
o.user_phone,
|
|
@@ -64,22 +64,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
sp_latest.bank_transaction_id
|
|
sp_latest.bank_transaction_id
|
|
|
FROM
|
|
FROM
|
|
|
fs_store_order_scrm o
|
|
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 ( 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_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_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_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 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 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_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
|
|
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
|
|
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 AND o.is_sys_del = 0 AND o.company_user_id IS NOT NULL AND o.company_user_id != 0
|
|
|
|
|
|
|
+ WHERE o.company_id IS NOT NULL
|
|
|
<if test="maps.status != null and maps.status != ''">
|
|
<if test="maps.status != null and maps.status != ''">
|
|
|
AND o.status = #{maps.status}
|
|
AND o.status = #{maps.status}
|
|
|
</if>
|
|
</if>
|
|
|
|
|
+ <if test="maps.productId != null and maps.productId != ''">
|
|
|
|
|
+ AND fspc.product_id = #{maps.productId}
|
|
|
|
|
+ </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 o.order_code LIKE CONCAT('%', #{maps.orderCode}, '%')
|
|
|
</if>
|
|
</if>
|
|
@@ -95,6 +99,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<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 o.user_phone LIKE CONCAT('%', #{maps.userPhone}, '%')
|
|
|
</if>
|
|
</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 != ''">
|
|
<if test="maps.realName != null and maps.realName != ''">
|
|
|
AND o.real_name LIKE CONCAT('%', #{maps.realName}, '%')
|
|
AND o.real_name LIKE CONCAT('%', #{maps.realName}, '%')
|
|
|
</if>
|
|
</if>
|
|
@@ -123,10 +130,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
AND cu.nick_name LIKE CONCAT('%', #{maps.companyUserNickName}, '%')
|
|
AND cu.nick_name LIKE CONCAT('%', #{maps.companyUserNickName}, '%')
|
|
|
</if>
|
|
</if>
|
|
|
<if test="maps.createTimeRange != null and maps.createTimeRange != ''">
|
|
<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)
|
|
|
|
|
|
|
+ AND o.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 DATE(o.pay_time) BETWEEN SUBSTRING_INDEX(#{maps.payTimeRange}, '--', 1) AND SUBSTRING_INDEX(#{maps.payTimeRange}, '--', -1)
|
|
|
|
|
|
|
+ AND o.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(o.delivery_send_time) BETWEEN SUBSTRING_INDEX(#{maps.deliverySendTimeRange}, '--', 1) AND SUBSTRING_INDEX(#{maps.deliverySendTimeRange}, '--', -1)
|
|
@@ -152,7 +159,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
o.STATUS,
|
|
o.STATUS,
|
|
|
o.is_package,
|
|
o.is_package,
|
|
|
o.package_json,
|
|
o.package_json,
|
|
|
- o.item_json,
|
|
|
|
|
|
|
+
|
|
|
|
|
+ item_latest.json_info as item_json,
|
|
|
o.delivery_id,
|
|
o.delivery_id,
|
|
|
o.delivery_sn as deliveryCode,
|
|
o.delivery_sn as deliveryCode,
|
|
|
o.delivery_name as deliveryName,
|
|
o.delivery_name as deliveryName,
|
|
@@ -160,20 +168,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
o.create_time,
|
|
o.create_time,
|
|
|
o.pay_time,
|
|
o.pay_time,
|
|
|
o.delivery_send_time,
|
|
o.delivery_send_time,
|
|
|
- NULL AS total_num,
|
|
|
|
|
- NULL AS discount_money,
|
|
|
|
|
|
|
+ o.total_num AS total_num,
|
|
|
|
|
+ o.deduction_price AS discount_money,
|
|
|
2 AS order_type,
|
|
2 AS order_type,
|
|
|
|
|
|
|
|
cu.phonenumber as salesPhone,
|
|
cu.phonenumber as salesPhone,
|
|
|
cu.create_time as salesCreateTime,
|
|
cu.create_time as salesCreateTime,
|
|
|
- u.user_id as userId,
|
|
|
|
|
|
|
+ o.user_id as userId,
|
|
|
u.order_count as userOrderCount,
|
|
u.order_count as userOrderCount,
|
|
|
u.total_amount as userTotalAmount,
|
|
u.total_amount as userTotalAmount,
|
|
|
u.level as userLevel,
|
|
u.level as userLevel,
|
|
|
fspc.product_id as productId,
|
|
fspc.product_id as productId,
|
|
|
fspc.product_name as productName,
|
|
fspc.product_name as productName,
|
|
|
fspc.prescribe_spec as productSpec,
|
|
fspc.prescribe_spec as productSpec,
|
|
|
- fspc.cost as cost,
|
|
|
|
|
|
|
+ COALESCE(fspc.cost, 0) as cost,
|
|
|
o.pay_postage as payDelivery,
|
|
o.pay_postage as payDelivery,
|
|
|
o.coupon_price as discountMoney,
|
|
o.coupon_price as discountMoney,
|
|
|
fss.store_id as storeId,
|
|
fss.store_id as storeId,
|
|
@@ -184,7 +192,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
c.company_name,
|
|
c.company_name,
|
|
|
cu.user_name AS sales_name,
|
|
cu.user_name AS sales_name,
|
|
|
cu.nick_name AS company_user_nick_name,
|
|
cu.nick_name AS company_user_nick_name,
|
|
|
- u.nickname,
|
|
|
|
|
|
|
+ ifnull(u.nickname,u.nick_name) as nickname,
|
|
|
u.phone,
|
|
u.phone,
|
|
|
o.real_name,
|
|
o.real_name,
|
|
|
o.user_phone,
|
|
o.user_phone,
|
|
@@ -197,22 +205,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
sp_latest.bank_transaction_id
|
|
sp_latest.bank_transaction_id
|
|
|
FROM
|
|
FROM
|
|
|
fs_store_order_scrm o
|
|
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 ( 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_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_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_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 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 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_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
|
|
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
|
|
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 AND o.is_sys_del = 0 AND (o.company_user_id IS NULL OR o.company_user_id = 0)
|
|
|
|
|
|
|
+ WHERE o.company_id is null
|
|
|
<if test="maps.status != null and maps.status != ''">
|
|
<if test="maps.status != null and maps.status != ''">
|
|
|
AND o.status = #{maps.status}
|
|
AND o.status = #{maps.status}
|
|
|
</if>
|
|
</if>
|
|
|
|
|
+ <if test="maps.productId != null and maps.productId != ''">
|
|
|
|
|
+ AND fspc.product_id = #{maps.productId}
|
|
|
|
|
+ </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 o.order_code LIKE CONCAT('%', #{maps.orderCode}, '%')
|
|
|
</if>
|
|
</if>
|
|
@@ -228,6 +240,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<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 o.user_phone LIKE CONCAT('%', #{maps.userPhone}, '%')
|
|
|
</if>
|
|
</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 != ''">
|
|
<if test="maps.realName != null and maps.realName != ''">
|
|
|
AND o.real_name LIKE CONCAT('%', #{maps.realName}, '%')
|
|
AND o.real_name LIKE CONCAT('%', #{maps.realName}, '%')
|
|
|
</if>
|
|
</if>
|
|
@@ -256,10 +271,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
AND cu.nick_name LIKE CONCAT('%', #{maps.companyUserNickName}, '%')
|
|
AND cu.nick_name LIKE CONCAT('%', #{maps.companyUserNickName}, '%')
|
|
|
</if>
|
|
</if>
|
|
|
<if test="maps.createTimeRange != null and maps.createTimeRange != ''">
|
|
<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)
|
|
|
|
|
|
|
+ AND o.create_time BETWEEN SUBSTRING_INDEX(#{maps.createTimeRange}, '--', 1) AND SUBSTRING_INDEX(#{maps.createTimeRange}, '--', -1)
|
|
|
</if>
|
|
</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 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>
|
|
|
<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(o.delivery_send_time) BETWEEN SUBSTRING_INDEX(#{maps.deliverySendTimeRange}, '--', 1) AND SUBSTRING_INDEX(#{maps.deliverySendTimeRange}, '--', -1)
|
|
@@ -285,7 +300,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
o.STATUS,
|
|
o.STATUS,
|
|
|
NULL AS is_package,
|
|
NULL AS is_package,
|
|
|
NULL AS package_json,
|
|
NULL AS package_json,
|
|
|
- o.item_json,
|
|
|
|
|
|
|
+ loi.json_info as item_json,
|
|
|
o.delivery_sn AS delivery_id,
|
|
o.delivery_sn AS delivery_id,
|
|
|
|
|
|
|
|
o.delivery_code as deliveryCode,
|
|
o.delivery_code as deliveryCode,
|
|
@@ -300,14 +315,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
|
|
|
cu.phonenumber as salesPhone,
|
|
cu.phonenumber as salesPhone,
|
|
|
cu.create_time as salesCreateTime,
|
|
cu.create_time as salesCreateTime,
|
|
|
- u.user_id as userId,
|
|
|
|
|
|
|
+ o.user_id as userId,
|
|
|
u.order_count as userOrderCount,
|
|
u.order_count as userOrderCount,
|
|
|
u.total_amount as userTotalAmount,
|
|
u.total_amount as userTotalAmount,
|
|
|
u.level as userLevel,
|
|
u.level as userLevel,
|
|
|
fspc.product_id as productId,
|
|
fspc.product_id as productId,
|
|
|
fspc.product_name as productName,
|
|
fspc.product_name as productName,
|
|
|
fspc.prescribe_spec as productSpec,
|
|
fspc.prescribe_spec as productSpec,
|
|
|
- fspc.cost as cost,
|
|
|
|
|
|
|
+ COALESCE(fspc.cost, 0) as cost,
|
|
|
o.pay_postage as payDelivery,
|
|
o.pay_postage as payDelivery,
|
|
|
o.discount_money as discountMoney,
|
|
o.discount_money as discountMoney,
|
|
|
fss.store_id as storeId,
|
|
fss.store_id as storeId,
|
|
@@ -318,7 +333,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
c.company_name,
|
|
c.company_name,
|
|
|
cu.user_name AS sales_name,
|
|
cu.user_name AS sales_name,
|
|
|
cu.nick_name AS company_user_nick_name,
|
|
cu.nick_name AS company_user_nick_name,
|
|
|
- u.nickname,
|
|
|
|
|
|
|
+ ifnull(u.nickname,u.nick_name) as nickname,
|
|
|
u.phone,
|
|
u.phone,
|
|
|
o.user_name AS real_name,
|
|
o.user_name AS real_name,
|
|
|
o.user_phone,
|
|
o.user_phone,
|
|
@@ -339,17 +354,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
left join fs_store_product_category_scrm fspcs on fspc.cate_id = fspcs.cate_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 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
|
|
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
|
|
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
|
|
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
|
|
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 o.is_del = 0 and fspc.product_id IS NOT NULL
|
|
|
<if test="maps.status != null and maps.status != ''">
|
|
<if test="maps.status != null and maps.status != ''">
|
|
|
AND o.status = #{maps.status}
|
|
AND o.status = #{maps.status}
|
|
|
</if>
|
|
</if>
|
|
|
|
|
+ <if test="maps.productId != null and maps.productId != ''">
|
|
|
|
|
+ AND fspc.product_id = #{maps.productId}
|
|
|
|
|
+ </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 o.order_code LIKE CONCAT('%', #{maps.orderCode}, '%')
|
|
|
</if>
|
|
</if>
|
|
@@ -365,6 +384,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<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 o.user_phone LIKE CONCAT('%', #{maps.userPhone}, '%')
|
|
|
</if>
|
|
</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 != ''">
|
|
<if test="maps.realName != null and maps.realName != ''">
|
|
|
AND o.user_name LIKE CONCAT('%', #{maps.realName}, '%')
|
|
AND o.user_name LIKE CONCAT('%', #{maps.realName}, '%')
|
|
|
</if>
|
|
</if>
|
|
@@ -393,10 +415,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
AND cu.nick_name LIKE CONCAT('%', #{maps.companyUserNickName}, '%')
|
|
AND cu.nick_name LIKE CONCAT('%', #{maps.companyUserNickName}, '%')
|
|
|
</if>
|
|
</if>
|
|
|
<if test="maps.createTimeRange != null and maps.createTimeRange != ''">
|
|
<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)
|
|
|
|
|
|
|
+ AND o.create_time BETWEEN SUBSTRING_INDEX(#{maps.createTimeRange}, '--', 1) AND SUBSTRING_INDEX(#{maps.createTimeRange}, '--', -1)
|
|
|
</if>
|
|
</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 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>
|
|
|
<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(o.delivery_send_time) BETWEEN SUBSTRING_INDEX(#{maps.deliverySendTimeRange}, '--', 1) AND SUBSTRING_INDEX(#{maps.deliverySendTimeRange}, '--', -1)
|