|
@@ -17,16 +17,15 @@
|
|
|
</sql>
|
|
|
<!--获取某个项目内子项目的工时成本统计-->
|
|
|
<select id="getTimeCost" resultType="java.util.Map">
|
|
|
- SELECT a.id, a.name AS name, SUM(b.working_time) AS cost, SUM(b.working_time * c.cost) AS costMoney
|
|
|
- FROM sub_project AS a
|
|
|
- LEFT JOIN report AS b ON b.sub_project_id = a.id
|
|
|
- JOIN user AS c ON b.creator_id = c.id
|
|
|
- WHERE a.project_id = #{projectId}
|
|
|
+ SELECT a.id, IFNULL(a.name,'未分配') AS name, SUM(b.working_time) AS cost, SUM(b.cost) AS costMoney
|
|
|
+ FROM report AS b
|
|
|
+ LEFT JOIN sub_project AS a ON b.sub_project_id = a.id
|
|
|
+ WHERE b.project_id = #{projectId}
|
|
|
<if test="startDate != null and endDate != null">
|
|
|
AND b.create_date between #{startDate} and #{endDate}
|
|
|
</if>
|
|
|
AND b.state = 1
|
|
|
- GROUP BY a.id
|
|
|
- ORDER BY a.id ASC
|
|
|
+ GROUP BY b.sub_project_id
|
|
|
+ ORDER BY b.sub_project_id ASC
|
|
|
</select>
|
|
|
</mapper>
|