|
@@ -1894,36 +1894,34 @@
|
|
|
|
|
|
<select id="groupExpendProcessList" resultType="java.util.Map">
|
|
|
SELECT p.project_name AS projectName,p.id AS projectId,tg.id AS groupId,d.department_name,d.department_id AS deptId,d.corpwx_deptid AS corpwxDeptId,tg.name AS groupName,
|
|
|
- IFNULL((SELECT SUM(working_time) FROM report WHERE group_id=tg.id AND dept_id=d.department_id AND create_date BETWEEN #{startDate} AND #{endDate} AND state=1 AND project_id IS NOT NULL),0) AS realHour,
|
|
|
- IFNULL((SELECT SUM(cost) FROM report WHERE group_id=tg.id AND dept_id=d.department_id AND create_date BETWEEN #{startDate} AND #{endDate} AND state=1 AND project_id IS NOT NULL) ,0) AS realCost,
|
|
|
- IFNULL((SELECT SUM(overtime_hours) FROM report WHERE group_id=tg.id AND dept_id=d.department_id AND create_date BETWEEN #{startDate} AND #{endDate} AND state=1 AND project_id IS NOT NULL ),0) AS overHour,
|
|
|
- (IFNULL((SELECT SUM(working_time) FROM report WHERE group_id=tg.id AND dept_id=d.department_id AND create_date BETWEEN #{startDate} AND #{endDate} AND state=1 AND project_id IS NOT NULL),0)
|
|
|
- -IFNULL((SELECT SUM(overtime_hours) FROM report WHERE group_id=tg.id AND dept_id=d.department_id AND create_date BETWEEN #{startDate} AND #{endDate} AND state=1 AND project_id IS NOT NULL ),0)) as normalHour,
|
|
|
+ IFNULL(r.realHour,0) AS realHour,IFNULL(r.realCost,0) AS realCost,IFNULL(r.normalHour,0) as normalHour,IFNULL(r.overHour,0) as overHour,
|
|
|
IFNULL(SUM(te.plan_hours),0) AS planHour
|
|
|
FROM task_executor te
|
|
|
LEFT JOIN task t ON t.id=te.task_id
|
|
|
- LEFT JOIN user u ON te.executor_id=u.id
|
|
|
+ LEFT JOIN USER u ON te.executor_id=u.id
|
|
|
LEFT JOIN task_group tg ON tg.id=t.group_id
|
|
|
LEFT JOIN project p ON p.id=tg.project_id
|
|
|
LEFT JOIN department d ON d.department_id=u.department_id
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT SUM(working_time) AS realHour,SUM(cost) AS realCost,(SUM(working_time)-SUM(overtime_hours)) AS normalHour,SUM(overtime_hours) AS overHour,group_id
|
|
|
+ FROM report WHERE create_date BETWEEN #{startDate} AND #{endDate} AND state=1 AND project_id IS NOT NULL AND company_id=#{companyId} GROUP BY group_id) r ON r.group_id=tg.`id`
|
|
|
WHERE u.company_id=#{companyId}
|
|
|
AND tg.name IN ('生产部电气','生产部车间','工程部现场安装施工','工程部配合调试','研发部工艺设计','研发部结构设计','研发部BIM设计','研发部电气设计','研发部工艺调试验收','研发部电气调试验收')
|
|
|
- AND d.department_id IN ( 7458, 7459, 7902, 7903, 7460, 7813, 7814, 7815, 7816)
|
|
|
<if test="userId!=null and userId!=''">
|
|
|
and t.executor_id=#{userId}
|
|
|
</if>
|
|
|
- <if test="list!=null and list.size()>0">
|
|
|
- and d.department_id in
|
|
|
- <foreach collection="list" open="(" close=")" item="item" separator=",">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- <if test="listSecond!=null and listSecond.size()>0">
|
|
|
- and d.department_id in
|
|
|
- <foreach collection="listSecond" open="(" close=")" item="item" separator=",">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
+<!-- <if test="list!=null and list.size()>0">-->
|
|
|
+<!-- and d.department_id in-->
|
|
|
+<!-- <foreach collection="list" open="(" close=")" item="item" separator=",">-->
|
|
|
+<!-- #{item}-->
|
|
|
+<!-- </foreach>-->
|
|
|
+<!-- </if>-->
|
|
|
+<!-- <if test="listSecond!=null and listSecond.size()>0">-->
|
|
|
+<!-- and d.department_id in-->
|
|
|
+<!-- <foreach collection="listSecond" open="(" close=")" item="item" separator=",">-->
|
|
|
+<!-- #{item}-->
|
|
|
+<!-- </foreach>-->
|
|
|
+<!-- </if>-->
|
|
|
GROUP BY p.id,tg.id,d.department_id ORDER BY p.id,d.department_id
|
|
|
</select>
|
|
|
|