Commit 64a7fab0 authored by nie'hong's avatar nie'hong

完善工时统计

parent 913831b8
...@@ -313,7 +313,7 @@ ...@@ -313,7 +313,7 @@
<select id="getUserProjectWorkTimeStatistics" resultMap="userWorkTimeStatisticsByProject"> <select id="getUserProjectWorkTimeStatistics" resultMap="userWorkTimeStatisticsByProject">
SELECT <if test="isAll"> u.id AS user_id, u.`name` AS user_name,</if> <if test="!isAll">'合计' AS user_name ,</if> t.project_id AS project_id, t.type AS project_type, p.project_name AS project_name, SELECT <if test="isAll"> u.id AS user_id, u.`name` AS user_name,</if> <if test="!isAll">'合计' AS user_name ,</if> t.project_id AS project_id, t.type AS project_type, p.project_name AS project_name,
IF(t.is_overtime = 0, <if test="!isAll">0</if> <if test="isAll">null</if>, sum(t.work_time)) AS over_time, if(t.is_overtime=1, <if test="!isAll">0</if> <if test="isAll">null</if>, sum(t.work_time)) AS normal_time IF(t.is_overtime = 0, <if test="!isAll">0</if> <if test="isAll">null</if>, sum(t.work_time)) AS over_time, IF(t.is_overtime=1, <if test="!isAll">0</if> <if test="isAll">null</if>, sum(t.work_time)) AS normal_time
from work_time_order t left join work_project p on t.project_id = p.id join work_user u on t.user_id = u.id from work_time_order t left join work_project p on t.project_id = p.id join work_user u on t.user_id = u.id
where where
t.status in (2,5) AND t.status in (2,5) AND
...@@ -348,7 +348,8 @@ ...@@ -348,7 +348,8 @@
</select> </select>
<select id="selectListByType" resultMap="userWorkTimeStatisticsByProject"> <select id="selectListByType" resultMap="userWorkTimeStatisticsByProject">
SELECT <if test="isAll"> u.id AS user_id, u.`name` AS user_name,</if> <if test="!isAll"> '合计' AS user_name,</if> ty.id AS project_type, ty.name AS project_name,IF(t.is_overtime = 0, 0,sum(t.work_time)) AS over_time, if(t.is_overtime=1, 0, sum(t.work_time)) AS normal_time SELECT <if test="isAll"> u.id AS user_id, u.`name` AS user_name,</if> <if test="!isAll"> '合计' AS user_name,</if> ty.id AS project_type, ty.name AS project_name,
IF(t.is_overtime = 0, <if test="!isAll">0</if> <if test="isAll">null</if>, sum(t.work_time)) AS over_time, IF(t.is_overtime=1, <if test="!isAll">0</if> <if test="isAll">null</if>, sum(t.work_time)) AS normal_time
from work_type ty left join work_time_order t on t.type = ty.id left join work_user u on t.user_id = u.id from work_type ty left join work_time_order t on t.type = ty.id left join work_user u on t.user_id = u.id
where where
(t.work_day &lt;= #{endDate} or t.work_day is null) AND (t.status IN (2, 5) or t.status is null) (t.work_day &lt;= #{endDate} or t.work_day is null) AND (t.status IN (2, 5) or t.status is null)
......
...@@ -821,7 +821,7 @@ public class StatisticsServiceImpl implements StatisticsService { ...@@ -821,7 +821,7 @@ public class StatisticsServiceImpl implements StatisticsService {
} else { } else {
//否则就除去假日 //否则就除去假日
for (Date isWorkDay : isWorkDays) { for (Date isWorkDay : isWorkDays) {
if (isWorkDay.compareTo(endDate) != 1 && isWorkDay.compareTo(startDate) != -1 && !workDays.contains(isWorkDay)) { if (isWorkDay.compareTo(endDate) != 1 && isWorkDay.compareTo(startDate) != -1) {
workDays.remove(isWorkDay); workDays.remove(isWorkDay);
} }
} }
......
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