|
@@ -29,17 +29,25 @@
|
|
|
resultType="java.util.Map">
|
|
|
select count(demand_id) countId
|
|
|
from pm_demand
|
|
|
- WHERE purchase_dept_id = #{purchaseDeptId}
|
|
|
+ WHERE purchase_dept_id in
|
|
|
+ <foreach collection="vo.deptList" item="item" index="index"
|
|
|
+ separator="," open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
</select>
|
|
|
|
|
|
<select id="purchaseProjectStatisticalYWC" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
|
|
|
resultType="java.util.Map">
|
|
|
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'
|
|
|
+ LEFT JOIN pm_contract_info c
|
|
|
+ ON d.demand_id = c.demand_id
|
|
|
+ AND d.purchase_dept_id in
|
|
|
+ <foreach collection="vo.deptList" item="item" index="index"
|
|
|
+ separator="," open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ AND d.project_status = '17'
|
|
|
</select>
|
|
|
|
|
|
<select id="purchaseProjectStatisticalXCJ" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
|
|
@@ -47,9 +55,13 @@
|
|
|
-- DATE_FORMAT(plan_demand_sub_time,'%Y')
|
|
|
select count(demand_id) countXCJ, ifnull(sum(evaluation), 0) evaluationXCJ
|
|
|
from pm_demand
|
|
|
- where purchase_dept_id = #{purchaseDeptId}
|
|
|
- AND project_status != '17'
|
|
|
- and year(plan_demand_sub_time) = year(NOW())
|
|
|
+ where purchase_dept_id in
|
|
|
+ <foreach collection="vo.deptList" item="item" index="index"
|
|
|
+ separator="," open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ AND project_status != '17'
|
|
|
+ and year(plan_demand_sub_time) = year(NOW())
|
|
|
</select>
|
|
|
|
|
|
<select id="purchaseProjectStatisticalQNWC" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
|
|
@@ -57,17 +69,25 @@
|
|
|
-- DATE_FORMAT(plan_demand_sub_time,'%Y')
|
|
|
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'
|
|
|
+ LEFT JOIN pm_contract_info c
|
|
|
+ ON d.demand_id = c.demand_id
|
|
|
+ AND d.purchase_dept_id in
|
|
|
+ <foreach collection="vo.deptList" item="item" index="index"
|
|
|
+ separator="," open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ 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, ifnull(sum(evaluation), 0) evaluationTotal
|
|
|
FROM `pm_demand`
|
|
|
- WHERE purchase_dept_id = #{purchaseDeptId}
|
|
|
+ WHERE purchase_dept_id in
|
|
|
+ <foreach collection="vo.deptList" item="item" index="index"
|
|
|
+ separator="," open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
GROUP BY project_status
|
|
|
</select>
|
|
|
|
|
@@ -75,7 +95,11 @@
|
|
|
resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
|
|
|
SELECT purchase_mode columnName, COUNT(demand_id) num, ifnull(sum(evaluation), 0) evaluationTotal
|
|
|
FROM `pm_demand`
|
|
|
- WHERE purchase_dept_id = #{purchaseDeptId}
|
|
|
+ WHERE purchase_dept_id in
|
|
|
+ <foreach collection="vo.deptList" item="item" index="index"
|
|
|
+ separator="," open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
GROUP BY purchase_mode
|
|
|
</select>
|
|
|
|
|
@@ -83,52 +107,76 @@
|
|
|
resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
|
|
|
SELECT COUNT(demand_id) num, ifnull(sum(evaluation), 0) evaluationTotal
|
|
|
FROM `pm_demand`
|
|
|
- WHERE purchase_dept_id = #{purchaseDeptId}
|
|
|
- AND evaluation < #{evaluation}
|
|
|
+ WHERE purchase_dept_id in
|
|
|
+ <foreach collection="vo.deptList" item="item" index="index"
|
|
|
+ separator="," open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ AND evaluation < #{evaluation}
|
|
|
</select>
|
|
|
|
|
|
<select id="countByEvaluationBet" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
|
|
|
resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
|
|
|
SELECT COUNT(demand_id) num, ifnull(sum(evaluation), 0) evaluationTotal
|
|
|
FROM `pm_demand`
|
|
|
- WHERE purchase_dept_id = #{purchaseDeptId}
|
|
|
- AND evaluation BETWEEN #{evaluation} and #{evaluationEnd}
|
|
|
+ WHERE purchase_dept_id in
|
|
|
+ <foreach collection="vo.deptList" item="item" index="index"
|
|
|
+ separator="," open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ 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, ifnull(sum(evaluation), 0) evaluationTotal
|
|
|
FROM `pm_demand`
|
|
|
- WHERE purchase_dept_id = #{purchaseDeptId}
|
|
|
- AND evaluation > #{evaluation}
|
|
|
+ WHERE purchase_dept_id in
|
|
|
+ <foreach collection="vo.deptList" item="item" index="index"
|
|
|
+ separator="," open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ AND evaluation > #{evaluation}
|
|
|
</select>
|
|
|
|
|
|
<select id="countProjectExceed" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
|
|
|
resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
|
|
|
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
|
|
|
- or real_purchase_finish_time > plan_purchase_finish_time
|
|
|
- or real_deliver_time > plan_deliver_time)
|
|
|
- and DATE_FORMAT(create_time, '%Y') = YEAR(NOW())
|
|
|
+ WHERE purchase_dept_id in
|
|
|
+ <foreach collection="vo.deptList" item="item" index="index"
|
|
|
+ separator="," open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ 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())
|
|
|
</select>
|
|
|
|
|
|
<select id="countThisYear" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
|
|
|
resultType="java.lang.Integer">
|
|
|
SELECT COUNT(demand_id) num
|
|
|
FROM `pm_demand`
|
|
|
- WHERE purchase_dept_id = #{purchaseDeptId}
|
|
|
- AND DATE_FORMAT(create_time, '%Y') = YEAR(NOW())
|
|
|
+ WHERE purchase_dept_id in
|
|
|
+ <foreach collection="vo.deptList" item="item" index="index"
|
|
|
+ separator="," open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ AND DATE_FORMAT(create_time, '%Y') = YEAR(NOW())
|
|
|
</select>
|
|
|
|
|
|
<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 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)
|
|
|
+ WHERE purchase_dept_id in
|
|
|
+ <foreach collection="vo.deptList" item="item" index="index"
|
|
|
+ separator="," open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ 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>
|
|
@@ -137,14 +185,18 @@
|
|
|
resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
|
|
|
SELECT DATE_FORMAT(create_time, '%Y-%m') columnName, COUNT(demand_id) num
|
|
|
FROM `pm_demand`
|
|
|
- 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 DATE_FORMAT(create_time
|
|
|
- , '%Y') = #{year}
|
|
|
+ WHERE purchase_dept_id in
|
|
|
+ <foreach collection="vo.deptList" item="item" index="index"
|
|
|
+ separator="," open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ 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 DATE_FORMAT(create_time
|
|
|
+ , '%Y') = #{year}
|
|
|
GROUP BY DATE_FORMAT(create_time, '%Y-%m')
|
|
|
</select>
|
|
|
|
|
@@ -152,22 +204,30 @@
|
|
|
resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
|
|
|
SELECT DATE_FORMAT(create_time, '%Y-${quarter}季度') columnName, COUNT(demand_id) num
|
|
|
FROM `pm_demand`
|
|
|
- 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}
|
|
|
+ WHERE purchase_dept_id in
|
|
|
+ <foreach collection="vo.deptList" item="item" index="index"
|
|
|
+ separator="," open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ 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" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
|
|
|
resultType="com.ozs.pm.doman.PmDemand">
|
|
|
SELECT *
|
|
|
FROM `pm_demand`
|
|
|
- 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)
|
|
|
+ WHERE purchase_dept_id in
|
|
|
+ <foreach collection="vo.deptList" item="item" index="index"
|
|
|
+ separator="," open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ 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>
|
|
|
|
|
@@ -175,21 +235,29 @@
|
|
|
resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
|
|
|
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)
|
|
|
- AND `project_status` = #{projectStatus}
|
|
|
- AND DATE_FORMAT(create_time, '%Y') = year(now())
|
|
|
+ WHERE purchase_dept_id in
|
|
|
+ <foreach collection="vo.deptList" item="item" index="index"
|
|
|
+ separator="," open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ 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, ifnull(sum(evaluation), 0) evaluationTotal
|
|
|
FROM `pm_demand`
|
|
|
- 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())
|
|
|
+ WHERE purchase_dept_id in
|
|
|
+ <foreach collection="vo.deptList" item="item" index="index"
|
|
|
+ separator="," open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ 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())
|
|
|
</select>
|
|
|
|
|
|
<select id="taskQuantityYear" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
|
|
@@ -218,9 +286,13 @@
|
|
|
resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
|
|
|
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)
|
|
|
- and DATE_FORMAT(create_time, '%Y') = YEAR(NOW())
|
|
|
+ WHERE purchase_dept_id in
|
|
|
+ <foreach collection="vo.deptList" item="item" index="index"
|
|
|
+ separator="," open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ AND `project_status` IN (9, 10, 11, 12, 13, 14)
|
|
|
+ and DATE_FORMAT(create_time, '%Y') = YEAR(NOW())
|
|
|
GROUP BY project_status
|
|
|
</select>
|
|
|
|
|
@@ -240,20 +312,29 @@
|
|
|
|
|
|
<select id="countMajorProjectLastYear" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
|
|
|
resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
|
|
|
- # AND find_in_set('1', project_attr)
|
|
|
+ # 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
|
|
|
+ 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 in
|
|
|
+ <foreach collection="vo.deptList" item="item" index="index"
|
|
|
+ separator="," open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ AND DATE_FORMAT(d.create_time, '%Y') = YEAR(NOW()) - 1
|
|
|
</select>
|
|
|
|
|
|
<select id="countProjectMajorByYear" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
|
|
|
SELECT DATE_FORMAT(create_time, '%Y') columnName, COUNT(demand_id) num
|
|
|
FROM `pm_demand`
|
|
|
- WHERE find_in_set('1', project_attr)
|
|
|
+ WHERE purchase_dept_id in
|
|
|
+ <foreach collection="vo.deptList" item="item" index="index"
|
|
|
+ separator="," open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ AND find_in_set('1', project_attr)
|
|
|
GROUP BY DATE_FORMAT(create_time, '%Y')
|
|
|
order by create_time asc
|
|
|
</select>
|
|
@@ -261,18 +342,26 @@
|
|
|
<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 purchase_dept_id = #{purchaseDeptId}
|
|
|
- AND find_in_set('1', project_attr)
|
|
|
+ WHERE purchase_dept_id in
|
|
|
+ <foreach collection="vo.deptList" item="item" index="index"
|
|
|
+ separator="," open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ 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 purchase_dept_id = #{purchaseDeptId}
|
|
|
- AND find_in_set('1', project_attr)
|
|
|
- and QUARTER(create_time) = #{quarter}
|
|
|
- AND DATE_FORMAT(create_time, '%Y') = #{year}
|
|
|
+ WHERE purchase_dept_id in
|
|
|
+ <foreach collection="vo.deptList" item="item" index="index"
|
|
|
+ separator="," open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ AND find_in_set('1', project_attr)
|
|
|
+ and QUARTER(create_time) = #{quarter}
|
|
|
+ AND DATE_FORMAT(create_time, '%Y') = #{year}
|
|
|
</select>
|
|
|
|
|
|
<!-- 正常推荐项目 -->
|
|
@@ -280,19 +369,27 @@
|
|
|
resultType="java.util.Map">
|
|
|
select count(demand_id) countNormalPropulsion, ifnull(sum(evaluation), 0) evaluationNormalPropulsion
|
|
|
from pm_demand
|
|
|
- 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)
|
|
|
+ where purchase_dept_id in
|
|
|
+ <foreach collection="vo.deptList" item="item" index="index"
|
|
|
+ separator="," open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ 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>
|
|
|
|
|
|
<select id="purchaseProjectExecuteIncomplete" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
|
|
|
resultType="java.util.Map">
|
|
|
select count(demand_id) countIncomplete, ifnull(sum(evaluation), 0) evaluationIncomplete
|
|
|
from pm_demand
|
|
|
- where purchase_dept_id = #{purchaseDeptId}
|
|
|
- AND project_status in (4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14)
|
|
|
+ where purchase_dept_id in
|
|
|
+ <foreach collection="vo.deptList" item="item" index="index"
|
|
|
+ separator="," open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ AND project_status in (4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14)
|
|
|
</select>
|
|
|
|
|
|
<select id="selectMinYear" resultType="java.lang.Integer">
|
|
@@ -302,19 +399,23 @@
|
|
|
|
|
|
<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 purchase_dept_id = #{purchaseDeptId}
|
|
|
- AND 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 in
|
|
|
+ <foreach collection="vo.deptList" item="item" index="index"
|
|
|
+ separator="," open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ 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)
|
|
@@ -322,95 +423,115 @@
|
|
|
|
|
|
<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 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
|
|
|
+ select evaluation, plan_demand_sub_time, demand_id
|
|
|
+ from pm_demand
|
|
|
+ where purchase_dept_id in
|
|
|
+ <foreach collection="vo.deptList" item="item" index="index"
|
|
|
+ separator="," open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ 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 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
|
|
|
+ select evaluation, plan_demand_sub_time, demand_id
|
|
|
+ from pm_demand
|
|
|
+ where purchase_dept_id in
|
|
|
+ <foreach collection="vo.deptList" item="item" index="index"
|
|
|
+ separator="," open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ 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(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 purchase_dept_id = #{purchaseDeptId}
|
|
|
- AND 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 in
|
|
|
+ <foreach collection="vo.deptList" item="item" index="index"
|
|
|
+ separator="," open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ 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)
|
|
|
</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 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
|
|
|
+ select evaluation, plan_demand_sub_time, demand_id
|
|
|
+ from pm_demand
|
|
|
+ where purchase_dept_id in
|
|
|
+ <foreach collection="vo.deptList" item="item" index="index"
|
|
|
+ separator="," open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ 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))
|
|
|
</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 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
|
|
|
+ select evaluation, plan_demand_sub_time, demand_id
|
|
|
+ from pm_demand
|
|
|
+ where purchase_dept_id in
|
|
|
+ <foreach collection="vo.deptList" item="item" index="index"
|
|
|
+ separator="," open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ 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>
|
|
@@ -428,8 +549,12 @@
|
|
|
|
|
|
<select id="purchaseProjectDistribution" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
|
|
|
resultType="java.util.Map">
|
|
|
- select count(demand_id) countNumber from pm_demand where purchase_dept_id=#{purchaseDeptId} AND project_status
|
|
|
- in
|
|
|
+ select count(demand_id) countNumber from pm_demand where purchase_dept_id in
|
|
|
+ <foreach collection="vo.deptList" item="item" index="index"
|
|
|
+ separator="," open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ AND project_status in
|
|
|
<foreach item="item" collection="projectStatusList" separator="," open="(" close=")">
|
|
|
#{item}
|
|
|
</foreach>
|
|
@@ -439,7 +564,11 @@
|
|
|
resultType="java.util.Map">
|
|
|
select count(demand_id) countNum, ifnull(sum(evaluation), 0) evaluationSum, year(plan_demand_sub_time) yy
|
|
|
from pm_demand
|
|
|
- where purchase_dept_id = #{purchaseDeptId}
|
|
|
+ where purchase_dept_id in
|
|
|
+ <foreach collection="vo.deptList" item="item" index="index"
|
|
|
+ separator="," open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
group by year(plan_demand_sub_time)
|
|
|
</select>
|
|
|
|
|
@@ -447,8 +576,12 @@
|
|
|
resultType="java.util.Map">
|
|
|
select count(demand_id) countNum, ifnull(sum(evaluation), 0) evaluationSum, quarter(plan_demand_sub_time) yy
|
|
|
from pm_demand
|
|
|
- where purchase_dept_id = #{purchaseDeptId}
|
|
|
- AND year(plan_demand_sub_time) = year(NOW())
|
|
|
+ where purchase_dept_id in
|
|
|
+ <foreach collection="vo.deptList" item="item" index="index"
|
|
|
+ separator="," open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ AND year(plan_demand_sub_time) = year(NOW())
|
|
|
group by concat(Year(plan_demand_sub_time), quarter(plan_demand_sub_time))
|
|
|
</select>
|
|
|
|
|
@@ -456,19 +589,27 @@
|
|
|
resultType="java.util.Map">
|
|
|
select count(demand_id) countNum, ifnull(sum(evaluation), 0) evaluationSum, quarter(plan_demand_sub_time) yy
|
|
|
from pm_demand
|
|
|
- where purchase_dept_id = #{purchaseDeptId}
|
|
|
- AND year(plan_demand_sub_time) = year(NOW() - 1)
|
|
|
+ where purchase_dept_id in
|
|
|
+ <foreach collection="vo.deptList" item="item" index="index"
|
|
|
+ separator="," open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ 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,
|
|
|
- date_format(plan_demand_sub_time, '%m') yy
|
|
|
+ select count(demand_id) countNum,
|
|
|
+ ifnull(sum(evaluation), 0) evaluationSum,
|
|
|
+ date_format(plan_demand_sub_time, '%m') yy
|
|
|
from pm_demand
|
|
|
- where purchase_dept_id = #{purchaseDeptId}
|
|
|
- AND year(plan_demand_sub_time) = year(NOW())
|
|
|
+ where purchase_dept_id in
|
|
|
+ <foreach collection="vo.deptList" item="item" index="index"
|
|
|
+ separator="," open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ AND year(plan_demand_sub_time) = year(NOW())
|
|
|
group by date_format(plan_demand_sub_time, '%y%m')
|
|
|
</select>
|
|
|
|