234 lines
9.9 KiB
XML
234 lines
9.9 KiB
XML
<?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.system.board.mapper.BoardMapper">
|
|
|
|
<!-- 查询会员汇总数据 -->
|
|
<select id="getMemberBoard" resultType="com.hzs.system.board.vo.BoardMemberVO">
|
|
select *
|
|
from (select count(1) member_total
|
|
from cu_member cm
|
|
where cm.del_flag = 0
|
|
and cm.pay_status = 1
|
|
and cm.category = 0) a
|
|
left join (
|
|
select count(1) member_today
|
|
from cu_member cm
|
|
where cm.del_flag = 0
|
|
and cm.pay_status = 1
|
|
and cm.category = 0
|
|
and to_char(cm.pay_time, 'yyyy-mm-dd') =
|
|
to_char(sysdate, 'yyyy-mm-dd')) b on 1 = 1
|
|
left join (select count(1) member_yesterday
|
|
from cu_member cm
|
|
where cm.del_flag = 0
|
|
and cm.pay_status = 1
|
|
and cm.category = 0
|
|
and to_char(cm.pay_time, 'yyyy-mm-dd') =
|
|
to_char(sysdate - 1, 'yyyy-mm-dd')) c
|
|
on 1 = 1
|
|
left join (select count(1) member_month
|
|
from cu_member cm
|
|
where cm.del_flag = 0
|
|
and cm.pay_status = 1
|
|
and cm.category = 0
|
|
and to_char(cm.pay_time, 'yyyy-mm') =
|
|
to_char(sysdate, 'yyyy-mm')) d on 1 = 1
|
|
</select>
|
|
|
|
<!-- 会员各等级数据 -->
|
|
<select id="listMemberLevelBoard" resultType="com.hzs.system.board.vo.BoardMemberLevelVO">
|
|
select bg.grade_name,
|
|
bg.grade_value,
|
|
nvl(a.member_total, 0) member_total,
|
|
0 sort
|
|
from (select cm.pk_settle_grade, count(1) member_total
|
|
from cu_member cm
|
|
where cm.del_flag = 0
|
|
and cm.pay_status = 1
|
|
and cm.category = 0
|
|
and to_char(cm.pay_time, 'yyyy-mm-dd') =
|
|
to_char(sysdate, 'yyyy-mm-dd')
|
|
group by cm.pk_settle_grade
|
|
order by cm.pk_settle_grade) a
|
|
right join bd_grade bg
|
|
on bg.pk_id = a.pk_settle_grade
|
|
where bg.del_flag = 0
|
|
union all
|
|
select bg.grade_name,
|
|
bg.grade_value,
|
|
nvl(a.member_total, 0) member_total,
|
|
1 sort
|
|
from (select cm.pk_settle_grade, count(1) member_total
|
|
from cu_member cm
|
|
where cm.del_flag = 0
|
|
and cm.pay_status = 1
|
|
and cm.category = 0
|
|
and to_char(cm.pay_time, 'yyyy-mm-dd') =
|
|
to_char(sysdate - 1, 'yyyy-mm-dd')
|
|
group by cm.pk_settle_grade
|
|
order by cm.pk_settle_grade) a
|
|
right join bd_grade bg
|
|
on bg.pk_id = a.pk_settle_grade
|
|
where bg.del_flag = 0
|
|
union all
|
|
select bg.grade_name,
|
|
bg.grade_value,
|
|
nvl(a.member_total, 0) member_total,
|
|
2 sort
|
|
from (select cm.pk_settle_grade, count(1) member_total
|
|
from cu_member cm
|
|
where cm.del_flag = 0
|
|
and cm.pay_status = 1
|
|
and cm.category = 0
|
|
and to_char(cm.pay_time, 'yyyy-mm') = to_char(sysdate, 'yyyy-mm')
|
|
group by cm.pk_settle_grade
|
|
order by cm.pk_settle_grade) a
|
|
right join bd_grade bg
|
|
on bg.pk_id = a.pk_settle_grade
|
|
where bg.del_flag = 0
|
|
order by sort, grade_value
|
|
</select>
|
|
|
|
<!-- 查询日业绩汇总数据 -->
|
|
<select id="getDayAchieve" resultType="com.hzs.system.board.vo.BoardAchieveVO">
|
|
select a.*, b.*, 0 sort
|
|
from (
|
|
select nvl(sum(so.order_achieve), 0) first_achieve,
|
|
nvl(sum(so.order_amount), 0) first_amount
|
|
from sa_order so
|
|
where so.del_flag = 0
|
|
and so.order_status = 1
|
|
and so.order_type in (1, 2, 24, 25)
|
|
and to_char(so.pay_time, 'yyyy-mm-dd') =
|
|
to_char(sysdate, 'yyyy-mm-dd')
|
|
) a
|
|
left join (
|
|
select nvl(sum(so.order_achieve), 0) rep_achieve,
|
|
nvl(sum(so.order_amount), 0) rep_amount
|
|
from sa_order so
|
|
where so.del_flag = 0
|
|
and so.order_status = 1
|
|
and so.order_type in (3, 26, 10)
|
|
and to_char(so.pay_time, 'yyyy-mm-dd') =
|
|
to_char(sysdate, 'yyyy-mm-dd')
|
|
) b on 1 = 1
|
|
union all
|
|
select a.*, b.*, 1 sort
|
|
from (
|
|
select nvl(sum(so.order_achieve), 0) first_achieve,
|
|
nvl(sum(so.order_amount), 0) first_amount
|
|
from sa_order so
|
|
where so.del_flag = 0
|
|
and so.order_status = 1
|
|
and so.order_type in (1, 2, 24, 25)
|
|
and to_char(so.pay_time, 'yyyy-mm-dd') =
|
|
to_char(sysdate - 1, 'yyyy-mm-dd')
|
|
) a
|
|
left join (
|
|
select nvl(sum(so.order_achieve), 0) rep_achieve,
|
|
nvl(sum(so.order_amount), 0) rep_amount
|
|
from sa_order so
|
|
where so.del_flag = 0
|
|
and so.order_status = 1
|
|
and so.order_type in (3, 26, 10)
|
|
and to_char(so.pay_time, 'yyyy-mm-dd') =
|
|
to_char(sysdate - 1, 'yyyy-mm-dd')
|
|
) b on 1 = 1
|
|
order by sort
|
|
</select>
|
|
|
|
<!-- 查询月业绩汇总数据 -->
|
|
<select id="getMonthAchieve" resultType="com.hzs.system.board.vo.BoardAchieveVO">
|
|
select a.*, b.*
|
|
from (select nvl(sum(so.order_achieve), 0) first_achieve,
|
|
nvl(sum(so.order_amount), 0) first_amount
|
|
from sa_order so
|
|
where so.del_flag = 0
|
|
and so.order_status = 1
|
|
and so.order_type in (1, 2, 24, 25)
|
|
and to_char(so.pay_time, 'yyyy-mm') = to_char(sysdate, 'yyyy-mm')
|
|
) a
|
|
left join (
|
|
select nvl(sum(so.order_achieve), 0) rep_achieve,
|
|
nvl(sum(so.order_amount - nvl(so.CONSUME_AMOUNT, 0)), 0) rep_amount
|
|
from sa_order so
|
|
where so.del_flag = 0
|
|
and so.order_status = 1
|
|
and so.order_type in (3, 26, 10)
|
|
and to_char(so.pay_time, 'yyyy-mm') =
|
|
to_char(sysdate, 'yyyy-mm')
|
|
) b on 1 = 1
|
|
</select>
|
|
|
|
<!-- 各币种充值数据 -->
|
|
<select id="listAccountRechargeBoard" resultType="com.hzs.system.board.vo.BoardRechargeAccountVO">
|
|
select ba.account_name, nvl(a.recharge_amount, 0) recharge_amount, 0 sort
|
|
from (select t.pk_account, sum(t.recharge_amount) recharge_amount
|
|
from CU_MEMBER_RECHARGE t
|
|
where t.del_flag = 0
|
|
and t.recharge_amount != 0
|
|
and t.pk_account in
|
|
(select t.pk_id
|
|
from bd_account t
|
|
where t.del_flag = 0
|
|
and t.enable_state = 0
|
|
and t.pk_country = 1
|
|
and t.field_value in (1, 2, 3, 4))
|
|
and ((t.recharge_source = 1 and t.approve_state = 2) or
|
|
(t.recharge_source = 0 and t.approve_state = 2))
|
|
and to_char(t.modified_time, 'yyyy-mm-dd') =
|
|
to_char(sysdate, 'yyyy-mm-dd')
|
|
group by t.pk_account) a
|
|
right join bd_account ba
|
|
on ba.pk_id = a.pk_account
|
|
and ba.del_flag = 0
|
|
where ba.field_value in (1, 2, 3, 4)
|
|
union all
|
|
select ba.account_name, nvl(a.recharge_amount, 0) recharge_amount, 1 sort
|
|
from (select t.pk_account, sum(t.recharge_amount) recharge_amount
|
|
from CU_MEMBER_RECHARGE t
|
|
where t.del_flag = 0
|
|
and t.recharge_amount != 0
|
|
and t.pk_account in
|
|
(select t.pk_id
|
|
from bd_account t
|
|
where t.del_flag = 0
|
|
and t.enable_state = 0
|
|
and t.pk_country = 1
|
|
and t.field_value in (1, 2, 3, 4))
|
|
and ((t.recharge_source = 1 and t.approve_state = 2) or
|
|
(t.recharge_source = 0 and t.approve_state = 2))
|
|
and to_char(t.modified_time, 'yyyy-mm-dd') =
|
|
to_char(sysdate - 1, 'yyyy-mm-dd')
|
|
group by t.pk_account) a
|
|
right join bd_account ba
|
|
on ba.pk_id = a.pk_account
|
|
and ba.del_flag = 0
|
|
where ba.field_value in (1, 2, 3, 4)
|
|
union all
|
|
select ba.account_name, nvl(a.recharge_amount, 0) recharge_amount, 2 sort
|
|
from (select t.pk_account, sum(t.recharge_amount) recharge_amount
|
|
from CU_MEMBER_RECHARGE t
|
|
where t.del_flag = 0
|
|
and t.recharge_amount != 0
|
|
and t.pk_account in
|
|
(select t.pk_id
|
|
from bd_account t
|
|
where t.del_flag = 0
|
|
and t.enable_state = 0
|
|
and t.pk_country = 1
|
|
and t.field_value in (1, 2, 3, 4))
|
|
and ((t.recharge_source = 1 and t.approve_state = 2) or
|
|
(t.recharge_source = 0 and t.approve_state = 2))
|
|
and to_char(t.modified_time, 'yyyy-mm') =
|
|
to_char(sysdate - 1, 'yyyy-mm')
|
|
group by t.pk_account) a
|
|
right join bd_account ba
|
|
on ba.pk_id = a.pk_account
|
|
and ba.del_flag = 0
|
|
where ba.field_value in (1, 2, 3, 4)
|
|
</select>
|
|
|
|
</mapper>
|