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

完善工时统计

parent 079b9ae0
......@@ -24,6 +24,7 @@
<resultMap id="userWorkTimeStatisticsByProject" type="cn.wisenergy.model.dto.UserWorkTimeStatisticsByProject">
<result property="userId" column="user_id"/>
<result property="userName" column="user_name"/>
<result property="userDeptName" column="dept_name"/>
<collection property="projectWorkTimeAndType" ofType="cn.wisenergy.model.dto.ProjectWorkTimeAndType">
<result property="projectId" column="project_id"/>
<result property="workTimeType" column="work_time_type"/>
......@@ -342,13 +343,13 @@
<select id="getUserProjectWorkTimeStatistics" resultMap="userWorkTimeStatisticsByProject">
SELECT <if test="isAll">u.id AS user_id, u.`name` AS user_name,</if>
SELECT <if test="isAll">u.id AS user_id, u.`name` AS user_name, d.dept_name AS dept_name,</if>
<if test="!isAll">'合计' AS user_name ,</if> t.project_id AS project_id, t.type AS work_time_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
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 join work_type ty on t.type = ty.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 join work_type ty on t.type = ty.id join work_dept d on u.dept_id = d.id
where
t.status in (2,5) AND
t.work_day &lt;= #{endDate}
......@@ -356,7 +357,7 @@
<if test="startDate != null">
AND t.work_day >= #{startDate}
</if>
GROUP BY <if test="isAll">u.id,u.`name`,</if> t.project_id,t.type,p.project_name, t.is_overtime
GROUP BY <if test="isAll">u.id,u.`name`,d.dept_name,</if> t.project_id,t.type,p.project_name, t.is_overtime
ORDER BY <if test="isAll">convert(u.`name` using gbk) asc</if>
<if test="!isAll">ty.sort</if> ,t.project_id
</select>
......
......@@ -350,8 +350,6 @@ public class WorkUserServiceImpl implements WorkUserService {
//将用户对象转换为dto
ResultUser resultUser = getResultUser(user);
WorkDept dept = workDeptService.getById(resultUser.getDeptId());
resultUser.setDeptName(dept.getDeptName());
resultUser.setDay(byId.getSubmitTime());
List<Integer> levelIds = UserRoleLevelUtils.getlevelIds(roles);
List<WorkLevel> workLevels = UserRoleLevelUtils.getlevelByIds(levelIds);
......
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