|
@@ -140,7 +140,7 @@
|
|
|
AND DATE_FORMAT(create_time, '%Y') = year (now())
|
|
|
</select>
|
|
|
|
|
|
- <select id="countProjectExceedAndMajor" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
|
|
|
+ <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
|
|
@@ -168,21 +168,60 @@
|
|
|
, project_attr)
|
|
|
AND `project_status` = #{code}
|
|
|
and DATE_FORMAT(create_time
|
|
|
- , '%Y') = YEAR (NOW()) - 1
|
|
|
+ , '%Y') = YEAR(NOW()) - 1
|
|
|
</select>
|
|
|
|
|
|
<select id="countEveryStatusNum" 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())
|
|
|
+ and DATE_FORMAT(create_time, '%Y') = YEAR(NOW())
|
|
|
+ GROUP BY project_status
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="countEveryStatusNumTwo" 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 (15, 16, 17)
|
|
|
+ and DATE_FORMAT(create_time, '%Y') = YEAR(NOW())
|
|
|
GROUP BY project_status
|
|
|
</select>
|
|
|
|
|
|
<select id="selectByPlanId" parameterType="java.lang.Integer" resultType="com.ozs.pm.doman.PmDemand">
|
|
|
select *
|
|
|
from pm_demand
|
|
|
- where plan_id = #{planId} limit 1
|
|
|
+ where plan_id = #{planId}
|
|
|
+ limit 1
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="countMajorProjectLastYear" 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
|
|
|
+ </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)
|
|
|
+ GROUP BY DATE_FORMAT(create_time, '%Y')
|
|
|
+ order by create_time asc
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <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)
|
|
|
+ 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)
|
|
|
+ and QUARTER(create_time) = #{quarter}
|
|
|
+ AND DATE_FORMAT(create_time, '%Y') = #{year}
|
|
|
</select>
|
|
|
|
|
|
<!-- 正常推荐项目 -->
|
|
@@ -202,4 +241,58 @@
|
|
|
from pm_demand
|
|
|
where project_status in (4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14)
|
|
|
</select>
|
|
|
+
|
|
|
+ <select id="selectMinYear" resultType="java.lang.Integer">
|
|
|
+ select min(year (plan_demand_sub_time))
|
|
|
+ from pm_demand
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectpurchaseProjectCompleteNumberYear" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
|
|
|
+ resultType="java.util.Map">
|
|
|
+ select 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
|
|
|
+ ) b on a.demand_id = b.demand_id
|
|
|
+ group by year (a.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 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
|
|
|
+ ) 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
|
|
|
+ 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
|
|
|
+ ) 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 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())
|
|
|
+ </select>
|
|
|
</mapper>
|