|
@@ -585,22 +585,26 @@
|
|
|
|
|
|
<select id="selectPurchaseTaskFinishYear" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
|
|
|
resultType="java.util.Map">
|
|
|
- select count(a.demand_id) countNum,
|
|
|
- ifnull(sum(a.evaluation), 0) evaluation,
|
|
|
- year(a.up_acceptance_time) yy,
|
|
|
- ifnull(sum(b.contract_amount), 0) contractAmount
|
|
|
- from (
|
|
|
- select evaluation, up_acceptance_time, demand_id
|
|
|
- from pm_demand
|
|
|
+ select count(de.num) countNum,
|
|
|
+ de.evaluationTotal evaluation,
|
|
|
+ year(c.up_acceptance_time) yy,
|
|
|
+ ifnull(sum(c.contract_amount), 0) contractAmount
|
|
|
+ FROM (SELECT ifnull(sum(c.contract_amount), 0) contract_amount,d.up_acceptance_time
|
|
|
+ FROM pm_demand d
|
|
|
+ left join pm_contract_info c
|
|
|
+ on d.demand_id = c.demand_id
|
|
|
+ <include refid="dDeptListOrDemandIdAll"/>
|
|
|
+ d.project_status in (19,20,21)
|
|
|
+ AND YEAR(d.up_acceptance_time) = YEAR(NOW())
|
|
|
+ group by year(d.up_acceptance_time)) c
|
|
|
+ LEFT JOIN
|
|
|
+ (SELECT ifnull(COUNT(demand_id), 0) num ,ifnull(sum(evaluation), 0) evaluationTotal,up_acceptance_time FROM
|
|
|
+ pm_demand
|
|
|
<include refid="deptListOrDemandIdAll"/>
|
|
|
- project_status in (15, 16, 17)
|
|
|
- and up_acceptance_time!=null
|
|
|
- ) a
|
|
|
- left join (
|
|
|
- select contract_amount, demand_id
|
|
|
- from pm_contract_info
|
|
|
- ) b on a.demand_id = b.demand_id
|
|
|
- group by year(a.up_acceptance_time)
|
|
|
+ project_status in (19,20,21) AND YEAR(up_acceptance_time) = YEAR(NOW())
|
|
|
+ group by year(up_acceptance_time)) de
|
|
|
+ ON c.up_acceptance_time=de.up_acceptance_time
|
|
|
+
|
|
|
</select>
|
|
|
|
|
|
<select id="selectPurchaseTaskFinishQuarter" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
|
|
@@ -612,7 +616,7 @@
|
|
|
select evaluation, up_acceptance_time, demand_id
|
|
|
from pm_demand
|
|
|
<include refid="deptListOrDemandIdAll"/>
|
|
|
- project_status in (15, 16, 17)
|
|
|
+ project_status in (19,20,21)
|
|
|
and up_acceptance_time!=null
|
|
|
and year(up_acceptance_time) = year(NOW())
|
|
|
) a
|
|
@@ -632,7 +636,7 @@
|
|
|
select evaluation, up_acceptance_time, demand_id
|
|
|
from pm_demand
|
|
|
<include refid="deptListOrDemandIdAll"/>
|
|
|
- project_status in (15, 16, 17)
|
|
|
+ project_status in (19,20,21)
|
|
|
and up_acceptance_time!=null
|
|
|
and year(up_acceptance_time) = year(NOW())
|
|
|
) a
|
|
@@ -826,12 +830,16 @@
|
|
|
parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo">
|
|
|
SELECT YEAR(NOW()) columnName, de.num,de.evaluationTotal,ifnull(sum(c.contract_amount), 0)
|
|
|
evaluationContractTotal
|
|
|
- FROM pm_demand d, pm_contract_info c,
|
|
|
+ FROM (SELECT c.contract_amount FROM pm_demand d
|
|
|
+ left join pm_contract_info c
|
|
|
+ on d.demand_id = c.demand_id
|
|
|
+ <include refid="dDeptListOrDemandIdAll"/>
|
|
|
+ d.project_status > 18
|
|
|
+ AND YEAR(d.up_acceptance_time) = YEAR(NOW())) c
|
|
|
+ ,
|
|
|
(SELECT ifnull(COUNT(demand_id), 0) num ,ifnull(sum(evaluation), 0) evaluationTotal FROM pm_demand
|
|
|
<include refid="deptListOrDemandIdAll"/>
|
|
|
- project_status > 17 ) de
|
|
|
- <include refid="dDeptListOrDemandIdAll"/>
|
|
|
- d.demand_id = c.demand_id AND d.project_status > 17
|
|
|
+ project_status > 18 AND YEAR(up_acceptance_time) = YEAR(NOW())) de
|
|
|
</select>
|
|
|
|
|
|
<select id="selectCCThisYear" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo"
|
|
@@ -1017,5 +1025,28 @@
|
|
|
</if>
|
|
|
</sql>
|
|
|
|
|
|
+ <sql id="dDeptListOrDemandIdAllNoAnd">
|
|
|
+ WHERE
|
|
|
+ <if test="vo.deptList != null and vo.deptList.size != 0 ">
|
|
|
+ d.purchase_dept_id
|
|
|
+ in
|
|
|
+ <foreach collection="vo.deptList" item="item" index="index"
|
|
|
+ separator="," open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="(vo.deptList != null and vo.deptList.size != 0) and (vo.demandIdAll != null and vo.demandIdAll.size != 0)">
|
|
|
+ AND
|
|
|
+ </if>
|
|
|
+ <if test="vo.demandIdAll != null and vo.demandIdAll.size != 0 ">
|
|
|
+ d.demand_id
|
|
|
+ in
|
|
|
+ <foreach collection="vo.demandIdAll" item="item" index="index"
|
|
|
+ separator="," open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ </sql>
|
|
|
+
|
|
|
|
|
|
</mapper>
|