Commit acdf59f2 authored by hongguangwu's avatar hongguangwu

MVP1.6.4-优化导出的count

parent 5b9f4544
......@@ -57,4 +57,7 @@ public interface TSalaryStandardOriginalMapper extends BaseMapper<TSalaryStandar
List<TSalaryOriginalExportVo> getTSalaryOriginalExportVoList(@Param("tSalaryStandardOriginal") TSalaryOriginalSearchVo tSalaryStandardOriginal
, @Param("idsStr") List<String> idsStr);
int exportListCount(@Param("tSalaryStandardOriginal") TSalaryOriginalSearchVo tSalaryStandardOriginal
, @Param("idsStr") List<String> idsStr);
}
......@@ -20,9 +20,7 @@ import com.alibaba.excel.EasyExcelFactory;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.monitorjbl.xlsx.StreamingReader;
......@@ -97,6 +95,11 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
return baseMapper.getTSalaryOriginalExportVoList(searchVo, idList);
}
private int exportListCount(TSalaryOriginalSearchVo searchVo) {
List<String> idList = Common.getList(searchVo.getIds());
return baseMapper.exportListCount(searchVo, idList);
}
/**
* @Description: 分页查询
* @Author: hgw
......@@ -1042,7 +1045,7 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
String fileName = "薪资原表配置导出" + DateUtil.getThisTime() + ".xlsx";
//获取要导出的列表
List<TSalaryOriginalExportVo> list = new ArrayList<>();
long count = noPageCountDiy(searchVo);
long count = exportListCount(searchVo);
ServletOutputStream out = null;
try {
out = response.getOutputStream();
......@@ -1087,21 +1090,4 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
}
}
private Long noPageCountDiy(TSalaryOriginalSearchVo searchVo) {
LambdaQueryWrapper<TSalaryStandardOriginal> wrapper = buildQueryWrapper(searchVo);
List<String> idList = Common.getList(searchVo.getIds());
if (Common.isNotNull(idList)) {
wrapper.in(TSalaryStandardOriginal::getId, idList);
}
return baseMapper.selectCount(wrapper);
}
private LambdaQueryWrapper buildQueryWrapper(TSalaryOriginalSearchVo entity) {
LambdaQueryWrapper<TSalaryOriginalSearchVo> wrapper = Wrappers.lambdaQuery(entity);
if (Common.isNotNull(entity.getCreateName())) {
wrapper.like(TSalaryOriginalSearchVo::getCreateName, entity.getCreateName());
}
return wrapper;
}
}
......@@ -123,6 +123,22 @@
ORDER BY a.CREATE_TIME desc
</select>
<select id="exportListCount" resultType="java.lang.Integer">
SELECT
count(1)
FROM
t_salary_standard_original a
<where> a.DELETE_FLAG = 0
<if test="idsStr != null and idsStr.size > 0">
AND a.ID in
<foreach item="items" index="index" collection="idsStr" open="(" separator="," close=")">
#{items}
</foreach>
</if>
<include refid="TSalaryStandardOriginal_where"/>
</where>
</select>
<select id="getTSalaryOriginalExportVoList" resultMap="TSalaryOriginalExportMap">
SELECT
a.DEPT_NO,a.DEPT_NAME,a.SET_NAME,a.CREATE_NAME,a.CREATE_TIME
......
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