From 5f3a09f3d4e5fdfc33bd89437c334e6b386c53ed Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期六, 26 十月 2024 10:01:11 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TShoppingOrderMapper.xml |  218 +++++++++++++++++++++++-------------------------------
 1 files changed, 94 insertions(+), 124 deletions(-)

diff --git a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TShoppingOrderMapper.xml b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TShoppingOrderMapper.xml
index f539844..588abad 100644
--- a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TShoppingOrderMapper.xml
+++ b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TShoppingOrderMapper.xml
@@ -97,133 +97,103 @@
             AND t1.del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()}
         </if>
         </if>
-        <if test="req.orderType == null or req.orderType == 2">
-        <if test="req.type == null or req.type == 1 or req.type == 2">
-            union all
-            select t2.code ,t2.order_amount as paymentAmount,
-            t2.coupon_discount_amount as couponDiscountAmount,
-            t2.vip_discount_amount as vipDiscountAmount,
-            t2.payment_amount as orderAmount,
-            t2.create_time as createTime,
-            t2.app_user_id as appUserId,
-            2 as orderType
-            from t_shopping_order t2
-            where 1 = 1
-            <if test="null != req.code and req.code!=''">
-                and t2.code  LIKE CONCAT('%',#{req.code},'%')
+        <if test="req.siteId == null">
+            <if test="req.orderType == null or req.orderType == 2">
+                <if test="req.type == null or req.type == 1 or req.type == 2">
+                    union all
+                    select t2.code ,t2.order_amount as paymentAmount,
+                    t2.coupon_discount_amount as couponDiscountAmount,
+                    t2.vip_discount_amount as vipDiscountAmount,
+                    t2.payment_amount as orderAmount,
+                    t2.create_time as createTime,
+                    t2.app_user_id as appUserId,
+                    2 as orderType
+                    from t_shopping_order t2
+                    where 1 = 1
+                    <if test="null != req.code and req.code!=''">
+                        and t2.code  LIKE CONCAT('%',#{req.code},'%')
+                    </if>
+                    <if test="req.type != null and req.type != '' and req.type == 1">
+                        and (t2.coupon_discount_amount  > 0)
+                    </if>
+                    <if test="req.type != null and req.type != '' and req.type == 2">
+                        and ( t2.vip_discount_amount  > 0)
+                    </if>
+                    <if test="req.type == null ">
+                        and (t2.vip_discount_amount  > 0 or t2.coupon_discount_amount  > 0)
+                    </if>
+                    <if test="null != req.userIds and req.userIds.size()>0" >
+                        and t2.app_user_id in
+                        <foreach collection="req.userIds" item="item" index="index" separator="," open="(" close=")">
+                            #{item}
+                        </foreach>
+                    </if>
+                    <if test="req.endTime != null and req.endTime != '' and req.startTime != null and req.startTime != ''">
+                        AND (t2.create_time between CONCAT(#{req.startTime},':00') and CONCAT(#{req.endTime},':59'))
+                    </if>
+                    and t2.payment_status =2
+                    AND t2.del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()}
+                </if>
             </if>
-            <if test="req.type != null and req.type != '' and req.type == 1">
-                and (t2.coupon_discount_amount  > 0)
+            <if test="req.orderType == null or req.orderType == 3">
+                <if test="req.type == null or req.type == 3">
+                    union all
+                    select t3.code ,t3.order_amount as orderAmount,
+                    0 as couponDiscountAmount,
+                    t3.discount_amount as vipDiscountAmount,
+                    t3.payment_amount as paymentAmount,
+                    t3.create_time as createTime,
+                    t3.app_user_id as appUserId,
+                    3 as orderType
+                    from t_vip_order t3
+                    where 1 = 1
+                    and t3.type =1
+                    <if test="null != req.code and req.code!=''">
+                        and t3.code  LIKE CONCAT('%',#{req.code},'%')
+                    </if>
+                    <if test="req.type == null ">
+                        and t3.discount_amount  > 0
+                    </if>
+                    <if test="null != req.userIds and req.userIds.size()>0" >
+                        and t3.app_user_id in
+                        <foreach collection="req.userIds" item="item" index="index" separator="," open="(" close=")">
+                            #{item}
+                        </foreach>
+                    </if>
+                    <if test="req.endTime != null and req.endTime != '' and req.startTime != null and req.startTime != ''">
+                        AND (t3.create_time between CONCAT(#{req.startTime},':00') and CONCAT(#{req.endTime},':59'))
+                    </if>
+                    and t3.payment_status =2
+                    AND t3.del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()}
+                </if>
             </if>
-            <if test="req.type != null and req.type != '' and req.type == 2">
-                and ( t2.vip_discount_amount  > 0)
-            </if>
-            <if test="req.type == null ">
-                and (t2.vip_discount_amount  > 0 or t2.coupon_discount_amount  > 0)
-            </if>
-            <if test="null != req.userIds and req.userIds.size()>0" >
-                and t2.app_user_id in
-                <foreach collection="req.userIds" item="item" index="index" separator="," open="(" close=")">
-                    #{item}
-                </foreach>
-            </if>
-            <if test="req.endTime != null and req.endTime != '' and req.startTime != null and req.startTime != ''">
-                AND (t2.create_time between CONCAT(#{req.startTime},':00') and CONCAT(#{req.endTime},':59'))
-            </if>
-            and t2.payment_status =2
-            AND t2.del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()}
-        </if>
-        </if>
-        <if test="req.orderType == null or req.orderType == 3">
-            <if test="req.type == null or req.type == 3">
-                union all
-                select t3.code ,t3.order_amount as orderAmount,
-                0 as couponDiscountAmount,
-                t3.discount_amount as vipDiscountAmount,
-                t3.payment_amount as paymentAmount,
-                t3.create_time as createTime,
-                t3.app_user_id as appUserId,
-                3 as orderType
-                from t_vip_order t3
-                where 1 = 1
-                and t3.type =1
-                <if test="null != req.code and req.code!=''">
-                    and t3.code  LIKE CONCAT('%',#{req.code},'%')
-                </if>
-                <if test="req.type == null ">
-                    and t3.discount_amount  > 0
-                </if>
-                <if test="null != req.userIds and req.userIds.size()>0" >
-                    and t3.app_user_id in
-                    <foreach collection="req.userIds" item="item" index="index" separator="," open="(" close=")">
-                        #{item}
-                    </foreach>
-                </if>
-                <if test="req.endTime != null and req.endTime != '' and req.startTime != null and req.startTime != ''">
-                    AND (t3.create_time between CONCAT(#{req.startTime},':00') and CONCAT(#{req.endTime},':59'))
-                </if>
-                and t3.payment_status =2
-                AND t3.del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()}
-            </if>
-        </if>
-        <if test="req.orderType == null or req.orderType == 4">
-            <if test="req.type == null or req.type == 4">
-                union all
-                select t4.code ,t4.order_amount as orderAmount,
-                0 as couponDiscountAmount,
-                t4.discount_amount as vipDiscountAmount,
-                t4.payment_amount as paymentAmount,
-                t4.create_time as createTime,
-                t4.app_user_id as appUserId,
-                4 as orderType
-                from t_vip_order t4
-                where 1 = 1
-                and t4.type =2
-                <if test="null != req.code and req.code!=''">
-                    and t4.code  LIKE CONCAT('%',#{req.code},'%')
-                </if>
-                <if test="req.type == null ">
-                    and t4.discount_amount  > 0
-                </if>
-                <if test="null != req.userIds and req.userIds.size()>0" >
-                    and t4.app_user_id in
-                    <foreach collection="req.userIds" item="item" index="index" separator="," open="(" close=")">
-                        #{item}
-                    </foreach>
-                </if>
-                <if test="req.endTime != null and req.endTime != '' and req.startTime != null and req.startTime != ''">
-                    AND (t4.create_time between CONCAT(#{req.startTime},':00') and CONCAT(#{req.endTime},':59'))
-                </if>
-                and t4.payment_status =2
-                AND t4.del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()}
-            </if>
-        </if>
-        <if test="req.orderType == null or req.orderType == 4">
-            <if test="req.type == null or req.type == 4">
-                union all
-                select t5.code ,t5.order_amount as orderAmount,
-                0 as couponDiscountAmount,
-                0 as vipDiscountAmount,
-                0 as paymentAmount,
-                t5.create_time as createTime,
-                t5.app_user_id as appUserId,
-                4 as orderType
-                from t_grant_vip t5
-                where 1 = 1
-                <if test="null != req.code and req.code!=''">
-                    and t5.code  LIKE CONCAT('%',#{req.code},'%')
-                </if>
-                <if test="null != req.userIds and req.userIds.size()>0" >
-                    and t5.app_user_id in
-                    <foreach collection="req.userIds" item="item" index="index" separator="," open="(" close=")">
-                        #{item}
-                    </foreach>
-                </if>
-                <if test="req.endTime != null and req.endTime != '' and req.startTime != null and req.startTime != ''">
-                    AND (t5.create_time between CONCAT(#{req.startTime},':00') and CONCAT(#{req.endTime},':59'))
-                </if>
-                AND t5.del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()}
+            <if test="req.orderType == null or req.orderType == 4">
+                <if test="req.type == null or req.type == 4">
+                    union all
+                    select t5.code ,t5.order_amount as orderAmount,
+                    0 as couponDiscountAmount,
+                    0 as vipDiscountAmount,
+                    0 as paymentAmount,
+                    t5.create_time as createTime,
+                    t5.app_user_id as appUserId,
+                    4 as orderType
+                    from t_grant_vip t5
+                    where 1 = 1
+                    <if test="null != req.code and req.code!=''">
+                        and t5.code  LIKE CONCAT('%',#{req.code},'%')
+                    </if>
+                    <if test="null != req.userIds and req.userIds.size()>0" >
+                        and t5.app_user_id in
+                        <foreach collection="req.userIds" item="item" index="index" separator="," open="(" close=")">
+                            #{item}
+                        </foreach>
+                    </if>
+                    <if test="req.endTime != null and req.endTime != '' and req.startTime != null and req.startTime != ''">
+                        AND (t5.create_time between CONCAT(#{req.startTime},':00') and CONCAT(#{req.endTime},':59'))
+                    </if>
+                    AND t5.del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()}
 
+                </if>
             </if>
         </if>
     </select>

--
Gitblit v1.7.1