|
@@ -1409,7 +1409,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
|
|
|
</select>
|
|
</select>
|
|
|
<select id="selectFsStoreOrderStatistics" resultType="java.util.Map">
|
|
<select id="selectFsStoreOrderStatistics" resultType="java.util.Map">
|
|
|
- select sum(o.pay_price) pay_price,sum(o.pay_money) pay_money,sum(o.pay_delivery) pay_remain
|
|
|
|
|
|
|
+ select sum(t.pay_price) pay_price, sum(t.pay_money) pay_money, sum(t.pay_remain) pay_remain from (
|
|
|
|
|
+ select o.id, o.pay_price, o.pay_money, o.pay_delivery as pay_remain
|
|
|
FROM fs_store_order_scrm o
|
|
FROM fs_store_order_scrm o
|
|
|
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 company c on c.company_id=o.company_id
|
|
left join company c on c.company_id=o.company_id
|
|
@@ -1421,7 +1422,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
left join fs_store_order_item_scrm oi on o.id = oi.order_id
|
|
left join fs_store_order_item_scrm oi on o.id = oi.order_id
|
|
|
left join fs_store_product_scrm fsp on fsp.product_id = oi.product_id
|
|
left join fs_store_product_scrm fsp on fsp.product_id = oi.product_id
|
|
|
</if>
|
|
</if>
|
|
|
- <if test="(maps.appId != null and maps.appId != '') or (maps.bankTransactionId != null and maps.bankTransactionId !='')">
|
|
|
|
|
|
|
+ <if test="(maps.appId != null and maps.appId != '') or (maps.bankTransactionId != null and maps.bankTransactionId !='') or (maps.merchantId != null and maps.merchantId != '')">
|
|
|
LEFT JOIN (
|
|
LEFT JOIN (
|
|
|
SELECT
|
|
SELECT
|
|
|
sp.*,
|
|
sp.*,
|
|
@@ -1429,7 +1430,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
FROM fs_store_payment_scrm sp
|
|
FROM fs_store_payment_scrm sp
|
|
|
WHERE sp.order_id IS NOT NULL
|
|
WHERE sp.order_id IS NOT NULL
|
|
|
) sp_latest ON sp_latest.order_id = o.id AND sp_latest.rn = 1
|
|
) sp_latest ON sp_latest.order_id = o.id AND sp_latest.rn = 1
|
|
|
- LEFT JOIN fs_course_play_source_config csc ON csc.appid = sp_latest.app_id
|
|
|
|
|
|
|
+ <if test="(maps.appId != null and maps.appId != '') or (maps.bankTransactionId != null and maps.bankTransactionId !='')">
|
|
|
|
|
+ LEFT JOIN fs_course_play_source_config csc ON csc.appid = sp_latest.app_id
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maps.merchantId != null and maps.merchantId != ''">
|
|
|
|
|
+ LEFT JOIN merchant_app_config mac
|
|
|
|
|
+ ON (mac.id = sp_latest.mer_config_id OR (sp_latest.app_id IS NOT NULL AND FIND_IN_SET(sp_latest.app_id, mac.app_id) > 0 AND (mac.is_deleted = 0 OR mac.is_deleted IS NULL)))
|
|
|
|
|
+ </if>
|
|
|
</if>
|
|
</if>
|
|
|
<where>
|
|
<where>
|
|
|
<if test="maps.appId != null and maps.appId != ''">
|
|
<if test="maps.appId != null and maps.appId != ''">
|
|
@@ -1447,6 +1454,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<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>
|
|
|
|
|
+ <if test="maps.merchantId != null and maps.merchantId != ''">
|
|
|
|
|
+ and mac.merchant_id = #{maps.merchantId}
|
|
|
|
|
+ <!-- 已支付订单:2待发货 3待收货 4待评价 5已完成;以及 status=1 但已支付(paid=1或有支付时间)的订单 -->
|
|
|
|
|
+ and (
|
|
|
|
|
+ o.status in (2, 3, 4, 5)
|
|
|
|
|
+ or (o.status = 1 and (o.paid = 1 or o.pay_time is not null))
|
|
|
|
|
+ )
|
|
|
|
|
+ <!-- 排除已退款成功的订单 -->
|
|
|
|
|
+ and (o.refund_status is null or o.refund_status = '0' or o.refund_status = '1')
|
|
|
|
|
+ </if>
|
|
|
<if test="maps.isPayRemain != null">
|
|
<if test="maps.isPayRemain != null">
|
|
|
and o.is_pay_remain =#{maps.isPayRemain}
|
|
and o.is_pay_remain =#{maps.isPayRemain}
|
|
|
</if>
|
|
</if>
|
|
@@ -1469,7 +1486,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
and o.user_phone like CONCAT('%',#{maps.userPhone},'%')
|
|
and o.user_phone like CONCAT('%',#{maps.userPhone},'%')
|
|
|
</if>
|
|
</if>
|
|
|
|
|
|
|
|
- <if test="maps.status != null and maps.status != 6">
|
|
|
|
|
|
|
+ <!-- 按 tab 筛状态:有商户号时顶部金额统计该商户下全部已支付(含待发货),不再按 status 过滤 -->
|
|
|
|
|
+ <if test="maps.status != null and maps.status != 6 and (maps.merchantId == null or maps.merchantId == '')">
|
|
|
and o.status = #{maps.status}
|
|
and o.status = #{maps.status}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="maps.status == 6">
|
|
<if test="maps.status == 6">
|
|
@@ -1553,6 +1571,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
|
|
|
</where>
|
|
</where>
|
|
|
${maps.params.dataScope}
|
|
${maps.params.dataScope}
|
|
|
|
|
+ GROUP BY o.id, o.pay_price, o.pay_money, o.pay_delivery
|
|
|
|
|
+ ) t
|
|
|
</select>
|
|
</select>
|
|
|
<select id="selectFsStoreOrderProductStatistics" resultType="java.lang.String">
|
|
<select id="selectFsStoreOrderProductStatistics" resultType="java.lang.String">
|
|
|
SELECT GROUP_CONCAT(
|
|
SELECT GROUP_CONCAT(
|
|
@@ -1705,7 +1725,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<select id="selectFsStoreOrderListVO" resultType="com.fs.hisStore.vo.FsStoreOrderVO">
|
|
<select id="selectFsStoreOrderListVO" resultType="com.fs.hisStore.vo.FsStoreOrderVO">
|
|
|
select DISTINCT o.id,o.order_code,o.extend_order_id,o.pay_order_id,o.bank_order_id,o.user_id,o.real_name,o.user_phone,o.user_address,o.cart_id,o.freight_price,o.total_num,o.total_price,o.total_postage,o.pay_price,o.pay_postage,o.pay_delivery,o.pay_money,o.deduction_price,o.coupon_id,o.coupon_price,o.paid,o.pay_time,o.pay_type,o.create_time,o.update_time,o.status,o.refund_status,o.refund_reason_wap_img,o.refund_reason_wap_explain,o.refund_reason_time,o.refund_reason_wap,o.refund_reason,o.refund_price,o.delivery_sn,o.delivery_name,o.delivery_type,o.delivery_id,o.gain_integral,o.use_integral,o.pay_integral,o.back_integral,o.mark,o.is_del,o.remark,o.verify_code,o.store_id,o.shipping_type,o.is_channel,o.is_remind,o.is_sys_del,o.is_prescribe,o.prescribe_id,o.company_id,o.company_user_id,o.is_package,o.package_json,o.order_type,o.package_id,o.finish_time,o.delivery_status,o.delivery_pay_status,o.delivery_time,o.delivery_pay_time,o.delivery_pay_money,o.tui_money,o.tui_money_status,o.delivery_import_time,o.tui_user_id,o.tui_user_money_status,o.order_create_type,o.store_house_code,o.dept_id,o.is_edit_money,o.customer_id,o.is_pay_remain,o.delivery_send_time,o.certificates,o.upload_time,o.item_json,o.schedule_id,o.delivery_pay_type,o.order_visit,o.service_fee,o.cycle,o.prescribe_price,o.follow_doctor_id,o.follow_time,o.user_coupon_id,o.order_medium,o.erp_phone
|
|
select DISTINCT o.id,o.order_code,o.extend_order_id,o.pay_order_id,o.bank_order_id,o.user_id,o.real_name,o.user_phone,o.user_address,o.cart_id,o.freight_price,o.total_num,o.total_price,o.total_postage,o.pay_price,o.pay_postage,o.pay_delivery,o.pay_money,o.deduction_price,o.coupon_id,o.coupon_price,o.paid,o.pay_time,o.pay_type,o.create_time,o.update_time,o.status,o.refund_status,o.refund_reason_wap_img,o.refund_reason_wap_explain,o.refund_reason_time,o.refund_reason_wap,o.refund_reason,o.refund_price,o.delivery_sn,o.delivery_name,o.delivery_type,o.delivery_id,o.gain_integral,o.use_integral,o.pay_integral,o.back_integral,o.mark,o.is_del,o.remark,o.verify_code,o.store_id,o.shipping_type,o.is_channel,o.is_remind,o.is_sys_del,o.is_prescribe,o.prescribe_id,o.company_id,o.company_user_id,o.is_package,o.package_json,o.order_type,o.package_id,o.finish_time,o.delivery_status,o.delivery_pay_status,o.delivery_time,o.delivery_pay_time,o.delivery_pay_money,o.tui_money,o.tui_money_status,o.delivery_import_time,o.tui_user_id,o.tui_user_money_status,o.order_create_type,o.store_house_code,o.dept_id,o.is_edit_money,o.customer_id,o.is_pay_remain,o.delivery_send_time,o.certificates,o.upload_time,o.item_json,o.schedule_id,o.delivery_pay_type,o.order_visit,o.service_fee,o.cycle,o.prescribe_price,o.follow_doctor_id,o.follow_time,o.user_coupon_id,o.order_medium,o.erp_phone
|
|
|
,u.phone,u.register_code,u.register_date,u.source, c.company_name ,cu.nick_name as company_user_nick_name ,cu.phonenumber as company_usere_phonenumber
|
|
,u.phone,u.register_code,u.register_date,u.source, c.company_name ,cu.nick_name as company_user_nick_name ,cu.phonenumber as company_usere_phonenumber
|
|
|
- , csc.name miniProgramName,fsp.cost, fspc.cate_name,spavs.bar_code, sp_latest.bank_transaction_id as bankTransactionId, o.is_audit, o.audit_time
|
|
|
|
|
|
|
+ , csc.name miniProgramName, MAX(mac.merchant_id) as merchantId, fsp.cost, fspc.cate_name,spavs.bar_code, sp_latest.bank_transaction_id as bankTransactionId, o.is_audit, o.audit_time
|
|
|
from fs_store_order_scrm o
|
|
from fs_store_order_scrm o
|
|
|
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 company c on c.company_id=o.company_id
|
|
left join company c on c.company_id=o.company_id
|
|
@@ -1729,6 +1749,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
WHERE sp.order_id IS NOT NULL
|
|
WHERE sp.order_id IS NOT NULL
|
|
|
) sp_latest ON sp_latest.order_id = o.id AND sp_latest.rn = 1
|
|
) sp_latest ON sp_latest.order_id = o.id 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
|
|
|
|
|
+ LEFT JOIN merchant_app_config mac ON (mac.id = sp_latest.mer_config_id OR (sp_latest.app_id IS NOT NULL AND FIND_IN_SET(sp_latest.app_id, mac.app_id) > 0 AND (mac.is_deleted = 0 OR mac.is_deleted IS NULL)))
|
|
|
<where>
|
|
<where>
|
|
|
<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}
|
|
@@ -1745,6 +1766,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<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>
|
|
|
|
|
+ <if test="maps.merchantId != null and maps.merchantId != ''">
|
|
|
|
|
+ and mac.merchant_id = #{maps.merchantId}
|
|
|
|
|
+ </if>
|
|
|
<if test="maps.isPayRemain != null">
|
|
<if test="maps.isPayRemain != null">
|
|
|
and o.is_pay_remain =#{maps.isPayRemain}
|
|
and o.is_pay_remain =#{maps.isPayRemain}
|
|
|
</if>
|
|
</if>
|
|
@@ -1896,7 +1920,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
left join fs_store_order_item_scrm oi on o.id = oi.order_id
|
|
left join fs_store_order_item_scrm oi on o.id = oi.order_id
|
|
|
left join fs_store_product_scrm fsp on fsp.product_id = oi.product_id
|
|
left join fs_store_product_scrm fsp on fsp.product_id = oi.product_id
|
|
|
</if>
|
|
</if>
|
|
|
- <if test="(maps.appId != null and maps.appId != '') or (maps.bankTransactionId != null and maps.bankTransactionId !='')">
|
|
|
|
|
|
|
+ <if test="(maps.appId != null and maps.appId != '') or (maps.bankTransactionId != null and maps.bankTransactionId !='') or (maps.merchantId != null and maps.merchantId != '')">
|
|
|
LEFT JOIN (
|
|
LEFT JOIN (
|
|
|
SELECT
|
|
SELECT
|
|
|
sp.*,
|
|
sp.*,
|
|
@@ -1905,6 +1929,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
WHERE sp.order_id IS NOT NULL
|
|
WHERE sp.order_id IS NOT NULL
|
|
|
) sp_latest ON sp_latest.order_id = o.id AND sp_latest.rn = 1
|
|
) sp_latest ON sp_latest.order_id = o.id 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
|
|
|
|
|
+ <if test="maps.merchantId != null and maps.merchantId != ''">
|
|
|
|
|
+ LEFT JOIN merchant_app_config mac ON (mac.id = sp_latest.mer_config_id OR (sp_latest.app_id IS NOT NULL AND FIND_IN_SET(sp_latest.app_id, mac.app_id) > 0 AND (mac.is_deleted = 0 OR mac.is_deleted IS NULL)))
|
|
|
|
|
+ </if>
|
|
|
</if>
|
|
</if>
|
|
|
<!-- <if test="maps.bankTransactionId != null and maps.bankTransactionId !=''">-->
|
|
<!-- <if test="maps.bankTransactionId != null and maps.bankTransactionId !=''">-->
|
|
|
<!-- LEFT JOIN (-->
|
|
<!-- LEFT JOIN (-->
|
|
@@ -1932,6 +1959,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<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>
|
|
|
|
|
+ <if test="maps.merchantId != null and maps.merchantId != ''">
|
|
|
|
|
+ and mac.merchant_id = #{maps.merchantId}
|
|
|
|
|
+ </if>
|
|
|
<if test="maps.isPayRemain != null">
|
|
<if test="maps.isPayRemain != null">
|
|
|
and o.is_pay_remain =#{maps.isPayRemain}
|
|
and o.is_pay_remain =#{maps.isPayRemain}
|
|
|
</if>
|
|
</if>
|