Commit 1675d947 authored by huyuchen's avatar huyuchen

优化修改

parent 9f61f549
......@@ -76,6 +76,7 @@ public class TSalaryAccountPhoneController {
.eq(TSalaryAccount::getEmpIdcard, idNumber)
.eq(TSalaryAccount::getDeleteFlag, CommonConstants.ZERO_INT)
.eq(TSalaryAccount::getSendStatus, CommonConstants.ONE_STRING)
.eq(TSalaryAccount::getPaySettleFlag, CommonConstants.ZERO_STRING)
.last(SORT_COL.concat(CommonConstants.LAST_ONE_SQL)));
//查实发工资
if (Common.isNotNull(list)) {
......@@ -89,6 +90,7 @@ public class TSalaryAccountPhoneController {
.eq(TSalaryAccount::getEmpIdcard, idNumber)
.eq(TSalaryAccount::getDeleteFlag, CommonConstants.ZERO_INT)
.eq(TSalaryAccount::getSendStatus, CommonConstants.ONE_STRING)
.eq(TSalaryAccount::getPaySettleFlag, CommonConstants.ZERO_STRING)
.likeRight(TSalaryAccount::getSalaryMonth, year).last(SORT_COL));
//查实发工资
if (Common.isNotNull(list)) {
......
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.yifu.social.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.HeadFontStyle;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.RowIndex;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* 缴费库查询导出字段
* @author huyc
* @date 2023-05-18 17:01:22
*/
@Data
public class TPaymentInfoNewExportVo extends RowIndex implements Serializable {
/**
* 员工姓名
*/
@ExcelAttribute(name = "员工姓名" )
@Schema(description ="员工姓名")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("员工姓名")
private String empName;
/**
* 身份证号
*/
@ExcelAttribute(name = "身份证号" )
@Schema(description ="身份证号")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("身份证号")
private String empIdcard;
/**
* 客户名称
*/
@ExcelAttribute(name = "客户名称" )
@Schema(description ="客户名称")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("客户名称")
private String unitName;
/**
* 项目名称
*/
@ExcelAttribute(name = "项目名称" )
@Schema(description ="项目名称")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("项目名称")
private String settleDomainName;
/**
* 社保缴纳地
*/
@ExcelAttribute(name = "社保缴纳地" )
@Schema(description ="社保缴纳地")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("社保缴纳地")
private String socialPayAddr;
/**
* 缴纳月份
*/
@ExcelAttribute(name = "缴纳月份")
@Schema(description ="缴纳月份")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("缴纳月份")
private String socialPayMonth;
/**
* 生成月份
*/
@ExcelAttribute(name = "生成月份")
@Schema(description ="生成月份")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("生成月份")
private String socialCreateMonth;
/**
* 养老金额
*/
@ExcelAttribute(name = "养老金额")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("养老金额")
private BigDecimal pensionMoneySum;
/**
* 医疗金额
*/
@ExcelAttribute(name = "医疗金额")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("医疗金额")
private BigDecimal medicalMoneySum;
/**
* 失业金额
*/
@ExcelAttribute(name = "失业金额")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("失业金额")
private BigDecimal unemploymentMoneySum;
/**
* 工伤金额
*/
@ExcelAttribute(name = "工伤金额")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("工伤金额")
private BigDecimal unitInjuryMoney;
/**
* 单位生育金额
*/
@ExcelAttribute(name = "生育金额")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("生育金额")
private BigDecimal unitBirthMoney;
/**
* 大病金额
*/
@ExcelAttribute(name = "大病金额")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("大病金额")
private BigDecimal bigmailmentMoneySum;
/**
* 补缴利息
*/
@ExcelAttribute(name = "补缴利息" )
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("补缴利息")
private BigDecimal accrualSum;
/**
* 社保户
*/
@ExcelAttribute(name = "社保户" )
@Schema(description ="社保户")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("社保户")
private String socialHousehold;
/**
* 社保合计
*/
@ExcelAttribute(name = "社保合计" )
@Schema(description ="社保合计")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("社保合计")
private BigDecimal socialSum;
/**
* 公积金户
*/
@ExcelAttribute(name = "公积金户" )
@Schema(description ="公积金户")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("公积金户")
private String providentHousehold;
/**
* 公积金缴纳地
*/
@ExcelAttribute(name = "公积金缴纳地" )
@Schema(description ="公积金缴纳地")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("公积金缴纳地")
private String providentPayAddr;
/**
* 公积金合计
*/
@ExcelAttribute(name = "公积金合计" )
@Schema(description ="公积金合计")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("公积金合计")
private BigDecimal providentSum;
/**
* 总合计
*/
@ExcelAttribute(name = "总合计" )
@Schema(description ="总合计")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("总合计")
private BigDecimal sumAll;
/**
* 分组键
*/
@ExcelAttribute(name = "分组键", isExport = false)
@Schema(description = "分组键")
private String keyGroup;
}
......@@ -70,19 +70,10 @@ public class TPaymentInfoNewVo extends RowIndex implements Serializable {
@ExcelProperty("项目名称")
private String settleDomainName;
/**
* 社保户
*/
@ExcelAttribute(name = "社保户" )
@Schema(description ="社保户")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("社保户")
private String socialHousehold;
/**
* 社保编号
*/
@ExcelAttribute(name = "社保编号" )
@ExcelAttribute(name = "社保编号", isExport = false)
@Schema(description ="社保编号")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("社保编号")
......@@ -116,49 +107,13 @@ public class TPaymentInfoNewVo extends RowIndex implements Serializable {
private String socialCreateMonth;
/**
* 总合计
*/
@ExcelAttribute(name = "总合计" )
@Schema(description ="总合计")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("总合计")
private BigDecimal sumAll;
/**
* 公积金缴纳月份
*/
@ExcelAttribute(name = "公积金缴纳月份")
@Schema(description ="公积金缴纳月份")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("公积金缴纳月份")
private String providentPayMonth;
/**
* 公积金生成月份
*/
@ExcelAttribute(name = "公积金生成月份")
@Schema(description ="公积金生成月份")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("公积金生成月份")
private String providentCreateMonth;
/**
* 公积金户
*/
@ExcelAttribute(name = "公积金户" )
@Schema(description ="公积金户")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("公积金户")
private String providentHousehold;
/**
* 公积金缴纳地
* 社保户
*/
@ExcelAttribute(name = "公积金缴纳地" )
@Schema(description ="公积金缴纳地")
@ExcelAttribute(name = "社保户" )
@Schema(description ="社保户")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("公积金缴纳地")
private String providentPayAddr;
@ExcelProperty("社保户")
private String socialHousehold;
/**
* 社保合计
......@@ -188,13 +143,22 @@ public class TPaymentInfoNewVo extends RowIndex implements Serializable {
private BigDecimal socialSecurityPersonalSum;
/**
* 公积金总合计
* 单位社保公积金合计
*/
@ExcelAttribute(name = "公积金总合计" )
@Schema(description ="公积金总合计")
@ExcelAttribute(name = "单位社保公积金合计" )
@Schema(description ="单位社保公积金合计")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("公积金总合计")
private BigDecimal providentSum;
@ExcelProperty("单位社保公积金合计")
private BigDecimal unitSocialFundSum;
/**
* 个人社保公积金合计
*/
@ExcelAttribute(name = "个人社保公积金合计" )
@Schema(description ="个人社保公积金合计")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("个人社保公积金合计")
private BigDecimal socialFundPersonalSum;
/**
* 单位社保补缴利息
......@@ -287,6 +251,7 @@ public class TPaymentInfoNewVo extends RowIndex implements Serializable {
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("单位大病金额")
private BigDecimal unitBigmailmentMoney;
/**
* 个人养老金额
*/
......@@ -315,6 +280,42 @@ public class TPaymentInfoNewVo extends RowIndex implements Serializable {
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("个人大病金额")
private BigDecimal personalBigmailmentMoney;
/**
* 养老金额
*/
@ExcelAttribute(name = "养老金额")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("养老金额")
private BigDecimal pensionMoneySum;
/**
* 医疗金额
*/
@ExcelAttribute(name = "医疗金额")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("医疗金额")
private BigDecimal medicalMoneySum;
/**
* 失业金额
*/
@ExcelAttribute(name = "失业金额")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("失业金额")
private BigDecimal unemploymentMoneySum;
/**
* 大病金额
*/
@ExcelAttribute(name = "大病金额")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("大病金额")
private BigDecimal bigmailmentMoneySum;
/**
* 补缴利息
*/
@ExcelAttribute(name = "补缴利息" )
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("补缴利息")
private BigDecimal accrualSum;
/**
* 公积金编号
*/
......@@ -358,6 +359,42 @@ public class TPaymentInfoNewVo extends RowIndex implements Serializable {
@ExcelProperty("个人公积金费用")
private BigDecimal personalProvidentSum;
/**
* 公积金户
*/
@ExcelAttribute(name = "公积金户" )
@Schema(description ="公积金户")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("公积金户")
private String providentHousehold;
/**
* 公积金缴纳地
*/
@ExcelAttribute(name = "公积金缴纳地" )
@Schema(description ="公积金缴纳地")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("公积金缴纳地")
private String providentPayAddr;
/**
* 公积金合计
*/
@ExcelAttribute(name = "公积金合计" )
@Schema(description ="公积金合计")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("公积金合计")
private BigDecimal providentSum;
/**
* 总合计
*/
@ExcelAttribute(name = "总合计" )
@Schema(description ="总合计")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("总合计")
private BigDecimal sumAll;
/**
* 分组键
*/
......
......@@ -12,4 +12,5 @@ public class PaymentConstants {
public static final String INJURY_RISK = "工伤保险";
public static final String MEDICAL = "医疗";
public static final String EXPORT = "缴费库合并导出";
public static final String SEARCH_EXPORT = "缴费库查询合并导出";
}
......@@ -303,6 +303,19 @@ public class TPaymentInfoController {
tPaymentInfoService.listSumExport(response, searchVo);
}
/**
* 缴费库查询合并导出
*
* @author huyc
* @date 2023-05-19
**/
@Operation(description = "缴费库查询合并导出 hasPermission('social_tpaymentinfo_export')")
@PostMapping("/sumSearchExport")
@PreAuthorize("@pms.hasPermission('social_tpaymentinfo_export')")
public void sumSearchExport(HttpServletResponse response, @RequestBody TPaymentInfoSearchVo searchVo) {
tPaymentInfoService.sumSearchExport(response, searchVo);
}
/**
* 根据条件批量删除
*
......
......@@ -67,6 +67,13 @@ public interface TPaymentInfoMapper extends BaseMapper<TPaymentInfo> {
*/
Integer selectCountTPaymentInfo(@Param("tPaymentInfo") TPaymentInfoSearchVo searchVo);
/**
* 缴费库简单分页查询
* @param searchVo 缴费库
* @return
*/
Integer selectCountPaymentSearchInfo(@Param("tPaymentInfo") TPaymentInfoSearchVo searchVo);
/**
* 缴费库简单分页查询
* @param searchVo 缴费库
......@@ -102,6 +109,13 @@ public interface TPaymentInfoMapper extends BaseMapper<TPaymentInfo> {
*/
List<TPaymentInfoExportVo> getTPaymentInfoSumNoPage(@Param("tPaymentInfo") TPaymentInfoSearchVo searchVo);
/**
* 缴费库查询详情
* @param tPaymentInfo
* @return
*/
List<TPaymentInfoNewExportVo> getTPaymentInfoNewExportInfo(@Param("tPaymentInfo") TPaymentInfoSearchVo tPaymentInfo);
/**
* 更新社保或者公积金
* @param tPaymentInfo 缴费库
......
......@@ -97,6 +97,14 @@ public interface TPaymentInfoService extends IService<TPaymentInfo> {
*/
void listSumExport(HttpServletResponse response, TPaymentInfoSearchVo searchVo);
/**
* 合并导出缴费库查询
* @param response
* @param searchVo
* @return
*/
void sumSearchExport(HttpServletResponse response, TPaymentInfoSearchVo searchVo);
/**
* 删除缴费库数据 包括明细
* @Author huyc
......
......@@ -290,6 +290,65 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
}
}
/**
* 缴费库查询批量导出
*
* @param searchVo 缴费库
* @return
*/
@Override
public void sumSearchExport(HttpServletResponse response, TPaymentInfoSearchVo searchVo) {
String fileName = PaymentConstants.SEARCH_EXPORT + DateUtil.getThisTime() + CommonConstants.XLSX;
//获取要导出的列表
List<TPaymentInfoNewExportVo> list = new ArrayList<>();
Integer count = baseMapper.selectCountPaymentSearchInfo(searchVo);
ServletOutputStream out = null;
try {
out = response.getOutputStream();
response.setContentType(CommonConstants.MULTIPART_FORM_DATA);
response.setCharacterEncoding("utf-8");
response.setHeader(CommonConstants.CONTENT_DISPOSITION, CommonConstants.ATTACHMENT_FILENAME + URLEncoder.encode(fileName, "UTF-8"));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
ExcelWriter excelWriter = EasyExcel.write(out, TPaymentInfoNewExportVo.class).includeColumnFieldNames(searchVo.getExportFields()).build();
int index = 0;
if (count > CommonConstants.ZERO_INT) {
WriteSheet writeSheet;
for (int i = 0; i <= count; i += CommonConstants.EXCEL_EXPORT_LIMIT) {
// 获取实际记录
searchVo.setLimitStart(i);
searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT);
list = baseMapper.getTPaymentInfoNewExportInfo(searchVo);
if (Common.isNotNull(list)) {
writeSheet = EasyExcel.writerSheet(PaymentConstants.SEARCH_EXPORT + index).build();
excelWriter.write(list, writeSheet);
index++;
}
if (Common.isNotNull(list)) {
list.clear();
}
}
} else {
WriteSheet writeSheet = EasyExcel.writerSheet(PaymentConstants.SEARCH_EXPORT + index).build();
excelWriter.write(list, writeSheet);
}
if (Common.isNotNull(list)) {
list.clear();
}
out.flush();
excelWriter.finish();
} catch (Exception e) {
log.error("执行异常", e);
} finally {
try {
if (null != out) {
out.close();
}
} catch (IOException e) {
log.error("执行异常", e);
}
}
}
@Override
public R<Boolean> removeInFoById(String id) {
YifuUser user = SecurityUtils.getUser();
......
......@@ -263,8 +263,6 @@
<result property="socialPayMonth" column="SOCIAL_PAY_MONTH"/>
<result property="socialCreateMonth" column="SOCIAL_CREATE_MONTH"/>
<result property="sumAll" column="SUM_ALL"/>
<result property="providentPayMonth" column="PROVIDENT_PAY_MONTH"/>
<result property="providentCreateMonth" column="PROVIDENT_CREATE_MONTH"/>
<result property="providentHousehold" column="PROVIDENT_HOUSEHOLD"/>
<result property="providentPayAddr" column="PROVIDENT_PAY_ADDR"/>
<result property="socialSum" column="SOCIAL_SUM"/>
......@@ -288,12 +286,43 @@
<result property="personalMedicalMoney" column="PERSONAL_MEDICAL_MONEY"/>
<result property="personalUnemploymentMoney" column="PERSONAL_UNEMPLOYMENT_MONEY"/>
<result property="personalBigmailmentMoney" column="PERSONAL_BIGMAILMENT_MONEY"/>
<result property="pensionMoneySum" column="PENSION_MONEY_SUM"/>
<result property="medicalMoneySum" column="MEDICAL_MONEY_SUM"/>
<result property="unemploymentMoneySum" column="UNEMPLOYMENT_MONEY_SUM"/>
<result property="bigmailmentMoneySum" column="BIGMAILMENT_MONEY_SUM"/>
<result property="accrualSum" column="ACCRUAL_SUM"/>
<result property="providentNo" column="PROVIDENT_NO"/>
<result property="unitProvidentSet" column="UNIT_PROVIDENT_SET"/>
<result property="providentPercent" column="PROVIDENT_PERCENT"/>
<result property="unitProvidentSum" column="UNIT_PROVIDENT_SUM"/>
<result property="personalProidentSet" column="PERSONAL_PROIDENT_SET"/>
<result property="personalProvidentSum" column="PERSONAL_PROVIDENT_SUM"/>
<result property="unitSocialFundSum" column="UNIT_SOCIAL_FUND_SUM"/>
<result property="socialFundPersonalSum" column="SOCIAL_FUND_PERSONAL_SUM"/>
<result property="keyGroup" column="keyGroup"/>
</resultMap>
<resultMap id="tPaymentInfoNewExportMap" type="com.yifu.cloud.plus.v1.yifu.social.vo.TPaymentInfoNewExportVo">
<result property="empName" column="EMP_NAME"/>
<result property="empIdcard" column="EMP_IDCARD"/>
<result property="unitName" column="UNIT_NAME"/>
<result property="settleDomainName" column="SETTLE_DOMAIN_NAME"/>
<result property="socialHousehold" column="SOCIAL_HOUSEHOLD"/>
<result property="socialPayAddr" column="SOCIAL_PAY_ADDR"/>
<result property="socialPayMonth" column="SOCIAL_PAY_MONTH"/>
<result property="socialCreateMonth" column="SOCIAL_CREATE_MONTH"/>
<result property="sumAll" column="SUM_ALL"/>
<result property="providentHousehold" column="PROVIDENT_HOUSEHOLD"/>
<result property="providentPayAddr" column="PROVIDENT_PAY_ADDR"/>
<result property="socialSum" column="SOCIAL_SUM"/>
<result property="providentSum" column="PROVIDENT_SUM"/>
<result property="pensionMoneySum" column="PENSION_MONEY_SUM"/>
<result property="medicalMoneySum" column="MEDICAL_MONEY_SUM"/>
<result property="unemploymentMoneySum" column="UNEMPLOYMENT_MONEY_SUM"/>
<result property="unitInjuryMoney" column="UNIT_INJURY_MONEY"/>
<result property="unitBirthMoney" column="UNIT_BIRTH_MONEY"/>
<result property="bigmailmentMoneySum" column="BIGMAILMENT_MONEY_SUM"/>
<result property="accrualSum" column="ACCRUAL_SUM"/>
<result property="keyGroup" column="keyGroup"/>
</resultMap>
<sql id="Base_Column_List">
......@@ -436,9 +465,6 @@
<if test="tPaymentInfo.providentPayAddr != null and tPaymentInfo.providentPayAddr.trim() != ''">
AND a.PROVIDENT_PAY_ADDR = #{tPaymentInfo.providentPayAddr}
</if>
<if test="tPaymentInfo.providentPayAddr != null and tPaymentInfo.providentPayAddr.trim() != ''">
AND a.PROVIDENT_PAY_ADDR = #{tPaymentInfo.providentPayAddr}
</if>
<!-- 区域 默认精准查询 0 包含下级查询 1 开始 2023-03-02 fxj -->
<if test='tPaymentInfo.areaFlag == null || tPaymentInfo.areaFlag == "1"'>
......@@ -732,6 +758,134 @@
</if>
</sql>
<sql id="tPaymentInfo_export_social_where">
<if test="tPaymentInfo != null">
<if test="tPaymentInfo.idList == null">
<if test="tPaymentInfo.empName != null and tPaymentInfo.empName.trim() != ''">
AND a.EMP_NAME like concat('%',#{tPaymentInfo.empName},'%')
</if>
<if test="tPaymentInfo.empIdcard != null and tPaymentInfo.empIdcard.trim() != ''">
AND a.EMP_IDCARD like concat('%',#{tPaymentInfo.empIdcard},'%')
</if>
<if test="tPaymentInfo.settleDomainName != null and tPaymentInfo.settleDomainName.trim() != ''">
AND a.SETTLE_DOMAIN_NAME = #{tPaymentInfo.settleDomainName}
</if>
<if test="tPaymentInfo.unitName != null and tPaymentInfo.unitName.trim() != ''">
AND a.UNIT_NAME = #{tPaymentInfo.unitName}
</if>
<if test="tPaymentInfo.socialHousehold != null and tPaymentInfo.socialHousehold.trim() != ''">
AND a.SOCIAL_HOUSEHOLD = #{tPaymentInfo.socialHousehold}
</if>
<if test="tPaymentInfo.socialPayMonth != null and tPaymentInfo.socialPayMonth.trim() != ''">
AND a.SOCIAL_PAY_MONTH = #{tPaymentInfo.socialPayMonth}
</if>
<if test="tPaymentInfo.socialCreateMonth != null and tPaymentInfo.socialCreateMonth.trim() != ''">
AND a.SOCIAL_CREATE_MONTH = #{tPaymentInfo.socialCreateMonth}
</if>
<!-- 区域 默认精准查询 0 包含下级查询 1 开始 2023-03-02 fxj -->
<if test='tPaymentInfo.areaFlag == null || tPaymentInfo.areaFlag == "1"'>
<if test="tPaymentInfo.socialTown == null">
<if test="tPaymentInfo.socialCity != null">
AND (a.SOCIAL_CITY = '${tPaymentInfo.socialCity}' or a.FUND_CITY = '${tPaymentInfo.socialCity}')
</if>
<if test="tPaymentInfo.socialCity == null">
<if test="tPaymentInfo.socialProvince != null">
AND (a.SOCIAL_PROVINCE = '${tPaymentInfo.socialProvince}' or a.FUND_PROVINCE = '${tPaymentInfo.socialProvince}')
</if>
</if>
</if>
<if test="tPaymentInfo.socialTown != null and tPaymentInfo.socialTown.trim() != ''">
AND (a.SOCIAL_TOWN = '${tPaymentInfo.socialTown}' or a.FUND_TOWN = '${tPaymentInfo.socialTown}')
</if>
</if>
<if test='tPaymentInfo.areaFlag == "0"'>
<if test="tPaymentInfo.socialProvince != null and tPaymentInfo.socialProvince.trim() != '' and tPaymentInfo.socialCity == null">
AND (
(a.SOCIAL_PROVINCE = '${tPaymentInfo.socialProvince}' and (a.SOCIAL_CITY is null or a.SOCIAL_CITY =''))
or
(a.FUND_PROVINCE = '${tPaymentInfo.socialProvince}' and (a.FUND_CITY is null or a.FUND_CITY =''))
)
</if>
<if test="tPaymentInfo.socialCity != null and tPaymentInfo.socialCity.trim() != '' and tPaymentInfo.socialTown == null">
AND (
(a.SOCIAL_CITY = '${tPaymentInfo.socialCity}' and (a.SOCIAL_TOWN is null or a.SOCIAL_TOWN =''))
or
(a.FUND_CITY = '${tPaymentInfo.socialCity}' and (a.FUND_TOWN is null or a.FUND_TOWN =''))
)
</if>
<if test="tPaymentInfo.socialTown != null and tPaymentInfo.socialTown.trim() != ''">
AND (a.SOCIAL_TOWN = '${tPaymentInfo.socialTown}' or a.FUND_TOWN = '${tPaymentInfo.socialTown}')
</if>
</if>
<!-- 区域 默认精准查询 0 包含下级查询 1 结束 2023-03-02 fxj -->
</if>
</if>
</sql>
<sql id="tPaymentInfo_export_fund_where">
<if test="tPaymentInfo != null">
<if test="tPaymentInfo.idList == null">
<if test="tPaymentInfo.empName != null and tPaymentInfo.empName.trim() != ''">
AND a.EMP_NAME like concat('%',#{tPaymentInfo.empName},'%')
</if>
<if test="tPaymentInfo.empIdcard != null and tPaymentInfo.empIdcard.trim() != ''">
AND a.EMP_IDCARD like concat('%',#{tPaymentInfo.empIdcard},'%')
</if>
<if test="tPaymentInfo.settleDomainName != null and tPaymentInfo.settleDomainName.trim() != ''">
AND a.SETTLE_DOMAIN_NAME = #{tPaymentInfo.settleDomainName}
</if>
<if test="tPaymentInfo.unitName != null and tPaymentInfo.unitName.trim() != ''">
AND a.UNIT_NAME = #{tPaymentInfo.unitName}
</if>
<if test="tPaymentInfo.socialPayMonth != null and tPaymentInfo.socialPayMonth.trim() != ''">
AND a.PROVIDENT_PAY_MONTH = #{tPaymentInfo.socialPayMonth}
</if>
<if test="tPaymentInfo.socialCreateMonth != null and tPaymentInfo.socialCreateMonth.trim() != ''">
AND a.PROVIDENT_CREATE_MONTH = #{tPaymentInfo.socialCreateMonth}
</if>
<if test="tPaymentInfo.providentHousehold != null and tPaymentInfo.providentHousehold.trim() != ''">
AND a.PROVIDENT_HOUSEHOLD = #{tPaymentInfo.providentHousehold}
</if>
<!-- 区域 默认精准查询 0 包含下级查询 1 开始 2023-03-02 fxj -->
<if test='tPaymentInfo.areaFlag == null || tPaymentInfo.areaFlag == "1"'>
<if test="tPaymentInfo.socialTown == null">
<if test="tPaymentInfo.socialCity != null">
AND (a.SOCIAL_CITY = '${tPaymentInfo.socialCity}' or a.FUND_CITY = '${tPaymentInfo.socialCity}')
</if>
<if test="tPaymentInfo.socialCity == null">
<if test="tPaymentInfo.socialProvince != null">
AND (a.SOCIAL_PROVINCE = '${tPaymentInfo.socialProvince}' or a.FUND_PROVINCE = '${tPaymentInfo.socialProvince}')
</if>
</if>
</if>
<if test="tPaymentInfo.socialTown != null and tPaymentInfo.socialTown.trim() != ''">
AND (a.SOCIAL_TOWN = '${tPaymentInfo.socialTown}' or a.FUND_TOWN = '${tPaymentInfo.socialTown}')
</if>
</if>
<if test='tPaymentInfo.areaFlag == "0"'>
<if test="tPaymentInfo.socialProvince != null and tPaymentInfo.socialProvince.trim() != '' and tPaymentInfo.socialCity == null">
AND (
(a.SOCIAL_PROVINCE = '${tPaymentInfo.socialProvince}' and (a.SOCIAL_CITY is null or a.SOCIAL_CITY =''))
or
(a.FUND_PROVINCE = '${tPaymentInfo.socialProvince}' and (a.FUND_CITY is null or a.FUND_CITY =''))
)
</if>
<if test="tPaymentInfo.socialCity != null and tPaymentInfo.socialCity.trim() != '' and tPaymentInfo.socialTown == null">
AND (
(a.SOCIAL_CITY = '${tPaymentInfo.socialCity}' and (a.SOCIAL_TOWN is null or a.SOCIAL_TOWN =''))
or
(a.FUND_CITY = '${tPaymentInfo.socialCity}' and (a.FUND_TOWN is null or a.FUND_TOWN =''))
)
</if>
<if test="tPaymentInfo.socialTown != null and tPaymentInfo.socialTown.trim() != ''">
AND (a.SOCIAL_TOWN = '${tPaymentInfo.socialTown}' or a.FUND_TOWN = '${tPaymentInfo.socialTown}')
</if>
</if>
<!-- 区域 默认精准查询 0 包含下级查询 1 结束 2023-03-02 fxj -->
</if>
</if>
</sql>
<sql id="tPaymentInfo_export_push_where">
<if test="tPaymentInfo != null">
<if test="tPaymentInfo.idList != null">
......@@ -953,6 +1107,73 @@
<!--tPaymentInfo简单分页查询-->
<select id="getTPaymentInfoNewPage" resultMap="tPaymentInfoNewMap">
SELECT
w.keyGroup,
w.EMP_IDCARD,
w.EMP_NAME,
w.UNIT_NAME,
w.SETTLE_DOMAIN_NAME,
w.SOCIAL_HOUSEHOLD,
w.SOCIAL_PAY_ADDR,
w.SOCIAL_PAY_MONTH,
w.SOCIAL_CREATE_MONTH,
SUM( w.SUM_ALL ) AS SUM_ALL,
MAX( w.PROVIDENT_HOUSEHOLD ) AS PROVIDENT_HOUSEHOLD,
MAX( w.PROVIDENT_PAY_ADDR ) AS PROVIDENT_PAY_ADDR,
w.SOCIAL_SUM,
SUM( w.PROVIDENT_SUM ) AS PROVIDENT_SUM
FROM (
(SELECT
CONCAT( a.EMP_IDCARD, '_', a.SOCIAL_PAY_MONTH, '_', a.SOCIAL_CREATE_MONTH, '_', a.SETTLE_DOMAIN_CODE ) AS keyGroup,
a.EMP_NAME,
a.EMP_IDCARD,
a.UNIT_NAME,
a.SETTLE_DOMAIN_NAME,
a.SOCIAL_HOUSEHOLD,
a.SOCIAL_PAY_ADDR,
a.SOCIAL_PAY_MONTH,
a.SOCIAL_CREATE_MONTH,
SUM( a.SUM_ALL ) AS SUM_ALL,
a.PROVIDENT_HOUSEHOLD,
a.PROVIDENT_PAY_ADDR,
SUM( a.SOCIAL_SUM ) AS SOCIAL_SUM,
a.PROVIDENT_SUM
FROM t_payment_info a
<where>
IFNULL(a.SOCIAL_ID,'1') != '1'
<include refid="tPaymentInfo_export_social_where"/>
</where>
GROUP BY a.EMP_IDCARD,a.SOCIAL_PAY_MONTH,a.SOCIAL_CREATE_MONTH,a.SETTLE_DOMAIN_CODE
)
union all
(SELECT
CONCAT( a.EMP_IDCARD, '_', a.PROVIDENT_PAY_MONTH, '_', a.PROVIDENT_CREATE_MONTH, '_', a.SETTLE_DOMAIN_CODE ) AS keyGroup,
a.EMP_NAME,
a.EMP_IDCARD,
a.UNIT_NAME,
a.SETTLE_DOMAIN_NAME,
a.SOCIAL_HOUSEHOLD,
a.SOCIAL_PAY_ADDR,
a.PROVIDENT_PAY_MONTH as SOCIAL_PAY_MONTH,
a.PROVIDENT_CREATE_MONTH as SOCIAL_CREATE_MONTH,
SUM( a.SUM_ALL ) AS SUM_ALL,
a.PROVIDENT_HOUSEHOLD,
a.PROVIDENT_PAY_ADDR,
a.SOCIAL_SUM,
SUM( a.PROVIDENT_SUM ) AS PROVIDENT_SUM
FROM t_payment_info a
<where>
IFNULL(a.FUND_ID,'1') != '1'
<include refid="tPaymentInfo_export_fund_where"/>
</where>
GROUP BY a.EMP_IDCARD,a.PROVIDENT_PAY_MONTH,a.PROVIDENT_CREATE_MONTH,a.SETTLE_DOMAIN_CODE
)
) w
GROUP BY w.keyGroup
</select>
<!--tPaymentInfo简单分页查询-->
<select id="getTPaymentInfoNewPageInfo" resultMap="tPaymentInfoNewMap">
SELECT
w.keyGroup,
w.EMP_IDCARD,
......@@ -966,8 +1187,6 @@
w.SOCIAL_CREATE_MONTH,
SUM( w.PERSONAL_PROVIDENT_SUM) AS PERSONAL_PROVIDENT_SUM,
SUM( w.SUM_ALL ) AS SUM_ALL,
MAX( w.PROVIDENT_PAY_MONTH ) AS PROVIDENT_PAY_MONTH,
MAX( w.PROVIDENT_CREATE_MONTH ) AS PROVIDENT_CREATE_MONTH,
MAX( w.PROVIDENT_HOUSEHOLD ) AS PROVIDENT_HOUSEHOLD,
MAX( w.PROVIDENT_PAY_ADDR ) AS PROVIDENT_PAY_ADDR,
w.SOCIAL_SUM,
......@@ -991,10 +1210,17 @@
w.PERSONAL_MEDICAL_MONEY,
w.PERSONAL_UNEMPLOYMENT_MONEY,
w.PERSONAL_BIGMAILMENT_MONEY,
MAX(w.PENSION_MONEY_SUM ) as PENSION_MONEY_SUM,
MAX(w.MEDICAL_MONEY_SUM ) as MEDICAL_MONEY_SUM,
MAX(w.UNEMPLOYMENT_MONEY_SUM ) as UNEMPLOYMENT_MONEY_SUM,
MAX(w.BIGMAILMENT_MONEY_SUM ) as BIGMAILMENT_MONEY_SUM,
MAX(w.ACCRUAL_SUM ) as ACCRUAL_SUM,
MAX( w.PROVIDENT_NO ) AS PROVIDENT_NO,
MAX( w.PERSONAL_PROIDENT_SET ) AS PERSONAL_PROIDENT_SET,
SUM( w.UNIT_PROVIDENT_SET ) AS UNIT_PROVIDENT_SET,
SUM( w.PROVIDENT_PERCENT ) AS PROVIDENT_PERCENT,
ifnull(SUM( w.SOCIAL_SECURITY_PERSONAL_SUM ),0) + ifnull(SUM( w.PERSONAL_PROVIDENT_SUM ),0) AS SOCIAL_FUND_PERSONAL_SUM,
ifnull(SUM( w.UNIT_SOCIAL_SUM ),0) + ifnull(SUM( w.UNIT_PROVIDENT_SUM ),0) AS UNIT_SOCIAL_FUND_SUM,
SUM( w.UNIT_PROVIDENT_SUM ) AS UNIT_PROVIDENT_SUM
FROM (
(SELECT
......@@ -1010,8 +1236,6 @@
a.SOCIAL_CREATE_MONTH,
a.PERSONAL_PROVIDENT_SUM,
SUM( a.SUM_ALL ) AS SUM_ALL,
a.PROVIDENT_PAY_MONTH,
a.PROVIDENT_CREATE_MONTH,
a.PROVIDENT_HOUSEHOLD,
a.PROVIDENT_PAY_ADDR,
SUM( a.SOCIAL_SUM ) AS SOCIAL_SUM,
......@@ -1035,6 +1259,11 @@
SUM( a.PERSONAL_MEDICAL_MONEY ) AS PERSONAL_MEDICAL_MONEY,
SUM( a.PERSONAL_UNEMPLOYMENT_MONEY ) AS PERSONAL_UNEMPLOYMENT_MONEY,
SUM( a.PERSONAL_BIGMAILMENT_MONEY ) AS PERSONAL_BIGMAILMENT_MONEY,
ifnull(SUM(a.UNIT_PENSION_MONEY),0)+ifnull(SUM(a.PERSONAL_PENSION_MONEY),0) as PENSION_MONEY_SUM,
ifnull(SUM(a.UNIT_MEDICAL_MONEY),0)+ifnull(SUM(a.PERSONAL_MEDICAL_MONEY),0) as MEDICAL_MONEY_SUM,
ifnull(SUM(a.UNIT_UNEMPLOYMENT_MONEY),0)+ifnull(SUM(a.PERSONAL_UNEMPLOYMENT_MONEY),0) as UNEMPLOYMENT_MONEY_SUM,
ifnull(SUM(a.UNIT_BIGMAILMENT_MONEY),0)+ifnull(SUM(a.PERSONAL_BIGMAILMENT_MONEY),0) as BIGMAILMENT_MONEY_SUM,
ifnull(SUM(a.COMPANY_ACCRUAL),0)+ifnull(SUM(a.PERSONAL_ACCRUAL),0) as ACCRUAL_SUM,
a.PROVIDENT_NO,
a.UNIT_PROVIDENT_SET,
a.PROVIDENT_PERCENT,
......@@ -1043,7 +1272,7 @@
FROM t_payment_info a
<where>
IFNULL(a.SOCIAL_ID,'1') != '1'
<include refid="tPaymentInfo_export_where"/>
<include refid="tPaymentInfo_export_social_where"/>
</where>
GROUP BY a.EMP_IDCARD,a.SOCIAL_PAY_MONTH,a.SOCIAL_CREATE_MONTH,a.SETTLE_DOMAIN_CODE
)
......@@ -1057,12 +1286,10 @@
a.SOCIAL_HOUSEHOLD,
a.SOCIAL_SECURITY_NO,
a.SOCIAL_PAY_ADDR,
a.SOCIAL_PAY_MONTH,
a.SOCIAL_CREATE_MONTH,
a.PROVIDENT_PAY_MONTH as SOCIAL_PAY_MONTH,
a.PROVIDENT_CREATE_MONTH as SOCIAL_CREATE_MONTH,
SUM(a.PERSONAL_PROVIDENT_SUM) AS PERSONAL_PROVIDENT_SUM,
SUM( a.SUM_ALL ) AS SUM_ALL,
a.PROVIDENT_PAY_MONTH,
a.PROVIDENT_CREATE_MONTH,
a.PROVIDENT_HOUSEHOLD,
a.PROVIDENT_PAY_ADDR,
a.SOCIAL_SUM,
......@@ -1086,6 +1313,11 @@
a.PERSONAL_MEDICAL_MONEY,
a.PERSONAL_UNEMPLOYMENT_MONEY,
a.PERSONAL_BIGMAILMENT_MONEY,
null PENSION_MONEY_SUM,
null MEDICAL_MONEY_SUM,
null UNEMPLOYMENT_MONEY_SUM,
null BIGMAILMENT_MONEY_SUM,
null ACCRUAL_SUM,
a.PROVIDENT_NO,
a.UNIT_PROVIDENT_SET,
a.PROVIDENT_PERCENT,
......@@ -1094,7 +1326,7 @@
FROM t_payment_info a
<where>
IFNULL(a.FUND_ID,'1') != '1'
<include refid="tPaymentInfo_export_where"/>
<include refid="tPaymentInfo_export_fund_where"/>
</where>
GROUP BY a.EMP_IDCARD,a.PROVIDENT_PAY_MONTH,a.PROVIDENT_CREATE_MONTH,a.SETTLE_DOMAIN_CODE
)
......@@ -1102,8 +1334,37 @@
GROUP BY w.keyGroup
</select>
<!--tPaymentInfo数量查询-->
<select id="selectCountPaymentSearchInfo" resultType="java.lang.Integer">
SELECT
count(1)
FROM (
select * from (
(SELECT
CONCAT( a.EMP_IDCARD, '_', a.SOCIAL_PAY_MONTH, '_', a.SOCIAL_CREATE_MONTH, '_', a.SETTLE_DOMAIN_CODE ) AS keyGroup
FROM t_payment_info a
<where>
IFNULL(a.SOCIAL_ID,'1') != '1'
<include refid="tPaymentInfo_export_social_where"/>
</where>
GROUP BY a.EMP_IDCARD,a.SOCIAL_PAY_MONTH,a.SOCIAL_CREATE_MONTH
)
union all
(SELECT
CONCAT( a.EMP_IDCARD, '_', a.SOCIAL_PAY_MONTH, '_', a.SOCIAL_CREATE_MONTH, '_', a.SETTLE_DOMAIN_CODE ) AS keyGroup
FROM t_payment_info a
<where>
IFNULL(a.FUND_ID,'1') != '1'
<include refid="tPaymentInfo_export_fund_where"/>
</where>
GROUP BY a.EMP_IDCARD,a.PROVIDENT_PAY_MONTH,a.PROVIDENT_CREATE_MONTH
)
) w
GROUP BY w.keyGroup) c
</select>
<!--tPaymentInfo简单分页查询-->
<select id="getTPaymentInfoNewPageInfo" resultMap="tPaymentInfoNewMap">
<select id="getTPaymentInfoNewExportInfo" resultMap="tPaymentInfoNewExportMap">
SELECT
w.keyGroup,
w.EMP_IDCARD,
......@@ -1111,146 +1372,84 @@
w.UNIT_NAME,
w.SETTLE_DOMAIN_NAME,
w.SOCIAL_HOUSEHOLD,
MAX( w.SOCIAL_SECURITY_NO ) AS SOCIAL_SECURITY_NO,
w.SOCIAL_PAY_ADDR,
w.SOCIAL_PAY_MONTH,
w.SOCIAL_CREATE_MONTH,
SUM( w.PERSONAL_PROVIDENT_SUM) AS PERSONAL_PROVIDENT_SUM,
SUM( w.SUM_ALL ) AS SUM_ALL,
MAX( w.PROVIDENT_PAY_MONTH ) AS PROVIDENT_PAY_MONTH,
MAX( w.PROVIDENT_CREATE_MONTH ) AS PROVIDENT_CREATE_MONTH,
MAX( w.PROVIDENT_HOUSEHOLD ) AS PROVIDENT_HOUSEHOLD,
MAX( w.PROVIDENT_PAY_ADDR ) AS PROVIDENT_PAY_ADDR,
w.SOCIAL_SUM,
w.UNIT_SOCIAL_SUM,
w.SOCIAL_SECURITY_PERSONAL_SUM,
SUM( w.PROVIDENT_SUM ) AS PROVIDENT_SUM,
w.COMPANY_ACCRUAL,
w.PERSONAL_ACCRUAL,
w.UNIT_PENSION_SET,
w.UNIT_MEDICAL_SET,
w.UNIT_UNEMPLOYMENT_SET,
w.UNIT_INJURY_SET,
w.UNIT_BIRTH_SET,
w.UNIT_PENSION_MONEY,
w.UNIT_MEDICAL_MONEY,
w.UNIT_UNEMPLOYMENT_MONEY,
w.UNIT_INJURY_MONEY,
w.UNIT_BIRTH_MONEY,
w.UNIT_BIGMAILMENT_MONEY,
w.PERSONAL_PENSION_MONEY,
w.PERSONAL_MEDICAL_MONEY,
w.PERSONAL_UNEMPLOYMENT_MONEY,
w.PERSONAL_BIGMAILMENT_MONEY,
MAX( w.PROVIDENT_NO ) AS PROVIDENT_NO,
MAX( w.PERSONAL_PROIDENT_SET ) AS PERSONAL_PROIDENT_SET,
SUM( w.UNIT_PROVIDENT_SET ) AS UNIT_PROVIDENT_SET,
SUM( w.PROVIDENT_PERCENT ) AS PROVIDENT_PERCENT,
SUM( w.UNIT_PROVIDENT_SUM ) AS UNIT_PROVIDENT_SUM
MAX(w.PENSION_MONEY_SUM ) as PENSION_MONEY_SUM,
MAX(w.MEDICAL_MONEY_SUM ) as MEDICAL_MONEY_SUM,
MAX(w.UNEMPLOYMENT_MONEY_SUM ) as UNEMPLOYMENT_MONEY_SUM,
MAX(w.BIGMAILMENT_MONEY_SUM ) as BIGMAILMENT_MONEY_SUM,
MAX(w.ACCRUAL_SUM ) as ACCRUAL_SUM
FROM (
(SELECT
CONCAT( a.EMP_IDCARD, '_', a.SOCIAL_PAY_MONTH, '_', a.SOCIAL_CREATE_MONTH ) AS keyGroup,
CONCAT( a.EMP_IDCARD, '_', a.SOCIAL_PAY_MONTH, '_', a.SOCIAL_CREATE_MONTH, '_', a.SETTLE_DOMAIN_CODE ) AS keyGroup,
a.EMP_NAME,
a.EMP_IDCARD,
a.UNIT_NAME,
a.SETTLE_DOMAIN_NAME,
a.SOCIAL_HOUSEHOLD,
MAX( a.SOCIAL_SECURITY_NO ) AS SOCIAL_SECURITY_NO,
a.SOCIAL_PAY_ADDR,
a.SOCIAL_PAY_MONTH,
a.SOCIAL_CREATE_MONTH,
a.PERSONAL_PROVIDENT_SUM,
SUM( a.SUM_ALL ) AS SUM_ALL,
a.PROVIDENT_PAY_MONTH,
a.PROVIDENT_CREATE_MONTH,
a.PROVIDENT_HOUSEHOLD,
a.PROVIDENT_PAY_ADDR,
SUM( a.SOCIAL_SUM ) AS SOCIAL_SUM,
SUM( a.UNIT_SOCIAL_SUM ) AS UNIT_SOCIAL_SUM,
SUM( a.SOCIAL_SECURITY_PERSONAL_SUM ) AS SOCIAL_SECURITY_PERSONAL_SUM,
a.PROVIDENT_SUM,
SUM( a.COMPANY_ACCRUAL ) AS COMPANY_ACCRUAL,
SUM( a.PERSONAL_ACCRUAL ) AS PERSONAL_ACCRUAL,
MAX(a.UNIT_PENSION_SET ) AS UNIT_PENSION_SET,
MAX(a.UNIT_MEDICAL_SET ) AS UNIT_MEDICAL_SET,
MAX(a.UNIT_UNEMPLOYMENT_SET ) AS UNIT_UNEMPLOYMENT_SET,
MAX(a.UNIT_INJURY_SET ) AS UNIT_INJURY_SET,
MAX(a.UNIT_BIRTH_SET ) AS UNIT_BIRTH_SET,
SUM( a.UNIT_PENSION_MONEY ) AS UNIT_PENSION_MONEY,
SUM( a.UNIT_MEDICAL_MONEY ) AS UNIT_MEDICAL_MONEY,
SUM( a.UNIT_UNEMPLOYMENT_MONEY ) AS UNIT_UNEMPLOYMENT_MONEY,
SUM( a.UNIT_INJURY_MONEY ) AS UNIT_INJURY_MONEY,
SUM( a.UNIT_BIRTH_MONEY ) AS UNIT_BIRTH_MONEY,
SUM( a.UNIT_BIGMAILMENT_MONEY ) AS UNIT_BIGMAILMENT_MONEY,
SUM( a.PERSONAL_PENSION_MONEY ) AS PERSONAL_PENSION_MONEY,
SUM( a.PERSONAL_MEDICAL_MONEY ) AS PERSONAL_MEDICAL_MONEY,
SUM( a.PERSONAL_UNEMPLOYMENT_MONEY ) AS PERSONAL_UNEMPLOYMENT_MONEY,
SUM( a.PERSONAL_BIGMAILMENT_MONEY ) AS PERSONAL_BIGMAILMENT_MONEY,
a.PROVIDENT_NO,
a.UNIT_PROVIDENT_SET,
a.PROVIDENT_PERCENT,
a.PERSONAL_PROIDENT_SET,
a.UNIT_PROVIDENT_SUM
ifnull(SUM(a.UNIT_PENSION_MONEY),0)+ifnull(SUM(a.PERSONAL_PENSION_MONEY),0) as PENSION_MONEY_SUM,
ifnull(SUM(a.UNIT_MEDICAL_MONEY),0)+ifnull(SUM(a.PERSONAL_MEDICAL_MONEY),0) as MEDICAL_MONEY_SUM,
ifnull(SUM(a.UNIT_UNEMPLOYMENT_MONEY),0)+ifnull(SUM(a.PERSONAL_UNEMPLOYMENT_MONEY),0) as UNEMPLOYMENT_MONEY_SUM,
ifnull(SUM(a.UNIT_BIGMAILMENT_MONEY),0)+ifnull(SUM(a.PERSONAL_BIGMAILMENT_MONEY),0) as BIGMAILMENT_MONEY_SUM,
ifnull(SUM(a.COMPANY_ACCRUAL),0)+ifnull(SUM(a.PERSONAL_ACCRUAL),0) as ACCRUAL_SUM
FROM t_payment_info a
<where>
IFNULL(a.SOCIAL_ID,'1') != '1'
<include refid="tPaymentInfo_export_where"/>
<include refid="tPaymentInfo_export_social_where"/>
</where>
GROUP BY a.EMP_IDCARD,a.SOCIAL_PAY_MONTH,a.SOCIAL_CREATE_MONTH,a.SETTLE_DOMAIN_CODE
)
union all
(SELECT
CONCAT( a.EMP_IDCARD, '_', a.PROVIDENT_PAY_MONTH, '_', a.PROVIDENT_CREATE_MONTH ) AS keyGroup,
CONCAT( a.EMP_IDCARD, '_', a.PROVIDENT_PAY_MONTH, '_', a.PROVIDENT_CREATE_MONTH, '_', a.SETTLE_DOMAIN_CODE ) AS keyGroup,
a.EMP_NAME,
a.EMP_IDCARD,
a.UNIT_NAME,
a.SETTLE_DOMAIN_NAME,
a.SOCIAL_HOUSEHOLD,
a.SOCIAL_SECURITY_NO,
a.SOCIAL_PAY_ADDR,
a.SOCIAL_PAY_MONTH,
a.SOCIAL_CREATE_MONTH,
SUM(a.PERSONAL_PROVIDENT_SUM) AS PERSONAL_PROVIDENT_SUM,
a.PROVIDENT_PAY_MONTH as SOCIAL_PAY_MONTH,
a.PROVIDENT_CREATE_MONTH as SOCIAL_CREATE_MONTH,
SUM( a.SUM_ALL ) AS SUM_ALL,
a.PROVIDENT_PAY_MONTH,
a.PROVIDENT_CREATE_MONTH,
a.PROVIDENT_HOUSEHOLD,
a.PROVIDENT_PAY_ADDR,
a.SOCIAL_SUM,
a.UNIT_SOCIAL_SUM,
a.SOCIAL_SECURITY_PERSONAL_SUM,
SUM( a.PROVIDENT_SUM ) AS PROVIDENT_SUM,
a.COMPANY_ACCRUAL,
a.PERSONAL_ACCRUAL,
a.UNIT_PENSION_SET,
a.UNIT_MEDICAL_SET,
a.UNIT_UNEMPLOYMENT_SET,
a.UNIT_INJURY_SET,
a.UNIT_BIRTH_SET,
a.UNIT_PENSION_MONEY,
a.UNIT_MEDICAL_MONEY,
a.UNIT_UNEMPLOYMENT_MONEY,
a.UNIT_INJURY_MONEY,
a.UNIT_BIRTH_MONEY,
a.UNIT_BIGMAILMENT_MONEY,
a.PERSONAL_PENSION_MONEY,
a.PERSONAL_MEDICAL_MONEY,
a.PERSONAL_UNEMPLOYMENT_MONEY,
a.PERSONAL_BIGMAILMENT_MONEY,
a.PROVIDENT_NO,
a.UNIT_PROVIDENT_SET,
a.PROVIDENT_PERCENT,
a.PERSONAL_PROIDENT_SET,
SUM( a.UNIT_PROVIDENT_SUM ) AS UNIT_PROVIDENT_SUM
null PENSION_MONEY_SUM,
null MEDICAL_MONEY_SUM,
null UNEMPLOYMENT_MONEY_SUM,
null BIGMAILMENT_MONEY_SUM,
null ACCRUAL_SUM
FROM t_payment_info a
<where>
IFNULL(a.FUND_ID,'1') != '1'
<include refid="tPaymentInfo_export_where"/>
<include refid="tPaymentInfo_export_fund_where"/>
</where>
GROUP BY a.EMP_IDCARD,a.PROVIDENT_PAY_MONTH,a.PROVIDENT_CREATE_MONTH,a.SETTLE_DOMAIN_CODE
)
) w
GROUP BY w.keyGroup
limit #{tPaymentInfo.limitStart},#{tPaymentInfo.limitEnd}
</select>
<!--tPaymentInfo不分页查询-->
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment