2025-09-23 16:52:09 +08:00
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
|
|
<mapper namespace="com.hzs.member.statis.mapper.MemberStatisticsMapper">
|
|
|
|
|
|
|
|
|
|
<select id="getDirectStatisticsNumberOfPeople"
|
|
|
|
|
resultType="com.hzs.common.domain.member.statis.DirectStatisticsTop30VO">
|
|
|
|
|
select
|
|
|
|
|
PK_ID memberId,
|
|
|
|
|
MEMBER_CODE memberCode,
|
|
|
|
|
member_name memberName,
|
|
|
|
|
numberOfPeople,
|
|
|
|
|
numberOfAmount
|
|
|
|
|
from (
|
|
|
|
|
select
|
2025-09-24 15:03:58 +08:00
|
|
|
o.PK_REFERENCE,
|
|
|
|
|
count(DISTINCT o.PK_MEMBER) numberOfPeople,
|
2025-09-23 16:52:09 +08:00
|
|
|
sum(order_amount) numberOfAmount
|
2025-09-24 15:03:58 +08:00
|
|
|
from sa_order o
|
|
|
|
|
right join cu_member m on m.PK_ID = o.pk_member and m.DEL_FLAG = 0 and m.CATEGORY = 0
|
2025-09-23 16:52:09 +08:00
|
|
|
where
|
2025-09-24 15:03:58 +08:00
|
|
|
o.del_flag = 0
|
2025-09-23 16:52:09 +08:00
|
|
|
and order_status = 1
|
2025-09-24 10:21:23 +08:00
|
|
|
AND (order_type in (1,2) or (order_Type = 3 and ORDER_TYPE_EXTEND = 1))
|
2025-09-24 15:03:58 +08:00
|
|
|
and o.pay_time between #{param.startDate} and #{param.endDate}
|
2025-09-23 16:52:09 +08:00
|
|
|
group by PK_REFERENCE
|
|
|
|
|
) r
|
|
|
|
|
left join cu_member cm on r.PK_REFERENCE = cm.pk_id
|
|
|
|
|
WHERE ROWNUM <![CDATA[ <=]]> 30
|
|
|
|
|
order by numberOfPeople desc
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getDirectStatisticsNumberOfAmount"
|
|
|
|
|
resultType="com.hzs.common.domain.member.statis.DirectStatisticsTop30VO">
|
|
|
|
|
select
|
|
|
|
|
PK_ID memberId,
|
|
|
|
|
MEMBER_CODE memberCode,
|
|
|
|
|
member_name memberName,
|
|
|
|
|
numberOfPeople,
|
|
|
|
|
numberOfAmount
|
|
|
|
|
from (
|
|
|
|
|
select
|
2025-09-24 15:03:58 +08:00
|
|
|
o.PK_REFERENCE,
|
|
|
|
|
count(DISTINCT o.PK_MEMBER) numberOfPeople,
|
2025-09-23 16:52:09 +08:00
|
|
|
sum(order_amount) numberOfAmount
|
2025-09-24 15:03:58 +08:00
|
|
|
from sa_order o
|
|
|
|
|
right join cu_member m on m.PK_ID = o.pk_member and m.DEL_FLAG = 0 and m.CATEGORY = 0
|
2025-09-23 16:52:09 +08:00
|
|
|
where
|
2025-09-24 15:03:58 +08:00
|
|
|
o.del_flag = 0
|
2025-09-23 16:52:09 +08:00
|
|
|
and order_status = 1
|
2025-09-24 10:21:23 +08:00
|
|
|
AND (order_type in (1,2) or (order_Type = 3 and ORDER_TYPE_EXTEND = 1))
|
2025-09-24 15:03:58 +08:00
|
|
|
and o.pay_time between #{param.startDate} and #{param.endDate}
|
2025-09-24 15:16:47 +08:00
|
|
|
group by PK_REFERENCE
|
2025-09-23 16:52:09 +08:00
|
|
|
) r
|
|
|
|
|
left join cu_member cm on r.PK_REFERENCE = cm.pk_id
|
|
|
|
|
WHERE ROWNUM <![CDATA[ <=]]> 30
|
|
|
|
|
order by numberOfAmount desc
|
|
|
|
|
</select>
|
|
|
|
|
</mapper>
|