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

完成项目统计报表

parent 871f62ba
......@@ -34,6 +34,9 @@ public interface WorkProjectTimeCostMapper {
*/
List<ProjectStatisticsByMonth> selectListByMonth(@Param("year") Integer year,@Param("deptId") Integer deptId,@Param("projectId") Integer projectId);
List<ProjectStatisticsByMonth> selectListStatistics(@Param("year") Integer year,@Param("deptId") Integer deptId,@Param("projectId") Integer projectId);
/**
* 删除月份大于参数的统计数据
* @return
......
......@@ -107,6 +107,20 @@
<select id="selectListByMonth" resultMap="projectStatisticsByMonth">
select '合计' AS project_name, group_CONCAT(DISTINCT YEAR (statistics_start),'年',MONTH (statistics_start),'月') AS date,sum(total_time) AS total_time, sum(cost) AS cost
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
<where>
<if test="projectId != null ">
ptc.project_id = #{projectId}
</if>
<if test="deptId != null">
AND p.dept_id = #{deptId} AND year(statistics_start) = #{year}
</if>
</where>
group by year(statistics_start),MONTH(statistics_start)
</select>
<select id="selectListStatistics" resultMap="projectStatisticsByMonth">
select ptc.project_id AS project_id, project_name,
group_CONCAT(DISTINCT YEAR (statistics_start),'年',MONTH (statistics_start),'月') AS date,
sum(total_time) AS total_time, sum(cost) AS cost <if test="projectId != null "> ,d.dept_name AS dept_name</if>
......@@ -119,6 +133,7 @@
AND p.dept_id = #{deptId} AND year(statistics_start) = #{year}
</if>
</where>
group by ptc.project_id,project_name,year(statistics_start),MONTH(statistics_start) <if test="projectId != null "> ,ptc.dept_id</if>
group by ptc.project_id,project_name,year(statistics_start),MONTH(statistics_start) <if test="projectId != null "> ,d.dept_name</if>
</select>
</mapper>
\ No newline at end of file
......@@ -297,9 +297,7 @@
<select id="getUserProjectWorkTimeStatistics" resultMap="userWorkTimeStatisticsByProject">
SELECT u.id AS user_id ,u.`name` AS user_name, t.project_id AS project_id
,case t.type when 1 then '项目' when 2 then '商机' when 5 then '外部商务、技术交流' when 6 then '内部培训、技术准备、管理' when 7 then '其他非项目/商机工作' end 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 u.id AS user_id, u.`name` AS user_name, 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
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
......@@ -319,8 +317,7 @@
GROUP BY u.id,u.`name`,t.project_id,t.type,p.project_name, t.is_overtime
<if test="userIds != null">
UNION
SELECT u.id AS user_id ,u.`name` AS user_name, t.project_id AS project_id
,case t.type when 1 then '项目' when 2 then '商机' when 5 then '外部商务、技术交流' when 6 then '内部培训、技术准备、管理' when 7 then '其他非项目/商机工作' end AS project_type
SELECT u.id AS user_id ,u.`name` AS user_name, 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
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
......
......@@ -23,7 +23,13 @@ public class ProjectWorkTimeAndType{
* 项目类型
*/
@ApiModelProperty(name = "projectType", value = "项目类型")
private String projectType;
private Integer projectType;
/**
* 项目类型
*/
@ApiModelProperty(name = "projectTypeName", value = "项目类型名称")
private String projectTypeName;
/**
* 是否加班
......
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