1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018 |
- <?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 ifnull(COUNT(demand_id), 0) 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 ifnull(COUNT(demand_id), 0) 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">
- select ifnull(COUNT(demand_id), 0) 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(create_time) = year(NOW())
- </select>
- <select id="purchaseProjectStatisticalQNWC" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
- resultType="java.util.Map">
- select de.countYWC, ifnull(sum(c.contract_amount), 0) evaluationQNWC
- from pm_demand d, pm_contract_info c,
- (SELECT ifnull(COUNT(demand_id), 0) 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, ifnull(COUNT(demand_id), 0) num, ifnull(sum(evaluation), 0) evaluationTotal
- FROM `pm_demand`
- <include refid="deptListOrDemandIdAll"/>
- find_in_set(#{vo.projectAttr},project_attr)
- </select>
- <select id="countByTaskAttr" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
- resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
- SELECT project_attr columnName, ifnull(COUNT(demand_id), 0) num, ifnull(sum(evaluation), 0) evaluationTotal
- FROM `pm_demand`
- <include refid="deptListOrDemandIdAll"/>
- find_in_set(#{vo.projectAttr},project_attr)
- AND project_status > #{vo.projectStatus}
- </select>
- <select id="countByPurchaseMode" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
- resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
- SELECT purchase_mode columnName, ifnull(COUNT(demand_id), 0) num, ifnull(sum(evaluation), 0) evaluationTotal
- FROM `pm_demand`
- <if test="(vo.deptList != null and vo.deptList.size != 0) or (vo.demandIdAll != null and vo.demandIdAll.size != 0)">
- <include refid="deptListOrDemandIdAll"/>
- </if>
- purchase_mode=#{vo.purchaseMode}
- AND project_status > #{vo.projectStatus}
- </select>
- <select id="countByEvaluationLt" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
- resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
- SELECT ifnull(COUNT(demand_id), 0) num, ifnull(sum(evaluation), 0) evaluationTotal
- FROM `pm_demand`
- <include refid="deptListOrDemandIdAll"/>
- evaluation < #{vo.evaluation}
- AND project_status > #{vo.projectStatus}
- </select>
- <select id="countByEvaluationBet" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
- resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
- SELECT ifnull(COUNT(demand_id), 0) num, ifnull(sum(evaluation), 0) evaluationTotal
- FROM `pm_demand`
- <include refid="deptListOrDemandIdAll"/>
- evaluation BETWEEN #{vo.evaluation} and #{vo.evaluationEnd}
- AND project_status > #{vo.projectStatus}
- </select>
- <select id="countByEvaluationGt" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
- resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
- SELECT ifnull(COUNT(demand_id), 0) num, ifnull(sum(evaluation), 0) evaluationTotal
- FROM `pm_demand`
- <include refid="deptListOrDemandIdAll"/>
- evaluation > #{vo.evaluation}
- AND project_status > #{vo.projectStatus}
- </select>
- <select id="countProjectExceedThisYear" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
- resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
- SELECT ifnull(COUNT(demand_id), 0) num, ifnull(sum(evaluation), 0) evaluationTotal
- FROM `pm_demand`
- <include refid="deptListOrDemandIdAll"/>
- ((now()> plan_purchase_finish_time and ISNULL(real_purchase_finish_time))
- or (real_purchase_finish_time > plan_purchase_finish_time))
- and YEAR(plan_demand_sub_time) = YEAR(NOW())
- </select>
- <select id="countProjectExceedThisQua" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
- resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
- SELECT ifnull(COUNT(demand_id), 0) num, ifnull(sum(evaluation), 0) evaluationTotal
- FROM `pm_demand`
- <include refid="deptListOrDemandIdAll"/>
- ((now()> plan_purchase_finish_time and ISNULL(real_purchase_finish_time))
- or (real_purchase_finish_time > plan_purchase_finish_time))
- and quarter(plan_demand_sub_time) = quarter(NOW())
- </select>
- <select id="countProjectExceedThisMonth" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
- resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
- SELECT ifnull(COUNT(demand_id), 0) num, ifnull(sum(evaluation), 0) evaluationTotal
- FROM `pm_demand`
- <include refid="deptListOrDemandIdAll"/>
- ((now()> plan_purchase_finish_time and ISNULL(real_purchase_finish_time))
- or (real_purchase_finish_time > plan_purchase_finish_time))
- and MONTH(plan_demand_sub_time) = MONTH(NOW())
- </select>
- <select id="countProjectExceedAllNum" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
- resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
- SELECT ifnull(COUNT(demand_id), 0) num, ifnull(sum(evaluation), 0) evaluationTotal
- FROM `pm_demand`
- <include refid="deptListOrDemandIdAll"/>
- ((now()> plan_purchase_finish_time and ISNULL(real_purchase_finish_time))
- or (real_purchase_finish_time > plan_purchase_finish_time))
- </select>
- <select id="countProjectExceedTZ" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
- 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>
- </select>
- <select id="countThisYear" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
- resultType="java.lang.Integer">
- SELECT ifnull(COUNT(demand_id), 0) 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, ifnull(COUNT(demand_id), 0) 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, ifnull(COUNT(demand_id), 0) 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, ifnull(COUNT(demand_id), 0) 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`
- <include refid="deptListOrDemandIdAll"/>
- ((now()> plan_purchase_finish_time and ISNULL(real_purchase_finish_time))
- or (real_purchase_finish_time > plan_purchase_finish_time))
- </select>
- <sql id="majorProjectByStatus">
- SELECT ifnull(COUNT(demand_id), 0) num, ifnull(sum(evaluation), 0) evaluationTotal
- FROM `pm_demand`
- <include refid="deptListOrDemandIdAll"/>
- find_in_set('1', project_attr)
- </sql>
- <select id="majorProjectByStatusThisMonthSub" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
- resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
- <include refid="majorProjectByStatus"/>
- AND MONTH(plan_demand_sub_time ) = MONTH(now())
- AND project_status > #{vo.projectStatus}
- </select>
- <select id="majorProjectByStatusThisQuaSub" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
- resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
- <include refid="majorProjectByStatus"/>
- AND QUARTER(plan_demand_sub_time ) = QUARTER(now())
- AND project_status > #{vo.projectStatus}
- </select>
- <select id="majorProjectByStatusThisYearSub" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
- resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
- <include refid="majorProjectByStatus"/>
- AND YEAR(plan_demand_sub_time ) = YEAR(now())
- AND project_status > #{vo.projectStatus}
- </select>
- <select id="majorProjectByStatusThisMonthNew" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
- resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
- <include refid="majorProjectByStatus"/>
- AND MONTH(task_release_time ) = MONTH(now())
- AND project_status > #{vo.projectStatus}
- </select>
- <select id="majorProjectByStatusThisQuaNew" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
- resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
- <include refid="majorProjectByStatus"/>
- AND QUARTER(task_release_time ) = QUARTER(now())
- AND project_status > #{vo.projectStatus}
- </select>
- <select id="majorProjectByStatusThisYearNew" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
- resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
- <include refid="majorProjectByStatus"/>
- AND YEAR(task_release_time ) = YEAR(now())
- AND project_status > #{vo.projectStatus}
- </select>
- <select id="majorProjectByStatusThisMonthFi" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
- resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
- <include refid="majorProjectByStatus"/>
- AND MONTH(up_acceptance_time ) = MONTH(now())
- AND project_status >= #{vo.projectStatus}
- </select>
- <select id="majorProjectByStatusThisQuaFi" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
- resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
- <include refid="majorProjectByStatus"/>
- AND QUARTER(up_acceptance_time ) = QUARTER(now())
- AND project_status >= #{vo.projectStatus}
- </select>
- <select id="majorProjectByStatusThisYearFi" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
- resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
- <include refid="majorProjectByStatus"/>
- AND YEAR(up_acceptance_time ) = YEAR(now())
- AND project_status >= #{vo.projectStatus}
- </select>
- <select id="majorProjectByStatusThisMonthFiCGB" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
- resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
- <include refid="majorProjectByStatus"/>
- AND MONTH(plan_demand_sub_time ) = MONTH(now())
- AND project_status > #{vo.projectStatus}
- </select>
- <select id="majorProjectByStatusThisQuaFiCGB" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
- resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
- <include refid="majorProjectByStatus"/>
- AND QUARTER(plan_demand_sub_time ) = QUARTER(now())
- AND project_status > #{vo.projectStatus}
- </select>
- <select id="majorProjectByStatusThisYearFiCGB" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
- resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
- <include refid="majorProjectByStatus"/>
- AND YEAR(plan_demand_sub_time ) = YEAR(now())
- AND project_status > #{vo.projectStatus}
- </select>
- <select id="majorProjectByStatusLastYear" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
- resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
- <include refid="majorProjectByStatus"/>
- AND YEAR(plan_demand_sub_time ) = YEAR(now())-1
- <if test="vo.projectStatusList!=null and vo.projectStatusList.size != 0">
- AND project_status in
- <foreach collection="vo.projectStatusList" item="item" index="index"
- separator="," open="(" close=")">
- #{item}
- </foreach>
- </if>
- </select>
- <select id="majorProjectByStatusToThisYear" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
- resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
- <include refid="majorProjectByStatus"/>
- AND project_status >= #{vo.projectStatus}
- AND YEAR(plan_demand_sub_time ) = YEAR(now())
- </select>
- <select id="majorProjectByStatusWei" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
- resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
- <include refid="majorProjectByStatus"/>
- AND real_purchase_finish_time <plan_purchase_finish_time
- </select>
- <select id="majorProjectByStatusChao" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
- resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
- <include refid="majorProjectByStatus"/>
- AND real_purchase_finish_time >plan_purchase_finish_time
- </select>
- <select id="countMajorProjectExceed" 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 (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, ifnull(COUNT(demand_id), 0) 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, ifnull(COUNT(demand_id), 0) 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, ifnull(COUNT(demand_id), 0) num, ifnull(sum(evaluation), 0) evaluationTotal
- FROM `pm_demand`
- <include refid="deptListOrDemandIdAll"/>
- YEAR(create_time) = YEAR(NOW())
- and `project_status`=#{vo.projectStatus}
- </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 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 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, ifnull(COUNT(demand_id), 0) 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, ifnull(COUNT(demand_id), 0) 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, ifnull(COUNT(demand_id), 0) 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) = #{vo.quarter}
- AND YEAR(create_time) = #{vo.year}
- </select>
- <!-- 正常推进项目 -->
- <select id="purchaseProjectExecuteNormalPropulsion" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
- resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
- select ifnull(COUNT(demand_id), 0) num, ifnull(sum(evaluation), 0) evaluationTotal
- from pm_demand
- <include refid="deptListOrDemandIdAll"/>
- 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="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
- select ifnull(COUNT(demand_id), 0) num, ifnull(sum(evaluation), 0) evaluationTotal
- from pm_demand
- <include refid="deptListOrDemandIdAll"/>
- project_status !=21
- </select>
- <select id="selectMinYear" resultType="java.lang.Integer">
- select ifnull(min(year(create_time)), year(now())) mYear
- 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.create_time) yy,
- ifnull(sum(b.contract_amount), 0) contractAmount
- from (
- select evaluation, create_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(create_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.create_time) yy,
- ifnull(sum(b.contract_amount), 0) contractAmount
- from (
- select evaluation, create_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(create_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.create_time), quarter(a.create_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(create_time, '%m') yy,
- ifnull(sum(b.contract_amount), 0) contractAmount
- from (
- select evaluation, create_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(create_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.create_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.create_time) yy,
- ifnull(sum(b.contract_amount), 0) contractAmount
- from (
- select evaluation, create_time, demand_id
- from pm_demand
- <include refid="deptListOrDemandIdAll"/>
- 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.up_acceptance_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.create_time) yy,
- ifnull(sum(b.contract_amount), 0) contractAmount
- from (
- select evaluation, create_time, demand_id
- from pm_demand
- <include refid="deptListOrDemandIdAll"/>
- project_status in (15, 16, 17)
- and year(up_acceptance_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.up_acceptance_time), quarter(a.up_acceptance_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(create_time, '%m') yy,
- ifnull(sum(b.contract_amount), 0) contractAmount
- from (
- select evaluation, create_time, demand_id
- from pm_demand
- <include refid="deptListOrDemandIdAll"/>
- project_status in (15, 16, 17)
- and year(up_acceptance_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.up_acceptance_time, '%y%m')
- </select>
- <select id="countProjectExceedAndMajor" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
- resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
- SELECT ifnull(COUNT(demand_id), 0) 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 ifnull(count(demand_id), 0) countNumber,ifnull(sum(evaluation), 0) evaluationTotal
- from pm_demand
- <include refid="deptListOrDemandIdAllNoAnd"/>
- <if test="(vo.deptList != null and vo.deptList.size != 0) or (vo.demandIdAll != null and vo.demandIdAll.size != 0)">
- AND
- </if>
- <if test="vo.projectStatusList!=null and vo.projectStatusList.size != 0">
- project_status in
- <foreach collection="vo.projectStatusList" item="item" index="index"
- separator="," open="(" close=")">
- #{item}
- </foreach>
- </if>
- </select>
- <select id="purchaseProjectNumberAnalysisYear" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
- resultType="java.util.Map">
- select ifnull(COUNT(demand_id), 0) countNum, ifnull(sum(evaluation), 0) evaluationSum, year(task_release_time)
- yy
- from pm_demand
- <if test="(vo.deptList != null and vo.deptList.size != 0) or (vo.demandIdAll != null and vo.demandIdAll.size != 0)">
- <include refid="deptListOrDemandIdAllNoAnd"/>
- </if>
- group by year(task_release_time!=null)
- </select>
- <select id="purchaseProjectNumberAnalysisQuarter" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
- resultType="java.util.Map">
- select ifnull(COUNT(demand_id), 0) countNum, ifnull(sum(evaluation), 0) evaluationSum,
- quarter(task_release_time) yy
- from pm_demand
- <include refid="deptListOrDemandIdAll"/>
- year(task_release_time) = year(NOW())
- group by concat(Year(task_release_time), quarter(task_release_time))
- </select>
- <select id="purchaseProjectNumberAnalysisOldYearQuarter" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
- resultType="java.util.Map">
- select ifnull(COUNT(demand_id), 0) countNum, ifnull(sum(evaluation), 0) evaluationSum,
- quarter(task_release_time) yy
- from pm_demand
- <include refid="deptListOrDemandIdAll"/>
- year(task_release_time) = year(NOW() - 1)
- group by concat(Year(task_release_time), quarter(task_release_time))
- </select>
- <select id="purchaseProjectNumberAnalysisMonth" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
- resultType="java.util.Map">
- select ifnull(COUNT(demand_id), 0) countNum,
- ifnull(sum(evaluation), 0) evaluationSum,
- date_format(task_release_time, '%m') yy
- from pm_demand
- <include refid="deptListOrDemandIdAll"/>
- year(task_release_time) = year(NOW())
- group by date_format(task_release_time, '%y%m')
- </select>
- <select id="purchaseProjectNumberAnalysisOldYearMonth" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
- resultType="java.util.Map">
- select ifnull(COUNT(demand_id), 0) countNum,
- ifnull(sum(evaluation), 0) evaluationSum,
- date_format(create_time, '%m') yy
- from pm_demand
- where purchase_dept_id = #{purchaseDeptId}
- AND year(task_release_time) = YEAR(NOW()) - 1
- group by date_format(task_release_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`
- <include refid="deptListOrDemandIdAll"/>
- `project_status` IN (6,7,8,9,10,11,12,13,14,15, 16,
- 17)
- and YEAR(plan_demand_sub_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`
- <include refid="deptListOrDemandIdAll"/>
- `project_status` > 4
- and YEAR(plan_demand_sub_time) = YEAR(NOW())
- </select>
- <select id="selectmeiJiDu" 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`
- <include refid="deptListOrDemandIdAll"/>
- (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, ifnull(COUNT(demand_id), 0) num, ifnull(sum(evaluation), 0) evaluationTotal
- FROM `pm_demand`
- <include refid="deptListOrDemandIdAll"/>
- project_type=#{vo.projectType}
- </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`
- <include refid="deptListOrDemandIdAll"/>
- `project_status` > 4
- and YEAR(plan_demand_sub_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 ifnull(COUNT(demand_id), 0) num ,ifnull(sum(evaluation), 0) evaluationTotal FROM pm_demand
- <include refid="deptListOrDemandIdAll"/>
- project_status > 16 AND MONTH(up_acceptance_time) =MONTH(NOW()) ) de
- <include refid="dDeptListOrDemandIdAll"/>
- d.demand_id = c.demand_id
- AND d.project_status > 16
- AND MONTH(d.up_acceptance_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 ifnull(COUNT(demand_id), 0) num ,ifnull(sum(evaluation), 0) evaluationTotal FROM pm_demand
- <include refid="deptListOrDemandIdAll"/>
- project_status > 17 AND QUARTER(up_acceptance_time) =QUARTER(NOW()) ) de
- <include refid="dDeptListOrDemandIdAll"/>
- d.demand_id = c.demand_id
- AND d.project_status > 17
- AND QUARTER(d.up_acceptance_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 ifnull(COUNT(demand_id), 0) num ,ifnull(sum(evaluation), 0) evaluationTotal FROM pm_demand
- <include refid="deptListOrDemandIdAll"/>
- project_status IN (17,18) AND YEAR(up_acceptance_time) = YEAR(NOW())-1 ) de
- <include refid="dDeptListOrDemandIdAll"/>
- d.demand_id = c.demand_id
- AND d.project_status IN (17,18)
- AND YEAR(d.up_acceptance_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 ifnull(COUNT(demand_id), 0) num ,ifnull(sum(evaluation), 0) evaluationTotal FROM pm_demand
- <include refid="deptListOrDemandIdAll"/>
- project_status > 17 AND YEAR(up_acceptance_time) = YEAR(NOW()) ) de
- <include refid="dDeptListOrDemandIdAll"/>
- d.demand_id = c.demand_id
- AND d.project_status > 17
- AND YEAR(d.up_acceptance_time) = YEAR(NOW())
- </select>
- <select id="selectFInishAll" 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 ifnull(COUNT(demand_id), 0) num ,ifnull(sum(evaluation), 0) evaluationTotal FROM pm_demand
- <include refid="deptListOrDemandIdAll"/>
- project_status > 17 ) de
- <include refid="dDeptListOrDemandIdAll"/>
- d.demand_id = c.demand_id AND d.project_status > 17
- </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(COUNT(demand_id), 0) num,ifnull(sum(evaluation), 0) evaluationTotal
- FROM pm_demand
- <include refid="deptListOrDemandIdAll"/>
- real_purchase_finish_time <=plan_purchase_finish_time
- AND YEAR(up_acceptance_time) = YEAR(NOW())
- </select>
- <sql id="countProjectExceedAndStatus">
- SELECT ifnull(COUNT(demand_id), 0) num,ifnull(sum(evaluation), 0) evaluationTotal
- FROM pm_demand
- <include refid="deptListOrDemandIdAllNoAnd"/>
- <if test="(vo.deptList != null and vo.deptList.size != 0) or (vo.demandIdAll != null and vo.demandIdAll.size != 0)">
- AND
- </if>
- <if test="vo.projectStatusList!=null and vo.projectStatusList.size != 0">
- project_status in
- <foreach collection="vo.projectStatusList" item="item" index="index"
- separator="," open="(" close=")">
- #{item}
- </foreach>
- </if>
- AND real_purchase_finish_time >plan_purchase_finish_time
- </sql>
- <select id="countProjectExceedAndStatus" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo"
- parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo">
- <include refid="countProjectExceedAndStatus"/>
- </select>
- <select id="countBaseAgencyWithWhite" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
- SELECT ifnull(COUNT(id), 0) num
- FROM base_agency
- WHERE status = 0
- </select>
- <select id="JZCGnum" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo"
- parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo">
- SELECT YEAR(NOW()) columnName,ifnull(COUNT(demand_id), 0) num,ifnull(sum(evaluation), 0) evaluationTotal
- FROM pm_demand
- <include refid="deptListOrDemandIdAll"/>
- project_status > 8
- # AND YEAR(create_time) = YEAR(NOW())
- </select>
- <select id="countProjecReaAndStatus" 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
- <include refid="deptListOrDemandIdAllNoAnd"/>
- <if test="(vo.deptList != null and vo.deptList.size != 0) or (vo.demandIdAll != null and vo.demandIdAll.size != 0)">
- AND
- </if>
- <if test="vo.projectStatusList!=null and vo.projectStatusList.size != 0">
- project_status in
- <foreach collection="vo.projectStatusList" item="item" index="index"
- separator="," open="(" close=")">
- #{item}
- </foreach>
- </if>
- and YEAR(create_time) = YEAR(NOW())-1
- </select>
- <select id="countProjectACT_Year" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo"
- parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo">
- SELECT #{vo.year} columnName, de.num, de.evaluationTotal, ifnull(sum(c.contract_amount), 0)
- evaluationContractTotal
- FROM pm_demand d, pm_contract_info c,
- (SELECT ifnull(COUNT(demand_id), 0) num ,ifnull(sum(evaluation), 0) evaluationTotal FROM pm_demand
- <include refid="deptListOrDemandIdAll"/>
- real_purchase_finish_time > plan_purchase_finish_time AND YEAR(create_time)=#{vo.year} ) de
- <include refid="dDeptListOrDemandIdAll"/>
- d.demand_id = c.demand_id AND d.real_purchase_finish_time > d.plan_purchase_finish_time AND
- YEAR(d.create_time)=#{vo.year}
- </select>
- <select id="countProjectACT_Qua" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo"
- parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo">
- SELECT #{vo.year} columnName, de.num, de.evaluationTotal, ifnull(sum(c.contract_amount), 0)
- evaluationContractTotal
- FROM pm_demand d, pm_contract_info c,
- (SELECT ifnull(COUNT(demand_id), 0) num ,ifnull(sum(evaluation), 0) evaluationTotal FROM pm_demand
- <include refid="deptListOrDemandIdAll"/>
- real_purchase_finish_time > plan_purchase_finish_time AND YEAR(create_time)=#{vo.year} AND
- QUARTER(create_time)=#{vo.quarter}) de
- <include refid="dDeptListOrDemandIdAll"/>
- d.demand_id = c.demand_id AND d.real_purchase_finish_time > d.plan_purchase_finish_time AND
- YEAR(d.create_time)=#{vo.year} AND QUARTER(d.create_time)=#{vo.quarter}
- </select>
- <select id="countProjectACT_Mon" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo"
- parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo">
- SELECT #{vo.year} columnName, de.num,
- de.evaluationTotal, ifnull(sum(c.contract_amount), 0)
- evaluationContractTotal
- FROM pm_demand d, pm_contract_info c,
- (SELECT ifnull(COUNT(demand_id), 0) num ,ifnull(sum(evaluation), 0) evaluationTotal FROM pm_demand
- <include refid="deptListOrDemandIdAll"/>
- real_purchase_finish_time > plan_purchase_finish_time AND
- YEAR(create_time)=#{vo.year} AND month(create_time)=#{vo.month}) de
- <include refid="dDeptListOrDemandIdAll"/>
- d.demand_id = c.demand_id AND d.real_purchase_finish_time > d.plan_purchase_finish_time AND
- YEAR(d.create_time)=#{vo.year} AND month(d.create_time)=#{vo.month}
- </select>
- <!-- 统计里查询全部or查询指定部门及下级超额项目-->
- <sql id="deptListOrDemandIdAll">
- WHERE
- <if test="vo.deptList != null and vo.deptList.size != 0 ">
- purchase_dept_id
- in
- <foreach collection="vo.deptList" item="item" index="index"
- separator="," open="(" close=")">
- #{item}
- </foreach>
- </if>
- <if test="(vo.deptList != null and vo.deptList.size != 0) and (vo.demandIdAll != null and vo.demandIdAll.size != 0)">
- AND
- </if>
- <if test="vo.demandIdAll != null and vo.demandIdAll.size != 0 ">
- demand_id
- in
- <foreach collection="vo.demandIdAll" item="item" index="index"
- separator="," open="(" close=")">
- #{item}
- </foreach>
- </if>
- <if test="(vo.deptList != null and vo.deptList.size != 0) or (vo.demandIdAll != null and vo.demandIdAll.size != 0)">
- AND
- </if>
- </sql>
- <sql id="deptListOrDemandIdAllNoAnd">
- WHERE
- <if test="vo.deptList != null and vo.deptList.size != 0 ">
- purchase_dept_id
- in
- <foreach collection="vo.deptList" item="item" index="index"
- separator="," open="(" close=")">
- #{item}
- </foreach>
- </if>
- <if test="(vo.deptList != null and vo.deptList.size != 0) and (vo.demandIdAll != null and vo.demandIdAll.size != 0)">
- AND
- </if>
- <if test="vo.demandIdAll != null and vo.demandIdAll.size != 0 ">
- demand_id
- in
- <foreach collection="vo.demandIdAll" item="item" index="index"
- separator="," open="(" close=")">
- #{item}
- </foreach>
- </if>
- </sql>
- <sql id="dDeptListOrDemandIdAll">
- WHERE
- <if test="vo.deptList != null and vo.deptList.size != 0 ">
- d.purchase_dept_id
- in
- <foreach collection="vo.deptList" item="item" index="index"
- separator="," open="(" close=")">
- #{item}
- </foreach>
- </if>
- <if test="(vo.deptList != null and vo.deptList.size != 0) and (vo.demandIdAll != null and vo.demandIdAll.size != 0)">
- AND
- </if>
- <if test="vo.demandIdAll != null and vo.demandIdAll.size != 0 ">
- d.demand_id
- in
- <foreach collection="vo.demandIdAll" item="item" index="index"
- separator="," open="(" close=")">
- #{item}
- </foreach>
- </if>
- <if test="(vo.deptList != null and vo.deptList.size != 0) or (vo.demandIdAll != null and vo.demandIdAll.size != 0)">
- AND
- </if>
- </sql>
- </mapper>
|