|
@@ -13,18 +13,16 @@
|
|
|
|
|
|
<select id="selectExtractionExpert" parameterType="com.ozs.base.domain.vo.BaseExpertVo"
|
|
|
resultType="com.ozs.pm.doman.PmDemand">
|
|
|
- select * from pm_demand
|
|
|
- <where>
|
|
|
- <if test="projectName != null and projectName != ''">
|
|
|
- and project_name like '%' + #{projectName} + '%'
|
|
|
- </if>
|
|
|
- <if test="startTime != null "><!-- 开始时间检索 -->
|
|
|
- and date_format(plan_demand_sub_time,'%y%m%d') >= date_format(#{startTime},'%y%m%d')
|
|
|
- </if>
|
|
|
- <if test="endTime != null "><!-- 结束时间检索 -->
|
|
|
- and date_format(plan_demand_sub_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d')
|
|
|
- </if>
|
|
|
- </where>
|
|
|
+ select * from pm_demand where demand_id in (select demand_id from pm_demand_expert_ref group by demand_id)
|
|
|
+ <if test="projectName != null and projectName != ''">
|
|
|
+ and project_name like '%' + #{projectName} + '%'
|
|
|
+ </if>
|
|
|
+ <if test="startTime != null "><!-- 开始时间检索 -->
|
|
|
+ and date_format(plan_demand_sub_time,'%y%m%d') >= date_format(#{startTime},'%y%m%d')
|
|
|
+ </if>
|
|
|
+ <if test="endTime != null "><!-- 结束时间检索 -->
|
|
|
+ and date_format(plan_demand_sub_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d')
|
|
|
+ </if>
|
|
|
</select>
|
|
|
|
|
|
<select id="purchaseProjectStatistical" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
|
|
@@ -118,8 +116,10 @@
|
|
|
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 MONTH(create_time) = #{month}
|
|
|
- AND DATE_FORMAT(create_time, '%Y') = #{year}
|
|
|
+ and MONTH (
|
|
|
+ create_time) = #{month}
|
|
|
+ AND DATE_FORMAT(create_time
|
|
|
+ , '%Y') = #{year}
|
|
|
GROUP BY DATE_FORMAT(create_time, '%Y-%m')
|
|
|
</select>
|
|
|
|
|
@@ -179,14 +179,14 @@
|
|
|
, 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>
|
|
|
|
|
@@ -194,7 +194,7 @@
|
|
|
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())
|
|
|
+ and DATE_FORMAT(create_time, '%Y') = YEAR (NOW())
|
|
|
GROUP BY project_status
|
|
|
</select>
|
|
|
|
|
@@ -205,10 +205,12 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="countMajorProjectLastYear" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
|
|
|
- SELECT YEAR(NOW()) - 1 columnName, COUNT(demand_id) num, SUM(evaluation) evaluationTotal
|
|
|
+ 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 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">
|
|
@@ -259,22 +261,31 @@
|
|
|
|
|
|
<select id="selectpurchaseProjectCompleteNumberYear" 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 = '17'
|
|
|
- ) a left join (
|
|
|
+ ) a left join (
|
|
|
select contract_amount, demand_id from pm_contract_info
|
|
|
- ) b on a.demand_id = b.demand_id
|
|
|
+ ) 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())
|
|
|
+ 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
|
|
|
+ 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>
|
|
|
|
|
@@ -287,29 +298,31 @@
|
|
|
select evaluation, plan_demand_sub_time, demand_id
|
|
|
from pm_demand
|
|
|
where project_status = '17'
|
|
|
- and year(plan_demand_sub_time) = year(NOW())
|
|
|
+ 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
|
|
|
+ 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 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
|
|
|
- ) b on a.demand_id = b.demand_id
|
|
|
- group by year(a.plan_demand_sub_time)
|
|
|
+ ) 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"
|
|
@@ -321,13 +334,14 @@
|
|
|
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())
|
|
|
+ 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 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"
|
|
@@ -339,12 +353,13 @@
|
|
|
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())
|
|
|
+ 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
|
|
|
+ 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>
|
|
|
|
|
@@ -355,20 +370,20 @@
|
|
|
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
|
|
|
- <foreach item = "item" collection="projectStatusList" separator="," open="(" close=")">
|
|
|
+ <foreach item="item" collection="projectStatusList" separator="," open="(" close=")">
|
|
|
#{item}
|
|
|
</foreach>
|
|
|
</select>
|
|
|
|
|
|
<select id="purchaseProjectNumberAnalysisYear" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
|
|
|
resultType="java.util.Map">
|
|
|
- select count(demand_id) countNum, year(plan_demand_sub_time) yy
|
|
|
+ select count(demand_id) countNum, year (plan_demand_sub_time) yy
|
|
|
from pm_demand
|
|
|
group by year (plan_demand_sub_time)
|
|
|
</select>
|
|
@@ -377,7 +392,7 @@
|
|
|
resultType="java.util.Map">
|
|
|
select count(demand_id) countNum, quarter(plan_demand_sub_time) yy
|
|
|
from pm_demand
|
|
|
- where year (plan_demand_sub_time) = year(NOW())
|
|
|
+ where year (plan_demand_sub_time) = year (NOW())
|
|
|
group by concat(Year (plan_demand_sub_time), quarter(plan_demand_sub_time))
|
|
|
</select>
|
|
|
|
|
@@ -385,7 +400,7 @@
|
|
|
resultType="java.util.Map">
|
|
|
select count(demand_id) countNum, date_format(plan_demand_sub_time, '%m') yy
|
|
|
from pm_demand
|
|
|
- where year(plan_demand_sub_time) = year(NOW())
|
|
|
+ where year (plan_demand_sub_time) = year (NOW())
|
|
|
group by date_format(plan_demand_sub_time, '%y%m')
|
|
|
</select>
|
|
|
</mapper>
|