|
@@ -29,13 +29,15 @@
|
|
|
resultType="java.util.Map">
|
|
|
select count(demand_id) countId
|
|
|
from pm_demand
|
|
|
+ WHERE purchase_dept_id = #{purchaseDeptId}
|
|
|
</select>
|
|
|
|
|
|
<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 project_status = '17'
|
|
|
+ WHERE purchase_dept_id = #{purchaseDeptId}
|
|
|
+ AND project_status = '17'
|
|
|
</select>
|
|
|
|
|
|
<select id="purchaseProjectStatisticalXCJ" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
|
|
@@ -43,7 +45,9 @@
|
|
|
-- DATE_FORMAT(plan_demand_sub_time,'%Y')
|
|
|
select count(demand_id) countXCJ, ifnull(sum(evaluation), 0) evaluationXCJ
|
|
|
from pm_demand
|
|
|
- where project_status != '17' and year(plan_demand_sub_time) = year(NOW())
|
|
|
+ where purchase_dept_id = #{purchaseDeptId}
|
|
|
+ AND project_status != '17'
|
|
|
+ and year(plan_demand_sub_time) = year(NOW())
|
|
|
</select>
|
|
|
|
|
|
<select id="purchaseProjectStatisticalQNWC" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
|
|
@@ -51,124 +55,149 @@
|
|
|
-- DATE_FORMAT(plan_demand_sub_time,'%Y')
|
|
|
select count(demand_id) countQNWC, ifnull(sum(evaluation), 0) evaluationQNWC
|
|
|
from pm_demand
|
|
|
- where project_status != '17'
|
|
|
+ where purchase_dept_id = #{purchaseDeptId}
|
|
|
+ AND project_status != '17'
|
|
|
and year(plan_demand_sub_time) = year(NOW()) - 1
|
|
|
</select>
|
|
|
|
|
|
- <select id="countByProjectAttr" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
|
|
|
+ <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
|
|
|
FROM `pm_demand`
|
|
|
+ WHERE purchase_dept_id = #{purchaseDeptId}
|
|
|
GROUP BY project_status
|
|
|
</select>
|
|
|
|
|
|
- <select id="countByPurchaseMode" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
|
|
|
+ <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
|
|
|
FROM `pm_demand`
|
|
|
+ WHERE purchase_dept_id = #{purchaseDeptId}
|
|
|
GROUP BY purchase_mode
|
|
|
</select>
|
|
|
|
|
|
- <select id="countByEvaluationLt" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
|
|
|
+ <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
|
|
|
FROM `pm_demand`
|
|
|
- WHERE evaluation < #{evaluation}
|
|
|
+ WHERE purchase_dept_id = #{purchaseDeptId}
|
|
|
+ AND evaluation < #{evaluation}
|
|
|
</select>
|
|
|
|
|
|
- <select id="countByEvaluationBet" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
|
|
|
+ <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
|
|
|
FROM `pm_demand`
|
|
|
- WHERE evaluation BETWEEN #{evaluation} and #{evaluationEnd}
|
|
|
+ WHERE purchase_dept_id = #{purchaseDeptId}
|
|
|
+ AND evaluation BETWEEN #{evaluation} and #{evaluationEnd}
|
|
|
</select>
|
|
|
- <select id="countByEvaluationGt" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo"
|
|
|
- parameterType="java.lang.Integer">
|
|
|
+ <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
|
|
|
FROM `pm_demand`
|
|
|
- WHERE evaluation > #{evaluation}
|
|
|
+ WHERE purchase_dept_id = #{purchaseDeptId}
|
|
|
+ AND evaluation > #{evaluation}
|
|
|
</select>
|
|
|
|
|
|
- <select id="countProjectExceed" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
|
|
|
+ <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
|
|
|
FROM `pm_demand`
|
|
|
- WHERE (real_demand_commit_time > plan_demand_sub_time
|
|
|
+ WHERE purchase_dept_id = #{purchaseDeptId}
|
|
|
+ AND (real_demand_commit_time > plan_demand_sub_time
|
|
|
or real_purchase_finish_time > plan_purchase_finish_time
|
|
|
or real_deliver_time > plan_deliver_time)
|
|
|
- and DATE_FORMAT(create_time, '%Y') = YEAR (NOW())
|
|
|
+ and DATE_FORMAT(create_time, '%Y') = YEAR(NOW())
|
|
|
</select>
|
|
|
|
|
|
- <select id="countThisYear" resultType="java.lang.Integer">
|
|
|
+ <select id="countThisYear" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
|
|
|
+ resultType="java.lang.Integer">
|
|
|
SELECT COUNT(demand_id) num
|
|
|
FROM `pm_demand`
|
|
|
- WHERE DATE_FORMAT(create_time, '%Y') = YEAR (NOW())
|
|
|
+ WHERE purchase_dept_id = #{purchaseDeptId}
|
|
|
+ AND DATE_FORMAT(create_time, '%Y') = YEAR(NOW())
|
|
|
</select>
|
|
|
|
|
|
- <select id="countProjectExceedYear" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
|
|
|
+ <select id="countProjectExceedYear" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
|
|
|
+ resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
|
|
|
SELECT DATE_FORMAT(create_time, '%Y') columnName, COUNT(demand_id) num
|
|
|
FROM `pm_demand`
|
|
|
- WHERE (real_demand_commit_time > plan_demand_sub_time
|
|
|
+ WHERE purchase_dept_id = #{purchaseDeptId}
|
|
|
+ AND (real_demand_commit_time > plan_demand_sub_time
|
|
|
or real_purchase_finish_time > plan_purchase_finish_time
|
|
|
or real_deliver_time > plan_deliver_time)
|
|
|
GROUP BY DATE_FORMAT(create_time, '%Y')
|
|
|
order by create_time asc
|
|
|
</select>
|
|
|
|
|
|
- <select id="countProjectExceedMonth" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
|
|
|
+ <select id="countProjectExceedMonth" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
|
|
|
+ resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
|
|
|
SELECT DATE_FORMAT(create_time, '%Y-%m') columnName, COUNT(demand_id) num
|
|
|
FROM `pm_demand`
|
|
|
- WHERE (real_demand_commit_time > plan_demand_sub_time
|
|
|
+ WHERE purchase_dept_id = #{purchaseDeptId}
|
|
|
+ AND (real_demand_commit_time > plan_demand_sub_time
|
|
|
or real_purchase_finish_time > plan_purchase_finish_time
|
|
|
or real_deliver_time > plan_deliver_time)
|
|
|
- and MONTH (
|
|
|
- create_time) = #{month}
|
|
|
+ and MONTH(
|
|
|
+ create_time) = #{month}
|
|
|
AND DATE_FORMAT(create_time
|
|
|
- , '%Y') = #{year}
|
|
|
+ , '%Y') = #{year}
|
|
|
GROUP BY DATE_FORMAT(create_time, '%Y-%m')
|
|
|
</select>
|
|
|
|
|
|
- <select id="countProjectExceedQuarter" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
|
|
|
+ <select id="countProjectExceedQuarter" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
|
|
|
+ resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
|
|
|
SELECT DATE_FORMAT(create_time, '%Y-${quarter}季度') columnName, COUNT(demand_id) num
|
|
|
FROM `pm_demand`
|
|
|
- WHERE (real_demand_commit_time > plan_demand_sub_time
|
|
|
+ WHERE purchase_dept_id = #{purchaseDeptId}
|
|
|
+ AND (real_demand_commit_time > plan_demand_sub_time
|
|
|
or real_purchase_finish_time > plan_purchase_finish_time
|
|
|
or real_deliver_time > plan_deliver_time)
|
|
|
and QUARTER(create_time) = #{quarter}
|
|
|
AND DATE_FORMAT(create_time, '%Y') = #{year}
|
|
|
</select>
|
|
|
|
|
|
- <select id="countProjectExceedAll" resultType="com.ozs.pm.doman.PmDemand">
|
|
|
+ <select id="countProjectExceedAll" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
|
|
|
+ resultType="com.ozs.pm.doman.PmDemand">
|
|
|
SELECT *
|
|
|
FROM `pm_demand`
|
|
|
- WHERE (real_demand_commit_time > plan_demand_sub_time
|
|
|
+ WHERE purchase_dept_id = #{purchaseDeptId}
|
|
|
+ AND (real_demand_commit_time > plan_demand_sub_time
|
|
|
or real_purchase_finish_time > plan_purchase_finish_time
|
|
|
or real_deliver_time > plan_deliver_time)
|
|
|
|
|
|
</select>
|
|
|
|
|
|
- <select id="majorProjectByStatus" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo"
|
|
|
- parameterType="java.lang.String">
|
|
|
+ <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
|
|
|
FROM `pm_demand`
|
|
|
- WHERE find_in_set('1', project_attr)
|
|
|
- AND `project_status` = #{code}
|
|
|
- AND DATE_FORMAT(create_time, '%Y') = year (now())
|
|
|
+ WHERE purchase_dept_id = #{purchaseDeptId}
|
|
|
+ AND find_in_set('1', project_attr)
|
|
|
+ AND `project_status` = #{projectStatus}
|
|
|
+ AND DATE_FORMAT(create_time, '%Y') = year(now())
|
|
|
</select>
|
|
|
|
|
|
<select id="countMajorProjectExceed" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
|
|
|
SELECT COUNT(demand_id) num, SUM(evaluation) evaluationTotal
|
|
|
FROM `pm_demand`
|
|
|
- WHERE (real_demand_commit_time > plan_demand_sub_time
|
|
|
+ WHERE purchase_dept_id = #{purchaseDeptId}
|
|
|
+ AND (real_demand_commit_time > plan_demand_sub_time
|
|
|
or real_purchase_finish_time > plan_purchase_finish_time
|
|
|
or real_deliver_time > plan_deliver_time)
|
|
|
AND find_in_set('1', project_attr)
|
|
|
- and DATE_FORMAT(create_time, '%Y') = YEAR (NOW())
|
|
|
+ and DATE_FORMAT(create_time, '%Y') = YEAR(NOW())
|
|
|
</select>
|
|
|
|
|
|
- <select id="taskQuantityYear" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
|
|
|
- SELECT YEAR (NOW()) columnName, COUNT (demand_id) num
|
|
|
+ <select id="taskQuantityYear" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
|
|
|
+ resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
|
|
|
+ SELECT YEAR(NOW()) columnName, COUNT(demand_id) num
|
|
|
FROM `pm_demand`
|
|
|
WHERE find_in_set('1'
|
|
|
, project_attr)
|
|
|
AND `project_status` = #{code}
|
|
|
and DATE_FORMAT(create_time
|
|
|
- , '%Y') = YEAR (NOW())
|
|
|
+ , '%Y') = YEAR(NOW())
|
|
|
</select>
|
|
|
|
|
|
<select id="taskQuantityLastYear" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo"
|
|
@@ -182,11 +211,13 @@
|
|
|
, '%Y') = YEAR (NOW()) - 1
|
|
|
</select>
|
|
|
|
|
|
- <select id="countEveryStatusNum" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
|
|
|
+ <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
|
|
|
FROM `pm_demand`
|
|
|
- WHERE `project_status` IN (9, 10, 11, 12, 13, 14)
|
|
|
- and DATE_FORMAT(create_time, '%Y') = YEAR (NOW())
|
|
|
+ WHERE purchase_dept_id = #{purchaseDeptId}
|
|
|
+ AND `project_status` IN (9, 10, 11, 12, 13, 14)
|
|
|
+ and DATE_FORMAT(create_time, '%Y') = YEAR(NOW())
|
|
|
GROUP BY project_status
|
|
|
</select>
|
|
|
|
|
@@ -204,13 +235,13 @@
|
|
|
where plan_id = #{planId} limit 1
|
|
|
</select>
|
|
|
|
|
|
- <select id="countMajorProjectLastYear" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
|
|
|
+ <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 find_in_set('1'
|
|
|
- , project_attr)
|
|
|
- and DATE_FORMAT(create_time
|
|
|
- , '%Y') = YEAR(NOW()) - 1
|
|
|
+ WHERE purchase_dept_id = #{purchaseDeptId}
|
|
|
+ AND find_in_set('1', project_attr)
|
|
|
+ and DATE_FORMAT(create_time, '%Y') = YEAR(NOW()) - 1
|
|
|
</select>
|
|
|
|
|
|
<select id="countProjectMajorByYear" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
|
|
@@ -224,14 +255,16 @@
|
|
|
<select id="countProjectMajorByMonth" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
|
|
|
SELECT DATE_FORMAT(create_time, '%Y-%m') columnName, COUNT(demand_id) num
|
|
|
FROM `pm_demand`
|
|
|
- WHERE find_in_set('1', project_attr)
|
|
|
+ WHERE purchase_dept_id = #{purchaseDeptId}
|
|
|
+ AND find_in_set('1', project_attr)
|
|
|
GROUP BY DATE_FORMAT(create_time, '%Y-%m')
|
|
|
</select>
|
|
|
|
|
|
<select id="countProjectMajorByQuarter" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
|
|
|
SELECT create_time columnName, COUNT(demand_id) num
|
|
|
FROM `pm_demand`
|
|
|
- WHERE find_in_set('1', project_attr)
|
|
|
+ WHERE purchase_dept_id = #{purchaseDeptId}
|
|
|
+ AND find_in_set('1', project_attr)
|
|
|
and QUARTER(create_time) = #{quarter}
|
|
|
AND DATE_FORMAT(create_time, '%Y') = #{year}
|
|
|
</select>
|
|
@@ -241,8 +274,9 @@
|
|
|
resultType="java.util.Map">
|
|
|
select count(demand_id) countNormalPropulsion, ifnull(sum(evaluation), 0) evaluationNormalPropulsion
|
|
|
from pm_demand
|
|
|
- where project_status != '17'
|
|
|
- and (real_demand_commit_time > plan_demand_sub_time
|
|
|
+ where purchase_dept_id = #{purchaseDeptId}
|
|
|
+ AND project_status != '17'
|
|
|
+ and (real_demand_commit_time > plan_demand_sub_time
|
|
|
or real_purchase_finish_time > plan_purchase_finish_time
|
|
|
or real_deliver_time > plan_deliver_time)
|
|
|
</select>
|
|
@@ -251,7 +285,8 @@
|
|
|
resultType="java.util.Map">
|
|
|
select count(demand_id) countIncomplete, ifnull(sum(evaluation), 0) evaluationIncomplete
|
|
|
from pm_demand
|
|
|
- where project_status in (4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14)
|
|
|
+ where purchase_dept_id = #{purchaseDeptId}
|
|
|
+ AND project_status in (4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14)
|
|
|
</select>
|
|
|
|
|
|
<select id="selectMinYear" resultType="java.lang.Integer">
|
|
@@ -261,88 +296,134 @@
|
|
|
|
|
|
<select id="selectpurchaseProjectCompleteNumberYear" 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.plan_demand_sub_time) yy, ifnull(sum(b.contract_amount), 0) contractAmount
|
|
|
+ select count(a.demand_id) countNum,
|
|
|
+ ifnull(sum(a.evaluation), 0) evaluation,
|
|
|
+ year(a.plan_demand_sub_time) yy,
|
|
|
+ ifnull(sum(b.contract_amount), 0) contractAmount
|
|
|
from (
|
|
|
- select evaluation, plan_demand_sub_time, demand_id from pm_demand where project_status = '17'
|
|
|
- ) a left join (
|
|
|
- select contract_amount, demand_id from pm_contract_info
|
|
|
+ select evaluation, plan_demand_sub_time, demand_id
|
|
|
+ from pm_demand
|
|
|
+ where purchase_dept_id = #{purchaseDeptId}
|
|
|
+ AND project_status = '17'
|
|
|
+ ) a
|
|
|
+ left join (
|
|
|
+ select contract_amount, demand_id
|
|
|
+ from pm_contract_info
|
|
|
) b on a.demand_id = b.demand_id
|
|
|
+
|
|
|
group by year(plan_demand_sub_time)
|
|
|
</select>
|
|
|
|
|
|
<select id="selectpurchaseProjectCompleteNumberQuarter" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
|
|
|
resultType="java.util.Map">
|
|
|
- select ifnull(sum(a.evaluation), 0) evaluation, quarter(a.plan_demand_sub_time) yy, ifnull(sum(b.contract_amount), 0) contractAmount
|
|
|
+ select ifnull(sum(a.evaluation), 0) evaluation,
|
|
|
+ quarter(a.plan_demand_sub_time) yy,
|
|
|
+ ifnull(sum(b.contract_amount), 0) contractAmount
|
|
|
from (
|
|
|
- select evaluation, plan_demand_sub_time, demand_id from pm_demand
|
|
|
- where project_status = '17' and year(plan_demand_sub_time) = year(NOW())
|
|
|
- ) a left join (
|
|
|
- select contract_amount, demand_id from pm_contract_info
|
|
|
+ select evaluation, plan_demand_sub_time, demand_id
|
|
|
+ from pm_demand
|
|
|
+ where purchase_dept_id = #{purchaseDeptId}
|
|
|
+ AND project_status = '17'
|
|
|
+ and year(plan_demand_sub_time) = year(NOW())
|
|
|
+ ) a
|
|
|
+ left join (
|
|
|
+ select contract_amount, demand_id
|
|
|
+ from pm_contract_info
|
|
|
) b on a.demand_id = b.demand_id
|
|
|
group by concat(Year(a.plan_demand_sub_time), quarter(a.plan_demand_sub_time))
|
|
|
</select>
|
|
|
|
|
|
<select id="selectpurchaseProjectCompleteNumberMonth" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
|
|
|
resultType="java.util.Map">
|
|
|
- select ifnull(sum(a.evaluation), 0) evaluation, date_format(plan_demand_sub_time, '%m') yy, ifnull(sum(b.contract_amount), 0) contractAmount
|
|
|
+ select ifnull(sum(a.evaluation), 0) evaluation,
|
|
|
+ date_format(plan_demand_sub_time, '%m') yy,
|
|
|
+ ifnull(sum(b.contract_amount), 0) contractAmount
|
|
|
from (
|
|
|
- select evaluation, plan_demand_sub_time, demand_id from pm_demand
|
|
|
- where project_status = '17' and year (plan_demand_sub_time) = year(NOW())
|
|
|
- ) a left join (
|
|
|
- select contract_amount, demand_id from pm_contract_info
|
|
|
+ select evaluation, plan_demand_sub_time, demand_id
|
|
|
+ from pm_demand
|
|
|
+ where purchase_dept_id = #{purchaseDeptId}
|
|
|
+ AND project_status = '17'
|
|
|
+ and year(plan_demand_sub_time) = year(NOW())
|
|
|
+ ) a
|
|
|
+ left join (
|
|
|
+ select contract_amount, demand_id
|
|
|
+ from pm_contract_info
|
|
|
) b on a.demand_id = b.demand_id
|
|
|
group by date_format(a.plan_demand_sub_time, '%y%m')
|
|
|
</select>
|
|
|
|
|
|
<select id="selectPurchaseTaskFinishYear" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
|
|
|
resultType="java.util.Map">
|
|
|
- select count(demand_id) countNum, ifnull(sum(a.evaluation), 0) evaluation, year(a.plan_demand_sub_time) yy, ifnull(sum(b.contract_amount), 0) contractAmount
|
|
|
+ select count(demand_id) countNum,
|
|
|
+ ifnull(sum(a.evaluation), 0) evaluation,
|
|
|
+ year(a.plan_demand_sub_time) yy,
|
|
|
+ ifnull(sum(b.contract_amount), 0) contractAmount
|
|
|
from (
|
|
|
- select evaluation, plan_demand_sub_time, demand_id from pm_demand where project_status in (15, 16, 17)
|
|
|
- ) a left join (
|
|
|
- select contract_amount, demand_id from pm_contract_info
|
|
|
+ select evaluation, plan_demand_sub_time, demand_id
|
|
|
+ from pm_demand
|
|
|
+ where purchase_dept_id = #{purchaseDeptId}
|
|
|
+ AND project_status in (15, 16, 17)
|
|
|
+ ) a
|
|
|
+ left join (
|
|
|
+ select contract_amount, demand_id
|
|
|
+ from pm_contract_info
|
|
|
) b on a.demand_id = b.demand_id
|
|
|
- group by year (a.plan_demand_sub_time)
|
|
|
+ group by year(a.plan_demand_sub_time)
|
|
|
</select>
|
|
|
|
|
|
<select id="selectPurchaseTaskFinishQuarter" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
|
|
|
resultType="java.util.Map">
|
|
|
- select ifnull(sum(a.evaluation), 0) evaluation, quarter(a.plan_demand_sub_time) yy, ifnull(sum(b.contract_amount), 0) contractAmount
|
|
|
+ select ifnull(sum(a.evaluation), 0) evaluation,
|
|
|
+ quarter(a.plan_demand_sub_time) yy,
|
|
|
+ ifnull(sum(b.contract_amount), 0) contractAmount
|
|
|
from (
|
|
|
- select evaluation, plan_demand_sub_time, demand_id from pm_demand
|
|
|
- where project_status in (15, 16, 17) and year (plan_demand_sub_time) = year(NOW())
|
|
|
- ) a left join (
|
|
|
- select contract_amount, demand_id from pm_contract_info
|
|
|
+ select evaluation, plan_demand_sub_time, demand_id
|
|
|
+ from pm_demand
|
|
|
+ where purchase_dept_id = #{purchaseDeptId}
|
|
|
+ AND project_status in (15, 16, 17)
|
|
|
+ and year(plan_demand_sub_time) = year(NOW())
|
|
|
+ ) a
|
|
|
+ left join (
|
|
|
+ select contract_amount, demand_id
|
|
|
+ from pm_contract_info
|
|
|
) b on a.demand_id = b.demand_id
|
|
|
- group by concat(Year (a.plan_demand_sub_time), quarter(a.plan_demand_sub_time))
|
|
|
+ group by concat(Year(a.plan_demand_sub_time), quarter(a.plan_demand_sub_time))
|
|
|
</select>
|
|
|
|
|
|
<select id="selectPurchaseTaskFinishMonth" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
|
|
|
resultType="java.util.Map">
|
|
|
- select ifnull(sum(a.evaluation), 0) evaluation, date_format(plan_demand_sub_time, '%m') yy, ifnull(sum(b.contract_amount), 0) contractAmount
|
|
|
+ select ifnull(sum(a.evaluation), 0) evaluation,
|
|
|
+ date_format(plan_demand_sub_time, '%m') yy,
|
|
|
+ ifnull(sum(b.contract_amount), 0) contractAmount
|
|
|
from (
|
|
|
- select evaluation, plan_demand_sub_time, demand_id from pm_demand
|
|
|
- where project_status in (15, 16, 17) and year (plan_demand_sub_time) = year(NOW())
|
|
|
- ) a left join (
|
|
|
- select contract_amount, demand_id from pm_contract_info
|
|
|
+ select evaluation, plan_demand_sub_time, demand_id
|
|
|
+ from pm_demand
|
|
|
+ where purchase_dept_id = #{purchaseDeptId}
|
|
|
+ AND project_status in (15, 16, 17)
|
|
|
+ and year(plan_demand_sub_time) = year(NOW())
|
|
|
+ ) a
|
|
|
+ left join (
|
|
|
+ select contract_amount, demand_id
|
|
|
+ from pm_contract_info
|
|
|
) b on a.demand_id = b.demand_id
|
|
|
group by date_format(a.plan_demand_sub_time, '%y%m')
|
|
|
</select>
|
|
|
|
|
|
- <select id="countProjectExceedAndMajor" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
|
|
|
+ <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
|
|
|
FROM `pm_demand`
|
|
|
WHERE (real_demand_commit_time > plan_demand_sub_time
|
|
|
or real_purchase_finish_time > plan_purchase_finish_time
|
|
|
or real_deliver_time > plan_deliver_time)
|
|
|
AND find_in_set('1', project_attr)
|
|
|
- and DATE_FORMAT(create_time, '%Y') = YEAR (NOW())
|
|
|
+ and DATE_FORMAT(create_time, '%Y') = YEAR(NOW())
|
|
|
</select>
|
|
|
|
|
|
<select id="purchaseProjectDistribution" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
|
|
|
resultType="java.util.Map">
|
|
|
- select count(demand_id) countNumber from pm_demand where project_status in
|
|
|
+ select count(demand_id) countNumber from pm_demand where purchase_dept_id=#{purchaseDeptId} AND project_status
|
|
|
+ in
|
|
|
<foreach item="item" collection="projectStatusList" separator="," open="(" close=")">
|
|
|
#{item}
|
|
|
</foreach>
|
|
@@ -352,14 +433,16 @@
|
|
|
resultType="java.util.Map">
|
|
|
select count(demand_id) countNum, ifnull(sum(evaluation), 0) evaluationSum, year(plan_demand_sub_time) yy
|
|
|
from pm_demand
|
|
|
- group by year (plan_demand_sub_time)
|
|
|
+ where purchase_dept_id = #{purchaseDeptId}
|
|
|
+ group by year(plan_demand_sub_time)
|
|
|
</select>
|
|
|
|
|
|
<select id="purchaseProjectNumberAnalysisQuarter" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
|
|
|
resultType="java.util.Map">
|
|
|
select count(demand_id) countNum, ifnull(sum(evaluation), 0) evaluationSum, quarter(plan_demand_sub_time) yy
|
|
|
from pm_demand
|
|
|
- where year (plan_demand_sub_time) = year (NOW())
|
|
|
+ where purchase_dept_id = #{purchaseDeptId}
|
|
|
+ AND year(plan_demand_sub_time) = year(NOW())
|
|
|
group by concat(Year(plan_demand_sub_time), quarter(plan_demand_sub_time))
|
|
|
</select>
|
|
|
|
|
@@ -367,27 +450,30 @@
|
|
|
resultType="java.util.Map">
|
|
|
select count(demand_id) countNum, ifnull(sum(evaluation), 0) evaluationSum, quarter(plan_demand_sub_time) yy
|
|
|
from pm_demand
|
|
|
- where year(plan_demand_sub_time) = year(NOW() - 1)
|
|
|
+ where purchase_dept_id = #{purchaseDeptId}
|
|
|
+ AND year(plan_demand_sub_time) = year(NOW() - 1)
|
|
|
group by concat(Year(plan_demand_sub_time), quarter(plan_demand_sub_time))
|
|
|
</select>
|
|
|
|
|
|
<select id="purchaseProjectNumberAnalysisMonth" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
|
|
|
resultType="java.util.Map">
|
|
|
- select count(demand_id) countNum,
|
|
|
- ifnull(sum(evaluation), 0) evaluationSum,
|
|
|
+ select count(demand_id) countNum,
|
|
|
+ ifnull(sum(evaluation), 0) evaluationSum,
|
|
|
date_format(plan_demand_sub_time, '%m') yy
|
|
|
from pm_demand
|
|
|
- where year (plan_demand_sub_time) = year(NOW())
|
|
|
+ where purchase_dept_id = #{purchaseDeptId}
|
|
|
+ AND year(plan_demand_sub_time) = year(NOW())
|
|
|
group by date_format(plan_demand_sub_time, '%y%m')
|
|
|
</select>
|
|
|
|
|
|
<select id="purchaseProjectNumberAnalysisOldYearMonth" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
|
|
|
resultType="java.util.Map">
|
|
|
- select count(demand_id) countNum,
|
|
|
- ifnull(sum(evaluation), 0) evaluationSum,
|
|
|
+ select count(demand_id) countNum,
|
|
|
+ ifnull(sum(evaluation), 0) evaluationSum,
|
|
|
date_format(plan_demand_sub_time, '%m') yy
|
|
|
from pm_demand
|
|
|
- where year(plan_demand_sub_time) = year(NOW() - 1)
|
|
|
+ where purchase_dept_id = #{purchaseDeptId}
|
|
|
+ AND year(plan_demand_sub_time) = year(NOW() - 1)
|
|
|
group by date_format(plan_demand_sub_time, '%y%m')
|
|
|
</select>
|
|
|
</mapper>
|