update 全所统计改用视图查询

This commit is contained in:
lijiarao
2022-06-07 16:49:57 +08:00
parent 071a8df6d0
commit dc19563970
3 changed files with 216 additions and 845 deletions
+131
View File
@@ -0,0 +1,131 @@
create view v_statistical as
select pp.id as projectId,
pp.projectName,
principalName,
chargeCompanyTemporaryName,
allMoney,
comeAllMoney,
chargeUse,
depart,
createTime,
if(pp.pack = 0, '', '') as packText,
year,
payStatue,
departCode,
principalNameId,
pp.pack
from (SELECT pwgs.id,
pwg.working_group_project AS projectName,
pwg.principal_name_a as principalName,
pwgs.charge_company_temporary_name AS chargeCompanyTemporaryName,
pwgs.receivable_amount as allMoney,
pwgs.paid_amount as comeAllMoney,
pwgs.charge_use as chargeUse,
sd.depart_name as depart,
pwgs.pack as pack,
pwg.year as year,
pwgs.in_account as payStatue,
su.org_code as departCode,
pwg.principal_id_a as principalNameId,
pwgs.create_time as createTime
FROM pay_working_group pwg
right join pay_working_group_subitem pwgs on (pwg.id = pwgs.working_group_id)
left JOIN sys_user su on (pwg.principal_id_a = su.id)
left join sys_depart sd on (su.org_code = sd.org_code)
union all
SELECT pcp.id,
pcp.charge_project AS projectName,
pcp.principal_name as principalName,
pcp.charge_company_temporary_name AS chargeCompanyTemporaryName,
pcp.receivable_amount as allMoney,
pcp.paid_amount as comeAllMoney,
pcp.charge_use as chargeUse,
sd.depart_name as depart,
pcp.pack as pack,
pcp.year as year,
pcp.in_account as payStatue,
su.org_code as departCode,
pcp.principal_id as principalNameId,
pcp.create_time as createTime
FROM pay_common_project pcp
left JOIN sys_user su on (pcp.principal_id = su.id)
left join sys_depart sd on (su.org_code = sd.org_code)
union all
SELECT pmps.id,
pmp.project_name AS projectName,
su.realname as principalName,
pmps.company_name AS chargeCompanyTemporaryName,
pmps.amount_receivable as allMoney,
pmps.paid_amount as comeAllMoney,
pmps.charge_use as chargeUse,
sd.depart_name as depart,
pmps.pack as pack,
pmp.particular_year as year,
pmps.in_account as payStatue,
su.org_code as departCode,
pmp.director_id as principalNameId,
pmps.create_time as createTime
FROM pay_member_project pmp
right join pay_member_project_subitem pmps on (pmp.id = pmps.project_id)
left JOIN sys_user su on (pmp.director_id = su.id)
left join sys_depart sd on (su.org_code = sd.org_code)
union all
SELECT pms.id,
pm.meeting_name AS projectName,
su.realname as principalName,
pms.company_name AS chargeCompanyTemporaryName,
pms.amount_receivable as allMoney,
pms.paid_amount as comeAllMoney,
pms.charge_use as chargeUse,
sd.depart_name as depart,
pms.pack as pack,
pm.particular_year as year,
pms.in_account as payStatue,
su.org_code as departCode,
pm.director_id as principalNameId,
pms.create_time as createTime
FROM pay_meeting pm
right join pay_meeting_situation pms on (pm.id = pms.meeting_id)
left JOIN sys_user su on (pm.director_id = su.id)
left join sys_depart sd on (su.org_code = sd.org_code)
union all
SELECT tmps.id,
tmp.project_name AS projectName,
su.realname as principalName,
tmps.company_name AS chargeCompanyTemporaryName,
tmps.amount_receivable as allMoney,
tmps.paid_amount as comeAllMoney,
tmps.charge_use as chargeUse,
sd.depart_name as depart,
tmps.pack as pack,
tmp.year as year,
tmps.in_account as payStatue,
su.org_code as departCode,
tmp.director_id as principalNameId,
tmps.create_time as createTime
FROM tb_member_project tmp
left join tb_member_project_subitem tmps on (tmp.id = tmps.project_id)
left JOIN sys_user su on (tmp.director_id = su.id)
left join sys_depart sd on (su.org_code = sd.org_code)
union all
SELECT tcp.id,
tmp.project_name AS projectName,
su.realname as principalName,
tcp.company_name AS chargeCompanyTemporaryName,
tcp.amount_receivable as allMoney,
tcp.paid_amount as comeAllMoney,
tcp.charge_use as chargeUse,
sd.depart_name as depart,
tcp.pack as pack,
tmp.year as year,
tcp.in_account as payStatue,
su.org_code as departCode,
tmp.director_id as principalNameId,
tcp.create_time as createTime
FROM tb_member_project tmp
left join tb_certificate_payment tcp on (tmp.id = tcp.project_id)
left JOIN sys_user su on (tmp.director_id = su.id)
left join sys_depart sd on (su.org_code = sd.org_code)
) pp
where pp.allMoney is not null
and pp.allMoney != 0
@@ -16,14 +16,14 @@ import java.util.List;
/**
* @Description: pay_working_group
* @Author: jeecg-boot
* @Date: 2021-08-27
* @Date: 2021-08-27
* @Version: V1.0
*/
public interface PayWorkingGroupMapper extends BaseMapper<PayWorkingGroup> {
/**
* @Description 分页查询
* @Author lqt
* @Date 2021/9/1
* @Author lqt
* @Date 2021/9/1
* @Param payWorkingGroup
* @Return
* @Exception
@@ -32,20 +32,20 @@ public interface PayWorkingGroupMapper extends BaseMapper<PayWorkingGroup> {
/**
* @Description 根据企业查询列表
* @Author lqt
* @Date 2021/9/5
* @Author lqt
* @Date 2021/9/5
* @Param
* @Return
* @Exception
*/
List<PayWorkingGroupVO> queryListByCompany(@Param("companyId") String companyId,@Param("workingGroupProject") String workingGroupProject,
@Param("year") String year,@Param("projectType") String projectType,
@Param("pack")Integer pack, @Param("packYear") String packYear);
List<PayWorkingGroupVO> queryListByCompany(@Param("companyId") String companyId, @Param("workingGroupProject") String workingGroupProject,
@Param("year") String year, @Param("projectType") String projectType,
@Param("pack") Integer pack, @Param("packYear") String packYear);
/**
* @Description 查询不存在成员单位的列表
* @Author lqt
* @Date 2021/9/7
* @Author lqt
* @Date 2021/9/7
* @Param
* @Return
* @Exception
@@ -54,69 +54,71 @@ public interface PayWorkingGroupMapper extends BaseMapper<PayWorkingGroup> {
/**
* @Description 工作组统计
* @Author zql
* @Date 2021/9/13
* @Author zql
* @Date 2021/9/13
* @Param
* @Return
* @Exception
*/
IPage<PayWorkingGroupStatistics> queryPageListForStatistics(Page<PayWorkingGroupStatistics> page,@Param("payWorkingGroupSearch") PayWorkingGroupSearch payWorkingGroupSearch,@Param("ids")List<String> ids);
IPage<PayWorkingGroupStatistics> queryPageListForStatistics(Page<PayWorkingGroupStatistics> page, @Param("payWorkingGroupSearch") PayWorkingGroupSearch payWorkingGroupSearch, @Param("ids") List<String> ids);
/**
* @Description 工作组统计导出
* @Author zql
* @Date 2021/9/13
* @Author zql
* @Date 2021/9/13
* @Param
* @Return
* @Exception
*/
List<PayWorkingGroupStatistics> queryPageListForStatistics(@Param("payWorkingGroupSearch") PayWorkingGroupSearch payWorkingGroupSearch,@Param("ids") List<String> ids);
List<PayWorkingGroupStatistics> queryPageListForStatistics(@Param("payWorkingGroupSearch") PayWorkingGroupSearch payWorkingGroupSearch, @Param("ids") List<String> ids);
/**
* @Description 工作组统计导出ids
* @Author zql
* @Date 2021/9/13
* @Author zql
* @Date 2021/9/13
* @Param
* @Return
* @Exception
*/
List<PayWorkingGroupStatistics> queryPageListForStatisticsIds(@Param("payWorkingGroupSearch") PayWorkingGroupSearch payWorkingGroupSearch,@Param("ids") List<String> ids,@Param("idss") List<String> idss);
List<PayWorkingGroupStatistics> queryPageListForStatisticsIds(@Param("payWorkingGroupSearch") PayWorkingGroupSearch payWorkingGroupSearch, @Param("ids") List<String> ids, @Param("idss") List<String> idss);
List<String> getGroupList();
/**
* @Description 全所统计
* @Author zql
* @Date 2021/9/17
* @Author zql
* @Date 2021/9/17
* @Param
* @Return
* @Exception
*/
List<AllProjectStatistics> queryPageList3(@Param(value = "allProjectStatisticsSearch") AllProjectStatisticsSearch allProjectStatisticsSearch);
//List<AllProjectStatistics> queryPageList3(@Param(value = "allProjectStatisticsSearch") AllProjectStatisticsSearch allProjectStatisticsSearch);
/**
* @Description 全所统计
* @Author zql
* @Date 2021/9/17
* @Author zql
* @Date 2021/9/17
* @Param
* @Return
* @Exception
*/
List<AllProjectStatistics> queryPageList3(@Param(value = "allProjectStatisticsSearch") AllProjectStatisticsSearch allProjectStatisticsSearch,List<String> idList);
List<AllProjectStatistics> queryPageList3(@Param(value = "allProjectStatisticsSearch") AllProjectStatisticsSearch allProjectStatisticsSearch, @Param("idList") List<String> idList);
/**
* @Description 企业来款查询和全所统计
* @Author zql
* @Date 2021/9/17
* @Author zql
* @Date 2021/9/17
* @Param
* @Return
* @Exception
*/
IPage<AllProjectStatistics> queryPageList3( Page<AllProjectStatistics> page,@Param(value = "allProjectStatisticsSearch") AllProjectStatisticsSearch allProjectStatisticsSearch,@Param("idList") List<String> idList);
List<AllProjectStatistics> queryPageListExcel(@Param(value = "allProjectStatisticsSearch") AllProjectStatisticsSearch allProjectStatisticsSearch,@Param("idList") List<String> idList,@Param("ids") List<String> ids);
IPage<AllProjectStatistics> queryPageList3(Page<AllProjectStatistics> page, @Param(value = "allProjectStatisticsSearch") AllProjectStatisticsSearch allProjectStatisticsSearch, @Param("idList") List<String> idList);
List<AllProjectStatistics> queryPageListExcel(@Param(value = "allProjectStatisticsSearch") AllProjectStatisticsSearch allProjectStatisticsSearch, @Param("idList") List<String> idList, @Param("ids") List<String> ids);
/**
* 个人来款统计
*
* @param page
* @param principalPeopleSearch
* @param idList
@@ -126,57 +128,66 @@ public interface PayWorkingGroupMapper extends BaseMapper<PayWorkingGroup> {
/**
* 个人来款统计导出excel
*
* @param idList
* @return
*/
List<PrincipalPeopleList> queryPageListForPrincipal(@Param("principalPeopleSearch") PrincipalPeopleSearch principalPeopleSearch,@Param("idList") List<String> idList);
List<PrincipalPeopleList> queryPageListForPrincipal(@Param("principalPeopleSearch") PrincipalPeopleSearch principalPeopleSearch, @Param("idList") List<String> idList);
/**
* 个人来款统计详情导出
*
* @param principalPeopleDetailSearch
* @return
*/
List<PrincipalPeopleDetail> queryPageListForPrincipalDetail(@Param("principalPeopleDetailSearch") PrincipalPeopleDetailSearch principalPeopleDetailSearch);
/**
* 个人来款统计详情
*
* @param page
* @return
*/
IPage<PrincipalPeopleDetail> queryPageListForPrincipalDetail(Page<PrincipalPeopleDetail> page,@Param("principalPeopleDetailSearch") PrincipalPeopleDetailSearch principalPeopleDetailSearch);
IPage<PrincipalPeopleDetail> queryPageListForPrincipalDetail(Page<PrincipalPeopleDetail> page, @Param("principalPeopleDetailSearch") PrincipalPeopleDetailSearch principalPeopleDetailSearch);
/**
* 企业来款统计
*
* @param page
* @param companyComeMoneySearch
* @param idList
* @return
*/
IPage<CompanyComeMoneyList> queryPageListForCompany(Page<CompanyComeMoneyList> page,@Param("companyComeMoneySearch") CompanyComeMoneySearch companyComeMoneySearch,@Param("idList") List<String> idList);
IPage<CompanyComeMoneyList> queryPageListForCompany(Page<CompanyComeMoneyList> page, @Param("companyComeMoneySearch") CompanyComeMoneySearch companyComeMoneySearch, @Param("idList") List<String> idList);
/**
* 企业来款统计
*
* @param
* @param companyComeMoneySearch
* @param idList
* @return
*/
List<CompanyComeMoneyList> queryPageListForCompany(@Param("companyComeMoneySearch") CompanyComeMoneySearch companyComeMoneySearch,@Param("idList") List<String> idList);
List<CompanyComeMoneyList> queryPageListForCompany(@Param("companyComeMoneySearch") CompanyComeMoneySearch companyComeMoneySearch, @Param("idList") List<String> idList);
/**
* 企业来款详情
*
* @param page
* @param companyComeMoneyDetailSearch
* @return
*/
IPage<CompanyComeMoneyDetail> queryPageListForCompanyDetail(Page<CompanyComeMoneyDetail> page,@Param("CompanyComeMoneyDetailSearch") CompanyComeMoneyDetailSearch companyComeMoneyDetailSearch,@Param("idList") List<String> idList );
IPage<CompanyComeMoneyDetail> queryPageListForCompanyDetail(Page<CompanyComeMoneyDetail> page, @Param("CompanyComeMoneyDetailSearch") CompanyComeMoneyDetailSearch companyComeMoneyDetailSearch, @Param("idList") List<String> idList);
/**
* 企业来款详情导出
*
* @param
* @param companyComeMoneyDetailSearch
* @return
*/
List<CompanyComeMoneyDetail> queryPageListForCompanyDetail(@Param("CompanyComeMoneyDetailSearch") CompanyComeMoneyDetailSearch companyComeMoneyDetailSearch,@Param("idList") List<String> idList);
List<CompanyComeMoneyDetail> queryPageListForCompanyDetail(@Param("CompanyComeMoneyDetailSearch") CompanyComeMoneyDetailSearch companyComeMoneyDetailSearch, @Param("idList") List<String> idList);
List<PrincipalPeopleList> queryPageListForPrincipalFirstPage();
@@ -187,7 +198,7 @@ public interface PayWorkingGroupMapper extends BaseMapper<PayWorkingGroup> {
List<DepartStatistics> queryPageListForDepartFirstPage();
List<PrincipalPeopleDetail> queryPageListForPrincipalDetailTwo(@Param("principalPeopleDetailSearch") PrincipalPeopleDetailSearch principalPeopleDetailSearch,@Param("ids") ArrayList<String> ids);
List<PrincipalPeopleDetail> queryPageListForPrincipalDetailTwo(@Param("principalPeopleDetailSearch") PrincipalPeopleDetailSearch principalPeopleDetailSearch, @Param("ids") ArrayList<String> ids);
AllMoney queryPageList33(@Param("allProjectStatisticsSearch") AllProjectStatisticsSearch allProjectStatisticsSearch, @Param("idList") List<String> idList);
@@ -325,885 +325,114 @@
<!-- 全所统计-->
<select id="queryPageList3" resultType="com.jero.statistics.entity.AllProjectStatistics">
select pp.id as projectId,pp.projectName, principalName, chargeCompanyTemporaryName, allMoney, comeAllMoney, chargeUse, depart, createTime,if(pp.pack=0,'否','是') as packText,pp.pack from
(SELECT
pwgs.id,
pwg.working_group_project AS projectName,
pwg.principal_name_a as principalName,
pwgs.charge_company_temporary_name AS chargeCompanyTemporaryName,
pwgs.receivable_amount as allMoney,
pwgs.paid_amount as comeAllMoney,
pwgs.charge_use as chargeUse,
sd.depart_name as depart,
pwgs.pack as pack,
pwgs.create_time as createTime
FROM pay_working_group pwg right join pay_working_group_subitem pwgs on(pwg.id=pwgs.working_group_id)
left JOIN sys_user su on(pwg.principal_id_a=su.id) left join sys_depart sd on(su.org_code=sd.org_code)
select projectId,projectName, principalName, chargeCompanyTemporaryName, allMoney, comeAllMoney, chargeUse, depart, createTime, packText,pack
from v_statistical
<where>
<if test="idList != null and idList != ''">
pwg.principal_id_a in
principalNameId in
<foreach item="item" open="(" separator="," close=")" collection="idList">
#{item}
</foreach>
</if>
<if test="allProjectStatisticsSearch.projectName != null and allProjectStatisticsSearch.projectName != ''">
AND pwg.working_group_project LIKE
concat('%',concat(#{allProjectStatisticsSearch.projectName},'%'))
AND projectName LIKE
concat('%', #{allProjectStatisticsSearch.projectName}, '%')
</if>
<if test="allProjectStatisticsSearch.year != null and allProjectStatisticsSearch.year != ''">
AND pwg.year LIKE
concat(#{allProjectStatisticsSearch.year},'%')
AND year LIKE
concat(#{allProjectStatisticsSearch.year}, '%')
</if>
<if test="allProjectStatisticsSearch.payStatue != null and allProjectStatisticsSearch.payStatue != ''">
AND pwgs.in_account LIKE
concat('%',concat(#{allProjectStatisticsSearch.payStatue},'%'))
AND payStatue LIKE
concat('%', #{allProjectStatisticsSearch.payStatue}, '%')
</if>
<if test="allProjectStatisticsSearch.departCode != null and allProjectStatisticsSearch.departCode != ''">
AND su.org_code =#{allProjectStatisticsSearch.departCode}
AND departCode = #{allProjectStatisticsSearch.departCode}
</if>
<if test="allProjectStatisticsSearch.chargeUse != null and allProjectStatisticsSearch.chargeUse != ''">
AND pwgs.charge_use=#{allProjectStatisticsSearch.chargeUse}
AND chargeUse = #{allProjectStatisticsSearch.chargeUse}
</if>
<if test="allProjectStatisticsSearch.chargeCompanyTemporaryName != null and allProjectStatisticsSearch.chargeCompanyTemporaryName != ''">
AND pwgs.charge_company_temporary_name LIKE
concat('%',concat(#{allProjectStatisticsSearch.chargeCompanyTemporaryName},'%'))
AND chargeCompanyTemporaryName LIKE
concat('%', #{allProjectStatisticsSearch.chargeCompanyTemporaryName}, '%')
</if>
<if test="allProjectStatisticsSearch.principalNameId != null and allProjectStatisticsSearch.principalNameId != ''">
AND pwg.principal_id_a=#{allProjectStatisticsSearch.principalNameId}
AND principalNameId = #{allProjectStatisticsSearch.principalNameId}
</if>
<if test="allProjectStatisticsSearch.pack != null and allProjectStatisticsSearch.pack != ''">
AND pwgs.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 pwgs.receivable_amount >= #{allProjectStatisticsSearch.allMoney} and pwgs.receivable_amount <![CDATA[<]]>=
#{allProjectStatisticsSearch.allMoneyTwo}
AND allMoney >= #{allProjectStatisticsSearch.allMoney}
and allMoney <![CDATA[<]]>=
#{allProjectStatisticsSearch.allMoneyTwo}
</when>
<otherwise>
<if test="allProjectStatisticsSearch.allMoney != null and allProjectStatisticsSearch.allMoney != ''">
AND pwgs.receivable_amount >= #{allProjectStatisticsSearch.allMoney}
AND allMoney >= #{allProjectStatisticsSearch.allMoney}
</if>
<if test="allProjectStatisticsSearch.allMoneyTwo != null and allProjectStatisticsSearch.allMoneyTwo != ''">
AND pwgs.receivable_amount <![CDATA[<]]>= #{allProjectStatisticsSearch.allMoneyTwo}
AND allMoney <![CDATA[<]]>= #{allProjectStatisticsSearch.allMoneyTwo}
</if>
</otherwise>
</choose>
</where>
union all
SELECT
pcp.id,
pcp.charge_project AS projectName,
pcp.principal_name as principalName,
pcp.charge_company_temporary_name AS chargeCompanyTemporaryName,
pcp.receivable_amount as allMoney,
pcp.paid_amount as comeAllMoney,
pcp.charge_use as chargeUse,
sd.depart_name as depart,
pcp.pack as pack,
pcp.create_time as createTime
FROM pay_common_project pcp left JOIN sys_user su on(pcp.principal_id=su.id) left join sys_depart sd
on(su.org_code=sd.org_code)
<where>
<if test="idList != null and idList != ''">
pcp.principal_id in
<foreach item="item" open="(" separator="," close=")" collection="idList">
#{item}
</foreach>
</if>
<if test="allProjectStatisticsSearch.projectName != null and allProjectStatisticsSearch.projectName != ''">
AND pcp.charge_project LIKE
concat('%',concat(#{allProjectStatisticsSearch.projectName},'%'))
</if>
<if test="allProjectStatisticsSearch.year != null and allProjectStatisticsSearch.year != ''">
AND pcp.year LIKE
concat(#{allProjectStatisticsSearch.year},'%')
</if>
<if test="allProjectStatisticsSearch.payStatue != null and allProjectStatisticsSearch.payStatue != ''">
AND pcp.in_account LIKE
concat('%',concat(#{allProjectStatisticsSearch.payStatue},'%'))
</if>
<if test="allProjectStatisticsSearch.chargeCompanyTemporaryName != null and allProjectStatisticsSearch.chargeCompanyTemporaryName != ''">
AND pcp.charge_company_temporary_name LIKE
concat('%',concat(#{allProjectStatisticsSearch.chargeCompanyTemporaryName},'%'))
</if>
<if test="allProjectStatisticsSearch.departCode != null and allProjectStatisticsSearch.departCode != ''">
AND su.org_code =#{allProjectStatisticsSearch.departCode}
</if>
<if test="allProjectStatisticsSearch.chargeUse != null and allProjectStatisticsSearch.chargeUse != ''">
AND pcp.charge_use=#{allProjectStatisticsSearch.chargeUse}
</if>
<if test="allProjectStatisticsSearch.principalNameId != null and allProjectStatisticsSearch.principalNameId != ''">
AND pcp.principal_id=#{allProjectStatisticsSearch.principalNameId}
</if>
<if test="allProjectStatisticsSearch.pack != null and allProjectStatisticsSearch.pack != ''">
AND pcp.pack=#{allProjectStatisticsSearch.pack}
</if>
<choose>
<when test="allProjectStatisticsSearch.allMoney != null and allProjectStatisticsSearch.allMoney != '' and allProjectStatisticsSearch.allMoneyTwo != null and allProjectStatisticsSearch.allMoneyTwo != ''">
AND pcp.receivable_amount >= #{allProjectStatisticsSearch.allMoney} and pcp.receivable_amount
<![CDATA[<]]>= #{allProjectStatisticsSearch.allMoneyTwo}
</when>
<otherwise>
<if test="allProjectStatisticsSearch.allMoney != null and allProjectStatisticsSearch.allMoney != ''">
AND pcp.receivable_amount >= #{allProjectStatisticsSearch.allMoney}
</if>
<if test="allProjectStatisticsSearch.allMoneyTwo != null and allProjectStatisticsSearch.allMoneyTwo != ''">
AND pcp.receivable_amount <![CDATA[<]]>= #{allProjectStatisticsSearch.allMoneyTwo}
</if>
</otherwise>
</choose>
</where>
union all
SELECT
pmps.id,
pmp.project_name AS projectName,
su.realname as principalName,
pmps.company_name AS chargeCompanyTemporaryName,
pmps.amount_receivable as allMoney,
pmps.paid_amount as comeAllMoney,
pmps.charge_use as chargeUse,
sd.depart_name as depart,
pmps.pack as pack,
pmps.create_time as createTime
FROM pay_member_project pmp right join pay_member_project_subitem pmps on(pmp.id=pmps.project_id)
left JOIN sys_user su on(pmp.director_id=su.id) left join sys_depart sd on(su.org_code=sd.org_code)
<where>
<if test="idList != null and idList != ''">
pmp.director_id in
<foreach item="item" open="(" separator="," close=")" collection="idList">
#{item}
</foreach>
</if>
<if test="allProjectStatisticsSearch.projectName != null and allProjectStatisticsSearch.projectName != ''">
AND pmp.project_name LIKE
concat('%',concat(#{allProjectStatisticsSearch.projectName},'%'))
</if>
<if test="allProjectStatisticsSearch.year != null and allProjectStatisticsSearch.year != ''">
AND pmp.particular_year LIKE
concat(#{allProjectStatisticsSearch.year},'%')
</if>
<if test="allProjectStatisticsSearch.payStatue != null and allProjectStatisticsSearch.payStatue != ''">
AND pmps.in_account LIKE
concat('%',concat(#{allProjectStatisticsSearch.payStatue},'%'))
</if>
<if test="allProjectStatisticsSearch.departCode != null and allProjectStatisticsSearch.departCode != ''">
AND su.org_code =#{allProjectStatisticsSearch.departCode}
</if>
<if test="allProjectStatisticsSearch.chargeUse != null and allProjectStatisticsSearch.chargeUse != ''">
AND pmps.charge_use=#{allProjectStatisticsSearch.chargeUse}
</if>
<if test="allProjectStatisticsSearch.chargeCompanyTemporaryName != null and allProjectStatisticsSearch.chargeCompanyTemporaryName != ''">
AND pmps.company_name LIKE
concat('%',concat(#{allProjectStatisticsSearch.chargeCompanyTemporaryName},'%'))
</if>
<if test="allProjectStatisticsSearch.principalNameId != null and allProjectStatisticsSearch.principalNameId != ''">
AND pmp.director_id=#{allProjectStatisticsSearch.principalNameId}
</if>
<if test="allProjectStatisticsSearch.pack != null and allProjectStatisticsSearch.pack != ''">
AND pmps.pack=#{allProjectStatisticsSearch.pack}
</if>
<choose>
<when test="allProjectStatisticsSearch.allMoney != null and allProjectStatisticsSearch.allMoney != '' and allProjectStatisticsSearch.allMoneyTwo != null and allProjectStatisticsSearch.allMoneyTwo != ''">
AND pmps.amount_receivable >= #{allProjectStatisticsSearch.allMoney} and pmps.amount_receivable <![CDATA[<]]>=
#{allProjectStatisticsSearch.allMoneyTwo}
</when>
<otherwise>
<if test="allProjectStatisticsSearch.allMoney != null and allProjectStatisticsSearch.allMoney != ''">
AND pmps.amount_receivable >= #{allProjectStatisticsSearch.allMoney}
</if>
<if test="allProjectStatisticsSearch.allMoneyTwo != null and allProjectStatisticsSearch.allMoneyTwo != ''">
AND pmps.amount_receivable <![CDATA[<]]>= #{allProjectStatisticsSearch.allMoneyTwo}
</if>
</otherwise>
</choose>
</where>
union all
SELECT
pms.id,
pm.meeting_name AS projectName,
su.realname as principalName,
pms.company_name AS chargeCompanyTemporaryName,
pms.amount_receivable as allMoney,
pms.paid_amount as comeAllMoney,
pms.charge_use as chargeUse,
sd.depart_name as depart,
pms.pack as pack,
pms.create_time as createTime
FROM pay_meeting pm right join pay_meeting_situation pms on(pm.id=pms.meeting_id)
left JOIN sys_user su on(pm.director_id=su.id) left join sys_depart sd on(su.org_code=sd.org_code)
<where>
<if test="idList != null and idList != ''">
pm.director_id in
<foreach item="item" open="(" separator="," close=")" collection="idList">
#{item}
</foreach>
</if>
<if test="allProjectStatisticsSearch.projectName != null and allProjectStatisticsSearch.projectName != ''">
AND pm.meeting_name LIKE
concat('%',concat(#{allProjectStatisticsSearch.projectName},'%'))
</if>
<if test="allProjectStatisticsSearch.year != null and allProjectStatisticsSearch.year != ''">
AND pm.particular_year LIKE
concat(#{allProjectStatisticsSearch.year},'%')
</if>
<if test="allProjectStatisticsSearch.payStatue != null and allProjectStatisticsSearch.payStatue != ''">
AND pms.in_account LIKE
concat('%',concat(#{allProjectStatisticsSearch.payStatue},'%'))
</if>
<if test="allProjectStatisticsSearch.departCode != null and allProjectStatisticsSearch.departCode != ''">
AND su.org_code =#{allProjectStatisticsSearch.departCode}
</if>
<if test="allProjectStatisticsSearch.chargeUse != null and allProjectStatisticsSearch.chargeUse != ''">
AND pms.charge_use=#{allProjectStatisticsSearch.chargeUse}
</if>
<if test="allProjectStatisticsSearch.chargeCompanyTemporaryName != null and allProjectStatisticsSearch.chargeCompanyTemporaryName != ''">
AND pms.company_name LIKE
concat('%',concat(#{allProjectStatisticsSearch.chargeCompanyTemporaryName},'%'))
</if>
<if test="allProjectStatisticsSearch.principalNameId != null and allProjectStatisticsSearch.principalNameId != ''">
AND pm.director_id=#{allProjectStatisticsSearch.principalNameId}
</if>
<if test="allProjectStatisticsSearch.pack != null and allProjectStatisticsSearch.pack != ''">
AND pms.pack=#{allProjectStatisticsSearch.pack}
</if>
<choose>
<when test="allProjectStatisticsSearch.allMoney != null and allProjectStatisticsSearch.allMoney != '' and allProjectStatisticsSearch.allMoneyTwo != null and allProjectStatisticsSearch.allMoneyTwo != ''">
AND pms.amount_receivable >= #{allProjectStatisticsSearch.allMoney} and pms.amount_receivable <![CDATA[<]]>=
#{allProjectStatisticsSearch.allMoneyTwo}
</when>
<otherwise>
<if test="allProjectStatisticsSearch.allMoney != null and allProjectStatisticsSearch.allMoney != ''">
AND pms.amount_receivable >= #{allProjectStatisticsSearch.allMoney}
</if>
<if test="allProjectStatisticsSearch.allMoneyTwo != null and allProjectStatisticsSearch.allMoneyTwo != ''">
AND pms.amount_receivable <![CDATA[<]]>= #{allProjectStatisticsSearch.allMoneyTwo}
</if>
</otherwise>
</choose>
</where>
union all
SELECT
tmps.id,
tmp.project_name AS projectName,
su.realname as principalName,
tmps.company_name AS chargeCompanyTemporaryName,
tmps.amount_receivable as allMoney,
tmps.paid_amount as comeAllMoney,
tmps.charge_use as chargeUse,
sd.depart_name as depart,
tmps.pack as pack,
tmps.create_time as createTime
FROM tb_member_project tmp left join tb_member_project_subitem tmps on(tmp.id=tmps.project_id)
left JOIN sys_user su on(tmp.director_id=su.id) left join sys_depart sd on(su.org_code=sd.org_code)
<where>
<if test="idList != null and idList != ''">
tmp.director_id in
<foreach item="item" open="(" separator="," close=")" collection="idList">
#{item}
</foreach>
</if>
<if test="allProjectStatisticsSearch.projectName != null and allProjectStatisticsSearch.projectName != ''">
AND tmp.project_name LIKE
concat('%',concat(#{allProjectStatisticsSearch.projectName},'%'))
</if>
<if test="allProjectStatisticsSearch.year != null and allProjectStatisticsSearch.year != ''">
AND tmp.year LIKE
concat(#{allProjectStatisticsSearch.year},'%')
</if>
<if test="allProjectStatisticsSearch.payStatue != null and allProjectStatisticsSearch.payStatue != ''">
AND tmps.in_account LIKE
concat('%',concat(#{allProjectStatisticsSearch.payStatue},'%'))
</if>
<if test="allProjectStatisticsSearch.principalNameId != null and allProjectStatisticsSearch.principalNameId != ''">
AND tmp.director_id=#{allProjectStatisticsSearch.principalNameId}
</if>
<if test="allProjectStatisticsSearch.departCode != null and allProjectStatisticsSearch.departCode != ''">
AND su.org_code =#{allProjectStatisticsSearch.departCode}
</if>
<if test="allProjectStatisticsSearch.chargeUse != null and allProjectStatisticsSearch.chargeUse != ''">
AND tmps.charge_use=#{allProjectStatisticsSearch.chargeUse}
</if>
<if test="allProjectStatisticsSearch.chargeCompanyTemporaryName != null and allProjectStatisticsSearch.chargeCompanyTemporaryName != ''">
AND tmps.company_name LIKE
concat('%',concat(#{allProjectStatisticsSearch.chargeCompanyTemporaryName},'%'))
</if>
<if test="allProjectStatisticsSearch.pack != null and allProjectStatisticsSearch.pack != ''">
AND tmps.pack=#{allProjectStatisticsSearch.pack}
</if>
<choose>
<when test="allProjectStatisticsSearch.allMoney != null and allProjectStatisticsSearch.allMoney != '' and allProjectStatisticsSearch.allMoneyTwo != null and allProjectStatisticsSearch.allMoneyTwo != ''">
AND tmps.amount_receivable >= #{allProjectStatisticsSearch.allMoney} and tmps.amount_receivable <![CDATA[<]]>=
#{allProjectStatisticsSearch.allMoneyTwo}
</when>
<otherwise>
<if test="allProjectStatisticsSearch.allMoney != null and allProjectStatisticsSearch.allMoney != ''">
AND tmps.amount_receivable >= #{allProjectStatisticsSearch.allMoney}
</if>
<if test="allProjectStatisticsSearch.allMoneyTwo != null and allProjectStatisticsSearch.allMoneyTwo != ''">
AND tmps.amount_receivable <![CDATA[<]]>= #{allProjectStatisticsSearch.allMoneyTwo}
</if>
</otherwise>
</choose>
</where>
union all
SELECT
tcp.id,
tmp.project_name AS projectName,
su.realname as principalName,
tcp.company_name AS chargeCompanyTemporaryName,
tcp.amount_receivable as allMoney,
tcp.paid_amount as comeAllMoney,
tcp.charge_use as chargeUse,
sd.depart_name as depart,
tcp.pack as pack,
tcp.create_time as createTime
FROM tb_member_project tmp left join tb_certificate_payment tcp on(tmp.id=tcp.project_id)
left JOIN sys_user su on(tmp.director_id=su.id) left join sys_depart sd on(su.org_code=sd.org_code)
<where>
<if test="idList != null and idList != ''">
tmp.director_id in
<foreach item="item" open="(" separator="," close=")" collection="idList">
#{item}
</foreach>
</if>
<if test="allProjectStatisticsSearch.projectName != null and allProjectStatisticsSearch.projectName != ''">
AND tmp.project_name LIKE
concat('%',concat(#{allProjectStatisticsSearch.projectName},'%'))
</if>
<if test="allProjectStatisticsSearch.year != null and allProjectStatisticsSearch.year != ''">
AND tmp.year LIKE
concat(#{allProjectStatisticsSearch.year},'%')
</if>
<if test="allProjectStatisticsSearch.payStatue != null and allProjectStatisticsSearch.payStatue != ''">
AND tcp.in_account LIKE
concat('%',concat(#{allProjectStatisticsSearch.payStatue},'%'))
</if>
<if test="allProjectStatisticsSearch.principalNameId != null and allProjectStatisticsSearch.principalNameId != ''">
AND tmp.director_id=#{allProjectStatisticsSearch.principalNameId}
</if>
<if test="allProjectStatisticsSearch.departCode != null and allProjectStatisticsSearch.departCode != ''">
AND su.org_code =#{allProjectStatisticsSearch.departCode}
</if>
<if test="allProjectStatisticsSearch.chargeUse != null and allProjectStatisticsSearch.chargeUse != ''">
AND tcp.charge_use=#{allProjectStatisticsSearch.chargeUse}
</if>
<if test="allProjectStatisticsSearch.chargeCompanyTemporaryName != null and allProjectStatisticsSearch.chargeCompanyTemporaryName != ''">
AND tcp.company_name LIKE
concat('%',concat(#{allProjectStatisticsSearch.chargeCompanyTemporaryName},'%'))
</if>
<if test="allProjectStatisticsSearch.pack != null and allProjectStatisticsSearch.pack != ''">
AND tcp.pack=#{allProjectStatisticsSearch.pack}
</if>
<choose>
<when test="allProjectStatisticsSearch.allMoney != null and allProjectStatisticsSearch.allMoney != '' and allProjectStatisticsSearch.allMoneyTwo != null and allProjectStatisticsSearch.allMoneyTwo != ''">
AND tcp.amount_receivable >= #{allProjectStatisticsSearch.allMoney} and tcp.amount_receivable <![CDATA[<]]>=
#{allProjectStatisticsSearch.allMoneyTwo}
</when>
<otherwise>
<if test="allProjectStatisticsSearch.allMoney != null and allProjectStatisticsSearch.allMoney != ''">
AND tcp.amount_receivable >= #{allProjectStatisticsSearch.allMoney}
</if>
<if test="allProjectStatisticsSearch.allMoneyTwo != null and allProjectStatisticsSearch.allMoneyTwo != ''">
AND tcp.amount_receivable <![CDATA[<]]>= #{allProjectStatisticsSearch.allMoneyTwo}
</if>
</otherwise>
</choose>
</where>) pp where pp.allMoney is not null and pp.allMoney !=0
<!-- pp left join-->
<!-- (-->
<!-- select pwgs.id as id,max(ppr.payment_date) as payment_date-->
<!-- from pay_working_group_subitem pwgs-->
<!-- inner join pay_payment_record ppr on(pwgs.id=ppr.project_id)-->
<!-- <if test="allProjectStatisticsSearch.year != null and allProjectStatisticsSearch.year != ''">-->
<!-- WHERE ppr.payment_date like-->
<!-- concat('%',#{allProjectStatisticsSearch.year},'%')-->
<!-- </if>-->
<!-- GROUP BY pwgs.id-->
<!-- union ALL-->
<!-- SELECT-->
<!-- pcp.id as id,max(ppr.payment_date) as payment_date-->
<!-- FROM pay_common_project pcp inner JOIN pay_payment_record ppr on(pcp.id=ppr.project_id)-->
<!-- <if test="allProjectStatisticsSearch.year != null and allProjectStatisticsSearch.year != ''">-->
<!-- WHERE ppr.payment_date like-->
<!-- concat('%',#{allProjectStatisticsSearch.year},'%')-->
<!-- </if>-->
<!-- group by pcp.id-->
<!-- union all-->
<!-- SELECT-->
<!-- pmps.id as id,max(ppr.payment_date) as payment_date from-->
<!-- pay_member_project_subitem pmps inner join pay_payment_record ppr on(pmps.id=ppr.project_id)-->
<!-- <if test="allProjectStatisticsSearch.year != null and allProjectStatisticsSearch.year != ''">-->
<!-- WHERE ppr.payment_date like-->
<!-- concat('%',#{allProjectStatisticsSearch.year},'%')-->
<!-- </if>-->
<!-- group by pmps.id-->
<!-- union all-->
<!-- SELECT-->
<!-- pms.id,max(ppr.payment_date) as payment_date from pay_meeting_situation pms inner join pay_payment_record ppr on(pms.id=ppr.project_id)-->
<!-- <if test="allProjectStatisticsSearch.year != null and allProjectStatisticsSearch.year != ''">-->
<!-- WHERE ppr.payment_date like-->
<!-- concat('%',#{allProjectStatisticsSearch.year},'%')-->
<!-- </if>-->
<!-- group by pms.id-->
<!-- union all-->
<!-- SELECT-->
<!-- tmps.id,max(ppr.payment_date) as payment_date from tb_member_project_subitem tmps inner join pay_payment_record ppr on(tmps.id=ppr.project_id)-->
<!-- <if test="allProjectStatisticsSearch.year != null and allProjectStatisticsSearch.year != ''">-->
<!-- WHERE ppr.payment_date like-->
<!-- concat('%',#{allProjectStatisticsSearch.year},'%')-->
<!-- </if>-->
<!-- group by tmps.id-->
<!-- union all-->
<!-- SELECT-->
<!-- tcp.id,max(ppr.payment_date) as payment_date from tb_certificate_payment tcp inner join pay_payment_record ppr on(tcp.id=ppr.project_id)-->
<!-- <if test="allProjectStatisticsSearch.year != null and allProjectStatisticsSearch.year != ''">-->
<!-- WHERE ppr.payment_date like-->
<!-- concat('%',#{allProjectStatisticsSearch.year},'%')-->
<!-- </if>-->
<!-- group by tcp.id-->
<!-- ) pprr on(pp.id=pprr.id) group by pp.id order by pprr.payment_date desc-->
</select>
<!-- 全所统计总金额统计-->
<select id="queryPageList33" resultType="com.jero.statistics.entity.AllMoney">
select sum(allMoney) as allMoney, sum(comeAllMoney) as comeAllMoney from
(SELECT
pwgs.id,
pwg.working_group_project AS projectName,
pwg.principal_name_a as principalName,
pwgs.charge_company_temporary_name AS chargeCompanyTemporaryName,
pwgs.receivable_amount as allMoney,
pwgs.paid_amount as comeAllMoney,
pwgs.charge_use as chargeUse,
sd.depart_name as depart,
pwgs.pack as pack,
pwgs.create_time as createTime
FROM pay_working_group pwg right join pay_working_group_subitem pwgs on(pwg.id=pwgs.working_group_id)
left JOIN sys_user su on(pwg.principal_id_a=su.id) left join sys_depart sd on(su.org_code=sd.org_code)
v_statistical
<where>
<if test="idList != null and idList != ''">
pwg.principal_id_a in
principalNameId in
<foreach item="item" open="(" separator="," close=")" collection="idList">
#{item}
</foreach>
</if>
<if test="allProjectStatisticsSearch.projectName != null and allProjectStatisticsSearch.projectName != ''">
AND pwg.working_group_project LIKE
concat('%',concat(#{allProjectStatisticsSearch.projectName},'%'))
AND projectName LIKE
concat('%',#{allProjectStatisticsSearch.projectName},'%')
</if>
<if test="allProjectStatisticsSearch.year != null and allProjectStatisticsSearch.year != ''">
AND pwg.year LIKE
AND year LIKE
concat(#{allProjectStatisticsSearch.year},'%')
</if>
<if test="allProjectStatisticsSearch.payStatue != null and allProjectStatisticsSearch.payStatue != ''">
AND pwgs.in_account LIKE
concat('%',concat(#{allProjectStatisticsSearch.payStatue},'%'))
AND payStatue LIKE
concat('%',#{allProjectStatisticsSearch.payStatue},'%')
</if>
<if test="allProjectStatisticsSearch.departCode != null and allProjectStatisticsSearch.departCode != ''">
AND su.org_code =#{allProjectStatisticsSearch.departCode}
AND departCode =#{allProjectStatisticsSearch.departCode}
</if>
<if test="allProjectStatisticsSearch.chargeUse != null and allProjectStatisticsSearch.chargeUse != ''">
AND pwgs.charge_use=#{allProjectStatisticsSearch.chargeUse}
AND chargeUse=#{allProjectStatisticsSearch.chargeUse}
</if>
<if test="allProjectStatisticsSearch.chargeCompanyTemporaryName != null and allProjectStatisticsSearch.chargeCompanyTemporaryName != ''">
AND pwgs.charge_company_temporary_name LIKE
concat('%',concat(#{allProjectStatisticsSearch.chargeCompanyTemporaryName},'%'))
AND chargeCompanyTemporaryName LIKE
concat('%',#{allProjectStatisticsSearch.chargeCompanyTemporaryName},'%')
</if>
<if test="allProjectStatisticsSearch.principalNameId != null and allProjectStatisticsSearch.principalNameId != ''">
AND pwg.principal_id_a=#{allProjectStatisticsSearch.principalNameId}
AND principalNameId=#{allProjectStatisticsSearch.principalNameId}
</if>
<if test="allProjectStatisticsSearch.pack != null and allProjectStatisticsSearch.pack != ''">
AND pwgs.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 pwgs.receivable_amount >= #{allProjectStatisticsSearch.allMoney} and pwgs.receivable_amount <![CDATA[<]]>=
AND allMoney >= #{allProjectStatisticsSearch.allMoney} and allMoney <![CDATA[<]]>=
#{allProjectStatisticsSearch.allMoneyTwo}
</when>
<otherwise>
<if test="allProjectStatisticsSearch.allMoney != null and allProjectStatisticsSearch.allMoney != ''">
AND pwgs.receivable_amount >= #{allProjectStatisticsSearch.allMoney}
AND allMoney >= #{allProjectStatisticsSearch.allMoney}
</if>
<if test="allProjectStatisticsSearch.allMoneyTwo != null and allProjectStatisticsSearch.allMoneyTwo != ''">
AND pwgs.receivable_amount <![CDATA[<]]>= #{allProjectStatisticsSearch.allMoneyTwo}
AND allMoney <![CDATA[<]]>= #{allProjectStatisticsSearch.allMoneyTwo}
</if>
</otherwise>
</choose>
</where>
union all
SELECT
pcp.id,
pcp.charge_project AS projectName,
pcp.principal_name as principalName,
pcp.charge_company_temporary_name AS chargeCompanyTemporaryName,
pcp.receivable_amount as allMoney,
pcp.paid_amount as comeAllMoney,
pcp.charge_use as chargeUse,
sd.depart_name as depart,
pcp.pack as pack,
pcp.create_time as createTime
FROM pay_common_project pcp left JOIN sys_user su on(pcp.principal_id=su.id) left join sys_depart sd
on(su.org_code=sd.org_code)
<where>
<if test="idList != null and idList != ''">
pcp.principal_id in
<foreach item="item" open="(" separator="," close=")" collection="idList">
#{item}
</foreach>
</if>
<if test="allProjectStatisticsSearch.projectName != null and allProjectStatisticsSearch.projectName != ''">
AND pcp.charge_project LIKE
concat('%',concat(#{allProjectStatisticsSearch.projectName},'%'))
</if>
<if test="allProjectStatisticsSearch.year != null and allProjectStatisticsSearch.year != ''">
AND pcp.year LIKE
concat(#{allProjectStatisticsSearch.year},'%')
</if>
<if test="allProjectStatisticsSearch.payStatue != null and allProjectStatisticsSearch.payStatue != ''">
AND pcp.in_account LIKE
concat('%',concat(#{allProjectStatisticsSearch.payStatue},'%'))
</if>
<if test="allProjectStatisticsSearch.chargeCompanyTemporaryName != null and allProjectStatisticsSearch.chargeCompanyTemporaryName != ''">
AND pcp.charge_company_temporary_name LIKE
concat('%',concat(#{allProjectStatisticsSearch.chargeCompanyTemporaryName},'%'))
</if>
<if test="allProjectStatisticsSearch.departCode != null and allProjectStatisticsSearch.departCode != ''">
AND su.org_code =#{allProjectStatisticsSearch.departCode}
</if>
<if test="allProjectStatisticsSearch.chargeUse != null and allProjectStatisticsSearch.chargeUse != ''">
AND pcp.charge_use=#{allProjectStatisticsSearch.chargeUse}
</if>
<if test="allProjectStatisticsSearch.principalNameId != null and allProjectStatisticsSearch.principalNameId != ''">
AND pcp.principal_id=#{allProjectStatisticsSearch.principalNameId}
</if>
<if test="allProjectStatisticsSearch.pack != null and allProjectStatisticsSearch.pack != ''">
AND pcp.pack=#{allProjectStatisticsSearch.pack}
</if>
<choose>
<when test="allProjectStatisticsSearch.allMoney != null and allProjectStatisticsSearch.allMoney != '' and allProjectStatisticsSearch.allMoneyTwo != null and allProjectStatisticsSearch.allMoneyTwo != ''">
AND pcp.receivable_amount >= #{allProjectStatisticsSearch.allMoney} and pcp.receivable_amount
<![CDATA[<]]>= #{allProjectStatisticsSearch.allMoneyTwo}
</when>
<otherwise>
<if test="allProjectStatisticsSearch.allMoney != null and allProjectStatisticsSearch.allMoney != ''">
AND pcp.receivable_amount >= #{allProjectStatisticsSearch.allMoney}
</if>
<if test="allProjectStatisticsSearch.allMoneyTwo != null and allProjectStatisticsSearch.allMoneyTwo != ''">
AND pcp.receivable_amount <![CDATA[<]]>= #{allProjectStatisticsSearch.allMoneyTwo}
</if>
</otherwise>
</choose>
</where>
union all
SELECT
pmps.id,
pmp.project_name AS projectName,
su.realname as principalName,
pmps.company_name AS chargeCompanyTemporaryName,
pmps.amount_receivable as allMoney,
pmps.paid_amount as comeAllMoney,
pmps.charge_use as chargeUse,
sd.depart_name as depart,
pmps.pack as pack,
pmps.create_time as createTime
FROM pay_member_project pmp right join pay_member_project_subitem pmps on(pmp.id=pmps.project_id)
left JOIN sys_user su on(pmp.director_id=su.id) left join sys_depart sd on(su.org_code=sd.org_code)
<where>
<if test="idList != null and idList != ''">
pmp.director_id in
<foreach item="item" open="(" separator="," close=")" collection="idList">
#{item}
</foreach>
</if>
<if test="allProjectStatisticsSearch.projectName != null and allProjectStatisticsSearch.projectName != ''">
AND pmp.project_name LIKE
concat('%',concat(#{allProjectStatisticsSearch.projectName},'%'))
</if>
<if test="allProjectStatisticsSearch.year != null and allProjectStatisticsSearch.year != ''">
AND pmp.particular_year LIKE
concat(#{allProjectStatisticsSearch.year},'%')
</if>
<if test="allProjectStatisticsSearch.payStatue != null and allProjectStatisticsSearch.payStatue != ''">
AND pmps.in_account LIKE
concat('%',concat(#{allProjectStatisticsSearch.payStatue},'%'))
</if>
<if test="allProjectStatisticsSearch.departCode != null and allProjectStatisticsSearch.departCode != ''">
AND su.org_code =#{allProjectStatisticsSearch.departCode}
</if>
<if test="allProjectStatisticsSearch.chargeUse != null and allProjectStatisticsSearch.chargeUse != ''">
AND pmps.charge_use=#{allProjectStatisticsSearch.chargeUse}
</if>
<if test="allProjectStatisticsSearch.chargeCompanyTemporaryName != null and allProjectStatisticsSearch.chargeCompanyTemporaryName != ''">
AND pmps.company_name LIKE
concat('%',concat(#{allProjectStatisticsSearch.chargeCompanyTemporaryName},'%'))
</if>
<if test="allProjectStatisticsSearch.principalNameId != null and allProjectStatisticsSearch.principalNameId != ''">
AND pmp.director_id=#{allProjectStatisticsSearch.principalNameId}
</if>
<if test="allProjectStatisticsSearch.pack != null and allProjectStatisticsSearch.pack != ''">
AND pmps.pack=#{allProjectStatisticsSearch.pack}
</if>
<choose>
<when test="allProjectStatisticsSearch.allMoney != null and allProjectStatisticsSearch.allMoney != '' and allProjectStatisticsSearch.allMoneyTwo != null and allProjectStatisticsSearch.allMoneyTwo != ''">
AND pmps.amount_receivable >= #{allProjectStatisticsSearch.allMoney} and pmps.amount_receivable <![CDATA[<]]>=
#{allProjectStatisticsSearch.allMoneyTwo}
</when>
<otherwise>
<if test="allProjectStatisticsSearch.allMoney != null and allProjectStatisticsSearch.allMoney != ''">
AND pmps.amount_receivable >= #{allProjectStatisticsSearch.allMoney}
</if>
<if test="allProjectStatisticsSearch.allMoneyTwo != null and allProjectStatisticsSearch.allMoneyTwo != ''">
AND pmps.amount_receivable <![CDATA[<]]>= #{allProjectStatisticsSearch.allMoneyTwo}
</if>
</otherwise>
</choose>
</where>
union all
SELECT
pms.id,
pm.meeting_name AS projectName,
su.realname as principalName,
pms.company_name AS chargeCompanyTemporaryName,
pms.amount_receivable as allMoney,
pms.paid_amount as comeAllMoney,
pms.charge_use as chargeUse,
sd.depart_name as depart,
pms.pack as pack,
pms.create_time as createTime
FROM pay_meeting pm right join pay_meeting_situation pms on(pm.id=pms.meeting_id)
left JOIN sys_user su on(pm.director_id=su.id) left join sys_depart sd on(su.org_code=sd.org_code)
<where>
<if test="idList != null and idList != ''">
pm.director_id in
<foreach item="item" open="(" separator="," close=")" collection="idList">
#{item}
</foreach>
</if>
<if test="allProjectStatisticsSearch.projectName != null and allProjectStatisticsSearch.projectName != ''">
AND pm.meeting_name LIKE
concat('%',concat(#{allProjectStatisticsSearch.projectName},'%'))
</if>
<if test="allProjectStatisticsSearch.year != null and allProjectStatisticsSearch.year != ''">
AND pm.particular_year LIKE
concat(#{allProjectStatisticsSearch.year},'%')
</if>
<if test="allProjectStatisticsSearch.payStatue != null and allProjectStatisticsSearch.payStatue != ''">
AND pms.in_account LIKE
concat('%',concat(#{allProjectStatisticsSearch.payStatue},'%'))
</if>
<if test="allProjectStatisticsSearch.departCode != null and allProjectStatisticsSearch.departCode != ''">
AND su.org_code =#{allProjectStatisticsSearch.departCode}
</if>
<if test="allProjectStatisticsSearch.chargeUse != null and allProjectStatisticsSearch.chargeUse != ''">
AND pms.charge_use=#{allProjectStatisticsSearch.chargeUse}
</if>
<if test="allProjectStatisticsSearch.chargeCompanyTemporaryName != null and allProjectStatisticsSearch.chargeCompanyTemporaryName != ''">
AND pms.company_name LIKE
concat('%',concat(#{allProjectStatisticsSearch.chargeCompanyTemporaryName},'%'))
</if>
<if test="allProjectStatisticsSearch.principalNameId != null and allProjectStatisticsSearch.principalNameId != ''">
AND pm.director_id=#{allProjectStatisticsSearch.principalNameId}
</if>
<if test="allProjectStatisticsSearch.pack != null and allProjectStatisticsSearch.pack != ''">
AND pms.pack=#{allProjectStatisticsSearch.pack}
</if>
<choose>
<when test="allProjectStatisticsSearch.allMoney != null and allProjectStatisticsSearch.allMoney != '' and allProjectStatisticsSearch.allMoneyTwo != null and allProjectStatisticsSearch.allMoneyTwo != ''">
AND pms.amount_receivable >= #{allProjectStatisticsSearch.allMoney} and pms.amount_receivable <![CDATA[<]]>=
#{allProjectStatisticsSearch.allMoneyTwo}
</when>
<otherwise>
<if test="allProjectStatisticsSearch.allMoney != null and allProjectStatisticsSearch.allMoney != ''">
AND pms.amount_receivable >= #{allProjectStatisticsSearch.allMoney}
</if>
<if test="allProjectStatisticsSearch.allMoneyTwo != null and allProjectStatisticsSearch.allMoneyTwo != ''">
AND pms.amount_receivable <![CDATA[<]]>= #{allProjectStatisticsSearch.allMoneyTwo}
</if>
</otherwise>
</choose>
</where>
union all
SELECT
tmps.id,
tmp.project_name AS projectName,
su.realname as principalName,
tmps.company_name AS chargeCompanyTemporaryName,
tmps.amount_receivable as allMoney,
tmps.paid_amount as comeAllMoney,
tmps.charge_use as chargeUse,
sd.depart_name as depart,
tmps.pack as pack,
tmps.create_time as createTime
FROM tb_member_project tmp left join tb_member_project_subitem tmps on(tmp.id=tmps.project_id)
left JOIN sys_user su on(tmp.director_id=su.id) left join sys_depart sd on(su.org_code=sd.org_code)
<where>
<if test="idList != null and idList != ''">
tmp.director_id in
<foreach item="item" open="(" separator="," close=")" collection="idList">
#{item}
</foreach>
</if>
<if test="allProjectStatisticsSearch.projectName != null and allProjectStatisticsSearch.projectName != ''">
AND tmp.project_name LIKE
concat('%',concat(#{allProjectStatisticsSearch.projectName},'%'))
</if>
<if test="allProjectStatisticsSearch.year != null and allProjectStatisticsSearch.year != ''">
AND tmp.year LIKE
concat(#{allProjectStatisticsSearch.year},'%')
</if>
<if test="allProjectStatisticsSearch.payStatue != null and allProjectStatisticsSearch.payStatue != ''">
AND tmps.in_account LIKE
concat('%',concat(#{allProjectStatisticsSearch.payStatue},'%'))
</if>
<if test="allProjectStatisticsSearch.principalNameId != null and allProjectStatisticsSearch.principalNameId != ''">
AND tmp.director_id=#{allProjectStatisticsSearch.principalNameId}
</if>
<if test="allProjectStatisticsSearch.departCode != null and allProjectStatisticsSearch.departCode != ''">
AND su.org_code =#{allProjectStatisticsSearch.departCode}
</if>
<if test="allProjectStatisticsSearch.chargeUse != null and allProjectStatisticsSearch.chargeUse != ''">
AND tmps.charge_use=#{allProjectStatisticsSearch.chargeUse}
</if>
<if test="allProjectStatisticsSearch.chargeCompanyTemporaryName != null and allProjectStatisticsSearch.chargeCompanyTemporaryName != ''">
AND tmps.company_name LIKE
concat('%',concat(#{allProjectStatisticsSearch.chargeCompanyTemporaryName},'%'))
</if>
<if test="allProjectStatisticsSearch.pack != null and allProjectStatisticsSearch.pack != ''">
AND tmps.pack=#{allProjectStatisticsSearch.pack}
</if>
<choose>
<when test="allProjectStatisticsSearch.allMoney != null and allProjectStatisticsSearch.allMoney != '' and allProjectStatisticsSearch.allMoneyTwo != null and allProjectStatisticsSearch.allMoneyTwo != ''">
AND tmps.amount_receivable >= #{allProjectStatisticsSearch.allMoney} and tmps.amount_receivable <![CDATA[<]]>=
#{allProjectStatisticsSearch.allMoneyTwo}
</when>
<otherwise>
<if test="allProjectStatisticsSearch.allMoney != null and allProjectStatisticsSearch.allMoney != ''">
AND tmps.amount_receivable >= #{allProjectStatisticsSearch.allMoney}
</if>
<if test="allProjectStatisticsSearch.allMoneyTwo != null and allProjectStatisticsSearch.allMoneyTwo != ''">
AND tmps.amount_receivable <![CDATA[<]]>= #{allProjectStatisticsSearch.allMoneyTwo}
</if>
</otherwise>
</choose>
</where>
union all
SELECT
tcp.id,
tmp.project_name AS projectName,
su.realname as principalName,
tcp.company_name AS chargeCompanyTemporaryName,
tcp.amount_receivable as allMoney,
tcp.paid_amount as comeAllMoney,
tcp.charge_use as chargeUse,
sd.depart_name as depart,
tcp.pack as pack,
tcp.create_time as createTime
FROM tb_member_project tmp left join tb_certificate_payment tcp on(tmp.id=tcp.project_id)
left JOIN sys_user su on(tmp.director_id=su.id) left join sys_depart sd on(su.org_code=sd.org_code)
<where>
<if test="idList != null and idList != ''">
tmp.director_id in
<foreach item="item" open="(" separator="," close=")" collection="idList">
#{item}
</foreach>
</if>
<if test="allProjectStatisticsSearch.projectName != null and allProjectStatisticsSearch.projectName != ''">
AND tmp.project_name LIKE
concat('%',concat(#{allProjectStatisticsSearch.projectName},'%'))
</if>
<if test="allProjectStatisticsSearch.year != null and allProjectStatisticsSearch.year != ''">
AND tmp.year LIKE
concat(#{allProjectStatisticsSearch.year},'%')
</if>
<if test="allProjectStatisticsSearch.payStatue != null and allProjectStatisticsSearch.payStatue != ''">
AND tcp.in_account LIKE
concat('%',concat(#{allProjectStatisticsSearch.payStatue},'%'))
</if>
<if test="allProjectStatisticsSearch.principalNameId != null and allProjectStatisticsSearch.principalNameId != ''">
AND tmp.director_id=#{allProjectStatisticsSearch.principalNameId}
</if>
<if test="allProjectStatisticsSearch.departCode != null and allProjectStatisticsSearch.departCode != ''">
AND su.org_code =#{allProjectStatisticsSearch.departCode}
</if>
<if test="allProjectStatisticsSearch.chargeUse != null and allProjectStatisticsSearch.chargeUse != ''">
AND tcp.charge_use=#{allProjectStatisticsSearch.chargeUse}
</if>
<if test="allProjectStatisticsSearch.chargeCompanyTemporaryName != null and allProjectStatisticsSearch.chargeCompanyTemporaryName != ''">
AND tcp.company_name LIKE
concat('%',concat(#{allProjectStatisticsSearch.chargeCompanyTemporaryName},'%'))
</if>
<if test="allProjectStatisticsSearch.pack != null and allProjectStatisticsSearch.pack != ''">
AND tcp.pack=#{allProjectStatisticsSearch.pack}
</if>
<choose>
<when test="allProjectStatisticsSearch.allMoney != null and allProjectStatisticsSearch.allMoney != '' and allProjectStatisticsSearch.allMoneyTwo != null and allProjectStatisticsSearch.allMoneyTwo != ''">
AND tcp.amount_receivable >= #{allProjectStatisticsSearch.allMoney} and tcp.amount_receivable <![CDATA[<]]>=
#{allProjectStatisticsSearch.allMoneyTwo}
</when>
<otherwise>
<if test="allProjectStatisticsSearch.allMoney != null and allProjectStatisticsSearch.allMoney != ''">
AND tcp.amount_receivable >= #{allProjectStatisticsSearch.allMoney}
</if>
<if test="allProjectStatisticsSearch.allMoneyTwo != null and allProjectStatisticsSearch.allMoneyTwo != ''">
AND tcp.amount_receivable <![CDATA[<]]>= #{allProjectStatisticsSearch.allMoneyTwo}
</if>
</otherwise>
</choose>
</where>) pp where pp.allMoney is not null and pp.allMoney !=0
<!-- pp left join-->
<!-- (-->
<!-- select pwgs.id as id,max(ppr.payment_date) as payment_date-->
<!-- from pay_working_group_subitem pwgs-->
<!-- inner join pay_payment_record ppr on(pwgs.id=ppr.project_id)-->
<!-- <if test="allProjectStatisticsSearch.year != null and allProjectStatisticsSearch.year != ''">-->
<!-- WHERE ppr.payment_date like-->
<!-- concat('%',#{allProjectStatisticsSearch.year},'%')-->
<!-- </if>-->
<!-- GROUP BY pwgs.id-->
<!-- union ALL-->
<!-- SELECT-->
<!-- pcp.id as id,max(ppr.payment_date) as payment_date-->
<!-- FROM pay_common_project pcp inner JOIN pay_payment_record ppr on(pcp.id=ppr.project_id)-->
<!-- <if test="allProjectStatisticsSearch.year != null and allProjectStatisticsSearch.year != ''">-->
<!-- WHERE ppr.payment_date like-->
<!-- concat('%',#{allProjectStatisticsSearch.year},'%')-->
<!-- </if>-->
<!-- group by pcp.id-->
<!-- union all-->
<!-- SELECT-->
<!-- pmps.id as id,max(ppr.payment_date) as payment_date from-->
<!-- pay_member_project_subitem pmps inner join pay_payment_record ppr on(pmps.id=ppr.project_id)-->
<!-- <if test="allProjectStatisticsSearch.year != null and allProjectStatisticsSearch.year != ''">-->
<!-- WHERE ppr.payment_date like-->
<!-- concat('%',#{allProjectStatisticsSearch.year},'%')-->
<!-- </if>-->
<!-- group by pmps.id-->
<!-- union all-->
<!-- SELECT-->
<!-- pms.id,max(ppr.payment_date) as payment_date from pay_meeting_situation pms inner join pay_payment_record ppr on(pms.id=ppr.project_id)-->
<!-- <if test="allProjectStatisticsSearch.year != null and allProjectStatisticsSearch.year != ''">-->
<!-- WHERE ppr.payment_date like-->
<!-- concat('%',#{allProjectStatisticsSearch.year},'%')-->
<!-- </if>-->
<!-- group by pms.id-->
<!-- union all-->
<!-- SELECT-->
<!-- tmps.id,max(ppr.payment_date) as payment_date from tb_member_project_subitem tmps inner join pay_payment_record ppr on(tmps.id=ppr.project_id)-->
<!-- <if test="allProjectStatisticsSearch.year != null and allProjectStatisticsSearch.year != ''">-->
<!-- WHERE ppr.payment_date like-->
<!-- concat('%',#{allProjectStatisticsSearch.year},'%')-->
<!-- </if>-->
<!-- group by tmps.id-->
<!-- union all-->
<!-- SELECT-->
<!-- tcp.id,max(ppr.payment_date) as payment_date from tb_certificate_payment tcp inner join pay_payment_record ppr on(tcp.id=ppr.project_id)-->
<!-- <if test="allProjectStatisticsSearch.year != null and allProjectStatisticsSearch.year != ''">-->
<!-- WHERE ppr.payment_date like-->
<!-- concat('%',#{allProjectStatisticsSearch.year},'%')-->
<!-- </if>-->
<!-- group by tcp.id-->
<!-- ) pprr on(pp.id=pprr.id) group by pp.id order by pprr.payment_date desc-->
</select>
<!-- 全所统计导出-->
<select id="queryPageListExcel" resultType="com.jero.statistics.entity.AllProjectStatistics">