fix: 智聪记账管理,新增结算卡统计、POS机统计功能。
This commit is contained in:
@@ -281,4 +281,522 @@
|
||||
group by a."name"
|
||||
|
||||
</select>
|
||||
|
||||
<select id="selectDebitCardPosList" parameterType="AccountsDto" resultType="com.intc.invest.domain.vo.AccountsDebitPosVo">
|
||||
select
|
||||
t.*
|
||||
from
|
||||
(
|
||||
select
|
||||
a.id ,
|
||||
a."name" ,
|
||||
a.code ,
|
||||
a.create_by,
|
||||
(
|
||||
select
|
||||
case
|
||||
when sum(atr.actual_amount) is null then 0
|
||||
else sum(atr.actual_amount)
|
||||
end
|
||||
from
|
||||
accounts_transfer_record atr
|
||||
where
|
||||
atr.type = '1'
|
||||
and atr.del_flag = '0'
|
||||
and atr.in_account_id = a.id
|
||||
and to_char( atr.create_time,
|
||||
'yyyy-MM-dd') = to_char(CURRENT_DATE,
|
||||
'yyyy-MM-dd')
|
||||
) as oneDayAmount
|
||||
,
|
||||
(
|
||||
select
|
||||
count(atr.actual_amount)
|
||||
from
|
||||
accounts_transfer_record atr
|
||||
where
|
||||
atr.type = '1'
|
||||
and atr.del_flag = '0'
|
||||
and atr.in_account_id = a.id
|
||||
and to_char( atr.create_time,
|
||||
'yyyy-MM-dd') = to_char(CURRENT_DATE,
|
||||
'yyyy-MM-dd')
|
||||
) as oneDayCount,
|
||||
(
|
||||
select
|
||||
case
|
||||
when sum(atr.actual_amount) is null then 0
|
||||
else sum(atr.actual_amount)
|
||||
end
|
||||
from
|
||||
accounts_transfer_record atr
|
||||
where
|
||||
atr.type = '1'
|
||||
and atr.del_flag = '0'
|
||||
and atr.in_account_id = a.id
|
||||
and atr.create_time >= CURRENT_DATE - interval '7 days'
|
||||
) as sevenDayAmount
|
||||
,
|
||||
(
|
||||
select
|
||||
count(atr.actual_amount)
|
||||
from
|
||||
accounts_transfer_record atr
|
||||
where
|
||||
atr.type = '1'
|
||||
and atr.del_flag = '0'
|
||||
and atr.in_account_id = a.id
|
||||
and atr.create_time >= CURRENT_DATE - interval '7 days'
|
||||
) as sevenDayCount,
|
||||
(
|
||||
select
|
||||
case
|
||||
when sum(atr.actual_amount) is null then 0
|
||||
else sum(atr.actual_amount)
|
||||
end
|
||||
from
|
||||
accounts_transfer_record atr
|
||||
where
|
||||
atr.type = '1'
|
||||
and atr.del_flag = '0'
|
||||
and atr.in_account_id = a.id
|
||||
and atr.create_time >= CURRENT_DATE - interval '1 months'
|
||||
) as oneMonthAmount
|
||||
,
|
||||
(
|
||||
select
|
||||
count(atr.actual_amount)
|
||||
from
|
||||
accounts_transfer_record atr
|
||||
where
|
||||
atr.type = '1'
|
||||
and atr.del_flag = '0'
|
||||
and atr.in_account_id = a.id
|
||||
and atr.create_time >= CURRENT_DATE - interval '1 months'
|
||||
) as oneMonthCount,
|
||||
(
|
||||
select
|
||||
case
|
||||
when sum(atr.actual_amount) is null then 0
|
||||
else sum(atr.actual_amount)
|
||||
end
|
||||
from
|
||||
accounts_transfer_record atr
|
||||
where
|
||||
atr.type = '1'
|
||||
and atr.del_flag = '0'
|
||||
and atr.in_account_id = a.id
|
||||
and atr.create_time >= CURRENT_DATE - interval '3 months'
|
||||
) as threeMonthAmount ,
|
||||
(
|
||||
select
|
||||
count(atr.actual_amount)
|
||||
from
|
||||
accounts_transfer_record atr
|
||||
where
|
||||
atr.type = '1'
|
||||
and atr.del_flag = '0'
|
||||
and atr.in_account_id = a.id
|
||||
and atr.create_time >= CURRENT_DATE - interval '3 months'
|
||||
) as threeMonthCount,
|
||||
(
|
||||
select
|
||||
case
|
||||
when sum(atr.actual_amount) is null then 0
|
||||
else sum(atr.actual_amount)
|
||||
end
|
||||
from
|
||||
accounts_transfer_record atr
|
||||
where
|
||||
atr.type = '1'
|
||||
and atr.del_flag = '0'
|
||||
and atr.in_account_id = a.id
|
||||
and atr.create_time >= CURRENT_DATE - interval '6 months'
|
||||
) as sixMonthAmount,
|
||||
(
|
||||
select
|
||||
count(atr.actual_amount)
|
||||
from
|
||||
accounts_transfer_record atr
|
||||
where
|
||||
atr.type = '1'
|
||||
and atr.del_flag = '0'
|
||||
and atr.in_account_id = a.id
|
||||
and atr.create_time >= CURRENT_DATE - interval '6 months'
|
||||
) as sixMonthCount,
|
||||
(
|
||||
select
|
||||
case
|
||||
when sum(atr.actual_amount) is null then 0
|
||||
else sum(atr.actual_amount)
|
||||
end
|
||||
from
|
||||
accounts_transfer_record atr
|
||||
where
|
||||
atr.type = '1'
|
||||
and atr.del_flag = '0'
|
||||
and atr.in_account_id = a.id
|
||||
and atr.create_time >= CURRENT_DATE - interval '1 years'
|
||||
) as oneYearAmount,
|
||||
(
|
||||
select
|
||||
count(atr.actual_amount)
|
||||
from
|
||||
accounts_transfer_record atr
|
||||
where
|
||||
atr.type = '1'
|
||||
and atr.del_flag = '0'
|
||||
and atr.in_account_id = a.id
|
||||
and atr.create_time >= CURRENT_DATE - interval '1 years'
|
||||
) as oneYearCount,
|
||||
(
|
||||
select
|
||||
case
|
||||
when sum(atr.actual_amount) is null then 0
|
||||
else sum(atr.actual_amount)
|
||||
end
|
||||
from
|
||||
accounts_transfer_record atr
|
||||
where
|
||||
atr.type = '1'
|
||||
and atr.del_flag = '0'
|
||||
and atr.in_account_id = a.id
|
||||
and atr.create_time >= CURRENT_DATE - interval '2 years'
|
||||
) as twoYearAmount,
|
||||
(
|
||||
select
|
||||
count(atr.actual_amount)
|
||||
from
|
||||
accounts_transfer_record atr
|
||||
where
|
||||
atr.type = '1'
|
||||
and atr.del_flag = '0'
|
||||
and atr.in_account_id = a.id
|
||||
and atr.create_time >= CURRENT_DATE - interval '2 years'
|
||||
) as twoYearCount,
|
||||
(
|
||||
select
|
||||
case
|
||||
when sum(atr.actual_amount) is null then 0
|
||||
else sum(atr.actual_amount)
|
||||
end
|
||||
from
|
||||
accounts_transfer_record atr
|
||||
where
|
||||
atr.type = '1'
|
||||
and atr.del_flag = '0'
|
||||
and atr.in_account_id = a.id
|
||||
and atr.create_time >= CURRENT_DATE - interval '5 years'
|
||||
) as fiveYearAmount,
|
||||
(
|
||||
select
|
||||
count(atr.actual_amount)
|
||||
from
|
||||
accounts_transfer_record atr
|
||||
where
|
||||
atr.type = '1'
|
||||
and atr.del_flag = '0'
|
||||
and atr.in_account_id = a.id
|
||||
and atr.create_time >= CURRENT_DATE - interval '5 years'
|
||||
) as fiveYearCount,
|
||||
(
|
||||
select
|
||||
case
|
||||
when sum(atr.actual_amount) is null then 0
|
||||
else sum(atr.actual_amount)
|
||||
end
|
||||
from
|
||||
accounts_transfer_record atr
|
||||
where
|
||||
atr.type = '1'
|
||||
and atr.del_flag = '0'
|
||||
and atr.in_account_id = a.id
|
||||
) as totalAmount,
|
||||
(
|
||||
select
|
||||
count(atr.actual_amount)
|
||||
from
|
||||
accounts_transfer_record atr
|
||||
where
|
||||
atr.type = '1'
|
||||
and atr.del_flag = '0'
|
||||
and atr.in_account_id = a.id
|
||||
) as totalCount
|
||||
from
|
||||
accounts a
|
||||
where
|
||||
a.status = '1'
|
||||
and a."type" = '1'
|
||||
and a.del_flag = '0'
|
||||
and a.account_id in
|
||||
(
|
||||
select
|
||||
distinct adr.account_id
|
||||
from
|
||||
accounts_deal_record adr
|
||||
where
|
||||
adr.deal_category = '5'
|
||||
and adr.del_flag = '0' )) t
|
||||
where 0=0
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
order by
|
||||
t.oneMonthCount desc
|
||||
|
||||
</select>
|
||||
|
||||
<select id="selectPosStaticList" parameterType="AccountsDto" resultType="com.intc.invest.domain.vo.AccountsDebitPosVo">
|
||||
select
|
||||
t.*
|
||||
from
|
||||
(
|
||||
select
|
||||
a.id ,
|
||||
a."name" ,
|
||||
a.merchant_name as merchantName,
|
||||
a.pay_company as payCompany,
|
||||
a.create_by,
|
||||
(
|
||||
select
|
||||
case
|
||||
when sum(atr.amount) is null then 0
|
||||
else sum(atr.amount)
|
||||
end
|
||||
from
|
||||
accounts_transfer_record atr
|
||||
where
|
||||
atr.type = '1'
|
||||
and atr.del_flag = '0'
|
||||
and atr.pos_id = a.id
|
||||
and to_char( atr.create_time,
|
||||
'yyyy-MM-dd') = to_char(CURRENT_DATE,
|
||||
'yyyy-MM-dd')
|
||||
) as oneDayAmount
|
||||
,
|
||||
(
|
||||
select
|
||||
count(atr.amount)
|
||||
from
|
||||
accounts_transfer_record atr
|
||||
where
|
||||
atr.type = '1'
|
||||
and atr.del_flag = '0'
|
||||
and atr.pos_id = a.id
|
||||
and to_char( atr.create_time,
|
||||
'yyyy-MM-dd') = to_char(CURRENT_DATE,
|
||||
'yyyy-MM-dd')
|
||||
) as oneDayCount,
|
||||
(
|
||||
select
|
||||
case
|
||||
when sum(atr.amount) is null then 0
|
||||
else sum(atr.amount)
|
||||
end
|
||||
from
|
||||
accounts_transfer_record atr
|
||||
where
|
||||
atr.type = '1'
|
||||
and atr.del_flag = '0'
|
||||
and atr.pos_id = a.id
|
||||
and atr.create_time >= CURRENT_DATE - interval '7 days'
|
||||
) as sevenDayAmount
|
||||
,
|
||||
(
|
||||
select
|
||||
count(atr.amount)
|
||||
from
|
||||
accounts_transfer_record atr
|
||||
where
|
||||
atr.type = '1'
|
||||
and atr.del_flag = '0'
|
||||
and atr.pos_id = a.id
|
||||
and atr.create_time >= CURRENT_DATE - interval '7 days'
|
||||
) as sevenDayCount,
|
||||
(
|
||||
select
|
||||
case
|
||||
when sum(atr.amount) is null then 0
|
||||
else sum(atr.amount)
|
||||
end
|
||||
from
|
||||
accounts_transfer_record atr
|
||||
where
|
||||
atr.type = '1'
|
||||
and atr.del_flag = '0'
|
||||
and atr.pos_id = a.id
|
||||
and atr.create_time >= CURRENT_DATE - interval '1 months'
|
||||
) as oneMonthAmount
|
||||
,
|
||||
(
|
||||
select
|
||||
count(atr.amount)
|
||||
from
|
||||
accounts_transfer_record atr
|
||||
where
|
||||
atr.type = '1'
|
||||
and atr.del_flag = '0'
|
||||
and atr.pos_id = a.id
|
||||
and atr.create_time >= CURRENT_DATE - interval '1 months'
|
||||
) as oneMonthCount,
|
||||
(
|
||||
select
|
||||
case
|
||||
when sum(atr.amount) is null then 0
|
||||
else sum(atr.amount)
|
||||
end
|
||||
from
|
||||
accounts_transfer_record atr
|
||||
where
|
||||
atr.type = '1'
|
||||
and atr.del_flag = '0'
|
||||
and atr.pos_id = a.id
|
||||
and atr.create_time >= CURRENT_DATE - interval '3 months'
|
||||
) as threeMonthAmount ,
|
||||
(
|
||||
select
|
||||
count(atr.amount)
|
||||
from
|
||||
accounts_transfer_record atr
|
||||
where
|
||||
atr.type = '1'
|
||||
and atr.del_flag = '0'
|
||||
and atr.pos_id = a.id
|
||||
and atr.create_time >= CURRENT_DATE - interval '3 months'
|
||||
) as threeMonthCount,
|
||||
(
|
||||
select
|
||||
case
|
||||
when sum(atr.amount) is null then 0
|
||||
else sum(atr.amount)
|
||||
end
|
||||
from
|
||||
accounts_transfer_record atr
|
||||
where
|
||||
atr.type = '1'
|
||||
and atr.del_flag = '0'
|
||||
and atr.pos_id = a.id
|
||||
and atr.create_time >= CURRENT_DATE - interval '6 months'
|
||||
) as sixMonthAmount,
|
||||
(
|
||||
select
|
||||
count(atr.amount)
|
||||
from
|
||||
accounts_transfer_record atr
|
||||
where
|
||||
atr.type = '1'
|
||||
and atr.del_flag = '0'
|
||||
and atr.pos_id = a.id
|
||||
and atr.create_time >= CURRENT_DATE - interval '6 months'
|
||||
) as sixMonthCount,
|
||||
(
|
||||
select
|
||||
case
|
||||
when sum(atr.amount) is null then 0
|
||||
else sum(atr.amount)
|
||||
end
|
||||
from
|
||||
accounts_transfer_record atr
|
||||
where
|
||||
atr.type = '1'
|
||||
and atr.del_flag = '0'
|
||||
and atr.pos_id = a.id
|
||||
and atr.create_time >= CURRENT_DATE - interval '1 years'
|
||||
) as oneYearAmount,
|
||||
(
|
||||
select
|
||||
count(atr.amount)
|
||||
from
|
||||
accounts_transfer_record atr
|
||||
where
|
||||
atr.type = '1'
|
||||
and atr.del_flag = '0'
|
||||
and atr.pos_id = a.id
|
||||
and atr.create_time >= CURRENT_DATE - interval '1 years'
|
||||
) as oneYearCount,
|
||||
(
|
||||
select
|
||||
case
|
||||
when sum(atr.amount) is null then 0
|
||||
else sum(atr.amount)
|
||||
end
|
||||
from
|
||||
accounts_transfer_record atr
|
||||
where
|
||||
atr.type = '1'
|
||||
and atr.del_flag = '0'
|
||||
and atr.pos_id = a.id
|
||||
and atr.create_time >= CURRENT_DATE - interval '2 years'
|
||||
) as twoYearAmount,
|
||||
(
|
||||
select
|
||||
count(atr.amount)
|
||||
from
|
||||
accounts_transfer_record atr
|
||||
where
|
||||
atr.type = '1'
|
||||
and atr.del_flag = '0'
|
||||
and atr.pos_id = a.id
|
||||
and atr.create_time >= CURRENT_DATE - interval '2 years'
|
||||
) as twoYearCount,
|
||||
(
|
||||
select
|
||||
case
|
||||
when sum(atr.amount) is null then 0
|
||||
else sum(atr.amount)
|
||||
end
|
||||
from
|
||||
accounts_transfer_record atr
|
||||
where
|
||||
atr.type = '1'
|
||||
and atr.del_flag = '0'
|
||||
and atr.pos_id = a.id
|
||||
and atr.create_time >= CURRENT_DATE - interval '5 years'
|
||||
) as fiveYearAmount,
|
||||
(
|
||||
select
|
||||
count(atr.amount)
|
||||
from
|
||||
accounts_transfer_record atr
|
||||
where
|
||||
atr.type = '1'
|
||||
and atr.del_flag = '0'
|
||||
and atr.pos_id = a.id
|
||||
and atr.create_time >= CURRENT_DATE - interval '5 years'
|
||||
) as fiveYearCount,
|
||||
(
|
||||
select
|
||||
case
|
||||
when sum(atr.amount) is null then 0
|
||||
else sum(atr.amount)
|
||||
end
|
||||
from
|
||||
accounts_transfer_record atr
|
||||
where
|
||||
atr.type = '1'
|
||||
and atr.del_flag = '0'
|
||||
and atr.pos_id = a.id
|
||||
) as totalAmount,
|
||||
(
|
||||
select
|
||||
count(atr.amount)
|
||||
from
|
||||
accounts_transfer_record atr
|
||||
where
|
||||
atr.type = '1'
|
||||
and atr.del_flag = '0'
|
||||
and atr.pos_id = a.id
|
||||
) as totalCount
|
||||
from
|
||||
pos_machine a
|
||||
where
|
||||
a.del_flag = '0'
|
||||
) t
|
||||
where 0=0
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
order by
|
||||
t.oneMonthCount desc
|
||||
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user