Commit b2bc8963 authored by fangxinjiang's avatar fangxinjiang

社保花名册导出增加离职日期-fxj

parent 622305be
...@@ -15,6 +15,7 @@ package com.yifu.cloud.plus.v1.yifu.social.controller;/* ...@@ -15,6 +15,7 @@ package com.yifu.cloud.plus.v1.yifu.social.controller;/*
* Author: lengleng (wangiegie@gmail.com) * Author: lengleng (wangiegie@gmail.com)
*/ */
import cn.hutool.core.date.LocalDateTimeUtil;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
...@@ -52,6 +53,8 @@ import org.springframework.web.bind.annotation.*; ...@@ -52,6 +53,8 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.text.ParseException;
import java.time.LocalDateTime;
import java.util.List; import java.util.List;
...@@ -307,7 +310,7 @@ public class TPaymentInfoController { ...@@ -307,7 +310,7 @@ public class TPaymentInfoController {
* @author huyc * @author huyc
* @date 2022-07-22 * @date 2022-07-22
**/ **/
@SysLog("实缴导列表不合并导出") @SysLog("实缴导列表不合并导出")
@Operation(description = "导出缴费库 hasPermission('social_tpaymentinfo_export')") @Operation(description = "导出缴费库 hasPermission('social_tpaymentinfo_export')")
@PostMapping("/export") @PostMapping("/export")
@PreAuthorize("@pms.hasPermission('social_tpaymentinfo_export')") @PreAuthorize("@pms.hasPermission('social_tpaymentinfo_export')")
...@@ -315,6 +318,20 @@ public class TPaymentInfoController { ...@@ -315,6 +318,20 @@ public class TPaymentInfoController {
tPaymentInfoService.listExport(response, searchVo); tPaymentInfoService.listExport(response, searchVo);
} }
/**
* @Author fxj
* @Description 实缴导入列表导出不合并数据校验,生成月份为空时 数据量超出2W 前端提示
* @Date 14:57 2024/8/5
* @Param
* @return
**/
@SysLog("实缴导出列表不合并导出--检测")
@Operation(description = "导出缴费库检测 ")
@PostMapping("/exportCheck")
public R<Integer> exportCheck(HttpServletResponse response, @RequestBody TPaymentInfoSearchVo searchVo) {
return tPaymentInfoService.listExportCheck(response, searchVo);
}
/** /**
* 缴费库合并导出 * 缴费库合并导出
* *
...@@ -329,6 +346,20 @@ public class TPaymentInfoController { ...@@ -329,6 +346,20 @@ public class TPaymentInfoController {
tPaymentInfoService.listSumExport(response, searchVo); tPaymentInfoService.listSumExport(response, searchVo);
} }
/**
* @Author fxj
* @Description 缴费库合并导出 检车 生成月份为空 数据条数超出2W条后 前端给提示
* @Date 15:09 2024/8/5
* @Param
* @return
**/
@SysLog("缴费库合并导出检测")
@Operation(description = "合并导出缴费库检测")
@PostMapping("/sumExportCheck")
public R<Integer> sumExportCheck(HttpServletResponse response, @RequestBody TPaymentInfoSearchVo searchVo) {
return tPaymentInfoService.listSumExportCheck(response, searchVo);
}
/** /**
* 缴费库查询合并导出 * 缴费库查询合并导出
* *
...@@ -353,6 +384,30 @@ public class TPaymentInfoController { ...@@ -353,6 +384,30 @@ public class TPaymentInfoController {
tPaymentInfoService.sumSearchExport(response, searchVo); tPaymentInfoService.sumSearchExport(response, searchVo);
} }
/**
* @Author fxj
* @Description 缴费库查询合并导出 校验, 生成月份为空时 导出条数超出2W 前端给提示
* @Date 15:13 2024/8/5
* @Param
* @return
**/
@Operation(description = "缴费库查询合并导出检测")
@PostMapping("/sumSearchExportCheck")
@SysLog("实缴查询列表合并导出检测")
public R<Integer> sumSearchExportCheck(HttpServletResponse response, @RequestBody TPaymentInfoSearchVo searchVo) {
YifuUser user = SecurityUtils.getUser();
menuUtil.setAuthSql(user, searchVo);
if (Common.isNotNull(searchVo.getAuthSql())) {
if (searchVo.getAuthSql().contains(CommonConstants.A_DEPT_ID)) {
searchVo.setAuthSql(searchVo.getAuthSql().replace(CommonConstants.A_DEPT_ID, "a.SETTLE_DOMAIN_ID"));
}
if (searchVo.getAuthSql().contains("1=2 EXISTS")) {
searchVo.setAuthSql(searchVo.getAuthSql().replace("1=2 EXISTS", "EXISTS"));
}
}
return tPaymentInfoService.sumSearchExportCheck(response, searchVo);
}
/** /**
* 根据条件批量删除 * 根据条件批量删除
* *
......
...@@ -53,6 +53,20 @@ public interface TPaymentInfoMapper extends BaseMapper<TPaymentInfo> { ...@@ -53,6 +53,20 @@ public interface TPaymentInfoMapper extends BaseMapper<TPaymentInfo> {
*/ */
IPage<TPaymentInfoNewVo> getTPaymentInfoNewPage(Page<TPaymentInfo> page, @Param("tPaymentInfo") TPaymentInfoSearchVo tPaymentInfo); IPage<TPaymentInfoNewVo> getTPaymentInfoNewPage(Page<TPaymentInfo> page, @Param("tPaymentInfo") TPaymentInfoSearchVo tPaymentInfo);
/**
* 缴费库分页查询
* @param tPaymentInfo 缴费库
* @return
*/
List<TPaymentInfoNewVo> getTPaymentInfoNewPageDiy(@Param("tPaymentInfo") TPaymentInfoSearchVo tPaymentInfo,@Param("page") Long page, @Param("size") Long size);
/**
* 缴费库分页查询
* @param tPaymentInfo 缴费库
* @return
*/
List<TPaymentInfoNewVo> getTPaymentInfoNewPageSocial(@Param("tPaymentInfo") TPaymentInfoSearchVo tPaymentInfo,@Param("page") Long page, @Param("size") Long size);
/** /**
* 缴费库查询详情 * 缴费库查询详情
* @param tPaymentInfo * @param tPaymentInfo
...@@ -74,6 +88,27 @@ public interface TPaymentInfoMapper extends BaseMapper<TPaymentInfo> { ...@@ -74,6 +88,27 @@ public interface TPaymentInfoMapper extends BaseMapper<TPaymentInfo> {
*/ */
Integer selectCountPaymentSearchInfo(@Param("tPaymentInfo") TPaymentInfoSearchVo searchVo); Integer selectCountPaymentSearchInfo(@Param("tPaymentInfo") TPaymentInfoSearchVo searchVo);
/**
* 缴费库简单分页查询
* @param searchVo 缴费库
* @return
*/
Integer selectCountPaymentSearchInfoSocial(@Param("tPaymentInfo") TPaymentInfoSearchVo searchVo);
/**
* 缴费库简单分页查询
* @param searchVo 缴费库
* @return
*/
Integer selectCountPaymentSearchInfoSocialByLimit(@Param("tPaymentInfo") TPaymentInfoSearchVo searchVo);
/**
* 缴费库简单分页查询
* @param searchVo 缴费库
* @return
*/
Integer selectCountPaymentSearchInfoFund(@Param("tPaymentInfo") TPaymentInfoSearchVo searchVo);
/** /**
* 缴费库简单分页查询 * 缴费库简单分页查询
* @param searchVo 缴费库 * @param searchVo 缴费库
...@@ -364,4 +399,16 @@ public interface TPaymentInfoMapper extends BaseMapper<TPaymentInfo> { ...@@ -364,4 +399,16 @@ public interface TPaymentInfoMapper extends BaseMapper<TPaymentInfo> {
IPage<SocialAndFundReduceBusinessVo> getSocialAndFundReduceInfo(Page page, @Param("month")String month IPage<SocialAndFundReduceBusinessVo> getSocialAndFundReduceInfo(Page page, @Param("month")String month
, @Param("settleDomainId")String settleDomainId, @Param("settleDomainIds")List<String> settleDomainIds); , @Param("settleDomainId")String settleDomainId, @Param("settleDomainIds")List<String> settleDomainIds);
/**
* 实缴查询社保合计查询
* @return
*/
List<TPaymentInfoExportVo> getSumByKeyGroupSocial(@Param("keyGroups") List<String> keyGroups);
/**
* 实缴查询公积金合计查询
* @return
*/
List<TPaymentInfoExportVo> getSumByKeyGroupFund(@Param("keyGroups") List<String> keyGroups);
} }
...@@ -258,6 +258,10 @@ public interface TPaymentInfoService extends IService<TPaymentInfo> { ...@@ -258,6 +258,10 @@ public interface TPaymentInfoService extends IService<TPaymentInfo> {
* @return * @return
**/ **/
IPage<SocialAndFundReduceBusinessVo> getSocialAndFundReduceInfo(Page<SocialAndFundReduceBusinessVo> page, String month, String settleDomainId, List<String> settleDomainIds); IPage<SocialAndFundReduceBusinessVo> getSocialAndFundReduceInfo(Page<SocialAndFundReduceBusinessVo> page, String month, String settleDomainId, List<String> settleDomainIds);
// hgw2023-1-6 10:42:06:以上:B端相关接口
R<Integer> listExportCheck(HttpServletResponse response, TPaymentInfoSearchVo searchVo);
R<Integer> listSumExportCheck(HttpServletResponse response, TPaymentInfoSearchVo searchVo);
R<Integer> sumSearchExportCheck(HttpServletResponse response, TPaymentInfoSearchVo searchVo);
} }
...@@ -180,9 +180,97 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -180,9 +180,97 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
*/ */
@Override @Override
public IPage<TPaymentInfoNewVo> getTPaymentInfoNewPage(Page<TPaymentInfo> page, TPaymentInfoSearchVo tPaymentInfo) { public IPage<TPaymentInfoNewVo> getTPaymentInfoNewPage(Page<TPaymentInfo> page, TPaymentInfoSearchVo tPaymentInfo) {
return baseMapper.getTPaymentInfoNewPage(page, tPaymentInfo); Page<TPaymentInfoNewVo> pageNew = new Page<>();
pageNew.setSize(page.getSize());
pageNew.setCurrent(page.getCurrent());
long totalCount = baseMapper.selectCountPaymentSearchInfoSocial(tPaymentInfo);
pageNew.setTotal(totalCount);
if (totalCount > 0L) {
pageNew.setPages(totalCount / pageNew.getSize());
}
if (pageNew.getCurrent() < 1) {
pageNew.setCurrent(1L);
}
if (pageNew.getSize() < 1) {
pageNew.setSize(10L);
}
if (totalCount > ((page.getCurrent() - 1) * page.getSize())) {
pageNew.setRecords(getPageData(tPaymentInfo,pageNew,totalCount));
}
return pageNew;
} }
private List<TPaymentInfoNewVo> getPageData(TPaymentInfoSearchVo searchVo,Page<TPaymentInfoNewVo> pageNew ,long totalCount){
List<TPaymentInfoNewVo> pageData;//baseMapper.getTPaymentInfoNewPageDiy(tPaymentInfo, (pageNew.getCurrent() - 1) * pageNew.getSize(), pageNew.getSize());
// 非大批量数据统计查询时走原逻辑
if (totalCount < 20000){
return baseMapper.getTPaymentInfoNewPageDiy(searchVo, (pageNew.getCurrent() - 1) * pageNew.getSize(), pageNew.getSize());
}
// 社保户、生成月、缴纳月、缴纳地、二级指标归属、单位、公积金户 走优化查询 先查询数据在封装合计金额
if ((Common.isNotNull(searchVo.getSocialHousehold())
|| Common.isNotNull(searchVo.getSocialCreateMonth())
|| Common.isNotNull(searchVo.getSocialPayMonth())
|| Common.isNotNull(searchVo.getSocialProvince())
|| Common.isNotNull(searchVo.getSecondIndicatorBelong())
|| Common.isNotNull(searchVo.getUnitName())
|| Common.isNotNull(searchVo.getProvidentHousehold()))
&& Common.isEmpty(searchVo.getEmpIdcard())
&& Common.isEmpty(searchVo.getSettleDomainName())){
pageData = baseMapper.getTPaymentInfoNewPageSocial(searchVo, (pageNew.getCurrent() - 1) * pageNew.getSize(), pageNew.getSize());
//封装对应的社保及公积金的合计数据处理
if (Common.isNotNull(pageData)){
List<String> keyGroup = new ArrayList<>();
HashMap<String,TPaymentInfoNewVo> newVoHashMap = new HashMap<>();
String key;
for (TPaymentInfoNewVo vo:pageData){
key = vo.getEmpIdcard() + CommonConstants.DOWN_LINE_STRING
+ vo.getSocialPayMonth()+ CommonConstants.DOWN_LINE_STRING
+ vo.getSocialCreateMonth();
keyGroup.add(key);
newVoHashMap.put(key,vo);
}
List<TPaymentInfoExportVo> pageDataSumSocial = baseMapper.getSumByKeyGroupSocial(keyGroup);
List<TPaymentInfoNewVo> pageDataHandle = new ArrayList<>();
if (Common.isNotNull(pageDataSumSocial)){
TPaymentInfoNewVo newVo;
for (TPaymentInfoExportVo exportVo:pageDataSumSocial){
newVo = newVoHashMap.get(exportVo.getKeyGroup());
if (null != newVo){
newVo.setSumAll(BigDecimalUtils.safeAdd(BigDecimalUtils.isNullToZero(newVo.getSumAll()),BigDecimalUtils.isNullToZero(exportVo.getSocialSum())));
newVo.setSocialSum(exportVo.getSocialSum());
newVo.setSocialPayAddr(exportVo.getSocialPayAddr());
newVo.setSocialHousehold(exportVo.getSocialHousehold());
}
newVoHashMap.put(exportVo.getKeyGroup(),newVo);
}
}
List<TPaymentInfoExportVo> pageDataSumFund = baseMapper.getSumByKeyGroupFund(keyGroup);
if (Common.isNotNull(pageDataSumFund)){
TPaymentInfoNewVo newVo;
for (TPaymentInfoExportVo exportVo:pageDataSumFund){
newVo = newVoHashMap.get(exportVo.getKeyGroup());
if (null != newVo){
newVo.setSumAll(BigDecimalUtils.safeAdd(BigDecimalUtils.isNullToZero(newVo.getSumAll()),BigDecimalUtils.isNullToZero(exportVo.getProvidentSum())));
newVo.setProvidentSum(exportVo.getProvidentSum());
newVo.setProvidentHousehold(exportVo.getProvidentHousehold());
newVo.setProvidentPayAddr(exportVo.getProvidentPayAddr());
}
newVoHashMap.put(exportVo.getKeyGroup(),newVo);
}
}
if (Common.isNotNull(newVoHashMap)){
for (TPaymentInfoNewVo k:newVoHashMap.values()){
pageDataHandle.add(k);
}
return pageDataHandle;
}
}
// 身份证查询 项目查询直接走原查询逻辑,因为此处数据量不会很大
}else {
pageData = baseMapper.getTPaymentInfoNewPageDiy(searchVo, (pageNew.getCurrent() - 1) * pageNew.getSize(), pageNew.getSize());
}
return pageData;
}
/** /**
* 缴费库批量导出 * 缴费库批量导出
* *
...@@ -5067,4 +5155,69 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -5067,4 +5155,69 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
} }
} }
/**
* @Author fxj
* @Description 实缴导入列表导出不合并数据校验,生成月份为空时 数据量超出2W 前端提示
* @Date 14:57 2024/8/5
* @Param
* @return
**/
@Override
public R<Integer> listExportCheck(HttpServletResponse response, TPaymentInfoSearchVo searchVo) {
return R.ok(baseMapper.selectCountTPaymentInfo(searchVo));
}
/**
* @Author fxj
* @Description 缴费库合并导出 检车 生成月份为空 数据条数超出2W条后 前端给提示
* @Date 15:09 2024/8/5
* @Param
* @return
**/
@Override
public R<Integer> listSumExportCheck(HttpServletResponse response, TPaymentInfoSearchVo searchVo){
if (Common.isEmpty(searchVo.getEmpIdcard())
&& Common.isEmpty(searchVo.getUnitName())
&& Common.isEmpty(searchVo.getSettleDomainName())
&& Common.isEmpty(searchVo.getSocialCreateMonth())
&& Common.isEmpty(searchVo.getSocialPayMonth())
&& Common.isEmpty(searchVo.getSocialProvince())
&& Common.isEmpty(searchVo.getSecondIndicatorBelong())){
// 只有社保户
if (Common.isNotNull(searchVo.getSocialHousehold())){
return R.ok(baseMapper.selectCountPaymentSearchInfoSocial(searchVo));
}
//只有公积金户
if (Common.isNotNull(searchVo.getProvidentHousehold())){
return R.ok(baseMapper.selectCountPaymentSearchInfoFund(searchVo));
}
}
return R.ok(baseMapper.selectCountSumPaymentInfo(searchVo));
}
/**
* @Author fxj
* @Description 缴费库查询合并导出 校验, 生成月份为空时 导出条数超出2W 前端给提示
* @Date 15:13 2024/8/5
* @Param
* @return
**/
@Override
public R<Integer> sumSearchExportCheck(HttpServletResponse response, TPaymentInfoSearchVo searchVo){
if (Common.isEmpty(searchVo.getEmpIdcard())
&& Common.isEmpty(searchVo.getUnitName())
&& Common.isEmpty(searchVo.getSettleDomainName())
&& Common.isEmpty(searchVo.getSocialCreateMonth())
&& Common.isEmpty(searchVo.getSocialPayMonth())
&& Common.isEmpty(searchVo.getSocialProvince())
&& Common.isEmpty(searchVo.getSecondIndicatorBelong())){
// 只有社保户
if (Common.isNotNull(searchVo.getSocialHousehold())){
return R.ok(baseMapper.selectCountPaymentSearchInfoSocialByLimit(searchVo));
}
//只有公积金户
if (Common.isNotNull(searchVo.getProvidentHousehold())){
return R.ok(baseMapper.selectCountPaymentSearchInfoSocialByLimit(searchVo));
}
}
return R.ok(baseMapper.selectCountPaymentSearchInfo(searchVo));
}
} }
...@@ -26,7 +26,7 @@ mybatis-plus: ...@@ -26,7 +26,7 @@ mybatis-plus:
logic-not-delete-value: 0 logic-not-delete-value: 0
configuration: configuration:
map-underscore-to-camel-case: true map-underscore-to-camel-case: true
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
# spring security 配置 # spring security 配置
security: security:
......
...@@ -458,7 +458,7 @@ ...@@ -458,7 +458,7 @@
AND a.ID = #{tPaymentInfo.id} AND a.ID = #{tPaymentInfo.id}
</if> </if>
<if test="tPaymentInfo.empName != null and tPaymentInfo.empName.trim() != ''"> <if test="tPaymentInfo.empName != null and tPaymentInfo.empName.trim() != ''">
AND a.EMP_NAME like concat('%',#{tPaymentInfo.empName},'%') AND a.EMP_NAME like concat('',#{tPaymentInfo.empName},'')
</if> </if>
<if test="tPaymentInfo.empNo != null and tPaymentInfo.empNo.trim() != ''"> <if test="tPaymentInfo.empNo != null and tPaymentInfo.empNo.trim() != ''">
AND a.EMP_NO like CONCAT(#{tPaymentInfo.empNo},'%') AND a.EMP_NO like CONCAT(#{tPaymentInfo.empNo},'%')
...@@ -467,7 +467,7 @@ ...@@ -467,7 +467,7 @@
AND a.EMP_ID = #{tPaymentInfo.empId} AND a.EMP_ID = #{tPaymentInfo.empId}
</if> </if>
<if test="tPaymentInfo.empIdcard != null and tPaymentInfo.empIdcard.trim() != ''"> <if test="tPaymentInfo.empIdcard != null and tPaymentInfo.empIdcard.trim() != ''">
AND a.EMP_IDCARD like concat('%',#{tPaymentInfo.empIdcard},'%') AND a.EMP_IDCARD like concat('',#{tPaymentInfo.empIdcard},'')
</if> </if>
<if test="tPaymentInfo.unitId != null and tPaymentInfo.unitId.trim() != ''"> <if test="tPaymentInfo.unitId != null and tPaymentInfo.unitId.trim() != ''">
AND a.UNIT_ID = #{tPaymentInfo.unitId} AND a.UNIT_ID = #{tPaymentInfo.unitId}
...@@ -706,13 +706,13 @@ ...@@ -706,13 +706,13 @@
AND a.ID = #{tPaymentInfo.id} AND a.ID = #{tPaymentInfo.id}
</if> </if>
<if test="tPaymentInfo.empName != null and tPaymentInfo.empName.trim() != ''"> <if test="tPaymentInfo.empName != null and tPaymentInfo.empName.trim() != ''">
AND a.EMP_NAME like concat('%',#{tPaymentInfo.empName},'%') AND a.EMP_NAME like concat('',#{tPaymentInfo.empName},'')
</if> </if>
<if test="tPaymentInfo.empNo != null and tPaymentInfo.empNo.trim() != ''"> <if test="tPaymentInfo.empNo != null and tPaymentInfo.empNo.trim() != ''">
AND a.EMP_NO like CONCAT(#{tPaymentInfo.empNo},'%') AND a.EMP_NO like CONCAT(#{tPaymentInfo.empNo},'%')
</if> </if>
<if test="tPaymentInfo.empIdcard != null and tPaymentInfo.empIdcard.trim() != ''"> <if test="tPaymentInfo.empIdcard != null and tPaymentInfo.empIdcard.trim() != ''">
AND a.EMP_IDCARD like concat('%',#{tPaymentInfo.empIdcard},'%') AND a.EMP_IDCARD like concat('',#{tPaymentInfo.empIdcard},'')
</if> </if>
<if test="tPaymentInfo.settleDomainName != null and tPaymentInfo.settleDomainName.trim() != ''"> <if test="tPaymentInfo.settleDomainName != null and tPaymentInfo.settleDomainName.trim() != ''">
AND a.SETTLE_DOMAIN_NAME = #{tPaymentInfo.settleDomainName} AND a.SETTLE_DOMAIN_NAME = #{tPaymentInfo.settleDomainName}
...@@ -808,15 +808,92 @@ ...@@ -808,15 +808,92 @@
</if> </if>
</if> </if>
</sql> </sql>
<sql id="tPaymentInfo_export_count_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.secondIndicatorBelong != null and tPaymentInfo.secondIndicatorBelong.trim() != ''">
AND a.SECOND_INDICATOR_BELONG = #{tPaymentInfo.secondIndicatorBelong}
</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.providentHousehold != null and tPaymentInfo.providentHousehold.trim() != ''">
AND a.PROVIDENT_HOUSEHOLD = #{tPaymentInfo.providentHousehold}
</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>-->
<if test="tPaymentInfo.socialPayMonth != null and tPaymentInfo.socialPayMonth.trim() != ''">
AND (a.SOCIAL_PAY_MONTH = '${tPaymentInfo.socialPayMonth}' or a.PROVIDENT_PAY_MONTH = '${tPaymentInfo.socialPayMonth}')
</if>
<if test="tPaymentInfo.socialCreateMonth != null and tPaymentInfo.socialCreateMonth.trim() != ''">
AND (a.SOCIAL_CREATE_MONTH = '${tPaymentInfo.socialCreateMonth}' or a.PROVIDENT_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>
<if test="tPaymentInfo.authSql != null and tPaymentInfo.authSql.trim() != ''">
${tPaymentInfo.authSql}
</if>
<!-- 区域 默认精准查询 0 包含下级查询 1 结束 2023-03-02 fxj -->
</if>
</if>
</sql>
<sql id="tPaymentInfo_export_social_where"> <sql id="tPaymentInfo_export_social_where">
<if test="tPaymentInfo != null"> <if test="tPaymentInfo != null">
<if test="tPaymentInfo.idList == null"> <if test="tPaymentInfo.idList == null">
<if test="tPaymentInfo.empName != null and tPaymentInfo.empName.trim() != ''"> <if test="tPaymentInfo.empName != null and tPaymentInfo.empName.trim() != ''">
AND a.EMP_NAME like concat('%',#{tPaymentInfo.empName},'%') AND a.EMP_NAME like concat('',#{tPaymentInfo.empName},'%')
</if> </if>
<if test="tPaymentInfo.empIdcard != null and tPaymentInfo.empIdcard.trim() != ''"> <if test="tPaymentInfo.empIdcard != null and tPaymentInfo.empIdcard.trim() != ''">
AND a.EMP_IDCARD like concat('%',#{tPaymentInfo.empIdcard},'%') AND a.EMP_IDCARD like concat('%',#{tPaymentInfo.empIdcard},'')
</if> </if>
<if test="tPaymentInfo.settleDomainName != null and tPaymentInfo.settleDomainName.trim() != ''"> <if test="tPaymentInfo.settleDomainName != null and tPaymentInfo.settleDomainName.trim() != ''">
AND a.SETTLE_DOMAIN_NAME = #{tPaymentInfo.settleDomainName} AND a.SETTLE_DOMAIN_NAME = #{tPaymentInfo.settleDomainName}
...@@ -867,6 +944,81 @@ ...@@ -867,6 +944,81 @@
</if> </if>
</if> </if>
</sql> </sql>
<sql id="tPaymentInfo_export_social_where_diy">
<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.providentHousehold != null and tPaymentInfo.providentHousehold.trim() != ''">
AND a.PROVIDENT_HOUSEHOLD = #{tPaymentInfo.providentHousehold}
</if>
<if test="tPaymentInfo.secondIndicatorBelong != null and tPaymentInfo.secondIndicatorBelong.trim() != ''">
AND a.SECOND_INDICATOR_BELONG = #{tPaymentInfo.secondIndicatorBelong}
</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>-->
<if test="tPaymentInfo.socialPayMonth != null and tPaymentInfo.socialPayMonth.trim() != ''">
AND (a.SOCIAL_PAY_MONTH = '${tPaymentInfo.socialPayMonth}' or a.PROVIDENT_PAY_MONTH = '${tPaymentInfo.socialPayMonth}')
</if>
<if test="tPaymentInfo.socialCreateMonth != null and tPaymentInfo.socialCreateMonth.trim() != ''">
AND (a.SOCIAL_CREATE_MONTH = '${tPaymentInfo.socialCreateMonth}' or a.PROVIDENT_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_socialFund_where2"> <sql id="tPaymentInfo_export_socialFund_where2">
<if test="tPaymentInfo != null"> <if test="tPaymentInfo != null">
...@@ -910,10 +1062,10 @@ ...@@ -910,10 +1062,10 @@
<if test="tPaymentInfo != null"> <if test="tPaymentInfo != null">
<if test="tPaymentInfo.idList == null"> <if test="tPaymentInfo.idList == null">
<if test="tPaymentInfo.empName != null and tPaymentInfo.empName.trim() != ''"> <if test="tPaymentInfo.empName != null and tPaymentInfo.empName.trim() != ''">
AND a.EMP_NAME like concat('%',#{tPaymentInfo.empName},'%') AND a.EMP_NAME like concat('',#{tPaymentInfo.empName},'')
</if> </if>
<if test="tPaymentInfo.empIdcard != null and tPaymentInfo.empIdcard.trim() != ''"> <if test="tPaymentInfo.empIdcard != null and tPaymentInfo.empIdcard.trim() != ''">
AND a.EMP_IDCARD like concat('%',#{tPaymentInfo.empIdcard},'%') AND a.EMP_IDCARD like concat('',#{tPaymentInfo.empIdcard},'')
</if> </if>
<if test="tPaymentInfo.settleDomainName != null and tPaymentInfo.settleDomainName.trim() != ''"> <if test="tPaymentInfo.settleDomainName != null and tPaymentInfo.settleDomainName.trim() != ''">
AND a.SETTLE_DOMAIN_NAME = #{tPaymentInfo.settleDomainName} AND a.SETTLE_DOMAIN_NAME = #{tPaymentInfo.settleDomainName}
...@@ -978,13 +1130,13 @@ ...@@ -978,13 +1130,13 @@
AND a.ID = #{tPaymentInfo.id} AND a.ID = #{tPaymentInfo.id}
</if> </if>
<if test="tPaymentInfo.empName != null and tPaymentInfo.empName.trim() != ''"> <if test="tPaymentInfo.empName != null and tPaymentInfo.empName.trim() != ''">
AND a.EMP_NAME like concat('%',#{tPaymentInfo.empName},'%') AND a.EMP_NAME like concat('',#{tPaymentInfo.empName},'')
</if> </if>
<if test="tPaymentInfo.empNo != null and tPaymentInfo.empNo.trim() != ''"> <if test="tPaymentInfo.empNo != null and tPaymentInfo.empNo.trim() != ''">
AND a.EMP_NO like CONCAT(#{tPaymentInfo.empNo},'%') AND a.EMP_NO like CONCAT(#{tPaymentInfo.empNo},'%')
</if> </if>
<if test="tPaymentInfo.empIdcard != null and tPaymentInfo.empIdcard.trim() != ''"> <if test="tPaymentInfo.empIdcard != null and tPaymentInfo.empIdcard.trim() != ''">
AND a.EMP_IDCARD like concat('%',#{tPaymentInfo.empIdcard},'%') AND a.EMP_IDCARD like concat('',#{tPaymentInfo.empIdcard},'')
</if> </if>
<if test="tPaymentInfo.settleDomainName != null and tPaymentInfo.settleDomainName.trim() != ''"> <if test="tPaymentInfo.settleDomainName != null and tPaymentInfo.settleDomainName.trim() != ''">
AND a.SETTLE_DOMAIN_NAME = #{tPaymentInfo.settleDomainName} AND a.SETTLE_DOMAIN_NAME = #{tPaymentInfo.settleDomainName}
...@@ -1221,7 +1373,7 @@ ...@@ -1221,7 +1373,7 @@
SUM( w.PROVIDENT_SUM ) AS PROVIDENT_SUM SUM( w.PROVIDENT_SUM ) AS PROVIDENT_SUM
FROM ( FROM (
(SELECT (SELECT
CONCAT( a.EMP_IDCARD, '_', a.SOCIAL_PAY_MONTH, '_', a.SOCIAL_CREATE_MONTH, '_', a.SETTLE_DOMAIN_CODE ) AS keyGroup, CONCAT( a.EMP_IDCARD, '_', a.SOCIAL_PAY_MONTH, '_', a.SOCIAL_CREATE_MONTH) AS keyGroup,
a.EMP_NAME, a.EMP_NAME,
a.EMP_IDCARD, a.EMP_IDCARD,
a.UNIT_NAME, a.UNIT_NAME,
...@@ -1241,11 +1393,11 @@ ...@@ -1241,11 +1393,11 @@
IFNULL(a.SOCIAL_ID,'1') != '1' IFNULL(a.SOCIAL_ID,'1') != '1'
<include refid="tPaymentInfo_export_social_where"/> <include refid="tPaymentInfo_export_social_where"/>
</where> </where>
GROUP BY a.EMP_IDCARD,a.SOCIAL_PAY_MONTH,a.SOCIAL_CREATE_MONTH,a.SETTLE_DOMAIN_CODE GROUP BY a.EMP_IDCARD,a.SOCIAL_PAY_MONTH,a.SOCIAL_CREATE_MONTH
) )
union all union all
(SELECT (SELECT
CONCAT( a.EMP_IDCARD, '_', a.PROVIDENT_PAY_MONTH, '_', a.PROVIDENT_CREATE_MONTH, '_', a.SETTLE_DOMAIN_CODE ) AS keyGroup, CONCAT( a.EMP_IDCARD, '_', a.PROVIDENT_PAY_MONTH, '_', a.PROVIDENT_CREATE_MONTH) AS keyGroup,
a.EMP_NAME, a.EMP_NAME,
a.EMP_IDCARD, a.EMP_IDCARD,
a.UNIT_NAME, a.UNIT_NAME,
...@@ -1265,7 +1417,7 @@ ...@@ -1265,7 +1417,7 @@
IFNULL(a.FUND_ID,'1') != '1' IFNULL(a.FUND_ID,'1') != '1'
<include refid="tPaymentInfo_export_fund_where"/> <include refid="tPaymentInfo_export_fund_where"/>
</where> </where>
GROUP BY a.EMP_IDCARD,a.PROVIDENT_PAY_MONTH,a.PROVIDENT_CREATE_MONTH,a.SETTLE_DOMAIN_CODE GROUP BY a.EMP_IDCARD,a.PROVIDENT_PAY_MONTH,a.PROVIDENT_CREATE_MONTH
) )
) w ) w
GROUP BY w.keyGroup ) c GROUP BY w.keyGroup ) c
...@@ -1273,8 +1425,189 @@ ...@@ -1273,8 +1425,189 @@
1 = 1 1 = 1
<include refid="tPaymentInfo_export_socialFund_where2"/> <include refid="tPaymentInfo_export_socialFund_where2"/>
</where> </where>
</select>
<!--tPaymentInfo简单分页查询 fxj 2024-08-08 调整-->
<select id="getTPaymentInfoNewPageDiy" resultMap="tPaymentInfoNewMap">
SELECT
c.keyGroup,
c.EMP_IDCARD,
c.EMP_NAME,
c.UNIT_NAME,
c.SETTLE_DOMAIN_NAME,
c.SECOND_INDICATOR_BELONG,
c.SOCIAL_HOUSEHOLD,
c.SOCIAL_PAY_ADDR,
c.SOCIAL_PAY_MONTH,
c.SOCIAL_CREATE_MONTH,
c.SUM_ALL AS SUM_ALL,
c.PROVIDENT_HOUSEHOLD AS PROVIDENT_HOUSEHOLD,
c.PROVIDENT_PAY_ADDR AS PROVIDENT_PAY_ADDR,
c.SOCIAL_SUM,
c.PROVIDENT_SUM AS PROVIDENT_SUM
from (
select
w.keyGroup,
w.EMP_IDCARD,
w.EMP_NAME,
w.UNIT_NAME,
w.SETTLE_DOMAIN_NAME,
w.SECOND_INDICATOR_BELONG,
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) AS keyGroup,
a.EMP_NAME,
a.EMP_IDCARD,
a.UNIT_NAME,
a.SETTLE_DOMAIN_NAME,
a.SECOND_INDICATOR_BELONG,
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
)
union all
(SELECT
CONCAT( a.EMP_IDCARD, '_', a.PROVIDENT_PAY_MONTH, '_', a.PROVIDENT_CREATE_MONTH) AS keyGroup,
a.EMP_NAME,
a.EMP_IDCARD,
a.UNIT_NAME,
a.SETTLE_DOMAIN_NAME,
a.SECOND_INDICATOR_BELONG,
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
)
) w
GROUP BY w.keyGroup ) c
<where>
1 = 1
<include refid="tPaymentInfo_export_socialFund_where2"/>
</where>
<if test="null != page and null != size">
limit #{page},#{size}
</if>
</select> </select>
<!--tPaymentInfo简单分页查询 fxj 2024-08-08 调整-->
<select id="getTPaymentInfoNewPageSocial" resultMap="tPaymentInfoNewMap">
SELECT
c.keyGroup,
c.EMP_IDCARD,
c.EMP_NAME,
c.UNIT_NAME,
c.SETTLE_DOMAIN_NAME,
c.SETTLE_DOMAIN_CODE,
c.SECOND_INDICATOR_BELONG,
c.SOCIAL_HOUSEHOLD,
c.SOCIAL_PAY_ADDR,
c.SOCIAL_PAY_MONTH,
c.SOCIAL_CREATE_MONTH,
c.PROVIDENT_HOUSEHOLD AS PROVIDENT_HOUSEHOLD,
c.PROVIDENT_PAY_ADDR AS PROVIDENT_PAY_ADDR,
c.SOCIAL_SUM,
c.PROVIDENT_SUM AS PROVIDENT_SUM
from (SELECT
<!--<if test="tPaymentInfo.providentHousehold != null and tPaymentInfo.providentHousehold.trim() != '' and tPaymentInfo.socialHousehold == null">
CONCAT( a.EMP_IDCARD, '_', a.PROVIDENT_PAY_MONTH, '_', a.PROVIDENT_CREATE_MONTH) AS keyGroup,
a.PROVIDENT_PAY_MONTH as SOCIAL_PAY_MONTH,
a.PROVIDENT_CREATE_MONTH as SOCIAL_CREATE_MONTH,
</if>
<if test="tPaymentInfo.socialHousehold != null and tPaymentInfo.socialHousehold.trim() != ''">
CONCAT( a.EMP_IDCARD, '_', a.SOCIAL_PAY_MONTH, '_', a.SOCIAL_CREATE_MONTH) AS keyGroup,
a.SOCIAL_PAY_MONTH,
a.SOCIAL_CREATE_MONTH,
</if>-->
<choose>
<when test="tPaymentInfo.providentHousehold != null and tPaymentInfo.providentHousehold.trim() != '' and tPaymentInfo.socialHousehold == null">
CONCAT( a.EMP_IDCARD, '_', a.PROVIDENT_PAY_MONTH, '_', a.PROVIDENT_CREATE_MONTH) AS keyGroup,
a.PROVIDENT_PAY_MONTH as SOCIAL_PAY_MONTH,
a.PROVIDENT_CREATE_MONTH as SOCIAL_CREATE_MONTH,
</when>
<when test="tPaymentInfo.socialHousehold != null and tPaymentInfo.socialHousehold.trim() != ''">
CONCAT( a.EMP_IDCARD, '_', a.SOCIAL_PAY_MONTH, '_', a.SOCIAL_CREATE_MONTH) AS keyGroup,
a.SOCIAL_PAY_MONTH,
a.SOCIAL_CREATE_MONTH,
</when>
<otherwise>
CONCAT( a.EMP_IDCARD, '_', a.SOCIAL_PAY_MONTH, '_', a.SOCIAL_CREATE_MONTH) AS keyGroup,
a.SOCIAL_PAY_MONTH,
a.SOCIAL_CREATE_MONTH,
</otherwise>
</choose>
a.EMP_NAME,
a.EMP_IDCARD,
a.UNIT_NAME,
a.SETTLE_DOMAIN_NAME,
a.SETTLE_DOMAIN_CODE,
a.SECOND_INDICATOR_BELONG,
a.SOCIAL_HOUSEHOLD,
a.SOCIAL_PAY_ADDR,
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>
<include refid="tPaymentInfo_export_social_where_diy"/>
</where>
<!--<if test="tPaymentInfo.providentHousehold != null and tPaymentInfo.providentHousehold.trim() != '' and tPaymentInfo.socialHousehold == null">
GROUP BY a.EMP_IDCARD,a.PROVIDENT_PAY_MONTH,a.PROVIDENT_CREATE_MONTH
</if>
<if test="tPaymentInfo.socialHousehold != null and tPaymentInfo.socialHousehold.trim() != ''">
GROUP BY a.EMP_IDCARD,a.SOCIAL_PAY_MONTH,a.SOCIAL_CREATE_MONTH
</if>-->
<choose>
<when test="tPaymentInfo.providentHousehold != null and tPaymentInfo.providentHousehold.trim() != '' and tPaymentInfo.socialHousehold == null">
GROUP BY a.EMP_IDCARD,a.PROVIDENT_PAY_MONTH,a.PROVIDENT_CREATE_MONTH
</when>
<when test="tPaymentInfo.socialHousehold != null and tPaymentInfo.socialHousehold.trim() != ''">
GROUP BY a.EMP_IDCARD,a.SOCIAL_PAY_MONTH,a.SOCIAL_CREATE_MONTH
</when>
<otherwise>
GROUP BY a.EMP_IDCARD,a.SOCIAL_PAY_MONTH,a.SOCIAL_CREATE_MONTH
</otherwise>
</choose>
) c
<if test="null != page and null != size">
limit #{page},#{size}
</if>
</select>
<!--tPaymentInfo简单分页查询--> <!--tPaymentInfo简单分页查询-->
<select id="getTPaymentInfoNewPageInfo" resultMap="tPaymentInfoNewMap"> <select id="getTPaymentInfoNewPageInfo" resultMap="tPaymentInfoNewMap">
SELECT SELECT
...@@ -1393,7 +1726,7 @@ ...@@ -1393,7 +1726,7 @@
MAX(w.PERSONAL_UNEMPLOYMENT_PER) as PERSONAL_UNEMPLOYMENT_PER MAX(w.PERSONAL_UNEMPLOYMENT_PER) as PERSONAL_UNEMPLOYMENT_PER
FROM ( FROM (
(SELECT (SELECT
CONCAT( a.EMP_IDCARD, '_', a.SOCIAL_PAY_MONTH, '_', a.SOCIAL_CREATE_MONTH, '_', a.SETTLE_DOMAIN_CODE ) AS keyGroup, CONCAT( a.EMP_IDCARD, '_', a.SOCIAL_PAY_MONTH, '_', a.SOCIAL_CREATE_MONTH) AS keyGroup,
a.EMP_NAME, a.EMP_NAME,
a.EMP_IDCARD, a.EMP_IDCARD,
a.UNIT_NAME, a.UNIT_NAME,
...@@ -1452,11 +1785,11 @@ ...@@ -1452,11 +1785,11 @@
IFNULL(a.SOCIAL_ID,'1') != '1' IFNULL(a.SOCIAL_ID,'1') != '1'
<include refid="tPaymentInfo_export_social_where"/> <include refid="tPaymentInfo_export_social_where"/>
</where> </where>
GROUP BY a.EMP_IDCARD,a.SOCIAL_PAY_MONTH,a.SOCIAL_CREATE_MONTH,a.SETTLE_DOMAIN_CODE GROUP BY a.EMP_IDCARD,a.SOCIAL_PAY_MONTH,a.SOCIAL_CREATE_MONTH
) )
union all union all
(SELECT (SELECT
CONCAT( a.EMP_IDCARD, '_', a.PROVIDENT_PAY_MONTH, '_', a.PROVIDENT_CREATE_MONTH, '_', a.SETTLE_DOMAIN_CODE ) AS keyGroup, CONCAT( a.EMP_IDCARD, '_', a.PROVIDENT_PAY_MONTH, '_', a.PROVIDENT_CREATE_MONTH) AS keyGroup,
a.EMP_NAME, a.EMP_NAME,
a.EMP_IDCARD, a.EMP_IDCARD,
a.UNIT_NAME, a.UNIT_NAME,
...@@ -1515,7 +1848,7 @@ ...@@ -1515,7 +1848,7 @@
IFNULL(a.FUND_ID,'1') != '1' IFNULL(a.FUND_ID,'1') != '1'
<include refid="tPaymentInfo_export_fund_where"/> <include refid="tPaymentInfo_export_fund_where"/>
</where> </where>
GROUP BY a.EMP_IDCARD,a.PROVIDENT_PAY_MONTH,a.PROVIDENT_CREATE_MONTH,a.SETTLE_DOMAIN_CODE GROUP BY a.EMP_IDCARD,a.PROVIDENT_PAY_MONTH,a.PROVIDENT_CREATE_MONTH
) )
) w ) w
GROUP BY w.keyGroup) k GROUP BY w.keyGroup) k
...@@ -1532,7 +1865,7 @@ ...@@ -1532,7 +1865,7 @@
FROM ( FROM (
select w.SOCIAL_HOUSEHOLD,w.PROVIDENT_HOUSEHOLD,w.SECOND_INDICATOR_BELONG from ( select w.SOCIAL_HOUSEHOLD,w.PROVIDENT_HOUSEHOLD,w.SECOND_INDICATOR_BELONG from (
(SELECT (SELECT
CONCAT( a.EMP_IDCARD, '_', a.SOCIAL_PAY_MONTH, '_', a.SOCIAL_CREATE_MONTH, '_', a.SETTLE_DOMAIN_CODE ) AS keyGroup, CONCAT( a.EMP_IDCARD, '_', a.SOCIAL_PAY_MONTH, '_', a.SOCIAL_CREATE_MONTH) AS keyGroup,
a.SOCIAL_HOUSEHOLD, a.SOCIAL_HOUSEHOLD,
a.PROVIDENT_HOUSEHOLD, a.PROVIDENT_HOUSEHOLD,
a.SECOND_INDICATOR_BELONG a.SECOND_INDICATOR_BELONG
...@@ -1541,11 +1874,11 @@ ...@@ -1541,11 +1874,11 @@
IFNULL(a.SOCIAL_ID,'1') != '1' IFNULL(a.SOCIAL_ID,'1') != '1'
<include refid="tPaymentInfo_export_social_where"/> <include refid="tPaymentInfo_export_social_where"/>
</where> </where>
GROUP BY a.EMP_IDCARD,a.SOCIAL_PAY_MONTH,a.SOCIAL_CREATE_MONTH,a.SETTLE_DOMAIN_CODE GROUP BY a.EMP_IDCARD,a.SOCIAL_PAY_MONTH,a.SOCIAL_CREATE_MONTH
) )
union all union all
(SELECT (SELECT
CONCAT( a.EMP_IDCARD, '_', a.PROVIDENT_PAY_MONTH, '_', a.PROVIDENT_CREATE_MONTH, '_', a.SETTLE_DOMAIN_CODE ) AS keyGroup, CONCAT( a.EMP_IDCARD, '_', a.PROVIDENT_PAY_MONTH, '_', a.PROVIDENT_CREATE_MONTH) AS keyGroup,
a.SOCIAL_HOUSEHOLD, a.SOCIAL_HOUSEHOLD,
a.PROVIDENT_HOUSEHOLD, a.PROVIDENT_HOUSEHOLD,
a.SECOND_INDICATOR_BELONG a.SECOND_INDICATOR_BELONG
...@@ -1554,7 +1887,13 @@ ...@@ -1554,7 +1887,13 @@
IFNULL(a.FUND_ID,'1') != '1' IFNULL(a.FUND_ID,'1') != '1'
<include refid="tPaymentInfo_export_fund_where"/> <include refid="tPaymentInfo_export_fund_where"/>
</where> </where>
GROUP BY a.EMP_IDCARD,a.PROVIDENT_PAY_MONTH,a.PROVIDENT_CREATE_MONTH,a.SETTLE_DOMAIN_CODE GROUP BY a.EMP_IDCARD,a.PROVIDENT_PAY_MONTH,a.PROVIDENT_CREATE_MONTH
<!-- 导出查询条数接口 fxj 2024-08-06 -->
<if test="tPaymentInfo != null">
<if test="tPaymentInfo.limitEnd != null and tPaymentInfo.limitEnd > 0">
limit 0,#{tPaymentInfo.limitEnd}
</if>
</if>
) )
) w ) w
GROUP BY w.keyGroup) c GROUP BY w.keyGroup) c
...@@ -1691,7 +2030,7 @@ ...@@ -1691,7 +2030,7 @@
SUM( w.UNIT_PROVIDENT_SUM ) AS UNIT_PROVIDENT_SUM SUM( w.UNIT_PROVIDENT_SUM ) AS UNIT_PROVIDENT_SUM
FROM ( FROM (
(SELECT (SELECT
CONCAT( a.EMP_IDCARD, '_', a.SOCIAL_PAY_MONTH, '_', a.SOCIAL_CREATE_MONTH, '_', a.SETTLE_DOMAIN_CODE ) AS keyGroup, CONCAT( a.EMP_IDCARD, '_', a.SOCIAL_PAY_MONTH, '_', a.SOCIAL_CREATE_MONTH) AS keyGroup,
a.EMP_NAME, a.EMP_NAME,
a.EMP_NO, a.EMP_NO,
a.EMP_IDCARD, a.EMP_IDCARD,
...@@ -1756,11 +2095,11 @@ ...@@ -1756,11 +2095,11 @@
IFNULL(a.SOCIAL_ID,'1') != '1' IFNULL(a.SOCIAL_ID,'1') != '1'
<include refid="tPaymentInfo_export_social_where"/> <include refid="tPaymentInfo_export_social_where"/>
</where> </where>
GROUP BY a.EMP_IDCARD,a.SOCIAL_PAY_MONTH,a.SOCIAL_CREATE_MONTH,a.SETTLE_DOMAIN_CODE GROUP BY a.EMP_IDCARD,a.SOCIAL_PAY_MONTH,a.SOCIAL_CREATE_MONTH
) )
union all union all
(SELECT (SELECT
CONCAT( a.EMP_IDCARD, '_', a.PROVIDENT_PAY_MONTH, '_', a.PROVIDENT_CREATE_MONTH, '_', a.SETTLE_DOMAIN_CODE ) AS keyGroup, CONCAT( a.EMP_IDCARD, '_', a.PROVIDENT_PAY_MONTH, '_', a.PROVIDENT_CREATE_MONTH) AS keyGroup,
a.EMP_NAME, a.EMP_NAME,
a.EMP_NO, a.EMP_NO,
a.EMP_IDCARD, a.EMP_IDCARD,
...@@ -1825,7 +2164,7 @@ ...@@ -1825,7 +2164,7 @@
IFNULL(a.FUND_ID,'1') != '1' IFNULL(a.FUND_ID,'1') != '1'
<include refid="tPaymentInfo_export_fund_where"/> <include refid="tPaymentInfo_export_fund_where"/>
</where> </where>
GROUP BY a.EMP_IDCARD,a.PROVIDENT_PAY_MONTH,a.PROVIDENT_CREATE_MONTH,a.SETTLE_DOMAIN_CODE GROUP BY a.EMP_IDCARD,a.PROVIDENT_PAY_MONTH,a.PROVIDENT_CREATE_MONTH
) )
) w ) w
GROUP BY w.keyGroup) c GROUP BY w.keyGroup) c
...@@ -1975,7 +2314,7 @@ ...@@ -1975,7 +2314,7 @@
SUM( w.UNIT_PROVIDENT_SUM ) AS UNIT_PROVIDENT_SUM SUM( w.UNIT_PROVIDENT_SUM ) AS UNIT_PROVIDENT_SUM
FROM ( FROM (
(SELECT (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) AS keyGroup,
a.EMP_NAME, a.EMP_NAME,
a.EMP_NO, a.EMP_NO,
a.EMP_IDCARD, a.EMP_IDCARD,
...@@ -2101,13 +2440,19 @@ ...@@ -2101,13 +2440,19 @@
FROM ( FROM (
select * from ( select * from (
(SELECT (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) AS keyGroup
FROM t_payment_info a FROM t_payment_info a
<where> <where>
IFNULL(a.SOCIAL_ID,'1') != '1' IFNULL(a.SOCIAL_ID,'1') != '1'
<include refid="tPaymentInfo_export_where"/> <include refid="tPaymentInfo_export_where"/>
</where> </where>
GROUP BY a.EMP_IDCARD,a.SOCIAL_PAY_MONTH,a.SOCIAL_CREATE_MONTH GROUP BY a.EMP_IDCARD,a.SOCIAL_PAY_MONTH,a.SOCIAL_CREATE_MONTH
<!-- 导出查询条数接口 fxj 2024-08-06 -->
<if test="tPaymentInfo != null">
<if test="tPaymentInfo.limitEnd != null and tPaymentInfo.limitEnd > 0">
limit 0,#{tPaymentInfo.limitEnd}
</if>
</if>
) )
union all union all
(SELECT (SELECT
...@@ -2118,6 +2463,12 @@ ...@@ -2118,6 +2463,12 @@
<include refid="tPaymentInfo_export_where"/> <include refid="tPaymentInfo_export_where"/>
</where> </where>
GROUP BY a.EMP_IDCARD,a.PROVIDENT_PAY_MONTH,a.PROVIDENT_CREATE_MONTH GROUP BY a.EMP_IDCARD,a.PROVIDENT_PAY_MONTH,a.PROVIDENT_CREATE_MONTH
<!-- 导出查询条数接口 fxj 2024-08-06 -->
<if test="tPaymentInfo != null">
<if test="tPaymentInfo.limitEnd != null and tPaymentInfo.limitEnd > 0">
limit 0,#{tPaymentInfo.limitEnd}
</if>
</if>
) )
) w ) w
GROUP BY w.keyGroup) c GROUP BY w.keyGroup) c
...@@ -2550,7 +2901,7 @@ ...@@ -2550,7 +2901,7 @@
ID = #{id} ID = #{id}
</update> </update>
<select id="getTPaymentSocialPushCount" resultType="java.lang.Long"> <!--<select id="getTPaymentSocialPushCount" resultType="java.lang.Long">
SELECT SELECT
count(1) count(1)
FROM t_payment_info a FROM t_payment_info a
...@@ -2558,7 +2909,7 @@ ...@@ -2558,7 +2909,7 @@
a.PUSH_STATUS = '1' AND a.SOCIAL_ID IS NOT NULL AND a.CREATE_BY = #{userId} a.PUSH_STATUS = '1' AND a.SOCIAL_ID IS NOT NULL AND a.CREATE_BY = #{userId}
<include refid="tPaymentInfo_export_where"/> <include refid="tPaymentInfo_export_where"/>
</where> </where>
</select> </select>-->
<!--tPaymentInfo公积金推送查询--> <!--tPaymentInfo公积金推送查询-->
<select id="getTPaymentFundPushCount" resultType="java.lang.Long"> <select id="getTPaymentFundPushCount" resultType="java.lang.Long">
...@@ -3201,5 +3552,138 @@ ...@@ -3201,5 +3552,138 @@
</where> </where>
) z GROUP BY z.EMP_ID ) z GROUP BY z.EMP_ID
</select> </select>
<select id="selectCountPaymentSearchInfoSocial" resultType="java.lang.Integer">
SELECT
count(1)
FROM (
select
1
from (
(SELECT
<!--<if test="tPaymentInfo.providentHousehold != null and tPaymentInfo.providentHousehold.trim() != '' and tPaymentInfo.socialHousehold == null">
distinct a.EMP_IDCARD,a.PROVIDENT_PAY_MONTH,a.PROVIDENT_CREATE_MONTH,a.SETTLE_DOMAIN_CODE
</if>
<if test="tPaymentInfo.socialHousehold != null and tPaymentInfo.socialHousehold.trim() != ''">
distinct a.EMP_IDCARD,a.SOCIAL_PAY_MONTH,a.SOCIAL_CREATE_MONTH,a.SETTLE_DOMAIN_CODE
</if>-->
<choose>
<when test="tPaymentInfo.providentHousehold != null and tPaymentInfo.providentHousehold.trim() != '' and tPaymentInfo.socialHousehold == null">
distinct a.EMP_IDCARD,IFNULL(a.PROVIDENT_PAY_MONTH,a.SOCIAL_PAY_MONTH),IFNULL(a.PROVIDENT_CREATE_MONTH,a.SOCIAL_CREATE_MONTH)
</when>
<when test="tPaymentInfo.socialHousehold != null and tPaymentInfo.socialHousehold.trim() != ''">
distinct a.EMP_IDCARD,IFNULL(a.SOCIAL_PAY_MONTH,a.PROVIDENT_PAY_MONTH),IFNULL(a.SOCIAL_CREATE_MONTH,a.PROVIDENT_CREATE_MONTH)
</when>
<otherwise>
distinct a.EMP_IDCARD,IFNULL(a.SOCIAL_PAY_MONTH,a.PROVIDENT_PAY_MONTH),IFNULL(a.SOCIAL_CREATE_MONTH,a.PROVIDENT_CREATE_MONTH)
</otherwise>
</choose>
FROM t_payment_info a
<where>
<include refid="tPaymentInfo_export_count_where"/>
</where>
)
) w ) c
</select>
<select id="selectCountPaymentSearchInfoSocialByLimit" resultType="java.lang.Integer">
SELECT
count(1)
FROM (
select
1
from (
(SELECT
<!--<if test="tPaymentInfo.providentHousehold != null and tPaymentInfo.providentHousehold.trim() != '' and tPaymentInfo.socialHousehold == null">
distinct a.EMP_IDCARD,a.PROVIDENT_PAY_MONTH,a.PROVIDENT_CREATE_MONTH
</if>
<if test="tPaymentInfo.socialHousehold != null and tPaymentInfo.socialHousehold.trim() != ''">
distinct a.EMP_IDCARD,a.SOCIAL_PAY_MONTH,a.SOCIAL_CREATE_MONTH
</if>-->
<choose>
<when test="tPaymentInfo.providentHousehold != null and tPaymentInfo.providentHousehold.trim() != '' and tPaymentInfo.socialHousehold == null">
distinct a.EMP_IDCARD,a.PROVIDENT_PAY_MONTH,a.PROVIDENT_CREATE_MONTH
</when>
<when test="tPaymentInfo.socialHousehold != null and tPaymentInfo.socialHousehold.trim() != ''">
distinct a.EMP_IDCARD,a.SOCIAL_PAY_MONTH,a.SOCIAL_CREATE_MONTH
</when>
<otherwise>
1
</otherwise>
</choose>
FROM t_payment_info a
<where>
<include refid="tPaymentInfo_export_count_where"/>
</where>
limit 20001
)
) w ) c
</select>
<select id="selectCountPaymentSearchInfoFund" resultType="java.lang.Integer">
SELECT
count(1)
FROM (
select
1
from (
(SELECT
distinct a.EMP_IDCARD,a.PROVIDENT_PAY_MONTH,a.PROVIDENT_CREATE_MONTH
FROM t_payment_info a
<where>
IFNULL(a.FUND_ID,'1') != '1'
<include refid="tPaymentInfo_export_fund_where"/>
</where>
)
) w ) c
</select>
<!--tPaymentInfo合并查询 通过keygroup获取对应数据-->
<select id="getSumByKeyGroupSocial" resultMap="tPaymentInfoSumMap">
SELECT
CONCAT( a.EMP_IDCARD, '_', a.SOCIAL_PAY_MONTH, '_', a.SOCIAL_CREATE_MONTH) AS keyGroup,
SUM( IFNULL(a.SUM_ALL,0) ) AS SUM_ALL,
SUM( IFNULL(a.SOCIAL_SUM,0) ) AS SOCIAL_SUM,
0 AS PROVIDENT_SUM,
a.SOCIAL_HOUSEHOLD,
a.SOCIAL_PAY_ADDR,
null PROVIDENT_HOUSEHOLD,
null PROVIDENT_PAY_ADDR
FROM t_payment_info a
<where>
<if test="keyGroups != null and keyGroups.size() > 0">
CONCAT( a.EMP_IDCARD, '_', a.SOCIAL_PAY_MONTH, '_', a.SOCIAL_CREATE_MONTH ) in
<foreach collection="keyGroups" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="keyGroups == null or keyGroups.size() == 0">
1=2
</if>
</where>
GROUP BY a.EMP_IDCARD,a.SOCIAL_PAY_MONTH,a.SOCIAL_CREATE_MONTH
</select>
<!--tPaymentInfo合并查询 通过keygroup获取对应数据-->
<select id="getSumByKeyGroupFund" resultMap="tPaymentInfoSumMap">
SELECT
CONCAT( a.EMP_IDCARD, '_', a.PROVIDENT_PAY_MONTH, '_', a.PROVIDENT_CREATE_MONTH) AS keyGroup,
SUM( IFNULL(a.SUM_ALL,0) ) AS SUM_ALL,
SUM( IFNULL(a.PROVIDENT_SUM,0) ) AS PROVIDENT_SUM,
0 AS SOCIAL_SUM,
null SOCIAL_HOUSEHOLD,
null SOCIAL_PAY_ADDR,
a.PROVIDENT_HOUSEHOLD,
a.PROVIDENT_PAY_ADDR
FROM t_payment_info a
<where>
<if test="keyGroups != null and keyGroups.size() > 0">
CONCAT( a.EMP_IDCARD, '_', a.PROVIDENT_PAY_MONTH, '_', a.PROVIDENT_CREATE_MONTH ) in
<foreach collection="keyGroups" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="keyGroups == null or keyGroups.size() == 0">
1=2
</if>
</where>
GROUP BY a.EMP_IDCARD,a.PROVIDENT_PAY_MONTH,a.PROVIDENT_CREATE_MONTH
</select>
</mapper> </mapper>
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