Commit 80169f81 authored by nie'hong's avatar nie'hong

优化导出

parent ec039315
...@@ -86,7 +86,7 @@ ...@@ -86,7 +86,7 @@
where id = #{userId} where id = #{userId}
</select> </select>
<select id="getStatisticsTableDtos" resultType="cn.wisenergy.model.dto.StatisticsTableDto"> <select id="getStatisticsTableDtos" resultType="cn.wisenergy.model.dto.StatisticsTableDto">
select u.id AS user_id, u.name AS dept_name, d.dept_name select u.id AS user_id, u.name AS user_name, d.dept_name
from work_user u join work_dept d on u.dept_id=d.id from work_user u join work_dept d on u.dept_id=d.id
where u.id in where u.id in
<foreach collection="list" open="(" close=")" separator="," item="id"> <foreach collection="list" open="(" close=")" separator="," item="id">
......
...@@ -104,15 +104,16 @@ public class StatisticsServiceImpl implements StatisticsService { ...@@ -104,15 +104,16 @@ public class StatisticsServiceImpl implements StatisticsService {
PageHelper.startPage(param.getCurrentPage(), param.getSize()); PageHelper.startPage(param.getCurrentPage(), param.getSize());
List<Integer> userIds = workUserDeptMapper.listByDeptId(deptId); List<Integer> userIds = workUserDeptMapper.listByDeptId(deptId);
PageInfo pageInfo = new PageInfo(userIds); PageInfo pageInfo = new PageInfo(userIds);
// 获取员工一个月中已审核、自动审核的工单单日汇总汇总 // 获取用户姓名、部门名称
List<StatisticsTableDto> statisticsTableDtos = workUserMapper.getStatisticsTableDtos(userIds); List<StatisticsTableDto> statisticsTableDtos = workUserMapper.getStatisticsTableDtos(userIds);
// 获取当月每天工时信息 // 获取用户当月每天工时信息
List<DayWorkTimeAndType> dayWorkTimeAndTypes = workTimeOrderMapper.listByDateAndUserId(year, month, userIds); List<DayWorkTimeAndType> dayWorkTimeAndTypes = workTimeOrderMapper.listByDateAndUserId(year, month, userIds);
// 将工单集合与对应用户信息封装在一起 // 将工单集合与对应用户信息封装在一起
Iterator<StatisticsTableDto> statisticsTableDtoIterator = statisticsTableDtos.iterator(); Iterator<StatisticsTableDto> statisticsTableDtoIterator = statisticsTableDtos.iterator();
while (statisticsTableDtoIterator.hasNext()) { while (statisticsTableDtoIterator.hasNext()) {
StatisticsTableDto statisticsTableDto = statisticsTableDtoIterator.next(); StatisticsTableDto statisticsTableDto = statisticsTableDtoIterator.next();
// 存放一位用户一个月中每天的工时信息
ArrayList<DayWorkTimeAndType> dayWorkTimeAndTypes1 = new ArrayList<>(); ArrayList<DayWorkTimeAndType> dayWorkTimeAndTypes1 = new ArrayList<>();
// 查询出的工时信息遍历 // 查询出的工时信息遍历
Iterator<DayWorkTimeAndType> workTimeAndTypeIterator = dayWorkTimeAndTypes.iterator(); Iterator<DayWorkTimeAndType> workTimeAndTypeIterator = dayWorkTimeAndTypes.iterator();
...@@ -123,7 +124,7 @@ public class StatisticsServiceImpl implements StatisticsService { ...@@ -123,7 +124,7 @@ public class StatisticsServiceImpl implements StatisticsService {
} }
} }
statisticsTableDto.setDayWorkTimeAndTypeList(dayWorkTimeAndTypes1); statisticsTableDto.setDayWorkTimeAndTypeList(dayWorkTimeAndTypes1);
statisticsTableDtos.add(statisticsTableDto);
} }
pageInfo.setList(statisticsTableDtos); pageInfo.setList(statisticsTableDtos);
return pageInfo; return pageInfo;
......
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