PmDemandMapper.xml 47 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.ozs.pm.mapper.PmDemandMapper">
  6. <select id="selectByDemandIdList" parameterType="java.util.List" resultType="com.ozs.pm.doman.PmDemand">
  7. select * from pm_demand where project_status &gt; 12 and demand_id in
  8. <foreach item="item" collection="demandIdList" separator="," open="(" close=")" index="">
  9. #{item}
  10. </foreach>
  11. </select>
  12. <select id="selectExtractionExpert" parameterType="com.ozs.base.domain.vo.BaseExpertVo"
  13. resultType="com.ozs.pm.doman.PmDemand">
  14. select * from pm_demand where demand_id in (select demand_id from pm_demand_expert_ref group by demand_id)
  15. <if test="projectName != null and projectName != ''">
  16. and project_name like '%' + #{projectName} + '%'
  17. </if>
  18. <if test="startTime != null "><!-- 开始时间检索 -->
  19. and date_format(plan_demand_sub_time,'%y%m%d') &gt; date_format(#{startTime},'%y%m%d')
  20. </if>
  21. <if test="endTime != null "><!-- 结束时间检索 -->
  22. and date_format(plan_demand_sub_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')
  23. </if>
  24. </select>
  25. <select id="purchaseProjectStatistical" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  26. resultType="java.util.Map">
  27. select ifnull(COUNT(demand_id), 0) countId
  28. from pm_demand
  29. WHERE purchase_dept_id in
  30. <foreach collection="vo.deptList" item="item" index="index"
  31. separator="," open="(" close=")">
  32. #{item}
  33. </foreach>
  34. </select>
  35. <select id="purchaseProjectStatisticalYWC" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  36. resultType="java.util.Map">
  37. select count(d.demand_id) countYWC, ifnull(sum(c.contract_amount), 0) evaluationYWC
  38. from pm_demand d, pm_contract_info c,
  39. (SELECT ifnull(COUNT(demand_id), 0) countYWC ,ifnull(sum(evaluation), 0) evaluationTotal FROM pm_demand WHERE
  40. purchase_dept_id in
  41. <foreach collection="vo.deptList" item="item" index="index"
  42. separator="," open="(" close=")">
  43. #{item}
  44. </foreach>
  45. AND project_status =21 ) de
  46. where d.demand_id = c.demand_id
  47. AND d.purchase_dept_id in
  48. <foreach collection="vo.deptList" item="item" index="index"
  49. separator="," open="(" close=")">
  50. #{item}
  51. </foreach>
  52. AND d.project_status =21
  53. </select>
  54. <select id="purchaseProjectStatisticalXCJ" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  55. resultType="java.util.Map">
  56. select ifnull(COUNT(demand_id), 0) countXCJ, ifnull(sum(evaluation), 0) evaluationXCJ
  57. from pm_demand
  58. where purchase_dept_id in
  59. <foreach collection="vo.deptList" item="item" index="index"
  60. separator="," open="(" close=")">
  61. #{item}
  62. </foreach>
  63. AND project_status !=17
  64. and year(create_time) = year(NOW())
  65. </select>
  66. <select id="purchaseProjectStatisticalQNWC" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  67. resultType="java.util.Map">
  68. select de.countYWC, ifnull(sum(c.contract_amount), 0) evaluationQNWC
  69. from pm_demand d, pm_contract_info c,
  70. (SELECT ifnull(COUNT(demand_id), 0) countYWC ,ifnull(sum(evaluation), 0) evaluationTotal FROM pm_demand WHERE
  71. purchase_dept_id in
  72. <foreach collection="vo.deptList" item="item" index="index"
  73. separator="," open="(" close=")">
  74. #{item}
  75. </foreach>
  76. AND project_status =21 and year(create_time) = year(NOW())-1) de
  77. WHERE d.demand_id = c.demand_id
  78. AND d.purchase_dept_id in
  79. <foreach collection="vo.deptList" item="item" index="index"
  80. separator="," open="(" close=")">
  81. #{item}
  82. </foreach>
  83. AND d.project_status =21 and year(d.create_time) = year(NOW())-1
  84. </select>
  85. <select id="countByProjectAttr" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  86. resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
  87. SELECT project_attr columnName, ifnull(COUNT(demand_id), 0) num, ifnull(sum(evaluation), 0) evaluationTotal
  88. FROM `pm_demand`
  89. <include refid="deptListOrDemandIdAll"/>
  90. find_in_set(#{vo.projectAttr},project_attr)
  91. </select>
  92. <select id="countByTaskAttr" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  93. resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
  94. SELECT project_attr columnName, ifnull(COUNT(demand_id), 0) num, ifnull(sum(evaluation), 0) evaluationTotal
  95. FROM `pm_demand`
  96. <include refid="deptListOrDemandIdAll"/>
  97. find_in_set(#{vo.projectAttr},project_attr)
  98. AND project_status &gt; #{vo.projectStatus}
  99. </select>
  100. <select id="countByPurchaseMode" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  101. resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
  102. SELECT purchase_mode columnName, ifnull(COUNT(demand_id), 0) num, ifnull(sum(evaluation), 0) evaluationTotal
  103. FROM `pm_demand`
  104. <if test="(vo.deptList != null and vo.deptList.size != 0) or (vo.demandIdAll != null and vo.demandIdAll.size != 0)">
  105. <include refid="deptListOrDemandIdAll"/>
  106. </if>
  107. purchase_mode=#{vo.purchaseMode}
  108. AND project_status &gt; #{vo.projectStatus}
  109. </select>
  110. <select id="countByEvaluationLt" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  111. resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
  112. SELECT ifnull(COUNT(demand_id), 0) num, ifnull(sum(evaluation), 0) evaluationTotal
  113. FROM `pm_demand`
  114. <include refid="deptListOrDemandIdAll"/>
  115. evaluation &lt; #{vo.evaluation}
  116. AND project_status &gt; #{vo.projectStatus}
  117. </select>
  118. <select id="countByEvaluationBet" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  119. resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
  120. SELECT ifnull(COUNT(demand_id), 0) num, ifnull(sum(evaluation), 0) evaluationTotal
  121. FROM `pm_demand`
  122. <include refid="deptListOrDemandIdAll"/>
  123. evaluation BETWEEN #{vo.evaluation} and #{vo.evaluationEnd}
  124. AND project_status &gt; #{vo.projectStatus}
  125. </select>
  126. <select id="countByEvaluationGt" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  127. resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
  128. SELECT ifnull(COUNT(demand_id), 0) num, ifnull(sum(evaluation), 0) evaluationTotal
  129. FROM `pm_demand`
  130. <include refid="deptListOrDemandIdAll"/>
  131. evaluation &gt; #{vo.evaluation}
  132. AND project_status &gt; #{vo.projectStatus}
  133. </select>
  134. <select id="countProjectExceedThisYear" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  135. resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
  136. SELECT ifnull(COUNT(demand_id), 0) num, ifnull(sum(evaluation), 0) evaluationTotal
  137. FROM `pm_demand`
  138. <include refid="deptListOrDemandIdAll"/>
  139. ((now()> plan_purchase_finish_time and ISNULL(real_purchase_finish_time))
  140. or (real_purchase_finish_time > plan_purchase_finish_time))
  141. and YEAR(plan_demand_sub_time) = YEAR(NOW())
  142. </select>
  143. <select id="countProjectExceedThisQua" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  144. resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
  145. SELECT ifnull(COUNT(demand_id), 0) num, ifnull(sum(evaluation), 0) evaluationTotal
  146. FROM `pm_demand`
  147. <include refid="deptListOrDemandIdAll"/>
  148. ((now()> plan_purchase_finish_time and ISNULL(real_purchase_finish_time))
  149. or (real_purchase_finish_time > plan_purchase_finish_time))
  150. and quarter(plan_demand_sub_time) = quarter(NOW())
  151. </select>
  152. <select id="countProjectExceedThisMonth" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  153. resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
  154. SELECT ifnull(COUNT(demand_id), 0) num, ifnull(sum(evaluation), 0) evaluationTotal
  155. FROM `pm_demand`
  156. <include refid="deptListOrDemandIdAll"/>
  157. ((now()> plan_purchase_finish_time and ISNULL(real_purchase_finish_time))
  158. or (real_purchase_finish_time > plan_purchase_finish_time))
  159. and MONTH(plan_demand_sub_time) = MONTH(NOW())
  160. </select>
  161. <select id="countProjectExceedAllNum" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  162. resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
  163. SELECT ifnull(COUNT(demand_id), 0) num, ifnull(sum(evaluation), 0) evaluationTotal
  164. FROM `pm_demand`
  165. <include refid="deptListOrDemandIdAll"/>
  166. ((now()> plan_purchase_finish_time and ISNULL(real_purchase_finish_time))
  167. or (real_purchase_finish_time > plan_purchase_finish_time))
  168. </select>
  169. <select id="countProjectExceedTZ" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  170. resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
  171. SELECT ifnull(COUNT(demand_id), 0) num, ifnull(sum(evaluation), 0) evaluationTotal
  172. FROM `pm_demand`
  173. WHERE purchase_dept_id in
  174. <foreach collection="vo.deptList" item="item" index="index"
  175. separator="," open="(" close=")">
  176. #{item}
  177. </foreach>
  178. </select>
  179. <select id="countThisYear" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  180. resultType="java.lang.Integer">
  181. SELECT ifnull(COUNT(demand_id), 0) num
  182. FROM `pm_demand`
  183. WHERE purchase_dept_id in
  184. <foreach collection="vo.deptList" item="item" index="index"
  185. separator="," open="(" close=")">
  186. #{item}
  187. </foreach>
  188. AND YEAR(create_time) = YEAR(NOW())
  189. </select>
  190. <select id="countProjectExceedYear" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  191. resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
  192. SELECT DATE_FORMAT(create_time, '%Y') columnName, ifnull(COUNT(demand_id), 0) num
  193. FROM `pm_demand`
  194. WHERE purchase_dept_id in
  195. <foreach collection="vo.deptList" item="item" index="index"
  196. separator="," open="(" close=")">
  197. #{item}
  198. </foreach>
  199. AND (real_demand_commit_time > plan_demand_sub_time
  200. or real_purchase_finish_time > plan_purchase_finish_time
  201. or real_deliver_time > plan_deliver_time)
  202. GROUP BY DATE_FORMAT(create_time, '%Y')
  203. order by create_time asc
  204. </select>
  205. <select id="countProjectExceedMonth" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  206. resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
  207. SELECT DATE_FORMAT(create_time, '%Y-%m') columnName, ifnull(COUNT(demand_id), 0) num
  208. FROM `pm_demand`
  209. WHERE purchase_dept_id in
  210. <foreach collection="vo.deptList" item="item" index="index"
  211. separator="," open="(" close=")">
  212. #{item}
  213. </foreach>
  214. AND (real_demand_commit_time > plan_demand_sub_time
  215. or real_purchase_finish_time > plan_purchase_finish_time
  216. or real_deliver_time > plan_deliver_time)
  217. and MONTH(
  218. create_time) = #{vo.month}
  219. AND DATE_FORMAT(create_time
  220. , '%Y') = #{vo.year}
  221. GROUP BY DATE_FORMAT(create_time, '%Y-%m')
  222. </select>
  223. <select id="countProjectExceedQuarter" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  224. resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
  225. SELECT DATE_FORMAT(create_time, '%Y-${quarter}季度') columnName, ifnull(COUNT(demand_id), 0) num
  226. FROM `pm_demand`
  227. WHERE purchase_dept_id in
  228. <foreach collection="vo.deptList" item="item" index="index"
  229. separator="," open="(" close=")">
  230. #{item}
  231. </foreach>
  232. AND (real_demand_commit_time > plan_demand_sub_time
  233. or real_purchase_finish_time > plan_purchase_finish_time
  234. or real_deliver_time > plan_deliver_time)
  235. and QUARTER(create_time) = #{vo.quarter}
  236. AND DATE_FORMAT(create_time, '%Y') = #{vo.year}
  237. </select>
  238. <select id="countProjectExceedAll" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  239. resultType="com.ozs.pm.doman.PmDemand">
  240. SELECT *
  241. FROM `pm_demand`
  242. <include refid="deptListOrDemandIdAll"/>
  243. ((now()> plan_purchase_finish_time and ISNULL(real_purchase_finish_time))
  244. or (real_purchase_finish_time > plan_purchase_finish_time))
  245. </select>
  246. <sql id="majorProjectByStatus">
  247. SELECT ifnull(COUNT(demand_id), 0) num, ifnull(sum(evaluation), 0) evaluationTotal
  248. FROM `pm_demand`
  249. <include refid="deptListOrDemandIdAll"/>
  250. find_in_set('1', project_attr)
  251. </sql>
  252. <select id="majorProjectByStatusThisMonthSub" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  253. resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
  254. <include refid="majorProjectByStatus"/>
  255. AND MONTH(plan_demand_sub_time ) = MONTH(now())
  256. AND project_status &gt; #{vo.projectStatus}
  257. </select>
  258. <select id="majorProjectByStatusThisQuaSub" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  259. resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
  260. <include refid="majorProjectByStatus"/>
  261. AND QUARTER(plan_demand_sub_time ) = QUARTER(now())
  262. AND project_status &gt; #{vo.projectStatus}
  263. </select>
  264. <select id="majorProjectByStatusThisYearSub" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  265. resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
  266. <include refid="majorProjectByStatus"/>
  267. AND YEAR(plan_demand_sub_time ) = YEAR(now())
  268. AND project_status &gt; #{vo.projectStatus}
  269. </select>
  270. <select id="majorProjectByStatusThisMonthNew" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  271. resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
  272. <include refid="majorProjectByStatus"/>
  273. AND MONTH(task_release_time ) = MONTH(now())
  274. AND project_status &gt; #{vo.projectStatus}
  275. </select>
  276. <select id="majorProjectByStatusThisQuaNew" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  277. resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
  278. <include refid="majorProjectByStatus"/>
  279. AND QUARTER(task_release_time ) = QUARTER(now())
  280. AND project_status &gt; #{vo.projectStatus}
  281. </select>
  282. <select id="majorProjectByStatusThisYearNew" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  283. resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
  284. <include refid="majorProjectByStatus"/>
  285. AND YEAR(task_release_time ) = YEAR(now())
  286. AND project_status &gt; #{vo.projectStatus}
  287. </select>
  288. <select id="majorProjectByStatusThisMonthFi" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  289. resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
  290. <include refid="majorProjectByStatus"/>
  291. AND MONTH(up_acceptance_time ) = MONTH(now())
  292. AND project_status &gt;= #{vo.projectStatus}
  293. </select>
  294. <select id="majorProjectByStatusThisQuaFi" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  295. resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
  296. <include refid="majorProjectByStatus"/>
  297. AND QUARTER(up_acceptance_time ) = QUARTER(now())
  298. AND project_status &gt;= #{vo.projectStatus}
  299. </select>
  300. <select id="majorProjectByStatusThisYearFi" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  301. resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
  302. <include refid="majorProjectByStatus"/>
  303. AND YEAR(up_acceptance_time ) = YEAR(now())
  304. AND project_status &gt;= #{vo.projectStatus}
  305. </select>
  306. <select id="majorProjectByStatusThisMonthFiCGB" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  307. resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
  308. <include refid="majorProjectByStatus"/>
  309. AND MONTH(plan_demand_sub_time ) = MONTH(now())
  310. AND project_status &gt; #{vo.projectStatus}
  311. </select>
  312. <select id="majorProjectByStatusThisQuaFiCGB" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  313. resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
  314. <include refid="majorProjectByStatus"/>
  315. AND QUARTER(plan_demand_sub_time ) = QUARTER(now())
  316. AND project_status &gt; #{vo.projectStatus}
  317. </select>
  318. <select id="majorProjectByStatusThisYearFiCGB" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  319. resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
  320. <include refid="majorProjectByStatus"/>
  321. AND YEAR(plan_demand_sub_time ) = YEAR(now())
  322. AND project_status &gt; #{vo.projectStatus}
  323. </select>
  324. <select id="majorProjectByStatusLastYear" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  325. resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
  326. <include refid="majorProjectByStatus"/>
  327. AND YEAR(plan_demand_sub_time ) = YEAR(now())-1
  328. <if test="vo.projectStatusList!=null and vo.projectStatusList.size != 0">
  329. AND project_status in
  330. <foreach collection="vo.projectStatusList" item="item" index="index"
  331. separator="," open="(" close=")">
  332. #{item}
  333. </foreach>
  334. </if>
  335. </select>
  336. <select id="majorProjectByStatusToThisYear" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  337. resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
  338. <include refid="majorProjectByStatus"/>
  339. AND project_status &gt;= #{vo.projectStatus}
  340. AND YEAR(plan_demand_sub_time ) = YEAR(now())
  341. </select>
  342. <select id="majorProjectByStatusWei" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  343. resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
  344. <include refid="majorProjectByStatus"/>
  345. AND real_purchase_finish_time &lt;plan_purchase_finish_time
  346. </select>
  347. <select id="majorProjectByStatusChao" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  348. resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
  349. <include refid="majorProjectByStatus"/>
  350. AND real_purchase_finish_time &gt;plan_purchase_finish_time
  351. </select>
  352. <select id="countMajorProjectExceed" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
  353. SELECT ifnull(COUNT(demand_id), 0) num, ifnull(sum(evaluation), 0) evaluationTotal
  354. FROM `pm_demand`
  355. WHERE purchase_dept_id in
  356. <foreach collection="vo.deptList" item="item" index="index"
  357. separator="," open="(" close=")">
  358. #{item}
  359. </foreach>
  360. AND (real_demand_commit_time > plan_demand_sub_time
  361. or real_purchase_finish_time > plan_purchase_finish_time
  362. or real_deliver_time > plan_deliver_time)
  363. AND find_in_set('1', project_attr)
  364. and YEAR(create_time ) = YEAR(NOW())
  365. </select>
  366. <select id="taskQuantityYear" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  367. resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
  368. SELECT YEAR(NOW()) columnName, ifnull(COUNT(demand_id), 0) num
  369. FROM `pm_demand`
  370. WHERE find_in_set('1'
  371. , project_attr)
  372. AND `project_status` = #{code}
  373. and YEAR(create_time) = YEAR(NOW())
  374. </select>
  375. <select id="taskQuantityLastYear" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo"
  376. parameterType="java.lang.String">
  377. SELECT YEAR(NOW()) - 1 columnName, ifnull(COUNT(demand_id), 0) num
  378. FROM `pm_demand`
  379. WHERE find_in_set('1'
  380. , project_attr)
  381. AND `project_status` = #{code}
  382. and YEAR(create_time) = YEAR(NOW()) - 1
  383. </select>
  384. <select id="countEveryStatusNum" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  385. resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
  386. SELECT project_status columnName, ifnull(COUNT(demand_id), 0) num, ifnull(sum(evaluation), 0) evaluationTotal
  387. FROM `pm_demand`
  388. <include refid="deptListOrDemandIdAll"/>
  389. YEAR(create_time) = YEAR(NOW())
  390. and `project_status`=#{vo.projectStatus}
  391. </select>
  392. <select id="selectByPlanId" parameterType="java.lang.Long" resultType="com.ozs.pm.doman.PmDemand">
  393. select *
  394. from pm_demand
  395. where plan_id = #{planId}
  396. limit 1
  397. </select>
  398. <select id="countMajorProjectLastYear" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  399. resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
  400. # AND find_in_set('1', project_attr)
  401. SELECT YEAR(NOW()) - 1 columnName, de.num, ifnull(sum(c.contract_amount), 0) evaluationContractTotal
  402. FROM pm_demand d, pm_contract_info c,
  403. (SELECT ifnull(COUNT(demand_id), 0) num ,ifnull(sum(evaluation), 0) evaluationTotal FROM pm_demand WHERE
  404. purchase_dept_id
  405. in
  406. <foreach collection="vo.deptList" item="item" index="index"
  407. separator="," open="(" close=")">
  408. #{item}
  409. </foreach>
  410. AND find_in_set('1', project_attr) AND YEAR(create_time) =YEAR(NOW()) - 1 ) de
  411. WHERE d.demand_id = c.demand_id
  412. AND find_in_set('1', d.project_attr)
  413. AND d.purchase_dept_id in
  414. <foreach collection="vo.deptList" item="item" index="index"
  415. separator="," open="(" close=")">
  416. #{item}
  417. </foreach>
  418. AND YEAR(d.create_time) = YEAR(NOW()) - 1
  419. </select>
  420. <select id="countProjectMajorByYear" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
  421. SELECT YEAR(create_time) columnName, ifnull(COUNT(demand_id), 0) num
  422. FROM `pm_demand`
  423. WHERE purchase_dept_id in
  424. <foreach collection="vo.deptList" item="item" index="index"
  425. separator="," open="(" close=")">
  426. #{item}
  427. </foreach>
  428. AND find_in_set('1', project_attr)
  429. GROUP BY YEAR(create_time)
  430. order by create_time asc
  431. </select>
  432. <select id="countProjectMajorByMonth" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
  433. SELECT DATE_FORMAT(create_time, '%Y-%m') columnName, ifnull(COUNT(demand_id), 0) num
  434. FROM `pm_demand`
  435. WHERE purchase_dept_id in
  436. <foreach collection="vo.deptList" item="item" index="index"
  437. separator="," open="(" close=")">
  438. #{item}
  439. </foreach>
  440. AND find_in_set('1', project_attr)
  441. GROUP BY DATE_FORMAT(create_time, '%Y-%m')
  442. </select>
  443. <select id="countProjectMajorByQuarter" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
  444. SELECT create_time columnName, ifnull(COUNT(demand_id), 0) num
  445. FROM `pm_demand`
  446. WHERE purchase_dept_id in
  447. <foreach collection="vo.deptList" item="item" index="index"
  448. separator="," open="(" close=")">
  449. #{item}
  450. </foreach>
  451. AND find_in_set('1', project_attr)
  452. and QUARTER(create_time) = #{vo.quarter}
  453. AND YEAR(create_time) = #{vo.year}
  454. </select>
  455. <!-- 正常推进项目 -->
  456. <select id="purchaseProjectExecuteNormalPropulsion" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  457. resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
  458. select ifnull(COUNT(demand_id), 0) num, ifnull(sum(evaluation), 0) evaluationTotal
  459. from pm_demand
  460. <include refid="deptListOrDemandIdAll"/>
  461. project_status !=21
  462. and (real_demand_commit_time &lt; plan_demand_sub_time
  463. or real_purchase_finish_time &lt; plan_purchase_finish_time
  464. or real_deliver_time &lt; plan_deliver_time)
  465. </select>
  466. <select id="purchaseProjectExecuteIncomplete" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  467. resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
  468. select ifnull(COUNT(demand_id), 0) num, ifnull(sum(evaluation), 0) evaluationTotal
  469. from pm_demand
  470. <include refid="deptListOrDemandIdAll"/>
  471. project_status !=21
  472. </select>
  473. <select id="selectMinYear" resultType="java.lang.Integer">
  474. select ifnull(min(year(create_time)), year(now())) mYear
  475. from pm_demand
  476. </select>
  477. <select id="selectpurchaseProjectCompleteNumberYear" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  478. resultType="java.util.Map">
  479. select count(a.demand_id) countNum,
  480. ifnull(sum(a.evaluation), 0) evaluation,
  481. year(a.create_time) yy,
  482. ifnull(sum(b.contract_amount), 0) contractAmount
  483. from (
  484. select evaluation, create_time, demand_id
  485. from pm_demand
  486. where purchase_dept_id in
  487. <foreach collection="vo.deptList" item="item" index="index"
  488. separator="," open="(" close=")">
  489. #{item}
  490. </foreach>
  491. AND project_status = '21'
  492. ) a
  493. left join (
  494. select contract_amount, demand_id
  495. from pm_contract_info
  496. ) b on a.demand_id = b.demand_id
  497. group by year(create_time)
  498. </select>
  499. <select id="selectpurchaseProjectCompleteNumberQuarter" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  500. resultType="java.util.Map">
  501. select ifnull(sum(a.evaluation), 0) evaluation,
  502. quarter(a.create_time) yy,
  503. ifnull(sum(b.contract_amount), 0) contractAmount
  504. from (
  505. select evaluation, create_time, demand_id
  506. from pm_demand
  507. where purchase_dept_id in
  508. <foreach collection="vo.deptList" item="item" index="index"
  509. separator="," open="(" close=")">
  510. #{item}
  511. </foreach>
  512. AND project_status = '21'
  513. and year(create_time) = year(NOW())
  514. ) a
  515. left join (
  516. select contract_amount, demand_id
  517. from pm_contract_info
  518. ) b on a.demand_id = b.demand_id
  519. group by concat(Year(a.create_time), quarter(a.create_time))
  520. </select>
  521. <select id="selectpurchaseProjectCompleteNumberMonth" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  522. resultType="java.util.Map">
  523. select ifnull(sum(a.evaluation), 0) evaluation,
  524. date_format(create_time, '%m') yy,
  525. ifnull(sum(b.contract_amount), 0) contractAmount
  526. from (
  527. select evaluation, create_time, demand_id
  528. from pm_demand
  529. where purchase_dept_id in
  530. <foreach collection="vo.deptList" item="item" index="index"
  531. separator="," open="(" close=")">
  532. #{item}
  533. </foreach>
  534. AND project_status = '21'
  535. and year(create_time) = year(NOW())
  536. ) a
  537. left join (
  538. select contract_amount, demand_id
  539. from pm_contract_info
  540. ) b on a.demand_id = b.demand_id
  541. group by date_format(a.create_time, '%y%m')
  542. </select>
  543. <select id="selectPurchaseTaskFinishYear" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  544. resultType="java.util.Map">
  545. select count(a.demand_id) countNum,
  546. ifnull(sum(a.evaluation), 0) evaluation,
  547. year(a.create_time) yy,
  548. ifnull(sum(b.contract_amount), 0) contractAmount
  549. from (
  550. select evaluation, create_time, demand_id
  551. from pm_demand
  552. <include refid="deptListOrDemandIdAll"/>
  553. project_status in (15, 16, 17)
  554. ) a
  555. left join (
  556. select contract_amount, demand_id
  557. from pm_contract_info
  558. ) b on a.demand_id = b.demand_id
  559. group by year(a.up_acceptance_time)
  560. </select>
  561. <select id="selectPurchaseTaskFinishQuarter" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  562. resultType="java.util.Map">
  563. select ifnull(sum(a.evaluation), 0) evaluation,
  564. quarter(a.create_time) yy,
  565. ifnull(sum(b.contract_amount), 0) contractAmount
  566. from (
  567. select evaluation, create_time, demand_id
  568. from pm_demand
  569. <include refid="deptListOrDemandIdAll"/>
  570. project_status in (15, 16, 17)
  571. and year(up_acceptance_time) = year(NOW())
  572. ) a
  573. left join (
  574. select contract_amount, demand_id
  575. from pm_contract_info
  576. ) b on a.demand_id = b.demand_id
  577. group by concat(Year(a.up_acceptance_time), quarter(a.up_acceptance_time))
  578. </select>
  579. <select id="selectPurchaseTaskFinishMonth" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  580. resultType="java.util.Map">
  581. select ifnull(sum(a.evaluation), 0) evaluation,
  582. date_format(create_time, '%m') yy,
  583. ifnull(sum(b.contract_amount), 0) contractAmount
  584. from (
  585. select evaluation, create_time, demand_id
  586. from pm_demand
  587. <include refid="deptListOrDemandIdAll"/>
  588. project_status in (15, 16, 17)
  589. and year(up_acceptance_time) = year(NOW())
  590. ) a
  591. left join (
  592. select contract_amount, demand_id
  593. from pm_contract_info
  594. ) b on a.demand_id = b.demand_id
  595. group by date_format(a.up_acceptance_time, '%y%m')
  596. </select>
  597. <select id="countProjectExceedAndMajor" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  598. resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
  599. SELECT ifnull(COUNT(demand_id), 0) num, ifnull(sum(evaluation), 0) evaluationTotal
  600. FROM `pm_demand`
  601. WHERE (real_demand_commit_time > plan_demand_sub_time
  602. or real_purchase_finish_time > plan_purchase_finish_time
  603. or real_deliver_time > plan_deliver_time)
  604. AND find_in_set('1', project_attr)
  605. and YEAR(create_time) = YEAR(NOW())
  606. </select>
  607. <select id="purchaseProjectDistribution" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  608. resultType="java.util.Map">
  609. select ifnull(count(demand_id), 0) countNumber,ifnull(sum(evaluation), 0) evaluationTotal
  610. from pm_demand
  611. <include refid="deptListOrDemandIdAllNoAnd"/>
  612. <if test="(vo.deptList != null and vo.deptList.size != 0) or (vo.demandIdAll != null and vo.demandIdAll.size != 0)">
  613. AND
  614. </if>
  615. <if test="vo.projectStatusList!=null and vo.projectStatusList.size != 0">
  616. project_status in
  617. <foreach collection="vo.projectStatusList" item="item" index="index"
  618. separator="," open="(" close=")">
  619. #{item}
  620. </foreach>
  621. </if>
  622. </select>
  623. <select id="purchaseProjectNumberAnalysisYear" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  624. resultType="java.util.Map">
  625. select ifnull(COUNT(demand_id), 0) countNum, ifnull(sum(evaluation), 0) evaluationSum, year(task_release_time)
  626. yy
  627. from pm_demand
  628. <if test="(vo.deptList != null and vo.deptList.size != 0) or (vo.demandIdAll != null and vo.demandIdAll.size != 0)">
  629. <include refid="deptListOrDemandIdAllNoAnd"/>
  630. </if>
  631. group by year(task_release_time!=null)
  632. </select>
  633. <select id="purchaseProjectNumberAnalysisQuarter" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  634. resultType="java.util.Map">
  635. select ifnull(COUNT(demand_id), 0) countNum, ifnull(sum(evaluation), 0) evaluationSum,
  636. quarter(task_release_time) yy
  637. from pm_demand
  638. <include refid="deptListOrDemandIdAll"/>
  639. year(task_release_time) = year(NOW())
  640. group by concat(Year(task_release_time), quarter(task_release_time))
  641. </select>
  642. <select id="purchaseProjectNumberAnalysisOldYearQuarter" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  643. resultType="java.util.Map">
  644. select ifnull(COUNT(demand_id), 0) countNum, ifnull(sum(evaluation), 0) evaluationSum,
  645. quarter(task_release_time) yy
  646. from pm_demand
  647. <include refid="deptListOrDemandIdAll"/>
  648. year(task_release_time) = year(NOW() - 1)
  649. group by concat(Year(task_release_time), quarter(task_release_time))
  650. </select>
  651. <select id="purchaseProjectNumberAnalysisMonth" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  652. resultType="java.util.Map">
  653. select ifnull(COUNT(demand_id), 0) countNum,
  654. ifnull(sum(evaluation), 0) evaluationSum,
  655. date_format(task_release_time, '%m') yy
  656. from pm_demand
  657. <include refid="deptListOrDemandIdAll"/>
  658. year(task_release_time) = year(NOW())
  659. group by date_format(task_release_time, '%y%m')
  660. </select>
  661. <select id="purchaseProjectNumberAnalysisOldYearMonth" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  662. resultType="java.util.Map">
  663. select ifnull(COUNT(demand_id), 0) countNum,
  664. ifnull(sum(evaluation), 0) evaluationSum,
  665. date_format(create_time, '%m') yy
  666. from pm_demand
  667. where purchase_dept_id = #{purchaseDeptId}
  668. AND year(task_release_time) = YEAR(NOW()) - 1
  669. group by date_format(task_release_time, '%y%m')
  670. </select>
  671. <select id="selectSTSLastYear" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
  672. SELECT ifnull(COUNT(demand_id),0)num, ifnull(sum(evaluation),0) evaluationTotal
  673. FROM `pm_demand`
  674. <include refid="deptListOrDemandIdAll"/>
  675. `project_status` IN (6,7,8,9,10,11,12,13,14,15, 16,
  676. 17)
  677. and YEAR(plan_demand_sub_time) = YEAR(NOW())-1
  678. </select>
  679. <select id="selectSTSThisYear" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
  680. SELECT ifnull(COUNT(demand_id),0)num, ifnull(sum(evaluation),0) evaluationTotal
  681. FROM `pm_demand`
  682. <include refid="deptListOrDemandIdAll"/>
  683. `project_status` &gt; 4
  684. and YEAR(plan_demand_sub_time) = YEAR(NOW())
  685. </select>
  686. <select id="selectmeiJiDu" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo"
  687. parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo">
  688. SELECT ifnull(COUNT(demand_id), 0) num, ifnull(sum(evaluation), 0) evaluationTotal
  689. FROM `pm_demand`
  690. <include refid="deptListOrDemandIdAll"/>
  691. (real_demand_commit_time &gt; plan_demand_sub_time)
  692. </select>
  693. <select id="selectByProjectType" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo"
  694. parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo">
  695. SELECT project_type columnName, ifnull(COUNT(demand_id), 0) num, ifnull(sum(evaluation), 0) evaluationTotal
  696. FROM `pm_demand`
  697. <include refid="deptListOrDemandIdAll"/>
  698. project_type=#{vo.projectType}
  699. </select>
  700. <select id="selectSTS" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo"
  701. parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo">
  702. SELECT ifnull(COUNT(demand_id),0)num, ifnull(sum(evaluation),0) evaluationTotal
  703. FROM `pm_demand`
  704. <include refid="deptListOrDemandIdAll"/>
  705. `project_status` &gt; 4
  706. and YEAR(plan_demand_sub_time) = YEAR(NOW())
  707. </select>
  708. <select id="selectCGThisMonth" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo"
  709. parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo">
  710. SELECT MONTH(NOW()) columnName, de.num, de.evaluationTotal,ifnull(sum(c.contract_amount), 0)
  711. evaluationContractTotal
  712. FROM pm_demand d,pm_contract_info c,
  713. (SELECT ifnull(COUNT(demand_id), 0) num ,ifnull(sum(evaluation), 0) evaluationTotal FROM pm_demand
  714. <include refid="deptListOrDemandIdAll"/>
  715. project_status &gt; 16 AND MONTH(up_acceptance_time) =MONTH(NOW()) ) de
  716. <include refid="dDeptListOrDemandIdAll"/>
  717. d.demand_id = c.demand_id
  718. AND d.project_status &gt; 16
  719. AND MONTH(d.up_acceptance_time) = MONTH(NOW())
  720. </select>
  721. <select id="selectCGThisQua" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo"
  722. parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo">
  723. SELECT QUARTER(NOW()) columnName, de.num, de.evaluationTotal,ifnull(sum(c.contract_amount), 0)
  724. evaluationContractTotal
  725. FROM pm_demand d,pm_contract_info c,
  726. (SELECT ifnull(COUNT(demand_id), 0) num ,ifnull(sum(evaluation), 0) evaluationTotal FROM pm_demand
  727. <include refid="deptListOrDemandIdAll"/>
  728. project_status &gt; 17 AND QUARTER(up_acceptance_time) =QUARTER(NOW()) ) de
  729. <include refid="dDeptListOrDemandIdAll"/>
  730. d.demand_id = c.demand_id
  731. AND d.project_status &gt; 17
  732. AND QUARTER(d.up_acceptance_time) = QUARTER(NOW())
  733. </select>
  734. <select id="selectZJLastYear" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo"
  735. parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo">
  736. SELECT YEAR(NOW())-1 columnName, de.num,de.evaluationTotal,ifnull(sum(c.contract_amount), 0)
  737. evaluationContractTotal
  738. FROM pm_demand d, pm_contract_info c,
  739. (SELECT ifnull(COUNT(demand_id), 0) num ,ifnull(sum(evaluation), 0) evaluationTotal FROM pm_demand
  740. <include refid="deptListOrDemandIdAll"/>
  741. project_status IN (17,18) AND YEAR(up_acceptance_time) = YEAR(NOW())-1 ) de
  742. <include refid="dDeptListOrDemandIdAll"/>
  743. d.demand_id = c.demand_id
  744. AND d.project_status IN (17,18)
  745. AND YEAR(d.up_acceptance_time) = YEAR(NOW())-1
  746. </select>
  747. <select id="selectTBThisYear" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo"
  748. parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo">
  749. SELECT YEAR(NOW()) columnName, de.num,de.evaluationTotal,ifnull(sum(c.contract_amount), 0)
  750. evaluationContractTotal
  751. FROM pm_demand d, pm_contract_info c,
  752. (SELECT ifnull(COUNT(demand_id), 0) num ,ifnull(sum(evaluation), 0) evaluationTotal FROM pm_demand
  753. <include refid="deptListOrDemandIdAll"/>
  754. project_status &gt; 17 AND YEAR(up_acceptance_time) = YEAR(NOW()) ) de
  755. <include refid="dDeptListOrDemandIdAll"/>
  756. d.demand_id = c.demand_id
  757. AND d.project_status &gt; 17
  758. AND YEAR(d.up_acceptance_time) = YEAR(NOW())
  759. </select>
  760. <select id="selectFInishAll" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo"
  761. parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo">
  762. SELECT YEAR(NOW()) columnName, de.num,de.evaluationTotal,ifnull(sum(c.contract_amount), 0)
  763. evaluationContractTotal
  764. FROM pm_demand d, pm_contract_info c,
  765. (SELECT ifnull(COUNT(demand_id), 0) num ,ifnull(sum(evaluation), 0) evaluationTotal FROM pm_demand
  766. <include refid="deptListOrDemandIdAll"/>
  767. project_status &gt; 17 ) de
  768. <include refid="dDeptListOrDemandIdAll"/>
  769. d.demand_id = c.demand_id AND d.project_status &gt; 17
  770. </select>
  771. <select id="selectCCThisYear" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo"
  772. parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo">
  773. SELECT YEAR(NOW()) columnName,ifnull(COUNT(demand_id), 0) num,ifnull(sum(evaluation), 0) evaluationTotal
  774. FROM pm_demand
  775. <include refid="deptListOrDemandIdAll"/>
  776. real_purchase_finish_time &lt;=plan_purchase_finish_time
  777. AND YEAR(up_acceptance_time) = YEAR(NOW())
  778. </select>
  779. <sql id="countProjectExceedAndStatus">
  780. SELECT ifnull(COUNT(demand_id), 0) num,ifnull(sum(evaluation), 0) evaluationTotal
  781. FROM pm_demand
  782. <include refid="deptListOrDemandIdAllNoAnd"/>
  783. <if test="(vo.deptList != null and vo.deptList.size != 0) or (vo.demandIdAll != null and vo.demandIdAll.size != 0)">
  784. AND
  785. </if>
  786. <if test="vo.projectStatusList!=null and vo.projectStatusList.size != 0">
  787. project_status in
  788. <foreach collection="vo.projectStatusList" item="item" index="index"
  789. separator="," open="(" close=")">
  790. #{item}
  791. </foreach>
  792. </if>
  793. AND real_purchase_finish_time &gt;plan_purchase_finish_time
  794. </sql>
  795. <select id="countProjectExceedAndStatus" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo"
  796. parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo">
  797. <include refid="countProjectExceedAndStatus"/>
  798. </select>
  799. <select id="countBaseAgencyWithWhite" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
  800. SELECT ifnull(COUNT(id), 0) num
  801. FROM base_agency
  802. WHERE status = 0
  803. </select>
  804. <select id="JZCGnum" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo"
  805. parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo">
  806. SELECT YEAR(NOW()) columnName,ifnull(COUNT(demand_id), 0) num,ifnull(sum(evaluation), 0) evaluationTotal
  807. FROM pm_demand
  808. <include refid="deptListOrDemandIdAll"/>
  809. project_status &gt; 8
  810. # AND YEAR(create_time) = YEAR(NOW())
  811. </select>
  812. <select id="countProjecReaAndStatus" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo"
  813. parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo">
  814. SELECT ifnull(COUNT(demand_id), 0) num,ifnull(sum(evaluation), 0) evaluationTotal
  815. FROM pm_demand
  816. <include refid="deptListOrDemandIdAllNoAnd"/>
  817. <if test="(vo.deptList != null and vo.deptList.size != 0) or (vo.demandIdAll != null and vo.demandIdAll.size != 0)">
  818. AND
  819. </if>
  820. <if test="vo.projectStatusList!=null and vo.projectStatusList.size != 0">
  821. project_status in
  822. <foreach collection="vo.projectStatusList" item="item" index="index"
  823. separator="," open="(" close=")">
  824. #{item}
  825. </foreach>
  826. </if>
  827. and YEAR(create_time) = YEAR(NOW())-1
  828. </select>
  829. <select id="countProjectACT_Year" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo"
  830. parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo">
  831. SELECT #{vo.year} columnName, de.num, de.evaluationTotal, ifnull(sum(c.contract_amount), 0)
  832. evaluationContractTotal
  833. FROM pm_demand d, pm_contract_info c,
  834. (SELECT ifnull(COUNT(demand_id), 0) num ,ifnull(sum(evaluation), 0) evaluationTotal FROM pm_demand
  835. <include refid="deptListOrDemandIdAll"/>
  836. real_purchase_finish_time > plan_purchase_finish_time AND YEAR(create_time)=#{vo.year} ) de
  837. <include refid="dDeptListOrDemandIdAll"/>
  838. d.demand_id = c.demand_id AND d.real_purchase_finish_time > d.plan_purchase_finish_time AND
  839. YEAR(d.create_time)=#{vo.year}
  840. </select>
  841. <select id="countProjectACT_Qua" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo"
  842. parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo">
  843. SELECT #{vo.year} columnName, de.num, de.evaluationTotal, ifnull(sum(c.contract_amount), 0)
  844. evaluationContractTotal
  845. FROM pm_demand d, pm_contract_info c,
  846. (SELECT ifnull(COUNT(demand_id), 0) num ,ifnull(sum(evaluation), 0) evaluationTotal FROM pm_demand
  847. <include refid="deptListOrDemandIdAll"/>
  848. real_purchase_finish_time > plan_purchase_finish_time AND YEAR(create_time)=#{vo.year} AND
  849. QUARTER(create_time)=#{vo.quarter}) de
  850. <include refid="dDeptListOrDemandIdAll"/>
  851. d.demand_id = c.demand_id AND d.real_purchase_finish_time > d.plan_purchase_finish_time AND
  852. YEAR(d.create_time)=#{vo.year} AND QUARTER(d.create_time)=#{vo.quarter}
  853. </select>
  854. <select id="countProjectACT_Mon" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo"
  855. parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo">
  856. SELECT #{vo.year} columnName, de.num,
  857. de.evaluationTotal, ifnull(sum(c.contract_amount), 0)
  858. evaluationContractTotal
  859. FROM pm_demand d, pm_contract_info c,
  860. (SELECT ifnull(COUNT(demand_id), 0) num ,ifnull(sum(evaluation), 0) evaluationTotal FROM pm_demand
  861. <include refid="deptListOrDemandIdAll"/>
  862. real_purchase_finish_time > plan_purchase_finish_time AND
  863. YEAR(create_time)=#{vo.year} AND month(create_time)=#{vo.month}) de
  864. <include refid="dDeptListOrDemandIdAll"/>
  865. d.demand_id = c.demand_id AND d.real_purchase_finish_time > d.plan_purchase_finish_time AND
  866. YEAR(d.create_time)=#{vo.year} AND month(d.create_time)=#{vo.month}
  867. </select>
  868. <!-- 统计里查询全部or查询指定部门及下级超额项目-->
  869. <sql id="deptListOrDemandIdAll">
  870. WHERE
  871. <if test="vo.deptList != null and vo.deptList.size != 0 ">
  872. purchase_dept_id
  873. in
  874. <foreach collection="vo.deptList" item="item" index="index"
  875. separator="," open="(" close=")">
  876. #{item}
  877. </foreach>
  878. </if>
  879. <if test="(vo.deptList != null and vo.deptList.size != 0) and (vo.demandIdAll != null and vo.demandIdAll.size != 0)">
  880. AND
  881. </if>
  882. <if test="vo.demandIdAll != null and vo.demandIdAll.size != 0 ">
  883. demand_id
  884. in
  885. <foreach collection="vo.demandIdAll" item="item" index="index"
  886. separator="," open="(" close=")">
  887. #{item}
  888. </foreach>
  889. </if>
  890. <if test="(vo.deptList != null and vo.deptList.size != 0) or (vo.demandIdAll != null and vo.demandIdAll.size != 0)">
  891. AND
  892. </if>
  893. </sql>
  894. <sql id="deptListOrDemandIdAllNoAnd">
  895. WHERE
  896. <if test="vo.deptList != null and vo.deptList.size != 0 ">
  897. purchase_dept_id
  898. in
  899. <foreach collection="vo.deptList" item="item" index="index"
  900. separator="," open="(" close=")">
  901. #{item}
  902. </foreach>
  903. </if>
  904. <if test="(vo.deptList != null and vo.deptList.size != 0) and (vo.demandIdAll != null and vo.demandIdAll.size != 0)">
  905. AND
  906. </if>
  907. <if test="vo.demandIdAll != null and vo.demandIdAll.size != 0 ">
  908. demand_id
  909. in
  910. <foreach collection="vo.demandIdAll" item="item" index="index"
  911. separator="," open="(" close=")">
  912. #{item}
  913. </foreach>
  914. </if>
  915. </sql>
  916. <sql id="dDeptListOrDemandIdAll">
  917. WHERE
  918. <if test="vo.deptList != null and vo.deptList.size != 0 ">
  919. d.purchase_dept_id
  920. in
  921. <foreach collection="vo.deptList" item="item" index="index"
  922. separator="," open="(" close=")">
  923. #{item}
  924. </foreach>
  925. </if>
  926. <if test="(vo.deptList != null and vo.deptList.size != 0) and (vo.demandIdAll != null and vo.demandIdAll.size != 0)">
  927. AND
  928. </if>
  929. <if test="vo.demandIdAll != null and vo.demandIdAll.size != 0 ">
  930. d.demand_id
  931. in
  932. <foreach collection="vo.demandIdAll" item="item" index="index"
  933. separator="," open="(" close=")">
  934. #{item}
  935. </foreach>
  936. </if>
  937. <if test="(vo.deptList != null and vo.deptList.size != 0) or (vo.demandIdAll != null and vo.demandIdAll.size != 0)">
  938. AND
  939. </if>
  940. </sql>
  941. </mapper>