123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper
- PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.ozs.pm.mapper.PmDemandMapper">
- <select id="selectByDemandIdList" parameterType="java.util.List" resultType="com.ozs.pm.doman.PmDemand">
- select * from pm_demand where demand_id in
- <foreach item="item" collection="demandIdList" separator="," open="(" close=")" index="">
- #{item}
- </foreach>
- </select>
- <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>
- <select id="purchaseProjectStatistical" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
- resultType="java.util.Map">
- select count(demand_id) countId
- from pm_demand
- </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'
- </select>
- <select id="purchaseProjectStatisticalXCJ" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
- resultType="java.util.Map">
- -- 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())
- </select>
- <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 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 project_status columnName, COUNT(demand_id) num, SUM(evaluation) evaluationTotal
- FROM `pm_demand`
- GROUP BY project_status
- </select>
- <select id="countByPurchaseMode" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
- SELECT purchase_mode columnName, COUNT(demand_id) num, SUM(evaluation) evaluationTotal
- FROM `pm_demand`
- GROUP BY purchase_mode
- </select>
- <select id="countByEvaluationLt" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
- SELECT COUNT(demand_id) num, SUM(evaluation) evaluationTotal
- FROM `pm_demand`
- WHERE evaluation < #{evaluation}
- </select>
- <select id="countByEvaluationBet" 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}
- </select>
- <select id="countByEvaluationGt" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo"
- parameterType="java.lang.Integer">
- SELECT COUNT(demand_id) num, SUM(evaluation) evaluationTotal
- FROM `pm_demand`
- WHERE evaluation > #{evaluation}
- </select>
- <select id="countProjectExceed" 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 DATE_FORMAT(create_time, '%Y') = YEAR (NOW())
- </select>
- <select id="countThisYear" resultType="java.lang.Integer">
- SELECT COUNT(demand_id) num
- FROM `pm_demand`
- WHERE DATE_FORMAT(create_time, '%Y') = YEAR (NOW())
- </select>
- <select id="countProjectExceedYear" 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
- 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 DATE_FORMAT(create_time, '%Y-%m') columnName, COUNT(demand_id) num
- 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 MONTH(create_time) = #{month}
- AND DATE_FORMAT(create_time, '%Y') = #{year}
- GROUP BY DATE_FORMAT(create_time, '%Y-%m')
- </select>
- <select id="countProjectExceedQuarter" 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
- 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 *
- 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)
- </select>
- <select id="majorProjectByStatus" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo"
- parameterType="java.lang.String">
- 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())
- </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
- 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" 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())
- </select>
- <select id="taskQuantityLastYear" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo"
- parameterType="java.lang.String">
- SELECT YEAR (NOW()) - 1 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()) - 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())
- 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
- </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>
- <!-- 正常推荐项目 -->
- <select id="purchaseProjectExecuteNormalPropulsion" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
- 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
- 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 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 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 (
- 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="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
- 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
- ) 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
- 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
- ) 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
- 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
- ) 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>
- <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=")">
- #{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
- from pm_demand
- 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, quarter(plan_demand_sub_time) yy
- from pm_demand
- where year (plan_demand_sub_time) = year(NOW())
- 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, date_format(plan_demand_sub_time, '%m') yy
- from pm_demand
- where year(plan_demand_sub_time) = year(NOW())
- group by date_format(plan_demand_sub_time, '%y%m')
- </select>
- </mapper>
|