add 统计增加排序功能

This commit is contained in:
lijiarao
2022-06-09 14:31:28 +08:00
parent 33ad3fc154
commit be734da2a2
13 changed files with 621 additions and 688 deletions
@@ -134,6 +134,7 @@
sum(comeAllMoney) as comeAllMoney
from
v_statistical
<where>
type = 2
<if test="ids != null and ids != ''">
@@ -301,8 +302,22 @@
<!-- 全所统计-->
<select id="queryPageList3" resultType="com.jero.statistics.entity.AllProjectStatistics">
select projectId,projectName, principalName, chargeCompanyTemporaryName, allMoney, comeAllMoney, chargeUse, depart, createTime, packText,pack
from v_statistical
select * from
(select projectId,
projectName,
principalName,
chargeCompanyTemporaryName,
allMoney,
comeAllMoney,
chargeUse,
depart,
createTime,
packText,
pack,
if(sum(pmb.invoice_amount) is null, 0.00, sum(pmb.invoice_amount)) as billMoney
from v_statistical v
left join pay_mail_bill_project pmbp on v.projectId = pmbp.project_id
left join pay_mail_bill pmb on pmbp.bill_id = pmb.id
<where>
<if test="idList != null and idList != ''">
principalNameId in
@@ -353,12 +368,38 @@
</if>
</otherwise>
</choose>
<if test="allProjectStatisticsSearch.billYear != null and allProjectStatisticsSearch.billYear != ''">
and DATE_FORMAT (pmb.bill_date,'%Y') like concat(#{allProjectStatisticsSearch.billYear}, '%')
</if>
</where>
group by v.projectId) p
<if test="allProjectStatisticsSearch.column != null and allProjectStatisticsSearch.column != ''">
order by
<if test="allProjectStatisticsSearch.column == 'allMoney'">
allMoney
</if>
<if test="allProjectStatisticsSearch.column == 'comeAllMoney'">
comeAllMoney
</if>
<if test="allProjectStatisticsSearch.column == 'billMoney'">
billMoney
</if>
<if test="allProjectStatisticsSearch.order == 'desc'">
desc
</if>
<if test="allProjectStatisticsSearch.order == 'asc'">
asc
</if>
</if>
</select>
<!-- 全所统计总金额统计-->
<select id="queryPageList33" resultType="com.jero.statistics.entity.AllMoney">
select sum(allMoney) as allMoney, sum(comeAllMoney) as comeAllMoney from
v_statistical
select sum(allMoney) as allMoney,
sum(comeAllMoney) as comeAllMoney,
if(sum(pmb.invoice_amount) is null, 0.00, sum(pmb.invoice_amount)) as billMoney
from v_statistical v
left join pay_mail_bill_project pmbp on v.projectId = pmbp.project_id
left join pay_mail_bill pmb on pmbp.bill_id = pmb.id
<where>
<if test="idList != null and idList != ''">
principalNameId in
@@ -366,38 +407,40 @@
#{item}
</foreach>
</if>
<if test="allProjectStatisticsSearch.projectName != null and allProjectStatisticsSearch.projectName != ''">
AND projectName LIKE
concat('%',#{allProjectStatisticsSearch.projectName},'%')
concat('%', #{allProjectStatisticsSearch.projectName}, '%')
</if>
<if test="allProjectStatisticsSearch.year != null and allProjectStatisticsSearch.year != ''">
AND year LIKE
concat(#{allProjectStatisticsSearch.year},'%')
concat(#{allProjectStatisticsSearch.year}, '%')
</if>
<if test="allProjectStatisticsSearch.payStatue != null and allProjectStatisticsSearch.payStatue != ''">
AND payStatue LIKE
concat('%',#{allProjectStatisticsSearch.payStatue},'%')
concat('%', #{allProjectStatisticsSearch.payStatue}, '%')
</if>
<if test="allProjectStatisticsSearch.departCode != null and allProjectStatisticsSearch.departCode != ''">
AND departCode =#{allProjectStatisticsSearch.departCode}
AND departCode = #{allProjectStatisticsSearch.departCode}
</if>
<if test="allProjectStatisticsSearch.chargeUse != null and allProjectStatisticsSearch.chargeUse != ''">
AND chargeUse=#{allProjectStatisticsSearch.chargeUse}
AND chargeUse = #{allProjectStatisticsSearch.chargeUse}
</if>
<if test="allProjectStatisticsSearch.chargeCompanyTemporaryName != null and allProjectStatisticsSearch.chargeCompanyTemporaryName != ''">
AND chargeCompanyTemporaryName LIKE
concat('%',#{allProjectStatisticsSearch.chargeCompanyTemporaryName},'%')
concat('%', #{allProjectStatisticsSearch.chargeCompanyTemporaryName}, '%')
</if>
<if test="allProjectStatisticsSearch.principalNameId != null and allProjectStatisticsSearch.principalNameId != ''">
AND principalNameId=#{allProjectStatisticsSearch.principalNameId}
AND principalNameId = #{allProjectStatisticsSearch.principalNameId}
</if>
<if test="allProjectStatisticsSearch.pack != null and allProjectStatisticsSearch.pack != ''">
AND pack=#{allProjectStatisticsSearch.pack}
AND pack = #{allProjectStatisticsSearch.pack}
</if>
<choose>
<when test="allProjectStatisticsSearch.allMoney != null and allProjectStatisticsSearch.allMoney != '' and allProjectStatisticsSearch.allMoneyTwo != null and allProjectStatisticsSearch.allMoneyTwo != ''">
AND allMoney >= #{allProjectStatisticsSearch.allMoney} and allMoney <![CDATA[<]]>=
#{allProjectStatisticsSearch.allMoneyTwo}
AND allMoney >= #{allProjectStatisticsSearch.allMoney}
and allMoney <![CDATA[<]]>=
#{allProjectStatisticsSearch.allMoneyTwo}
</when>
<otherwise>
<if test="allProjectStatisticsSearch.allMoney != null and allProjectStatisticsSearch.allMoney != ''">
@@ -408,6 +451,9 @@
</if>
</otherwise>
</choose>
<if test="allProjectStatisticsSearch.billYear != null and allProjectStatisticsSearch.billYear != ''">
and DATE_FORMAT (pmb.bill_date,'%Y') like concat(#{allProjectStatisticsSearch.billYear}, '%')
</if>
</where>
</select>
<!-- 全所统计导出-->