|
@@ -34,10 +34,12 @@
|
|
|
|
|
|
<select id="purchaseProjectStatisticalYWC" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
|
|
|
resultType="java.util.Map">
|
|
|
- select count(demand_id) countYWC, ifnull(sum(evaluation), 0) evaluationYWC
|
|
|
- from pm_demand
|
|
|
- WHERE purchase_dept_id = #{purchaseDeptId}
|
|
|
- AND project_status = '17'
|
|
|
+ select count(d.demand_id) countYWC, ifnull(sum(c.contract_amount), 0) evaluationYWC
|
|
|
+ from pm_demand d
|
|
|
+ LEFT JOIN pm_contract_info c
|
|
|
+ ON d.demand_id = c.demand_id
|
|
|
+ AND d.purchase_dept_id = #{purchaseDeptId}
|
|
|
+ AND d.project_status = '17'
|
|
|
</select>
|
|
|
|
|
|
<select id="purchaseProjectStatisticalXCJ" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
|
|
@@ -53,16 +55,17 @@
|
|
|
<select id="purchaseProjectStatisticalQNWC" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
|
|
|
resultType="java.util.Map">
|
|
|
-- DATE_FORMAT(plan_demand_sub_time,'%Y')
|
|
|
- select count(demand_id) countQNWC, ifnull(sum(evaluation), 0) evaluationQNWC
|
|
|
- from pm_demand
|
|
|
- where purchase_dept_id = #{purchaseDeptId}
|
|
|
- AND project_status = '17'
|
|
|
- and year(plan_demand_sub_time) = year(NOW()) - 1
|
|
|
+ select count(d.demand_id) countYWC, ifnull(sum(c.contract_amount), 0) evaluationQNWC
|
|
|
+ from pm_demand d
|
|
|
+ LEFT JOIN pm_contract_info c
|
|
|
+ ON d.demand_id = c.demand_id
|
|
|
+ AND d.purchase_dept_id = #{purchaseDeptId}
|
|
|
+ AND d.project_status = '17'
|
|
|
</select>
|
|
|
|
|
|
<select id="countByProjectAttr" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
|
|
|
resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
|
|
|
- SELECT project_status columnName, COUNT(demand_id) num, SUM(evaluation) evaluationTotal
|
|
|
+ SELECT project_status columnName, COUNT(demand_id) num, ifnull(sum(evaluation), 0) evaluationTotal
|
|
|
FROM `pm_demand`
|
|
|
WHERE purchase_dept_id = #{purchaseDeptId}
|
|
|
GROUP BY project_status
|
|
@@ -70,7 +73,7 @@
|
|
|
|
|
|
<select id="countByPurchaseMode" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
|
|
|
resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
|
|
|
- SELECT purchase_mode columnName, COUNT(demand_id) num, SUM(evaluation) evaluationTotal
|
|
|
+ SELECT purchase_mode columnName, COUNT(demand_id) num, ifnull(sum(evaluation), 0) evaluationTotal
|
|
|
FROM `pm_demand`
|
|
|
WHERE purchase_dept_id = #{purchaseDeptId}
|
|
|
GROUP BY purchase_mode
|
|
@@ -78,7 +81,7 @@
|
|
|
|
|
|
<select id="countByEvaluationLt" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
|
|
|
resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
|
|
|
- SELECT COUNT(demand_id) num, SUM(evaluation) evaluationTotal
|
|
|
+ SELECT COUNT(demand_id) num, ifnull(sum(evaluation), 0) evaluationTotal
|
|
|
FROM `pm_demand`
|
|
|
WHERE purchase_dept_id = #{purchaseDeptId}
|
|
|
AND evaluation < #{evaluation}
|
|
@@ -86,14 +89,14 @@
|
|
|
|
|
|
<select id="countByEvaluationBet" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
|
|
|
resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
|
|
|
- SELECT COUNT(demand_id) num, SUM(evaluation) evaluationTotal
|
|
|
+ SELECT COUNT(demand_id) num, ifnull(sum(evaluation), 0) evaluationTotal
|
|
|
FROM `pm_demand`
|
|
|
WHERE purchase_dept_id = #{purchaseDeptId}
|
|
|
AND evaluation BETWEEN #{evaluation} and #{evaluationEnd}
|
|
|
</select>
|
|
|
<select id="countByEvaluationGt" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
|
|
|
resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
|
|
|
- SELECT COUNT(demand_id) num, SUM(evaluation) evaluationTotal
|
|
|
+ SELECT COUNT(demand_id) num, ifnull(sum(evaluation), 0) evaluationTotal
|
|
|
FROM `pm_demand`
|
|
|
WHERE purchase_dept_id = #{purchaseDeptId}
|
|
|
AND evaluation > #{evaluation}
|
|
@@ -101,7 +104,7 @@
|
|
|
|
|
|
<select id="countProjectExceed" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
|
|
|
resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
|
|
|
- SELECT COUNT(demand_id) num, SUM(evaluation) evaluationTotal
|
|
|
+ SELECT COUNT(demand_id) num, ifnull(sum(evaluation), 0) evaluationTotal
|
|
|
FROM `pm_demand`
|
|
|
WHERE purchase_dept_id = #{purchaseDeptId}
|
|
|
AND (real_demand_commit_time > plan_demand_sub_time
|
|
@@ -170,7 +173,7 @@
|
|
|
|
|
|
<select id="majorProjectByStatus" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
|
|
|
resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
|
|
|
- SELECT COUNT(demand_id) num, SUM(evaluation) evaluationTotal
|
|
|
+ SELECT COUNT(demand_id) num, ifnull(sum(evaluation), 0) evaluationTotal
|
|
|
FROM `pm_demand`
|
|
|
WHERE purchase_dept_id = #{purchaseDeptId}
|
|
|
AND find_in_set('1', project_attr)
|
|
@@ -179,7 +182,7 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="countMajorProjectExceed" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
|
|
|
- SELECT COUNT(demand_id) num, SUM(evaluation) evaluationTotal
|
|
|
+ SELECT COUNT(demand_id) num, ifnull(sum(evaluation), 0) evaluationTotal
|
|
|
FROM `pm_demand`
|
|
|
WHERE purchase_dept_id = #{purchaseDeptId}
|
|
|
AND (real_demand_commit_time > plan_demand_sub_time
|
|
@@ -213,7 +216,7 @@
|
|
|
|
|
|
<select id="countEveryStatusNum" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
|
|
|
resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
|
|
|
- SELECT project_status columnName, COUNT(demand_id) num, SUM(evaluation) evaluationTotal
|
|
|
+ SELECT project_status columnName, COUNT(demand_id) num, ifnull(sum(evaluation), 0) evaluationTotal
|
|
|
FROM `pm_demand`
|
|
|
WHERE purchase_dept_id = #{purchaseDeptId}
|
|
|
AND `project_status` IN (9, 10, 11, 12, 13, 14)
|
|
@@ -222,10 +225,10 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="countEveryStatusNumTwo" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
|
|
|
- SELECT project_status columnName, COUNT(demand_id) num, SUM(evaluation) evaluationTotal
|
|
|
+ SELECT project_status columnName, COUNT(demand_id) num, ifnull(sum(evaluation), 0) evaluationTotal
|
|
|
FROM `pm_demand`
|
|
|
WHERE `project_status` IN (15, 16, 17)
|
|
|
- and DATE_FORMAT(create_time, '%Y') = YEAR (NOW())
|
|
|
+ and DATE_FORMAT(create_time, '%Y') = YEAR(NOW())
|
|
|
GROUP BY project_status
|
|
|
</select>
|
|
|
|
|
@@ -237,11 +240,14 @@
|
|
|
|
|
|
<select id="countMajorProjectLastYear" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
|
|
|
resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
|
|
|
- SELECT YEAR(NOW()) - 1 columnName, COUNT(demand_id) num, SUM(evaluation) evaluationTotal
|
|
|
- FROM `pm_demand`
|
|
|
- WHERE purchase_dept_id = #{purchaseDeptId}
|
|
|
- AND find_in_set('1', project_attr)
|
|
|
- and DATE_FORMAT(create_time, '%Y') = YEAR(NOW()) - 1
|
|
|
+ # AND find_in_set('1', project_attr)
|
|
|
+ SELECT YEAR(NOW()) - 1 columnName, COUNT(d.demand_id) num, ifnull(sum(c.contract_amount), 0) evaluationTotal
|
|
|
+ FROM pm_demand d
|
|
|
+ LEFT JOIN pm_contract_info c
|
|
|
+ ON d.demand_id = c.demand_id
|
|
|
+ AND find_in_set('1', d.project_attr)
|
|
|
+ AND d.purchase_dept_id = #{purchaseDeptId}
|
|
|
+ AND DATE_FORMAT(d.create_time, '%Y') = YEAR(NOW()) - 1
|
|
|
</select>
|
|
|
|
|
|
<select id="countProjectMajorByYear" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
|
|
@@ -411,7 +417,7 @@
|
|
|
|
|
|
<select id="countProjectExceedAndMajor" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
|
|
|
resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
|
|
|
- SELECT COUNT(demand_id) num, SUM(evaluation) evaluationTotal
|
|
|
+ SELECT COUNT(demand_id) num, ifnull(sum(evaluation), 0) evaluationTotal
|
|
|
FROM `pm_demand`
|
|
|
WHERE (real_demand_commit_time > plan_demand_sub_time
|
|
|
or real_purchase_finish_time > plan_purchase_finish_time
|