update 修改统计视图查询

This commit is contained in:
lijiarao
2022-07-20 14:42:26 +08:00
parent 76e35ce693
commit 1c81ec5b7a
2 changed files with 54 additions and 57 deletions
+26 -1
View File
@@ -214,4 +214,29 @@ alter table pay_meeting_situation
alter table tb_member_project_subitem alter table tb_member_project_subitem
add column confirm_amount decimal(12, 2) default 0 null comment '确认金额'; add column confirm_amount decimal(12, 2) default 0 null comment '确认金额';
alter table tb_certificate_payment alter table tb_certificate_payment
add column confirm_amount decimal(12, 2) default 0 null comment '确认金额'; add column confirm_amount decimal(12, 2) default 0 null comment '确认金额';
-- 新增税额和未税金额
alter table pay_payment_record
add column tax decimal(12, 2) default 0 comment '税额',
add column no_tax_amount decimal(12, 2) default 0 comment '未税金额';
alter table pay_mail_bill
add column tax decimal(12, 2) default 0 comment '税额',
add column no_tax_amount decimal(12, 2) default 0 comment '未税金额';
alter table pay_confirm_payment_record
add column tax decimal(12, 2) default 0 comment '税额',
add column no_tax_amount decimal(12, 2) default 0 comment '未税金额';
-- 处理历史数据
update pay_payment_record
set no_tax_amount = amount_received / 1.06,
tax = amount_received - no_tax_amount
where amount_received is not null;
update pay_mail_bill
set no_tax_amount = invoice_amount / 1.06,
tax = invoice_amount - no_tax_amount
where invoice_amount is not null;
update pay_confirm_payment_record
set no_tax_amount = amount_received / 1.06,
tax = amount_received - no_tax_amount
where amount_received is not null;
@@ -140,13 +140,11 @@
projectName as workGroup, projectName as workGroup,
sum(allMoney) as allMoney, sum(allMoney) as allMoney,
sum(comeAllMoney) as comeAllMoney, sum(comeAllMoney) as comeAllMoney,
if(sum(pmb.invoice_amount) is null, 0.00, sum(pmb.invoice_amount)) as billMoney, sum(billMoney) as billMoney,
sum(confirmAmount) as confirmAmount sum(confirmAmount) as confirmAmount
from from
v_statistical v v_statistical v
left join pay_mail_bill_project pmbp on v.projectId = pmbp.project_id left join pay_confirm_payment_record pcpr on(v.projectId=pcpr.project_id)
left join pay_mail_bill pmb on pmbp.bill_id = pmb.id
left join pay_confirm_payment_record pcpr on(pmbp.project_id=pcpr.project_id)
<where> <where>
type = 2 type = 2
<if test="ids != null and ids != ''"> <if test="ids != null and ids != ''">
@@ -225,12 +223,10 @@
projectName as workGroup, projectName as workGroup,
sum(allMoney) as allMoney, sum(allMoney) as allMoney,
sum(comeAllMoney) as comeAllMoney, sum(comeAllMoney) as comeAllMoney,
if(sum(pmb.invoice_amount) is null, 0.00, sum(pmb.invoice_amount)) as billMoney, sum(billMoney) as billMoney,
sum(confirmAmount) as confirmAmount sum(confirmAmount) as confirmAmount
from v_statistical v from v_statistical v
left join pay_mail_bill_project pmbp on v.projectId = pmbp.project_id left join pay_confirm_payment_record pcpr on(v.projectId=pcpr.project_id)
left join pay_mail_bill pmb on pmbp.bill_id = pmb.id
left join pay_confirm_payment_record pcpr on(pmbp.project_id=pcpr.project_id)
<where> <where>
type = 2 type = 2
<if test="ids != null and ids != ''"> <if test="ids != null and ids != ''">
@@ -375,12 +371,10 @@
createTime, createTime,
packText, packText,
pack, pack,
if(sum(pmb.invoice_amount) is null, 0.00, sum(pmb.invoice_amount)) as billMoney, billMoney,
confirmAmount confirmAmount
from v_statistical v from v_statistical v
left join pay_mail_bill_project pmbp on v.projectId = pmbp.project_id left join pay_confirm_payment_record pcpr on(v.projectId=pcpr.project_id)
left join pay_mail_bill pmb on pmbp.bill_id = pmb.id
left join pay_confirm_payment_record pcpr on(pmbp.project_id=pcpr.project_id)
<where> <where>
<if test="idList != null and idList != ''"> <if test="idList != null and idList != ''">
principalNameId in principalNameId in
@@ -473,12 +467,10 @@
<select id="queryPageList33" resultType="com.jero.statistics.entity.AllMoney"> <select id="queryPageList33" resultType="com.jero.statistics.entity.AllMoney">
select sum(allMoney) as allMoney, select sum(allMoney) as allMoney,
sum(comeAllMoney) as comeAllMoney, sum(comeAllMoney) as comeAllMoney,
if(sum(pmb.invoice_amount) is null, 0.00, sum(pmb.invoice_amount)) as billMoney, sum(billMoney) as billMoney,
sum(confirmAmount) as confirmAmount sum(confirmAmount) as confirmAmount
from v_statistical v from v_statistical v
left join pay_mail_bill_project pmbp on v.projectId = pmbp.project_id left join pay_confirm_payment_record pcpr on(v.projectId=pcpr.project_id)
left join pay_mail_bill pmb on pmbp.bill_id = pmb.id
left join pay_confirm_payment_record pcpr on(pmbp.project_id=pcpr.project_id)
<where> <where>
<if test="idList != null and idList != ''"> <if test="idList != null and idList != ''">
principalNameId in principalNameId in
@@ -1098,12 +1090,10 @@
SUM(allMoney) as allMoney, SUM(allMoney) as allMoney,
sum(comeAllMoney) as comeAllMoney, sum(comeAllMoney) as comeAllMoney,
createTime, createTime,
if(sum(pmb.invoice_amount) is null, 0.00, sum(pmb.invoice_amount)) as billMoney, sum(billMoney) as billMoney,
sum(confirmAmount) as confirmAmount sum(confirmAmount) as confirmAmount
from v_statistical v from v_statistical v
left join pay_mail_bill_project pmbp on v.projectId = pmbp.project_id left join pay_confirm_payment_record pcpr on(v.projectId=pcpr.project_id)
left join pay_mail_bill pmb on pmbp.bill_id = pmb.id
left join pay_confirm_payment_record pcpr on(pmbp.project_id=pcpr.project_id)
<where> <where>
<if test="idList != null and idList != ''"> <if test="idList != null and idList != ''">
principalNameId in principalNameId in
@@ -1184,12 +1174,10 @@
SUM(allMoney) as allMoney, SUM(allMoney) as allMoney,
sum(comeAllMoney) as comeAllMoney, sum(comeAllMoney) as comeAllMoney,
createTime, createTime,
if(sum(pmb.invoice_amount) is null, 0.00, sum(pmb.invoice_amount)) as billMoney, sum(billMoney) as billMoney,
sum(confirmAmount) as confirmAmount sum(confirmAmount) as confirmAmount
from v_statistical v from v_statistical v
left join pay_mail_bill_project pmbp on v.projectId = pmbp.project_id left join pay_confirm_payment_record pcpr on(v.projectId=pcpr.project_id)
left join pay_mail_bill pmb on pmbp.bill_id = pmb.id
left join pay_confirm_payment_record pcpr on(pmbp.project_id=pcpr.project_id)
<where> <where>
<if test="idList != null and idList != ''"> <if test="idList != null and idList != ''">
principalNameId in principalNameId in
@@ -1361,12 +1349,10 @@
pack, pack,
chargeUse, chargeUse,
chargeCompanyTemporaryName, chargeCompanyTemporaryName,
if(pmb.invoice_amount is null, 0.00, pmb.invoice_amount) as billMoney, billMoney,
confirmAmount confirmAmount
from v_statistical v from v_statistical v
left join pay_mail_bill_project pmbp on v.projectId = pmbp.project_id left join pay_confirm_payment_record pcpr on(v.projectId=pcpr.project_id)
left join pay_mail_bill pmb on pmbp.bill_id = pmb.id
left join pay_confirm_payment_record pcpr on(pmbp.project_id=pcpr.project_id)
<where> <where>
principalNameId = #{principalPeopleDetailSearch.principalNameId} principalNameId = #{principalPeopleDetailSearch.principalNameId}
<if test="principalPeopleDetailSearch.projectName != null and principalPeopleDetailSearch.projectName != ''"> <if test="principalPeopleDetailSearch.projectName != null and principalPeopleDetailSearch.projectName != ''">
@@ -1421,12 +1407,10 @@
pack, pack,
chargeUse, chargeUse,
chargeCompanyTemporaryName, chargeCompanyTemporaryName,
if(pmb.invoice_amount is null, 0.00, pmb.invoice_amount) as billMoney, billMoney,
confirmAmount confirmAmount
from v_statistical v from v_statistical v
left join pay_mail_bill_project pmbp on v.projectId = pmbp.project_id left join pay_confirm_payment_record pcpr on(v.projectId=pcpr.project_id)
left join pay_mail_bill pmb on pmbp.bill_id = pmb.id
left join pay_confirm_payment_record pcpr on(pmbp.project_id=pcpr.project_id)
<where> <where>
principalNameId = #{principalPeopleDetailSearch.principalNameId} principalNameId = #{principalPeopleDetailSearch.principalNameId}
<if test="principalPeopleDetailSearch.projectName != null and principalPeopleDetailSearch.projectName != ''"> <if test="principalPeopleDetailSearch.projectName != null and principalPeopleDetailSearch.projectName != ''">
@@ -1749,12 +1733,10 @@
SUM(allMoney) as allMoney, SUM(allMoney) as allMoney,
sum(comeAllMoney) as comeAllMoney, sum(comeAllMoney) as comeAllMoney,
createTime, createTime,
if(sum(pmb.invoice_amount) is null, 0.00, sum(pmb.invoice_amount)) as billMoney, sum(billMoney) as billMoney,
sum(confirmAmount) as confirmAmount sum(confirmAmount) as confirmAmount
from v_statistical v from v_statistical v
left join pay_mail_bill_project pmbp on v.projectId = pmbp.project_id left join pay_confirm_payment_record pcpr on(v.projectId=pcpr.project_id)
left join pay_mail_bill pmb on pmbp.bill_id = pmb.id
left join pay_confirm_payment_record pcpr on(pmbp.project_id=pcpr.project_id)
<where> <where>
<if test="idList != null and idList != ''"> <if test="idList != null and idList != ''">
principalNameId in principalNameId in
@@ -1834,12 +1816,10 @@
SUM(allMoney) as allMoney, SUM(allMoney) as allMoney,
sum(comeAllMoney) as comeAllMoney, sum(comeAllMoney) as comeAllMoney,
createTime, createTime,
if(sum(pmb.invoice_amount) is null, 0.00, sum(pmb.invoice_amount)) as billMoney, sum(billMoney) as billMoney,
sum(confirmAmount) as confirmAmount sum(confirmAmount) as confirmAmount
from v_statistical v from v_statistical v
left join pay_mail_bill_project pmbp on v.projectId = pmbp.project_id left join pay_confirm_payment_record pcpr on(v.projectId=pcpr.project_id)
left join pay_mail_bill pmb on pmbp.bill_id = pmb.id
left join pay_confirm_payment_record pcpr on(pmbp.project_id=pcpr.project_id)
<where> <where>
<if test="idList != null and idList != ''"> <if test="idList != null and idList != ''">
principalNameId in principalNameId in
@@ -1997,12 +1977,10 @@
<select id="queryPageListForCompanyDetail" resultType="com.jero.statistics.entity.CompanyComeMoneyDetail"> <select id="queryPageListForCompanyDetail" resultType="com.jero.statistics.entity.CompanyComeMoneyDetail">
select * from( select * from(
select projectId,projectName,allMoney,comeAllMoney,chargeUse,packText,pack, select projectId,projectName,allMoney,comeAllMoney,chargeUse,packText,pack,
pmb.invoice_amount as billMoney, billMoney,
confirmAmount confirmAmount
from v_statistical v from v_statistical v
left join pay_mail_bill_project pmbp on v.projectId = pmbp.project_id left join pay_confirm_payment_record pcpr on(v.projectId=pcpr.project_id)
left join pay_mail_bill pmb on pmbp.bill_id = pmb.id
left join pay_confirm_payment_record pcpr on(pmbp.project_id=pcpr.project_id)
<where> <where>
chargeCompanyId = #{CompanyComeMoneyDetailSearch.chargeCompanyId} chargeCompanyId = #{CompanyComeMoneyDetailSearch.chargeCompanyId}
<if test="idList != null and idList != ''"> <if test="idList != null and idList != ''">
@@ -2090,12 +2068,10 @@
chargeUse, chargeUse,
packText, packText,
pack, pack,
pmb.invoice_amount as billMoney, billMoney,
confirmAmount confirmAmount
from v_statistical v from v_statistical v
left join pay_mail_bill_project pmbp on v.projectId = pmbp.project_id left join pay_confirm_payment_record pcpr on(v.projectId=pcpr.project_id)
left join pay_mail_bill pmb on pmbp.bill_id = pmb.id
left join pay_confirm_payment_record pcpr on(pmbp.project_id=pcpr.project_id)
<where> <where>
chargeCompanyId = #{CompanyComeMoneyDetailSearch.chargeCompanyId} chargeCompanyId = #{CompanyComeMoneyDetailSearch.chargeCompanyId}
<if test="idList != null and idList != ''"> <if test="idList != null and idList != ''">
@@ -2159,12 +2135,10 @@
sum(allMoney) as allMoney, sum(allMoney) as allMoney,
sum(comeAllMoney) as comeAllMoney, sum(comeAllMoney) as comeAllMoney,
depart as departName, depart as departName,
if(sum(pmb.invoice_amount) is null, 0.00, sum(pmb.invoice_amount)) as billMoney, sum(billMoney) as billMoney,
sum(confirmAmount) as confirmAmount sum(confirmAmount) as confirmAmount
from v_statistical v from v_statistical v
left join pay_mail_bill_project pmbp on v.projectId = pmbp.project_id left join pay_confirm_payment_record pcpr on(v.projectId=pcpr.project_id)
left join pay_mail_bill pmb on pmbp.bill_id = pmb.id
left join pay_confirm_payment_record pcpr on(pmbp.project_id=pcpr.project_id)
<where> <where>
<foreach item="item" open="departId in(" separator="," close=")" collection="idList"> <foreach item="item" open="departId in(" separator="," close=")" collection="idList">
#{item} #{item}
@@ -2212,12 +2186,10 @@
<select id="queryPageListDepartment33" resultType="com.jero.statistics.entity.AllMoney"> <select id="queryPageListDepartment33" resultType="com.jero.statistics.entity.AllMoney">
select sum(allMoney) as allMoney, select sum(allMoney) as allMoney,
sum(comeAllMoney) as comeAllMoney, sum(comeAllMoney) as comeAllMoney,
if(sum(pmb.invoice_amount) is null, 0.00, sum(pmb.invoice_amount)) as billMoney, sum(billMoney) as billMoney,
sum(confirmAmount) as confirmAmount sum(confirmAmount) as confirmAmount
from v_statistical v from v_statistical v
left join pay_mail_bill_project pmbp on v.projectId = pmbp.project_id left join pay_confirm_payment_record pcpr on(v.projectId=pcpr.project_id)
left join pay_mail_bill pmb on pmbp.bill_id = pmb.id
left join pay_confirm_payment_record pcpr on(pmbp.project_id=pcpr.project_id)
<where> <where>
<foreach item="item" open="departId in(" separator="," close=")" collection="idList"> <foreach item="item" open="departId in(" separator="," close=")" collection="idList">
#{item} #{item}