|
@@ -1488,33 +1488,31 @@
|
|
|
|
|
|
<!--获取按维度分组的工时成本-->
|
|
|
<select id="getExportDegreeCost" resultType="java.util.Map">
|
|
|
- SELECT r.name as name,r.id as id,SUM(b.working_time) AS cost, SUM(b.cost) AS costMoney
|
|
|
- FROM project AS a
|
|
|
- LEFT JOIN report AS b ON b.project_id = a.id
|
|
|
- LEFT JOIN report_extra_degree AS r ON b.degree_id = r.id
|
|
|
- JOIN user AS c ON b.creator_id = c.id
|
|
|
- WHERE a.company_id = #{companyId}
|
|
|
+ SELECT r.name as name,report.degree_id as id,SUM(report.working_time) AS cost, SUM(report.cost) AS costMoney
|
|
|
+ FROM report
|
|
|
+ LEFT JOIN report_extra_degree AS r ON report.degree_id = r.id
|
|
|
+ WHERE report.company_id = #{companyId}
|
|
|
<if test="projectId != null">
|
|
|
- AND a.id = #{projectId}
|
|
|
+ AND report.project_id = #{projectId}
|
|
|
</if>
|
|
|
<if test="startDate != null and endDate != null">
|
|
|
- AND b.create_date between #{startDate} and #{endDate}
|
|
|
+ AND report.create_date between #{startDate} and #{endDate}
|
|
|
</if>
|
|
|
<choose>
|
|
|
<when test="filterDeptIds!=null and filterDeptIds.size()>0">
|
|
|
- and b.dept_id in
|
|
|
+ and report.dept_id in
|
|
|
<foreach collection="filterDeptIds" open="(" item="item" separator="," close=")">
|
|
|
#{item}
|
|
|
</foreach>
|
|
|
</when>
|
|
|
<otherwise>
|
|
|
<if test="deptIds!=null and deptIds.size()>0">
|
|
|
- and (b.dept_id in
|
|
|
+ and (report.dept_id in
|
|
|
<foreach collection="deptIds" open="(" item="item" separator="," close=")">
|
|
|
#{item}
|
|
|
</foreach>
|
|
|
<if test="deptRelatedProjectIds.size() > 0">
|
|
|
- or a.id in
|
|
|
+ or report.project_id in
|
|
|
<foreach collection="deptRelatedProjectIds" open="(" item="pid" separator="," close=")">
|
|
|
#{pid}
|
|
|
</foreach>
|
|
@@ -1523,9 +1521,9 @@
|
|
|
</if>
|
|
|
</otherwise>
|
|
|
</choose>
|
|
|
- AND b.state = 1
|
|
|
- GROUP BY b.degree_id
|
|
|
- ORDER BY b.degree_id
|
|
|
+ AND report.state = 1
|
|
|
+ GROUP BY report.degree_id,r.name
|
|
|
+ ORDER BY report.degree_id
|
|
|
</select>
|
|
|
|
|
|
<!--获取某个维度每个人分别需要的工时-->
|
|
@@ -1551,6 +1549,21 @@
|
|
|
#{item}
|
|
|
</foreach>
|
|
|
</when>
|
|
|
+ <otherwise>
|
|
|
+ <if test="deptIds!=null and deptIds.size()>0">
|
|
|
+ and (report.dept_id in
|
|
|
+ <foreach collection="deptIds" open="(" item="item" separator="," close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ <if test="deptRelatedProjectIds.size() > 0">
|
|
|
+ or report.project_id in
|
|
|
+ <foreach collection="deptRelatedProjectIds" open="(" item="pid" separator="," close=")">
|
|
|
+ #{pid}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ </otherwise>
|
|
|
</choose>
|
|
|
GROUP BY b.id, a.dept_id, a.degree_id
|
|
|
ORDER BY b.id ASC, a.dept_id ASC
|