Commit 041f9e52 authored by nie'hong's avatar nie'hong

完善项目工时统计权限

parent 29d1dde2
......@@ -25,6 +25,5 @@ public interface WorkDeptMapper extends BaseMapper<WorkDept> {
int updateManagerIdISNullById(Integer id);
List<WorkDept> getDeptByManagerId(Integer userId);
}
......@@ -50,7 +50,9 @@ public interface WorkProjectMapper extends BaseMapper<WorkProject> {
int updateProject(ModifyProjectVo modifyProjectVo);
List<WorkProject> getListByDeptAndIsConclusion(@Param("deptId") Integer deptId,@Param("isConclusion") Integer isConclusion);
List<WorkProject> getListByCriteria(Map<String,Object> map);
List<Integer> getProjectIdByManager(Integer userId);
List<WorkProject> getListByCentreIdAndIsConclusion(@Param("centreId") Integer centreId,@Param("isConclusion") Integer isConclusion);
}
......@@ -37,7 +37,7 @@
<if test="deptId != null">and dept_id = #{deptId}</if>
<if test="workTime != null">and work_time =#{workTime}</if>
<if test="costBudget != null">and cost_budget = #{costBudget}</if>
<if test="isConclusion != null">and is_conlusion =#{isConclusion}</if>
<if test="isConclusion != null">and is_conclusion =#{isConclusion}</if>
<if test="startTime != null">and start_time =#{startTime}</if>
<if test="endTime != null">and end_time =#{endTime}</if>
<if test="createTime != null">and create_time &gt;= #{createTime}</if>
......@@ -161,11 +161,12 @@ ORDER BY p.is_conclusion DESC
</select>
<select id="getListByDeptAndIsConclusion" resultType="cn.wisenergy.model.app.WorkProject">
<select id="getListByCriteria" resultType="cn.wisenergy.model.app.WorkProject">
select <include refid="Base_Column_List"/>
from <include refid="table"/>
where dept_id = #{deptId}
<if test="isConclusion !=null ">AND is_conclusion=#{isConclusion}</if>
<where>
<include refid="criteria"/>
</where>
</select>
<select id="getProjectIdByManager" resultType="java.lang.Integer">
......@@ -174,5 +175,14 @@ ORDER BY p.is_conclusion DESC
where manager_id = #{userId}
</select>
<select id="getListByCentreIdAndIsConclusion" resultType="cn.wisenergy.model.app.WorkProject">
select <include refid="Base_Column_List"/>
from work_project p join work_dept d on p.dept_id = d.id
where centre_id = #{centreId}
<if test="isConclusion != null">
AND is_conclusion = #{isConclusion}
</if>
</select>
</mapper>
......@@ -63,8 +63,8 @@
t.dept_id,
min(work_day),
max(work_day),
sum(work_time / 8),
sum(work_time / 8 * s.day_salary),
sum(work_time)/ 8,
sum(work_time * s.day_salary)/ 8,
now() AS create_time
FROM
work_time_order t
......@@ -86,10 +86,13 @@
SELECT type ,<if test="centreId == null">'汇总' AS dept_name,</if> <if test="centreId != null"> dept_name,p.dept_id,</if>p.id AS
project_id,project_name,concat(min(statistics_start),'~' ,max(statistics_end)) AS statistics_time ,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 p.dept_id=d.id
where project_id in
<where>
<if test="projectIds != null">
project_id in
<foreach collection="projectIds" open="(" close=")" separator="," item="projectId">
#{projectId}
</foreach>
</if>
<if test="deptId != null">
AND dept_id = #{deptId}
</if>
......@@ -105,6 +108,7 @@
<if test="firstDayOfMonth != null">
AND statistics_start >= #{firstDayOfMonth}
</if>
</where>
GROUP BY type, <if test="centreId == null"> dept_name,</if> <if test="centreId != null"> dept_name,p.dept_id,</if>p.id,project_name
<if test="centreId != null"> ORDER BY p.dept_id</if>
</select>
......
......@@ -260,6 +260,9 @@
<foreach collection="types" item="type" open="(" close=")" separator=",">
#{type}
</foreach>
<if test="centreId != null">
AND centre_id = #{centreId}
</if>
group by t.type,t.dept_id, dept_name, t.project_id,p.project_name, if(YEAR (work_day) = YEAR(NOW()),',month(work_day)','')
order by t.dept_id,work_day
</select>
......@@ -331,7 +334,7 @@
</select>
<select id="selectListByType" resultMap="userWorkTimeStatisticsByProject">
SELECT <if test="isAll == true"> u.id AS user_id, u.`name` AS user_name,</if> <if test="isAll == false"> '合计' 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, case t.is_overtime when 1 then '加班' ELSE '正常' end AS is_overtime,IFNULL(SUM(t.work_time),0) AS work_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)
......@@ -342,11 +345,13 @@
<foreach collection="queryType" item="type" open="(" close=")" separator=",">
#{type}
</foreach>
AND (t.user_id in
AND (<if test="userIds.size != 0"> t.user_id in
<foreach collection="userIds" item="userId" open="(" close=")" separator=",">
#{userId}
</foreach>
or t.user_id is null)
GROUP BY <if test="isAll == true">u.id,u.`name`,</if> ty.id,ty.name, t.is_overtime
OR
</if>
t.user_id is null)
GROUP BY <if test="isAll">u.id,u.`name`,</if> ty.id,ty.name, t.is_overtime
</select>
</mapper>
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