Commit cebd9600 authored by nie'hong's avatar nie'hong

完善工时统计

parent 9c8edbed
...@@ -137,12 +137,18 @@ ...@@ -137,12 +137,18 @@
<select id="selectListStatistics" resultMap="projectStatisticsByMonth"> <select id="selectListStatistics" resultMap="projectStatisticsByMonth">
select ptc.project_id AS project_id, project_name, select ptc.project_id AS project_id, project_name,
group_CONCAT(DISTINCT YEAR (statistics_start),'年',MONTH (statistics_start),'月') AS date,year(statistics_start) AS year, group_CONCAT(DISTINCT YEAR (statistics_start),'年',MONTH (statistics_start),'月') AS date,year(statistics_start) AS year,
sum(total_time) AS total_time, sum(cost) AS cost <if test="projectId != null "> ,d.dept_name AS dept_name</if> sum(total_time) AS total_time, sum(cost) AS cost <if test="projectId != null "> ,d.dept_name AS dept_name</if> <if test="projectIds != null">,d.dept_name AS dept_name,u.name </if>
from work_project_time_cost ptc join work_project p on ptc.project_id = p.id join work_dept d on ptc.dept_id = d.id from work_project_time_cost ptc join work_project p on ptc.project_id = p.id join work_dept d on ptc.dept_id = d.id join work_user u on ptc.user_id = u.id
<where> <where>
<if test="projectId != null "> <if test="projectId != null ">
ptc.project_id = #{projectId} ptc.project_id = #{projectId}
</if> </if>
<if test="projectIds != null">
ptc.project_id in
<foreach collection="projectIds" open="(" close=")" separator="," item="projectId">
#{projectId}
</foreach>
</if>
<if test="deptId != null and managerId == null"> <if test="deptId != null and managerId == null">
AND p.dept_id = #{deptId} AND year(statistics_start) = #{year} AND p.dept_id = #{deptId} AND year(statistics_start) = #{year}
</if> </if>
...@@ -153,7 +159,7 @@ ...@@ -153,7 +159,7 @@
AND p.manager_id = #{managerId} AND year(statistics_start) = #{year} AND p.manager_id = #{managerId} AND year(statistics_start) = #{year}
</if> </if>
</where> </where>
group by ptc.project_id,project_name,year(statistics_start),MONTH(statistics_start) <if test="projectId != null "> ,d.dept_name</if> group by ptc.project_id,project_name,year(statistics_start),MONTH(statistics_start) <if test="projectId != null "> ,d.dept_name</if> <if test="projectIds != null">,d.dept_name AS dept_name,u.name </if>
</select> </select>
......
...@@ -548,7 +548,11 @@ public class StatisticsServiceImpl implements StatisticsService { ...@@ -548,7 +548,11 @@ public class StatisticsServiceImpl implements StatisticsService {
map.put("isAll", false); map.put("isAll", false);
userProjectWorkTimeStatistics = workTimeOrderMapper.getUserProjectWorkTimeStatistics(map); userProjectWorkTimeStatistics = workTimeOrderMapper.getUserProjectWorkTimeStatistics(map);
List<UserWorkTimeStatisticsByProject> userWorkTimeStatisticsByProjects = new ArrayList<>();
userWorkTimeStatisticsByProjects.addAll(userProjectWorkTimeStatistics);
userWorkTimeStatisticsByProjects.get(0).setUserName("总计");
userProjectWorkTimeStatistics.addAll(userWorkTimeStatisticsByProjects);
// 所有项目下所有人员的统计 // 所有项目下所有人员的统计
map.replace("isAll", true); map.replace("isAll", true);
userProjectWorkTimeStatistics1 = workTimeOrderMapper.getUserProjectWorkTimeStatistics(map); userProjectWorkTimeStatistics1 = workTimeOrderMapper.getUserProjectWorkTimeStatistics(map);
...@@ -1044,6 +1048,7 @@ public class StatisticsServiceImpl implements StatisticsService { ...@@ -1044,6 +1048,7 @@ public class StatisticsServiceImpl implements StatisticsService {
map.put("year", year); map.put("year", year);
map.put("projectIds", projectIds); map.put("projectIds", projectIds);
List<ProjectStatisticsByMonth> projectStatisticsByMonths = workProjectTimeCostMapper.selectListByMonth(map); List<ProjectStatisticsByMonth> projectStatisticsByMonths = workProjectTimeCostMapper.selectListByMonth(map);
// workProjectTimeCostMapper.projectStatisticsByMonth();
return null; return null;
} }
......
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