Commit 9d8b385d authored by nie'hong's avatar nie'hong

完善人员工时统计

parent 5e632cd5
......@@ -94,7 +94,7 @@ public interface WorkTimeOrderMapper extends BaseMapper<WorkTimeOrder> {
/**
* 获取人员项目工时
*/
List<UserWorkTimeStatisticsByProject> getUserProjectWorkTimeStatistics(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projectIds") List<Integer> projectIds, @Param("isAll") Boolean isAll);
List<UserWorkTimeStatisticsByProject> getUserProjectWorkTimeStatistics(Map<String, Object> map);
/**
* 根据工单状态获取填报条数
......
......@@ -6,10 +6,11 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* <p>
* Mapper 接口
* Mapper 接口
* </p>
*
* @author chenqi
......@@ -21,7 +22,7 @@ public interface WorkUserProjectMapper extends BaseMapper<WorkUserProject> {
int deleteByProjectId(Integer projectId);
int insertBatch(@Param("userIds") List<Integer> userIds,@Param("projectId") Integer projectId);
int insertBatch(@Param("userIds") List<Integer> userIds, @Param("projectId") Integer projectId);
List<Integer> selectUserIdByProjectIds(@Param("projectIds") List<Integer> projectIds);
List<Integer> selectUserIdByProjectIds(Map<String,Object> map);
}
......@@ -61,6 +61,7 @@
<where>
<include refid="criteria"/>
</where>
order by sort
</select>
<select id="getAllDeptByAllCentre" resultMap="CentreDeptMap">
......
......@@ -28,9 +28,8 @@
<result property="projectId" column="project_id"/>
<result property="projectType" column="project_type"/>
<result property="projectName" column="project_name"/>
<result property="projectTypeName" column="type_name"/>
<result property="isOvertime" column="is_overtime"/>
<result property="workTime" column="work_time"/>
<result property="overtime" column="over_time"/>
<result property="normalTime" column="normal_time"/>
</collection>
</resultMap>
......@@ -313,7 +312,7 @@
<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, case t.is_overtime when 1 then '加班' ELSE '正常' end AS is_overtime,SUM(t.work_time) AS work_time
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, 0, sum(t.work_time)) AS over_time, if(t.is_overtime=1, 0, 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
where
t.status in (2,5) AND
......@@ -321,10 +320,17 @@
<if test="startDate != null">
AND t.work_day >= #{startDate}
</if>
AND project_id in
<foreach collection="projectIds" item="projectId" open="(" close=")" separator=",">
#{projectId}
</foreach>
<if test="isConclusion != null">
AND p.is_conclusion = #{isConclusion}
</if>
<if test="deptId != null">
AND p.dept_id = #{deptId}
</if>
<if test="managerId != null">
AND p.manager_id = #{managerId}
</if>
GROUP BY <if test="isAll"> u.id,u.`name`,</if>t.project_id,t.type,p.project_name, t.is_overtime
</select>
......@@ -339,7 +345,7 @@
</select>
<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, case t.is_overtime when 1 then '加班' ELSE '正常' end AS is_overtime,IFNULL(SUM(t.work_time),0) AS work_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, 0,sum(t.work_time)) AS over_time, if(t.is_overtime=1, 0, 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
where
(t.work_day &lt;= #{endDate} or t.work_day is null) AND (t.status IN (2, 5) or t.status is null)
......
......@@ -39,12 +39,16 @@
</select>
<select id="selectUserIdByProjectIds" resultType="java.lang.Integer">
select user_id
from work_user_project
where project_id in
<foreach collection="projectIds" item="projectId" open="(" close=")" separator=",">
#{projectId}
</foreach>
select distinct user_id
from work_user_project up join work_project p on up.project_id = p.id
<where>
<if test="deptId != null">
p.dept_id = #{deptId}
</if>
<if test="managerId != null">
p.manager_id = #{managerId}
</if>
</where>
</select>
</mapper>
......@@ -25,22 +25,18 @@ public class ProjectWorkTimeAndType{
@ApiModelProperty(name = "projectType", value = "项目类型")
private Integer projectType;
/**
* 项目类型
*/
@ApiModelProperty(name = "projectTypeName", value = "项目类型名称")
private String projectTypeName;
/**
* 是否加班
* 加班工时
*/
@ApiModelProperty(name = "isOvertime", value = "是否加班")
private String isOvertime;
@ApiModelProperty(name = "isOvertime", value = "加班工时")
private Integer overtime;
/**
* 工时
* 加班工时
*/
@ApiModelProperty(name = "workTime", value = "总工时")
private Integer workTime;
@ApiModelProperty(name = "normalTime", value = "正常工时")
private Integer normalTime;
}
\ No newline at end of file
......@@ -31,17 +31,19 @@ public class UserWorkTimeStatisticsByProject implements Serializable{
@ApiModelProperty(name = "userName", value = "用户名")
private String userName;
/**
* 总工时
*/
@ApiModelProperty(name = "totalTime", value = "总工时")
private Integer totalTime;
/**
* 项目工时列表
*/
@ApiModelProperty(name = "projectWorkTimeAndType", value = "项目工时列表")
private List<ProjectWorkTimeAndType> projectWorkTimeAndType;
/**
* 总工时
*/
@ApiModelProperty(name = "totalTime", value = "总工时")
private Integer totalTime;
@Override
public boolean equals(Object obj) {
......
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