Commit b572669c16e67cf7b617c90e85a42e39a4dd4861
1 parent
20f06c51
fix(mall): 补齐商城统计查询的租户过滤条件
补齐订单、售后、佣金、会员、钱包、访问量和商品统计的 tenant_id 条件 覆盖关联子查询和 JOIN 两侧,并将租户条件统一放在 WHERE 条件末尾 保持全局租户拦截器行为不变
Showing
7 changed files
with
143 additions
and
12 deletions
yudao-module-mall/yudao-module-statistics/src/main/resources/mapper/infra/ApiAccessLogStatisticsMapper.xml
| ... | ... | @@ -8,6 +8,9 @@ |
| 8 | 8 | WHERE user_type = #{userType} |
| 9 | 9 | AND create_time BETWEEN #{beginTime} AND #{endTime} |
| 10 | 10 | AND deleted = FALSE |
| 11 | + <if test="@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId() != null"> | |
| 12 | + AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()} | |
| 13 | + </if> | |
| 11 | 14 | </select> |
| 12 | 15 | |
| 13 | 16 | <select id="selectUserCountByUserTypeAndCreateTimeBetween" resultType="java.lang.Integer"> |
| ... | ... | @@ -17,6 +20,9 @@ |
| 17 | 20 | AND user_type = #{userType} |
| 18 | 21 | AND create_time BETWEEN #{beginTime} AND #{endTime} |
| 19 | 22 | AND deleted = FALSE |
| 23 | + <if test="@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId() != null"> | |
| 24 | + AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()} | |
| 25 | + </if> | |
| 20 | 26 | </select> |
| 21 | 27 | |
| 22 | 28 | </mapper> | ... | ... |
yudao-module-mall/yudao-module-statistics/src/main/resources/mapper/member/MemberStatisticsMapper.xml
| ... | ... | @@ -7,6 +7,9 @@ |
| 7 | 7 | SELECT area_id, COUNT(1) AS userCount |
| 8 | 8 | FROM member_user |
| 9 | 9 | WHERE deleted = FALSE |
| 10 | + <if test="@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId() != null"> | |
| 11 | + AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()} | |
| 12 | + </if> | |
| 10 | 13 | GROUP BY area_id |
| 11 | 14 | </select> |
| 12 | 15 | |
| ... | ... | @@ -15,6 +18,9 @@ |
| 15 | 18 | SELECT sex, COUNT(1) AS userCount |
| 16 | 19 | FROM member_user |
| 17 | 20 | WHERE deleted = FALSE |
| 21 | + <if test="@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId() != null"> | |
| 22 | + AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()} | |
| 23 | + </if> | |
| 18 | 24 | GROUP BY sex |
| 19 | 25 | </select> |
| 20 | 26 | |
| ... | ... | @@ -23,6 +29,9 @@ |
| 23 | 29 | SELECT register_terminal as terminal, COUNT(1) AS userCount |
| 24 | 30 | FROM member_user |
| 25 | 31 | WHERE deleted = FALSE |
| 32 | + <if test="@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId() != null"> | |
| 33 | + AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()} | |
| 34 | + </if> | |
| 26 | 35 | GROUP BY register_terminal |
| 27 | 36 | </select> |
| 28 | 37 | |
| ... | ... | @@ -36,6 +45,9 @@ |
| 36 | 45 | <if test="endTime != null"> |
| 37 | 46 | AND create_time <= #{endTime} |
| 38 | 47 | </if> |
| 48 | + <if test="@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId() != null"> | |
| 49 | + AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()} | |
| 50 | + </if> | |
| 39 | 51 | </select> |
| 40 | 52 | |
| 41 | 53 | <select id="selectListByCreateTimeBetween" |
| ... | ... | @@ -45,6 +57,9 @@ |
| 45 | 57 | FROM member_user |
| 46 | 58 | WHERE create_time BETWEEN #{beginTime} AND #{endTime} |
| 47 | 59 | AND deleted = FALSE |
| 60 | + <if test="@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId() != null"> | |
| 61 | + AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()} | |
| 62 | + </if> | |
| 48 | 63 | GROUP BY date |
| 49 | 64 | </select> |
| 50 | 65 | ... | ... |
yudao-module-mall/yudao-module-statistics/src/main/resources/mapper/pay/PayWalletStatisticsMapper.xml
| ... | ... | @@ -10,6 +10,9 @@ |
| 10 | 10 | WHERE pay_status = #{payStatus} |
| 11 | 11 | AND pay_time BETWEEN #{beginTime} AND #{endTime} |
| 12 | 12 | AND deleted = FALSE |
| 13 | + <if test="@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId() != null"> | |
| 14 | + AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()} | |
| 15 | + </if> | |
| 13 | 16 | </select> |
| 14 | 17 | |
| 15 | 18 | <select id="selectRechargeSummaryByRefundTimeBetween" |
| ... | ... | @@ -20,6 +23,9 @@ |
| 20 | 23 | WHERE refund_status = #{refundStatus} |
| 21 | 24 | AND refund_time BETWEEN #{beginTime} AND #{endTime} |
| 22 | 25 | AND deleted = FALSE |
| 26 | + <if test="@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId() != null"> | |
| 27 | + AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()} | |
| 28 | + </if> | |
| 23 | 29 | </select> |
| 24 | 30 | |
| 25 | 31 | <select id="selectPriceSummaryByBizTypeAndCreateTimeBetween" resultType="java.lang.Integer"> |
| ... | ... | @@ -28,6 +34,9 @@ |
| 28 | 34 | WHERE biz_type = #{bizType} |
| 29 | 35 | AND create_time BETWEEN #{beginTime} AND #{endTime} |
| 30 | 36 | AND deleted = FALSE |
| 37 | + <if test="@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId() != null"> | |
| 38 | + AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()} | |
| 39 | + </if> | |
| 31 | 40 | </select> |
| 32 | 41 | |
| 33 | 42 | <select id="selectRechargeSummaryGroupByWalletId" |
| ... | ... | @@ -43,6 +52,9 @@ |
| 43 | 52 | AND pay_time <= #{endTime} |
| 44 | 53 | </if> |
| 45 | 54 | AND deleted = FALSE |
| 55 | + <if test="@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId() != null"> | |
| 56 | + AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()} | |
| 57 | + </if> | |
| 46 | 58 | </select> |
| 47 | 59 | |
| 48 | 60 | <select id="selectRechargePriceSummary" resultType="java.lang.Integer"> |
| ... | ... | @@ -50,6 +62,9 @@ |
| 50 | 62 | FROM pay_wallet_recharge |
| 51 | 63 | WHERE pay_status = #{payStatus} |
| 52 | 64 | AND deleted = FALSE |
| 65 | + <if test="@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId() != null"> | |
| 66 | + AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()} | |
| 67 | + </if> | |
| 53 | 68 | </select> |
| 54 | 69 | |
| 55 | 70 | </mapper> | ... | ... |
yudao-module-mall/yudao-module-statistics/src/main/resources/mapper/product/ProductStatisticsMapper.xml
| ... | ... | @@ -9,55 +9,96 @@ |
| 9 | 9 | , (SELECT COUNT(1) |
| 10 | 10 | FROM product_browse_history |
| 11 | 11 | WHERE spu_id = spu.id |
| 12 | - AND create_time BETWEEN #{beginTime} AND #{endTime}) AS browse_count | |
| 12 | + AND create_time BETWEEN #{beginTime} AND #{endTime} | |
| 13 | + <if test="@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId() != null"> | |
| 14 | + AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()} | |
| 15 | + </if> | |
| 16 | + ) AS browse_count | |
| 13 | 17 | -- 访客量:按用户去重计数 |
| 14 | 18 | , (SELECT COUNT(DISTINCT user_id) |
| 15 | 19 | FROM product_browse_history |
| 16 | 20 | WHERE spu_id = spu.id |
| 17 | - AND create_time BETWEEN #{beginTime} AND #{endTime}) AS browse_user_count | |
| 21 | + AND create_time BETWEEN #{beginTime} AND #{endTime} | |
| 22 | + <if test="@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId() != null"> | |
| 23 | + AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()} | |
| 24 | + </if> | |
| 25 | + ) AS browse_user_count | |
| 18 | 26 | -- 收藏数量:按用户去重计数 |
| 19 | 27 | , (SELECT COUNT(DISTINCT user_id) |
| 20 | 28 | FROM product_favorite |
| 21 | 29 | WHERE spu_id = spu.id |
| 22 | - AND create_time BETWEEN #{beginTime} AND #{endTime}) AS favorite_count | |
| 30 | + AND create_time BETWEEN #{beginTime} AND #{endTime} | |
| 31 | + <if test="@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId() != null"> | |
| 32 | + AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()} | |
| 33 | + </if> | |
| 34 | + ) AS favorite_count | |
| 23 | 35 | -- 加购数量:按用户去重计数 |
| 24 | 36 | , (SELECT COUNT(DISTINCT user_id) |
| 25 | 37 | FROM trade_cart |
| 26 | 38 | WHERE spu_id = spu.id |
| 27 | - AND create_time BETWEEN #{beginTime} AND #{endTime}) AS cart_count | |
| 39 | + AND create_time BETWEEN #{beginTime} AND #{endTime} | |
| 40 | + <if test="@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId() != null"> | |
| 41 | + AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()} | |
| 42 | + </if> | |
| 43 | + ) AS cart_count | |
| 28 | 44 | -- 下单件数 |
| 29 | 45 | , (SELECT IFNULL(SUM(count), 0) |
| 30 | 46 | FROM trade_order_item |
| 31 | 47 | WHERE spu_id = spu.id |
| 32 | - AND create_time BETWEEN #{beginTime} AND #{endTime}) AS order_count | |
| 48 | + AND create_time BETWEEN #{beginTime} AND #{endTime} | |
| 49 | + <if test="@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId() != null"> | |
| 50 | + AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()} | |
| 51 | + </if> | |
| 52 | + ) AS order_count | |
| 33 | 53 | -- 支付件数 |
| 34 | 54 | , (SELECT IFNULL(SUM(item.count), 0) |
| 35 | 55 | FROM trade_order_item item |
| 36 | 56 | JOIN trade_order o ON item.order_id = o.id |
| 37 | 57 | WHERE spu_id = spu.id |
| 38 | 58 | AND o.pay_status = TRUE |
| 39 | - AND item.create_time BETWEEN #{beginTime} AND #{endTime}) AS order_pay_count | |
| 59 | + AND item.create_time BETWEEN #{beginTime} AND #{endTime} | |
| 60 | + <if test="@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId() != null"> | |
| 61 | + AND item.tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()} | |
| 62 | + AND o.tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()} | |
| 63 | + </if> | |
| 64 | + ) AS order_pay_count | |
| 40 | 65 | -- 支付金额 |
| 41 | 66 | , (SELECT IFNULL(SUM(item.pay_price), 0) |
| 42 | 67 | FROM trade_order_item item |
| 43 | 68 | JOIN trade_order o ON item.order_id = o.id |
| 44 | 69 | WHERE spu_id = spu.id |
| 45 | 70 | AND o.pay_status = TRUE |
| 46 | - AND item.create_time BETWEEN #{beginTime} AND #{endTime}) AS order_pay_price | |
| 71 | + AND item.create_time BETWEEN #{beginTime} AND #{endTime} | |
| 72 | + <if test="@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId() != null"> | |
| 73 | + AND item.tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()} | |
| 74 | + AND o.tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()} | |
| 75 | + </if> | |
| 76 | + ) AS order_pay_price | |
| 47 | 77 | -- 退款件数 |
| 48 | 78 | , (SELECT IFNULL(SUM(count), 0) |
| 49 | 79 | FROM trade_after_sale |
| 50 | 80 | WHERE spu_id = spu.id |
| 51 | 81 | AND refund_time IS NOT NULL |
| 52 | - AND create_time BETWEEN #{beginTime} AND #{endTime}) AS after_sale_count | |
| 82 | + AND create_time BETWEEN #{beginTime} AND #{endTime} | |
| 83 | + <if test="@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId() != null"> | |
| 84 | + AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()} | |
| 85 | + </if> | |
| 86 | + ) AS after_sale_count | |
| 53 | 87 | -- 退款金额 |
| 54 | 88 | , (SELECT IFNULL(SUM(refund_price), 0) |
| 55 | 89 | FROM trade_after_sale |
| 56 | 90 | WHERE spu_id = spu.id |
| 57 | 91 | AND refund_time IS NOT NULL |
| 58 | - AND create_time BETWEEN #{beginTime} AND #{endTime}) AS after_sale_refund_price | |
| 92 | + AND create_time BETWEEN #{beginTime} AND #{endTime} | |
| 93 | + <if test="@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId() != null"> | |
| 94 | + AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()} | |
| 95 | + </if> | |
| 96 | + ) AS after_sale_refund_price | |
| 59 | 97 | FROM product_spu spu |
| 60 | 98 | WHERE spu.deleted = FALSE |
| 99 | + <if test="@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId() != null"> | |
| 100 | + AND spu.tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()} | |
| 101 | + </if> | |
| 61 | 102 | ORDER BY spu.id |
| 62 | 103 | </select> |
| 63 | 104 | ... | ... |
yudao-module-mall/yudao-module-statistics/src/main/resources/mapper/trade/AfterSaleStatisticsMapper.xml
| ... | ... | @@ -9,6 +9,9 @@ |
| 9 | 9 | FROM trade_after_sale |
| 10 | 10 | WHERE refund_time BETWEEN #{beginTime} AND #{endTime} |
| 11 | 11 | AND deleted = FALSE |
| 12 | + <if test="@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId() != null"> | |
| 13 | + AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()} | |
| 14 | + </if> | |
| 12 | 15 | </select> |
| 13 | 16 | |
| 14 | 17 | <select id="selectCountByStatus" resultType="java.lang.Long"> |
| ... | ... | @@ -16,6 +19,9 @@ |
| 16 | 19 | FROM trade_after_sale |
| 17 | 20 | WHERE status = #{status} |
| 18 | 21 | AND deleted = FALSE |
| 22 | + <if test="@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId() != null"> | |
| 23 | + AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()} | |
| 24 | + </if> | |
| 19 | 25 | </select> |
| 20 | 26 | |
| 21 | 27 | </mapper> | ... | ... |
yudao-module-mall/yudao-module-statistics/src/main/resources/mapper/trade/BrokerageStatisticsMapper.xml
| ... | ... | @@ -9,6 +9,9 @@ |
| 9 | 9 | AND status = #{status} |
| 10 | 10 | AND unfreeze_time BETWEEN #{beginTime} AND #{endTime} |
| 11 | 11 | AND deleted = FALSE |
| 12 | + <if test="@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId() != null"> | |
| 13 | + AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()} | |
| 14 | + </if> | |
| 12 | 15 | </select> |
| 13 | 16 | |
| 14 | 17 | <select id="selectWithdrawCountByStatus" resultType="java.lang.Long"> |
| ... | ... | @@ -16,6 +19,9 @@ |
| 16 | 19 | FROM trade_brokerage_withdraw |
| 17 | 20 | WHERE status = #{status} |
| 18 | 21 | AND deleted = FALSE |
| 22 | + <if test="@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId() != null"> | |
| 23 | + AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()} | |
| 24 | + </if> | |
| 19 | 25 | </select> |
| 20 | 26 | |
| 21 | 27 | </mapper> | ... | ... |
yudao-module-mall/yudao-module-statistics/src/main/resources/mapper/trade/TradeOrderStatisticsMapper.xml
| ... | ... | @@ -7,19 +7,34 @@ |
| 7 | 7 | SELECT receiver_area_id AS areaId, |
| 8 | 8 | (SELECT COUNT(DISTINCT s.user_id) |
| 9 | 9 | FROM trade_order AS s |
| 10 | - WHERE s.receiver_area_id = m.receiver_area_id) AS orderCreateUserCount, | |
| 10 | + WHERE s.receiver_area_id = m.receiver_area_id | |
| 11 | + <if test="@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId() != null"> | |
| 12 | + AND s.tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()} | |
| 13 | + </if> | |
| 14 | + ) AS orderCreateUserCount, | |
| 11 | 15 | (SELECT COUNT(DISTINCT s.user_id) |
| 12 | 16 | FROM trade_order AS s |
| 13 | 17 | WHERE s.receiver_area_id = m.receiver_area_id |
| 14 | 18 | AND s.pay_status = TRUE |
| 15 | - AND s.deleted = FALSE) AS orderPayUserCount, | |
| 19 | + AND s.deleted = FALSE | |
| 20 | + <if test="@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId() != null"> | |
| 21 | + AND s.tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()} | |
| 22 | + </if> | |
| 23 | + ) AS orderPayUserCount, | |
| 16 | 24 | (SELECT SUM(s.pay_price) |
| 17 | 25 | FROM trade_order AS s |
| 18 | 26 | WHERE s.receiver_area_id = m.receiver_area_id |
| 19 | 27 | AND s.pay_status = TRUE |
| 20 | - AND s.deleted = FALSE) AS orderPayPrice | |
| 28 | + AND s.deleted = FALSE | |
| 29 | + <if test="@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId() != null"> | |
| 30 | + AND s.tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()} | |
| 31 | + </if> | |
| 32 | + ) AS orderPayPrice | |
| 21 | 33 | FROM trade_order m |
| 22 | 34 | WHERE deleted = FALSE |
| 35 | + <if test="@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId() != null"> | |
| 36 | + AND m.tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()} | |
| 37 | + </if> | |
| 23 | 38 | GROUP BY receiver_area_id |
| 24 | 39 | </select> |
| 25 | 40 | |
| ... | ... | @@ -28,6 +43,9 @@ |
| 28 | 43 | FROM trade_order |
| 29 | 44 | WHERE deleted = FALSE |
| 30 | 45 | AND create_time BETWEEN #{beginTime} AND #{endTime} |
| 46 | + <if test="@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId() != null"> | |
| 47 | + AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()} | |
| 48 | + </if> | |
| 31 | 49 | </select> |
| 32 | 50 | |
| 33 | 51 | <select id="selectUserCountByPayTimeBetween" resultType="java.lang.Integer"> |
| ... | ... | @@ -36,6 +54,9 @@ |
| 36 | 54 | WHERE pay_time BETWEEN #{beginTime} AND #{endTime} |
| 37 | 55 | AND pay_status = TRUE |
| 38 | 56 | AND deleted = FALSE |
| 57 | + <if test="@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId() != null"> | |
| 58 | + AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()} | |
| 59 | + </if> | |
| 39 | 60 | </select> |
| 40 | 61 | |
| 41 | 62 | <select id="selectCountByCreateTimeBetween" resultType="java.lang.Integer"> |
| ... | ... | @@ -43,6 +64,9 @@ |
| 43 | 64 | FROM trade_order |
| 44 | 65 | WHERE create_time BETWEEN #{beginTime} AND #{endTime} |
| 45 | 66 | AND deleted = FALSE |
| 67 | + <if test="@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId() != null"> | |
| 68 | + AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()} | |
| 69 | + </if> | |
| 46 | 70 | </select> |
| 47 | 71 | |
| 48 | 72 | <select id="selectCountByPayTimeBetween" resultType="java.lang.Integer"> |
| ... | ... | @@ -51,6 +75,9 @@ |
| 51 | 75 | WHERE pay_status = TRUE |
| 52 | 76 | AND create_time BETWEEN #{beginTime} AND #{endTime} |
| 53 | 77 | AND deleted = FALSE |
| 78 | + <if test="@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId() != null"> | |
| 79 | + AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()} | |
| 80 | + </if> | |
| 54 | 81 | </select> |
| 55 | 82 | |
| 56 | 83 | <select id="selectSummaryPriceByPayTimeBetween" resultType="java.lang.Integer"> |
| ... | ... | @@ -59,6 +86,9 @@ |
| 59 | 86 | WHERE s.pay_status = TRUE |
| 60 | 87 | AND deleted = FALSE |
| 61 | 88 | AND create_time BETWEEN #{beginTime} AND #{endTime} |
| 89 | + <if test="@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId() != null"> | |
| 90 | + AND s.tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()} | |
| 91 | + </if> | |
| 62 | 92 | </select> |
| 63 | 93 | |
| 64 | 94 | <select id="selectListByPayTimeBetweenAndGroupByDay" |
| ... | ... | @@ -70,6 +100,9 @@ |
| 70 | 100 | WHERE pay_status = TRUE |
| 71 | 101 | AND create_time BETWEEN #{beginTime} AND #{endTime} |
| 72 | 102 | AND deleted = FALSE |
| 103 | + <if test="@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId() != null"> | |
| 104 | + AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()} | |
| 105 | + </if> | |
| 73 | 106 | GROUP BY date |
| 74 | 107 | </select> |
| 75 | 108 | |
| ... | ... | @@ -82,6 +115,9 @@ |
| 82 | 115 | WHERE pay_status = TRUE |
| 83 | 116 | AND create_time BETWEEN #{beginTime} AND #{endTime} |
| 84 | 117 | AND deleted = FALSE |
| 118 | + <if test="@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId() != null"> | |
| 119 | + AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()} | |
| 120 | + </if> | |
| 85 | 121 | GROUP BY date |
| 86 | 122 | </select> |
| 87 | 123 | |
| ... | ... | @@ -91,6 +127,9 @@ |
| 91 | 127 | WHERE status = #{status} |
| 92 | 128 | ANd delivery_type = #{deliveryType} |
| 93 | 129 | AND deleted = FALSE |
| 130 | + <if test="@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId() != null"> | |
| 131 | + AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()} | |
| 132 | + </if> | |
| 94 | 133 | </select> |
| 95 | 134 | |
| 96 | 135 | <select id="selectPaySummaryByPayStatusAndPayTimeBetween" |
| ... | ... | @@ -101,6 +140,9 @@ |
| 101 | 140 | WHERE pay_status = #{payStatus} |
| 102 | 141 | AND pay_time BETWEEN #{beginTime} AND #{endTime} |
| 103 | 142 | AND deleted = FALSE |
| 143 | + <if test="@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId() != null"> | |
| 144 | + AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()} | |
| 145 | + </if> | |
| 104 | 146 | </select> |
| 105 | 147 | |
| 106 | 148 | </mapper> | ... | ... |