123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837 |
- <?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 project_status >= 12 and 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 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"
- resultType="java.util.Map">
- select count(demand_id) countId
- from pm_demand
- 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, pm_contract_info c,
- (SELECT COUNT(demand_id) countYWC ,ifnull(sum(evaluation), 0) evaluationTotal FROM pm_demand WHERE
- purchase_dept_id in
- <foreach collection="vo.deptList" item="item" index="index"
- separator="," open="(" close=")">
- #{item}
- </foreach>
- AND project_status =21 ) de
- where 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 =21
- </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 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"
- resultType="java.util.Map">
- -- DATE_FORMAT(plan_demand_sub_time,'%Y')
- select de.countYWC, ifnull(sum(c.contract_amount), 0) evaluationQNWC
- from pm_demand d, pm_contract_info c,
- (SELECT COUNT(demand_id) countYWC ,ifnull(sum(evaluation), 0) evaluationTotal FROM pm_demand WHERE
- purchase_dept_id in
- <foreach collection="vo.deptList" item="item" index="index"
- separator="," open="(" close=")">
- #{item}
- </foreach>
- AND project_status =21 and year(create_time) = year(NOW())-1) de
- WHERE 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 =21 and year(d.create_time) = year(NOW())-1
- </select>
- <select id="countByProjectAttr" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
- resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
- SELECT project_attr columnName, COUNT(demand_id) num, ifnull(sum(evaluation), 0) evaluationTotal
- FROM `pm_demand`
- WHERE purchase_dept_id in
- <foreach collection="vo.deptList" item="item" index="index"
- separator="," open="(" close=")">
- #{item}
- </foreach>
- GROUP BY project_attr
- </select>
- <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, ifnull(sum(evaluation), 0) evaluationTotal
- FROM `pm_demand`
- WHERE purchase_dept_id in
- <foreach collection="vo.deptList" item="item" index="index"
- separator="," open="(" close=")">
- #{item}
- </foreach>
- GROUP BY purchase_mode
- </select>
- <select id="countByEvaluationLt" 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 in
- <foreach collection="vo.deptList" item="item" index="index"
- separator="," open="(" close=")">
- #{item}
- </foreach>
- AND evaluation < #{vo.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 in
- <foreach collection="vo.deptList" item="item" index="index"
- separator="," open="(" close=")">
- #{item}
- </foreach>
- AND evaluation BETWEEN #{vo.evaluation} and #{vo.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 in
- <foreach collection="vo.deptList" item="item" index="index"
- separator="," open="(" close=")">
- #{item}
- </foreach>
- AND evaluation > #{vo.evaluation}
- </select>
- <select id="countProjectExceedThisYear" 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 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 YEAR(create_time) = YEAR(NOW())
- </select>
- <select id="countProjectExceedThisQua" 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 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(NOW())
- </select>
- <select id="countProjectExceedThisMonth" 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 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(NOW())
- </select>
- <select id="countProjectExceedAllNum" 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 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>
- <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 in
- <foreach collection="vo.deptList" item="item" index="index"
- separator="," open="(" close=")">
- #{item}
- </foreach>
- AND YEAR(create_time) = 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 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>
- <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 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) = #{vo.month}
- AND DATE_FORMAT(create_time
- , '%Y') = #{vo.year}
- GROUP BY DATE_FORMAT(create_time, '%Y-%m')
- </select>
- <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 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) = #{vo.quarter}
- AND DATE_FORMAT(create_time, '%Y') = #{vo.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 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>
- <select id="majorProjectByStatus" 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 in
- <foreach collection="vo.deptList" item="item" index="index"
- separator="," open="(" close=")">
- #{item}
- </foreach>
- AND find_in_set('1', project_attr)
- AND `project_status` = #{vo.projectStatus}
- AND YEAR(create_time ) = 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 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 YEAR(create_time ) = YEAR(NOW())
- </select>
- <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 YEAR(create_time) = 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 YEAR(create_time) = YEAR(NOW()) - 1
- </select>
- <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, ifnull(sum(evaluation), 0) evaluationTotal
- 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 (9, 10, 11, 12, 13, 14,15,16,17)
- and YEAR(create_time) = YEAR(NOW())
- GROUP BY project_status
- </select>
- <select id="selectByPlanId" parameterType="java.lang.Long" resultType="com.ozs.pm.doman.PmDemand">
- select *
- from pm_demand
- where plan_id = #{planId} limit 1
- </select>
- <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)
- SELECT YEAR(NOW()) - 1 columnName, de.num, ifnull(sum(c.contract_amount), 0) evaluationContractTotal
- FROM pm_demand d, pm_contract_info c,
- (SELECT COUNT(demand_id) num ,ifnull(sum(evaluation), 0) evaluationTotal FROM pm_demand 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 YEAR(create_time) =YEAR(NOW()) - 1 ) de
- WHERE 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 YEAR(d.create_time) = YEAR(NOW()) - 1
- </select>
- <select id="countProjectMajorByYear" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
- SELECT YEAR(create_time) columnName, COUNT(demand_id) num
- FROM `pm_demand`
- 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 YEAR(create_time)
- 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 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 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 YEAR(create_time) = #{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 purchase_dept_id in
- <foreach collection="vo.deptList" item="item" index="index"
- separator="," open="(" close=")">
- #{item}
- </foreach>
- AND project_status !=21
- 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 in
- <foreach collection="vo.deptList" item="item" index="index"
- separator="," open="(" close=")">
- #{item}
- </foreach>
- AND project_status !=21
- </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(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 in
- <foreach collection="vo.deptList" item="item" index="index"
- separator="," open="(" close=")">
- #{item}
- </foreach>
- AND project_status = '21'
- ) 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
- from (
- 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 = '21'
- 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 purchase_dept_id in
- <foreach collection="vo.deptList" item="item" index="index"
- separator="," open="(" close=")">
- #{item}
- </foreach>
- AND project_status = '21'
- 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
- from (
- 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
- from (
- 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
- from (
- 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>
- <select id="countProjectExceedAndMajor" 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 (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 YEAR(create_time) = 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 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="vo.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, ifnull(sum(evaluation), 0) evaluationSum, year(plan_demand_sub_time) yy
- from pm_demand
- 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>
- <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 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>
- <select id="purchaseProjectNumberAnalysisOldYearQuarter" 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 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
- from pm_demand
- 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>
- <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,
- date_format(plan_demand_sub_time, '%m') yy
- from pm_demand
- 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>
- <select id="selectSTSLastYear" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
- SELECT ifnull(COUNT(demand_id),0)num, ifnull(sum(evaluation),0) evaluationTotal
- 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 (6,7,8,9,10,11,12,13,14,15, 16, 17)
- and YEAR(create_time) = YEAR(NOW())-1
- </select>
- <select id="selectSTSThisYear" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
- SELECT ifnull(COUNT(demand_id),0)num, ifnull(sum(evaluation),0) evaluationTotal
- FROM `pm_demand`
- WHERE purchase_dept_id in
- <foreach collection="vo.deptList" item="item" index="index"
- separator="," open="(" close=")">
- #{item}
- </foreach>
- AND `project_status` > 4
- and YEAR(create_time) = YEAR(NOW())
- </select>
- <select id="selectmeiJiDu" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo"
- parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo">
- SELECT COUNT(demand_id) num, ifnull(sum(evaluation), 0) evaluationTotal
- FROM `pm_demand`
- 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)
- </select>
- <select id="selectByProjectType" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo"
- parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo">
- SELECT project_type columnName, COUNT(demand_id) num, ifnull(sum(evaluation), 0) evaluationTotal
- FROM `pm_demand`
- WHERE purchase_dept_id in
- <foreach collection="vo.deptList" item="item" index="index"
- separator="," open="(" close=")">
- #{item}
- </foreach>
- GROUP BY project_type
- </select>
- <select id="selectSTS" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo"
- parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo">
- SELECT ifnull(COUNT(demand_id),0)num, ifnull(sum(evaluation),0) evaluationTotal
- FROM `pm_demand`
- WHERE purchase_dept_id in
- <foreach collection="vo.deptList" item="item" index="index"
- separator="," open="(" close=")">
- #{item}
- </foreach>
- AND `project_status` > 4
- and YEAR(create_time) = YEAR(NOW())
- </select>
- <select id="selectCGThisMonth" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo"
- parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo">
- SELECT MONTH(NOW()) columnName, de.num, de.evaluationTotal,ifnull(sum(c.contract_amount), 0)
- evaluationContractTotal
- FROM pm_demand d,pm_contract_info c,
- (SELECT COUNT(demand_id) num ,ifnull(sum(evaluation), 0) evaluationTotal FROM pm_demand WHERE purchase_dept_id
- in
- <foreach collection="vo.deptList" item="item" index="index"
- separator="," open="(" close=")">
- #{item}
- </foreach>
- AND project_status > 16 AND MONTH(create_time) =MONTH(NOW()) ) de
- where d.demand_id = c.demand_id and purchase_dept_id in
- <foreach collection="vo.deptList" item="item" index="index"
- separator="," open="(" close=")">
- #{item}
- </foreach>
- AND d.project_status > 16
- AND MONTH(d.create_time) = MONTH(NOW())
- </select>
- <select id="selectCGThisQua" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo"
- parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo">
- SELECT QUARTER(NOW()) columnName, de.num, de.evaluationTotal,ifnull(sum(c.contract_amount), 0)
- evaluationContractTotal
- FROM pm_demand d,pm_contract_info c,
- (SELECT COUNT(demand_id) num ,ifnull(sum(evaluation), 0) evaluationTotal 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 QUARTER(create_time) =QUARTER(NOW()) ) de
- WHERE d.demand_id = c.demand_id and purchase_dept_id in
- <foreach collection="vo.deptList" item="item" index="index"
- separator="," open="(" close=")">
- #{item}
- </foreach>
- AND d.project_status > 17
- AND QUARTER(d.create_time) = QUARTER(NOW())
- </select>
- <select id="selectZJLastYear" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo"
- parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo">
- SELECT YEAR(NOW())-1 columnName, de.num,de.evaluationTotal,ifnull(sum(c.contract_amount), 0)
- evaluationContractTotal
- FROM pm_demand d, pm_contract_info c,
- (SELECT COUNT(demand_id) num ,ifnull(sum(evaluation), 0) evaluationTotal 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 (17,18) AND YEAR(create_time) = YEAR(NOW())-1 ) de
- WHERE d.demand_id = c.demand_id and purchase_dept_id in
- <foreach collection="vo.deptList" item="item" index="index"
- separator="," open="(" close=")">
- #{item}
- </foreach>
- AND d.project_status IN (17,18)
- AND YEAR(d.create_time) = YEAR(NOW())-1
- </select>
- <select id="selectTBThisYear" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo"
- parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo">
- SELECT YEAR(NOW()) columnName, de.num,de.evaluationTotal,ifnull(sum(c.contract_amount), 0)
- evaluationContractTotal
- FROM pm_demand d, pm_contract_info c,
- (SELECT COUNT(demand_id) num ,ifnull(sum(evaluation), 0) evaluationTotal 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(create_time) = YEAR(NOW()) ) de
- WHERE d.demand_id = c.demand_id and purchase_dept_id in
- <foreach collection="vo.deptList" item="item" index="index"
- separator="," open="(" close=")">
- #{item}
- </foreach>
- AND d.project_status > 17
- AND YEAR(d.create_time) = YEAR(NOW())
- </select>
- <select id="selectCCThisYear" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo"
- parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo">
- SELECT YEAR(NOW()) columnName,ifnull(demand_id, 0) num,ifnull(sum(evaluation), 0) evaluationTotal
- FROM pm_demand
- WHERE purchase_dept_id in
- <foreach collection="vo.deptList" item="item" index="index"
- separator="," open="(" close=")">
- #{item}
- </foreach>
- AND real_purchase_finish_time <=plan_purchase_finish_time
- AND DATE_FORMAT(create_time, '%Y') = YEAR(NOW())
- </select>
- </mapper>
|