diff --git a/yudao-module-mall/yudao-module-statistics/src/main/resources/mapper/infra/ApiAccessLogStatisticsMapper.xml b/yudao-module-mall/yudao-module-statistics/src/main/resources/mapper/infra/ApiAccessLogStatisticsMapper.xml
index c307c02..96ebd47 100644
--- a/yudao-module-mall/yudao-module-statistics/src/main/resources/mapper/infra/ApiAccessLogStatisticsMapper.xml
+++ b/yudao-module-mall/yudao-module-statistics/src/main/resources/mapper/infra/ApiAccessLogStatisticsMapper.xml
@@ -7,7 +7,7 @@
FROM infra_api_access_log
WHERE user_type = #{userType}
AND create_time BETWEEN #{beginTime} AND #{endTime}
- AND deleted = FALSE
+ AND deleted = 0
AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()}
@@ -19,7 +19,7 @@
WHERE user_id > 0
AND user_type = #{userType}
AND create_time BETWEEN #{beginTime} AND #{endTime}
- AND deleted = FALSE
+ AND deleted = 0
AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()}
diff --git a/yudao-module-mall/yudao-module-statistics/src/main/resources/mapper/member/MemberStatisticsMapper.xml b/yudao-module-mall/yudao-module-statistics/src/main/resources/mapper/member/MemberStatisticsMapper.xml
index 0c1be40..c156419 100644
--- a/yudao-module-mall/yudao-module-statistics/src/main/resources/mapper/member/MemberStatisticsMapper.xml
+++ b/yudao-module-mall/yudao-module-statistics/src/main/resources/mapper/member/MemberStatisticsMapper.xml
@@ -6,7 +6,7 @@
resultType="cn.iocoder.yudao.module.statistics.service.member.bo.MemberAreaStatisticsRespBO">
SELECT area_id, COUNT(1) AS userCount
FROM member_user
- WHERE deleted = FALSE
+ WHERE deleted = 0
AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()}
@@ -17,7 +17,7 @@
resultType="cn.iocoder.yudao.module.statistics.controller.admin.member.vo.MemberSexStatisticsRespVO">
SELECT sex, COUNT(1) AS userCount
FROM member_user
- WHERE deleted = FALSE
+ WHERE deleted = 0
AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()}
@@ -28,7 +28,7 @@
resultType="cn.iocoder.yudao.module.statistics.controller.admin.member.vo.MemberTerminalStatisticsRespVO">
SELECT register_terminal as terminal, COUNT(1) AS userCount
FROM member_user
- WHERE deleted = FALSE
+ WHERE deleted = 0
AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()}
@@ -38,7 +38,7 @@
- SELECT IFNULL(SUM(pay_price), 0)
+ SELECT COALESCE(SUM(pay_price), 0)
FROM pay_wallet_recharge
WHERE pay_status = #{payStatus}
- AND deleted = FALSE
+ AND deleted = 0
AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()}
diff --git a/yudao-module-mall/yudao-module-statistics/src/main/resources/mapper/product/ProductStatisticsMapper.xml b/yudao-module-mall/yudao-module-statistics/src/main/resources/mapper/product/ProductStatisticsMapper.xml
index 43a1540..899f28c 100644
--- a/yudao-module-mall/yudao-module-statistics/src/main/resources/mapper/product/ProductStatisticsMapper.xml
+++ b/yudao-module-mall/yudao-module-statistics/src/main/resources/mapper/product/ProductStatisticsMapper.xml
@@ -42,7 +42,7 @@
) AS cart_count
-- 下单件数
- , (SELECT IFNULL(SUM(count), 0)
+ , (SELECT COALESCE(SUM(count), 0)
FROM trade_order_item
WHERE spu_id = spu.id
AND create_time BETWEEN #{beginTime} AND #{endTime}
@@ -51,7 +51,7 @@
) AS order_count
-- 支付件数
- , (SELECT IFNULL(SUM(item.count), 0)
+ , (SELECT COALESCE(SUM(item.count), 0)
FROM trade_order_item item
JOIN trade_order o ON item.order_id = o.id
WHERE spu_id = spu.id
@@ -63,7 +63,7 @@
) AS order_pay_count
-- 支付金额
- , (SELECT IFNULL(SUM(item.pay_price), 0)
+ , (SELECT COALESCE(SUM(item.pay_price), 0)
FROM trade_order_item item
JOIN trade_order o ON item.order_id = o.id
WHERE spu_id = spu.id
@@ -75,7 +75,7 @@
) AS order_pay_price
-- 退款件数
- , (SELECT IFNULL(SUM(count), 0)
+ , (SELECT COALESCE(SUM(count), 0)
FROM trade_after_sale
WHERE spu_id = spu.id
AND refund_time IS NOT NULL
@@ -85,7 +85,7 @@
) AS after_sale_count
-- 退款金额
- , (SELECT IFNULL(SUM(refund_price), 0)
+ , (SELECT COALESCE(SUM(refund_price), 0)
FROM trade_after_sale
WHERE spu_id = spu.id
AND refund_time IS NOT NULL
@@ -95,7 +95,7 @@
) AS after_sale_refund_price
FROM product_spu spu
- WHERE spu.deleted = FALSE
+ WHERE spu.deleted = 0
AND spu.tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()}
diff --git a/yudao-module-mall/yudao-module-statistics/src/main/resources/mapper/trade/AfterSaleStatisticsMapper.xml b/yudao-module-mall/yudao-module-statistics/src/main/resources/mapper/trade/AfterSaleStatisticsMapper.xml
index cd24b50..4846bcb 100644
--- a/yudao-module-mall/yudao-module-statistics/src/main/resources/mapper/trade/AfterSaleStatisticsMapper.xml
+++ b/yudao-module-mall/yudao-module-statistics/src/main/resources/mapper/trade/AfterSaleStatisticsMapper.xml
@@ -8,7 +8,7 @@
SUM(refund_price) AS afterSaleRefundPrice
FROM trade_after_sale
WHERE refund_time BETWEEN #{beginTime} AND #{endTime}
- AND deleted = FALSE
+ AND deleted = 0
AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()}
@@ -18,7 +18,7 @@
SELECT COUNT(1)
FROM trade_after_sale
WHERE status = #{status}
- AND deleted = FALSE
+ AND deleted = 0
AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()}
diff --git a/yudao-module-mall/yudao-module-statistics/src/main/resources/mapper/trade/BrokerageStatisticsMapper.xml b/yudao-module-mall/yudao-module-statistics/src/main/resources/mapper/trade/BrokerageStatisticsMapper.xml
index cd91e92..daac452 100644
--- a/yudao-module-mall/yudao-module-statistics/src/main/resources/mapper/trade/BrokerageStatisticsMapper.xml
+++ b/yudao-module-mall/yudao-module-statistics/src/main/resources/mapper/trade/BrokerageStatisticsMapper.xml
@@ -8,7 +8,7 @@
WHERE biz_type = #{bizType}
AND status = #{status}
AND unfreeze_time BETWEEN #{beginTime} AND #{endTime}
- AND deleted = FALSE
+ AND deleted = 0
AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()}
@@ -18,7 +18,7 @@
SELECT COUNT(1)
FROM trade_brokerage_withdraw
WHERE status = #{status}
- AND deleted = FALSE
+ AND deleted = 0
AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()}
diff --git a/yudao-module-mall/yudao-module-statistics/src/main/resources/mapper/trade/TradeOrderStatisticsMapper.xml b/yudao-module-mall/yudao-module-statistics/src/main/resources/mapper/trade/TradeOrderStatisticsMapper.xml
index 270c90b..434b04b 100644
--- a/yudao-module-mall/yudao-module-statistics/src/main/resources/mapper/trade/TradeOrderStatisticsMapper.xml
+++ b/yudao-module-mall/yudao-module-statistics/src/main/resources/mapper/trade/TradeOrderStatisticsMapper.xml
@@ -16,7 +16,7 @@
FROM trade_order AS s
WHERE s.receiver_area_id = m.receiver_area_id
AND s.pay_status = TRUE
- AND s.deleted = FALSE
+ AND s.deleted = 0
AND s.tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()}
@@ -25,13 +25,13 @@
FROM trade_order AS s
WHERE s.receiver_area_id = m.receiver_area_id
AND s.pay_status = TRUE
- AND s.deleted = FALSE
+ AND s.deleted = 0
AND s.tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()}
) AS orderPayPrice
FROM trade_order m
- WHERE deleted = FALSE
+ WHERE deleted = 0
AND m.tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()}
@@ -41,7 +41,7 @@
SELECT COUNT(DISTINCT (user_id))
FROM trade_order
- WHERE deleted = FALSE
+ WHERE deleted = 0
AND create_time BETWEEN #{beginTime} AND #{endTime}
AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()}
@@ -53,7 +53,7 @@
FROM trade_order
WHERE pay_time BETWEEN #{beginTime} AND #{endTime}
AND pay_status = TRUE
- AND deleted = FALSE
+ AND deleted = 0
AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()}
@@ -63,7 +63,7 @@
SELECT COUNT(1)
FROM trade_order
WHERE create_time BETWEEN #{beginTime} AND #{endTime}
- AND deleted = FALSE
+ AND deleted = 0
AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()}
@@ -74,7 +74,7 @@
FROM trade_order
WHERE pay_status = TRUE
AND create_time BETWEEN #{beginTime} AND #{endTime}
- AND deleted = FALSE
+ AND deleted = 0
AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()}
@@ -84,7 +84,7 @@
SELECT SUM(pay_price)
FROM trade_order AS s
WHERE s.pay_status = TRUE
- AND deleted = FALSE
+ AND deleted = 0
AND create_time BETWEEN #{beginTime} AND #{endTime}
AND s.tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()}
@@ -93,32 +93,35 @@
- SELECT DATE_FORMAT(pay_time, '%Y-%m-%d') AS date,
+ SELECT CAST(pay_time AS DATE) AS date,
COUNT(1) AS orderPayCount,
SUM(pay_price) AS orderPayPrice
FROM trade_order
WHERE pay_status = TRUE
AND create_time BETWEEN #{beginTime} AND #{endTime}
- AND deleted = FALSE
+ AND deleted = 0
AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()}
GROUP BY date
+ ORDER BY date
- SELECT DATE_FORMAT(pay_time, '%Y-%m') AS date,
+ SELECT CONCAT(EXTRACT(YEAR FROM pay_time), '-',
+ LPAD(CONCAT(EXTRACT(MONTH FROM pay_time)), 2, '0')) AS date,
COUNT(1) AS order_pay_count,
SUM(pay_price) AS order_pay_price
FROM trade_order
WHERE pay_status = TRUE
AND create_time BETWEEN #{beginTime} AND #{endTime}
- AND deleted = FALSE
+ AND deleted = 0
AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()}
GROUP BY date
+ ORDER BY date
@@ -126,7 +129,7 @@
FROM trade_order
WHERE status = #{status}
ANd delivery_type = #{deliveryType}
- AND deleted = FALSE
+ AND deleted = 0
AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()}
@@ -134,12 +137,12 @@
- SELECT IFNULL(SUM(pay_price), 0) AS order_pay_price,
+ SELECT COALESCE(SUM(pay_price), 0) AS order_pay_price,
COUNT(1) AS order_pay_count
FROM trade_order
WHERE pay_status = #{payStatus}
AND pay_time BETWEEN #{beginTime} AND #{endTime}
- AND deleted = FALSE
+ AND deleted = 0
AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()}
diff --git a/yudao-module-mall/yudao-module-statistics/src/main/resources/mapper/trade/TradeStatisticsMapper.xml b/yudao-module-mall/yudao-module-statistics/src/main/resources/mapper/trade/TradeStatisticsMapper.xml
index 2415f6d..0a49132 100644
--- a/yudao-module-mall/yudao-module-statistics/src/main/resources/mapper/trade/TradeStatisticsMapper.xml
+++ b/yudao-module-mall/yudao-module-statistics/src/main/resources/mapper/trade/TradeStatisticsMapper.xml
@@ -4,11 +4,11 @@
- SELECT IFNULL(SUM(order_create_count), 0) AS count,
- IFNULL(SUM(order_pay_price), 0) AS summary
+ SELECT COALESCE(SUM(order_create_count), 0) AS count,
+ COALESCE(SUM(order_pay_price), 0) AS summary
FROM trade_statistics
WHERE time BETWEEN #{beginTime} AND #{endTime}
- AND deleted = FALSE
+ AND deleted = 0
SELECT -- 支出金额 = 余额支付金额 + 支付佣金金额 + 商品退款金额
SUM(wallet_pay_price + brokerage_settlement_price + after_sale_refund_price) AS expensePrice
FROM trade_statistics
- WHERE deleted = FALSE
+ WHERE deleted = 0
AND time >= #{beginTime}
diff --git a/yudao-module-mall/yudao-module-trade/src/main/resources/mapper/brokerage/BrokerageUserMapper.xml b/yudao-module-mall/yudao-module-trade/src/main/resources/mapper/brokerage/BrokerageUserMapper.xml
index 69ee4ed..315cc70 100644
--- a/yudao-module-mall/yudao-module-trade/src/main/resources/mapper/brokerage/BrokerageUserMapper.xml
+++ b/yudao-module-mall/yudao-module-trade/src/main/resources/mapper/brokerage/BrokerageUserMapper.xml
@@ -17,14 +17,14 @@
resultType="cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.user.AppBrokerageUserChildSummaryRespVO">
SELECT bu.id, bu.bind_user_time AS brokerageTime,
(SELECT SUM(price) FROM trade_brokerage_record r
- WHERE r.user_id = bu.id AND biz_type = #{bizType} AND r.status = #{status} AND r.deleted = FALSE) AS brokeragePrice,
+ WHERE r.user_id = bu.id AND biz_type = #{bizType} AND r.status = #{status} AND r.deleted = 0) AS brokeragePrice,
(SELECT COUNT(1) FROM trade_brokerage_record r
- WHERE r.user_id = bu.id AND biz_type = #{bizType} AND r.status = #{status} AND r.deleted = FALSE) AS brokerageOrderCount,
+ WHERE r.user_id = bu.id AND biz_type = #{bizType} AND r.status = #{status} AND r.deleted = 0) AS brokerageOrderCount,
(SELECT COUNT(1) FROM trade_brokerage_user c
- WHERE c.bind_user_id = bu.id AND c.deleted = FALSE) AS brokerageUserCount
+ WHERE c.bind_user_id = bu.id AND c.deleted = 0) AS brokerageUserCount
FROM trade_brokerage_user AS bu
- bu.deleted = false
+ bu.deleted = 0
and bu.id in