PmDemandMapper.xml 49 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052
  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(de.num) countNum,
  546. de.evaluationTotal evaluation,
  547. year(c.up_acceptance_time) yy,
  548. ifnull(sum(c.contract_amount), 0) contractAmount
  549. FROM (SELECT ifnull(sum(c.contract_amount), 0) contract_amount,d.up_acceptance_time
  550. FROM pm_demand d
  551. left join pm_contract_info c
  552. on d.demand_id = c.demand_id
  553. <include refid="dDeptListOrDemandIdAll"/>
  554. d.project_status in (19,20,21)
  555. AND YEAR(d.up_acceptance_time) = YEAR(NOW())
  556. group by year(d.up_acceptance_time)) c
  557. LEFT JOIN
  558. (SELECT ifnull(COUNT(demand_id), 0) num ,ifnull(sum(evaluation), 0) evaluationTotal,up_acceptance_time FROM
  559. pm_demand
  560. <include refid="deptListOrDemandIdAll"/>
  561. project_status in (19,20,21) AND YEAR(up_acceptance_time) = YEAR(NOW())
  562. group by year(up_acceptance_time)) de
  563. ON c.up_acceptance_time=de.up_acceptance_time
  564. </select>
  565. <select id="selectPurchaseTaskFinishQuarter" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  566. resultType="java.util.Map">
  567. select ifnull(sum(a.evaluation), 0) evaluation,
  568. quarter(a.up_acceptance_time) yy,
  569. ifnull(sum(b.contract_amount), 0) contractAmount
  570. from (
  571. select evaluation, up_acceptance_time, demand_id
  572. from pm_demand
  573. <include refid="deptListOrDemandIdAll"/>
  574. project_status in (19,20,21)
  575. and up_acceptance_time!=null
  576. and year(up_acceptance_time) = year(NOW())
  577. ) a
  578. left join (
  579. select contract_amount, demand_id
  580. from pm_contract_info
  581. ) b on a.demand_id = b.demand_id
  582. group by concat(Year(a.up_acceptance_time), quarter(a.up_acceptance_time))
  583. </select>
  584. <select id="selectPurchaseTaskFinishMonth" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  585. resultType="java.util.Map">
  586. select ifnull(sum(a.evaluation), 0) evaluation,
  587. date_format(up_acceptance_time, '%m') yy,
  588. ifnull(sum(b.contract_amount), 0) contractAmount
  589. from (
  590. select evaluation, up_acceptance_time, demand_id
  591. from pm_demand
  592. <include refid="deptListOrDemandIdAll"/>
  593. project_status in (19,20,21)
  594. and up_acceptance_time!=null
  595. and year(up_acceptance_time) = year(NOW())
  596. ) a
  597. left join (
  598. select contract_amount, demand_id
  599. from pm_contract_info
  600. ) b on a.demand_id = b.demand_id
  601. group by date_format(a.up_acceptance_time, '%y%m')
  602. </select>
  603. <select id="countProjectExceedAndMajor" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  604. resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
  605. SELECT ifnull(COUNT(demand_id), 0) num, ifnull(sum(evaluation), 0) evaluationTotal
  606. FROM `pm_demand`
  607. WHERE (real_demand_commit_time > plan_demand_sub_time
  608. or real_purchase_finish_time > plan_purchase_finish_time
  609. or real_deliver_time > plan_deliver_time)
  610. AND find_in_set('1', project_attr)
  611. and YEAR(create_time) = YEAR(NOW())
  612. </select>
  613. <select id="purchaseProjectDistribution" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  614. resultType="java.util.Map">
  615. select ifnull(count(demand_id), 0) countNumber,ifnull(sum(evaluation), 0) evaluationTotal
  616. from pm_demand
  617. <include refid="deptListOrDemandIdAllNoAnd"/>
  618. <if test="(vo.deptList != null and vo.deptList.size != 0) or (vo.demandIdAll != null and vo.demandIdAll.size != 0)">
  619. AND
  620. </if>
  621. <if test="vo.projectStatusList!=null and vo.projectStatusList.size != 0">
  622. project_status in
  623. <foreach collection="vo.projectStatusList" item="item" index="index"
  624. separator="," open="(" close=")">
  625. #{item}
  626. </foreach>
  627. </if>
  628. </select>
  629. <select id="purchaseProjectNumberAnalysisYear" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  630. resultType="java.util.Map">
  631. select ifnull(COUNT(demand_id), 0) countNum, ifnull(sum(evaluation), 0) evaluationSum, year(task_release_time)
  632. yy
  633. from pm_demand
  634. <if test="(vo.deptList != null and vo.deptList.size != 0) or (vo.demandIdAll != null and vo.demandIdAll.size != 0)">
  635. <include refid="deptListOrDemandIdAllNoAnd"/>
  636. </if>
  637. group by year(task_release_time!=null)
  638. </select>
  639. <select id="purchaseProjectNumberAnalysisQuarter" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  640. resultType="java.util.Map">
  641. select ifnull(COUNT(demand_id), 0) countNum, ifnull(sum(evaluation), 0) evaluationSum,
  642. quarter(task_release_time) yy
  643. from pm_demand
  644. <include refid="deptListOrDemandIdAll"/>
  645. year(task_release_time) = year(NOW())
  646. group by concat(Year(task_release_time), quarter(task_release_time))
  647. </select>
  648. <select id="purchaseProjectNumberAnalysisOldYearQuarter" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  649. resultType="java.util.Map">
  650. select ifnull(COUNT(demand_id), 0) countNum, ifnull(sum(evaluation), 0) evaluationSum,
  651. quarter(task_release_time) yy
  652. from pm_demand
  653. <include refid="deptListOrDemandIdAll"/>
  654. year(task_release_time) = year(NOW() - 1)
  655. group by concat(Year(task_release_time), quarter(task_release_time))
  656. </select>
  657. <select id="purchaseProjectNumberAnalysisMonth" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  658. resultType="java.util.Map">
  659. select ifnull(COUNT(demand_id), 0) countNum,
  660. ifnull(sum(evaluation), 0) evaluationSum,
  661. date_format(task_release_time, '%m') yy
  662. from pm_demand
  663. <include refid="deptListOrDemandIdAll"/>
  664. year(task_release_time) = year(NOW())
  665. group by date_format(task_release_time, '%y%m')
  666. </select>
  667. <select id="purchaseProjectNumberAnalysisOldYearMonth" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
  668. resultType="java.util.Map">
  669. select ifnull(COUNT(demand_id), 0) countNum,
  670. ifnull(sum(evaluation), 0) evaluationSum,
  671. date_format(create_time, '%m') yy
  672. from pm_demand
  673. where purchase_dept_id = #{purchaseDeptId}
  674. AND year(task_release_time) = YEAR(NOW()) - 1
  675. group by date_format(task_release_time, '%y%m')
  676. </select>
  677. <select id="selectSTSLastYear" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
  678. SELECT ifnull(COUNT(demand_id),0)num, ifnull(sum(evaluation),0) evaluationTotal
  679. FROM `pm_demand`
  680. <include refid="deptListOrDemandIdAll"/>
  681. `project_status` IN (6,7,8,9,10,11,12,13,14,15, 16,
  682. 17)
  683. and YEAR(plan_demand_sub_time) = YEAR(NOW())-1
  684. </select>
  685. <select id="selectSTSThisYear" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
  686. SELECT ifnull(COUNT(demand_id),0)num, ifnull(sum(evaluation),0) evaluationTotal
  687. FROM `pm_demand`
  688. <include refid="deptListOrDemandIdAll"/>
  689. `project_status` &gt; 4
  690. and YEAR(plan_demand_sub_time) = YEAR(NOW())
  691. </select>
  692. <select id="selectmeiJiDu" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo"
  693. parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo">
  694. SELECT ifnull(COUNT(demand_id), 0) num, ifnull(sum(evaluation), 0) evaluationTotal
  695. FROM `pm_demand`
  696. <include refid="deptListOrDemandIdAll"/>
  697. (real_demand_commit_time &gt; plan_demand_sub_time)
  698. </select>
  699. <select id="selectByProjectType" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo"
  700. parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo">
  701. SELECT project_type columnName, ifnull(COUNT(demand_id), 0) num, ifnull(sum(evaluation), 0) evaluationTotal
  702. FROM `pm_demand`
  703. <include refid="deptListOrDemandIdAll"/>
  704. project_type=#{vo.projectType}
  705. </select>
  706. <select id="selectSTS" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo"
  707. parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo">
  708. SELECT ifnull(COUNT(demand_id),0)num, ifnull(sum(evaluation),0) evaluationTotal
  709. FROM `pm_demand`
  710. <include refid="deptListOrDemandIdAll"/>
  711. `project_status` &gt; 4
  712. and YEAR(plan_demand_sub_time) = YEAR(NOW())
  713. </select>
  714. <select id="selectCGThisMonth" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo"
  715. parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo">
  716. SELECT MONTH(NOW()) columnName, de.num, de.evaluationTotal,ifnull(sum(c.contract_amount), 0)
  717. evaluationContractTotal
  718. FROM pm_demand d,pm_contract_info c,
  719. (SELECT ifnull(COUNT(demand_id), 0) num ,ifnull(sum(evaluation), 0) evaluationTotal FROM pm_demand
  720. <include refid="deptListOrDemandIdAll"/>
  721. project_status &gt; 16 AND MONTH(up_acceptance_time) =MONTH(NOW()) ) de
  722. <include refid="dDeptListOrDemandIdAll"/>
  723. d.demand_id = c.demand_id
  724. AND d.project_status &gt; 16
  725. AND MONTH(d.up_acceptance_time) = MONTH(NOW())
  726. </select>
  727. <select id="selectCGThisQua" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo"
  728. parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo">
  729. SELECT QUARTER(NOW()) columnName, de.num, de.evaluationTotal,ifnull(sum(c.contract_amount), 0)
  730. evaluationContractTotal
  731. FROM pm_demand d,pm_contract_info c,
  732. (SELECT ifnull(COUNT(demand_id), 0) num ,ifnull(sum(evaluation), 0) evaluationTotal FROM pm_demand
  733. <include refid="deptListOrDemandIdAll"/>
  734. project_status &gt; 17 AND QUARTER(up_acceptance_time) =QUARTER(NOW()) ) de
  735. <include refid="dDeptListOrDemandIdAll"/>
  736. d.demand_id = c.demand_id
  737. AND d.project_status &gt; 17
  738. AND QUARTER(d.up_acceptance_time) = QUARTER(NOW())
  739. </select>
  740. <select id="selectZJLastYear" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo"
  741. parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo">
  742. SELECT YEAR(NOW())-1 columnName, de.num,de.evaluationTotal,ifnull(sum(c.contract_amount), 0)
  743. evaluationContractTotal
  744. FROM pm_demand d, pm_contract_info c,
  745. (SELECT ifnull(COUNT(demand_id), 0) num ,ifnull(sum(evaluation), 0) evaluationTotal FROM pm_demand
  746. <include refid="deptListOrDemandIdAll"/>
  747. project_status IN (17,18) AND YEAR(up_acceptance_time) = YEAR(NOW())-1 ) de
  748. <include refid="dDeptListOrDemandIdAll"/>
  749. d.demand_id = c.demand_id
  750. AND d.project_status IN (17,18)
  751. AND YEAR(d.up_acceptance_time) = YEAR(NOW())-1
  752. </select>
  753. <select id="selectTBThisYear" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo"
  754. parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo">
  755. SELECT YEAR(NOW()) columnName, de.num,de.evaluationTotal,ifnull(sum(c.contract_amount), 0)
  756. evaluationContractTotal
  757. FROM pm_demand d, pm_contract_info c,
  758. (SELECT ifnull(COUNT(demand_id), 0) num ,ifnull(sum(evaluation), 0) evaluationTotal FROM pm_demand
  759. <include refid="deptListOrDemandIdAll"/>
  760. project_status &gt; 17 AND YEAR(up_acceptance_time) = YEAR(NOW()) ) de
  761. <include refid="dDeptListOrDemandIdAll"/>
  762. d.demand_id = c.demand_id
  763. AND d.project_status &gt; 17
  764. AND YEAR(d.up_acceptance_time) = YEAR(NOW())
  765. </select>
  766. <select id="selectFInishAll" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo"
  767. parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo">
  768. SELECT YEAR(NOW()) columnName, de.num,de.evaluationTotal,ifnull(sum(c.contract_amount), 0)
  769. evaluationContractTotal
  770. FROM (SELECT c.contract_amount FROM pm_demand d
  771. left join pm_contract_info c
  772. on d.demand_id = c.demand_id
  773. <include refid="dDeptListOrDemandIdAll"/>
  774. d.project_status > 18
  775. AND YEAR(d.up_acceptance_time) = YEAR(NOW())) c
  776. ,
  777. (SELECT ifnull(COUNT(demand_id), 0) num ,ifnull(sum(evaluation), 0) evaluationTotal FROM pm_demand
  778. <include refid="deptListOrDemandIdAll"/>
  779. project_status > 18 AND YEAR(up_acceptance_time) = YEAR(NOW())) de
  780. </select>
  781. <select id="selectCCThisYear" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo"
  782. parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo">
  783. SELECT YEAR(NOW()) columnName,ifnull(COUNT(demand_id), 0) num,ifnull(sum(evaluation), 0) evaluationTotal
  784. FROM pm_demand
  785. <include refid="deptListOrDemandIdAll"/>
  786. real_purchase_finish_time &lt;=plan_purchase_finish_time
  787. AND YEAR(up_acceptance_time) = YEAR(NOW())
  788. </select>
  789. <sql id="countProjectExceedAndStatus">
  790. SELECT ifnull(COUNT(demand_id), 0) num,ifnull(sum(evaluation), 0) evaluationTotal
  791. FROM pm_demand
  792. <include refid="deptListOrDemandIdAllNoAnd"/>
  793. <if test="(vo.deptList != null and vo.deptList.size != 0) or (vo.demandIdAll != null and vo.demandIdAll.size != 0)">
  794. AND
  795. </if>
  796. <if test="vo.projectStatusList!=null and vo.projectStatusList.size != 0">
  797. project_status in
  798. <foreach collection="vo.projectStatusList" item="item" index="index"
  799. separator="," open="(" close=")">
  800. #{item}
  801. </foreach>
  802. </if>
  803. AND real_purchase_finish_time &gt;plan_purchase_finish_time
  804. </sql>
  805. <select id="countProjectExceedAndStatus" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo"
  806. parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo">
  807. <include refid="countProjectExceedAndStatus"/>
  808. </select>
  809. <select id="countBaseAgencyWithWhite" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
  810. SELECT ifnull(COUNT(id), 0) num
  811. FROM base_agency
  812. WHERE status = 0
  813. </select>
  814. <select id="JZCGnum" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo"
  815. parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo">
  816. SELECT YEAR(NOW()) columnName,ifnull(COUNT(demand_id), 0) num,ifnull(sum(evaluation), 0) evaluationTotal
  817. FROM pm_demand
  818. <include refid="deptListOrDemandIdAll"/>
  819. project_status &gt; 8
  820. # AND YEAR(create_time) = YEAR(NOW())
  821. </select>
  822. <select id="countProjecReaAndStatus" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo"
  823. parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo">
  824. SELECT ifnull(COUNT(demand_id), 0) num,ifnull(sum(evaluation), 0) evaluationTotal
  825. FROM pm_demand
  826. <include refid="deptListOrDemandIdAllNoAnd"/>
  827. <if test="(vo.deptList != null and vo.deptList.size != 0) or (vo.demandIdAll != null and vo.demandIdAll.size != 0)">
  828. AND
  829. </if>
  830. <if test="vo.projectStatusList!=null and vo.projectStatusList.size != 0">
  831. project_status in
  832. <foreach collection="vo.projectStatusList" item="item" index="index"
  833. separator="," open="(" close=")">
  834. #{item}
  835. </foreach>
  836. </if>
  837. and YEAR(create_time) = YEAR(NOW())-1
  838. </select>
  839. <select id="countProjectACT_Year" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo"
  840. parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo">
  841. SELECT #{vo.year} columnName, de.num, de.evaluationTotal, ifnull(sum(c.contract_amount), 0)
  842. evaluationContractTotal
  843. FROM pm_demand d, pm_contract_info c,
  844. (SELECT ifnull(COUNT(demand_id), 0) num ,ifnull(sum(evaluation), 0) evaluationTotal FROM pm_demand
  845. <include refid="deptListOrDemandIdAll"/>
  846. real_purchase_finish_time > plan_purchase_finish_time AND YEAR(create_time)=#{vo.year} ) de
  847. <include refid="dDeptListOrDemandIdAll"/>
  848. d.demand_id = c.demand_id AND d.real_purchase_finish_time > d.plan_purchase_finish_time AND
  849. YEAR(d.create_time)=#{vo.year}
  850. </select>
  851. <select id="countProjectACT_Qua" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo"
  852. parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo">
  853. SELECT #{vo.year} columnName, de.num, de.evaluationTotal, ifnull(sum(c.contract_amount), 0)
  854. evaluationContractTotal
  855. FROM pm_demand d, pm_contract_info c,
  856. (SELECT ifnull(COUNT(demand_id), 0) num ,ifnull(sum(evaluation), 0) evaluationTotal FROM pm_demand
  857. <include refid="deptListOrDemandIdAll"/>
  858. real_purchase_finish_time > plan_purchase_finish_time AND YEAR(create_time)=#{vo.year} AND
  859. QUARTER(create_time)=#{vo.quarter}) de
  860. <include refid="dDeptListOrDemandIdAll"/>
  861. d.demand_id = c.demand_id AND d.real_purchase_finish_time > d.plan_purchase_finish_time AND
  862. YEAR(d.create_time)=#{vo.year} AND QUARTER(d.create_time)=#{vo.quarter}
  863. </select>
  864. <select id="countProjectACT_Mon" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo"
  865. parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo">
  866. SELECT #{vo.year} columnName, de.num,
  867. de.evaluationTotal, ifnull(sum(c.contract_amount), 0)
  868. evaluationContractTotal
  869. FROM pm_demand d, pm_contract_info c,
  870. (SELECT ifnull(COUNT(demand_id), 0) num ,ifnull(sum(evaluation), 0) evaluationTotal FROM pm_demand
  871. <include refid="deptListOrDemandIdAll"/>
  872. real_purchase_finish_time > plan_purchase_finish_time AND
  873. YEAR(create_time)=#{vo.year} AND month(create_time)=#{vo.month}) de
  874. <include refid="dDeptListOrDemandIdAll"/>
  875. d.demand_id = c.demand_id AND d.real_purchase_finish_time > d.plan_purchase_finish_time AND
  876. YEAR(d.create_time)=#{vo.year} AND month(d.create_time)=#{vo.month}
  877. </select>
  878. <!-- 统计里查询全部or查询指定部门及下级超额项目-->
  879. <sql id="deptListOrDemandIdAll">
  880. WHERE
  881. <if test="vo.deptList != null and vo.deptList.size != 0 ">
  882. purchase_dept_id
  883. in
  884. <foreach collection="vo.deptList" item="item" index="index"
  885. separator="," open="(" close=")">
  886. #{item}
  887. </foreach>
  888. </if>
  889. <if test="(vo.deptList != null and vo.deptList.size != 0) and (vo.demandIdAll != null and vo.demandIdAll.size != 0)">
  890. AND
  891. </if>
  892. <if test="vo.demandIdAll != null and vo.demandIdAll.size != 0 ">
  893. demand_id
  894. in
  895. <foreach collection="vo.demandIdAll" item="item" index="index"
  896. separator="," open="(" close=")">
  897. #{item}
  898. </foreach>
  899. </if>
  900. <if test="(vo.deptList != null and vo.deptList.size != 0) or (vo.demandIdAll != null and vo.demandIdAll.size != 0)">
  901. AND
  902. </if>
  903. </sql>
  904. <sql id="deptListOrDemandIdAllNoAnd">
  905. WHERE
  906. <if test="vo.deptList != null and vo.deptList.size != 0 ">
  907. purchase_dept_id
  908. in
  909. <foreach collection="vo.deptList" item="item" index="index"
  910. separator="," open="(" close=")">
  911. #{item}
  912. </foreach>
  913. </if>
  914. <if test="(vo.deptList != null and vo.deptList.size != 0) and (vo.demandIdAll != null and vo.demandIdAll.size != 0)">
  915. AND
  916. </if>
  917. <if test="vo.demandIdAll != null and vo.demandIdAll.size != 0 ">
  918. demand_id
  919. in
  920. <foreach collection="vo.demandIdAll" item="item" index="index"
  921. separator="," open="(" close=")">
  922. #{item}
  923. </foreach>
  924. </if>
  925. </sql>
  926. <sql id="dDeptListOrDemandIdAll">
  927. WHERE
  928. <if test="vo.deptList != null and vo.deptList.size != 0 ">
  929. d.purchase_dept_id
  930. in
  931. <foreach collection="vo.deptList" item="item" index="index"
  932. separator="," open="(" close=")">
  933. #{item}
  934. </foreach>
  935. </if>
  936. <if test="(vo.deptList != null and vo.deptList.size != 0) and (vo.demandIdAll != null and vo.demandIdAll.size != 0)">
  937. AND
  938. </if>
  939. <if test="vo.demandIdAll != null and vo.demandIdAll.size != 0 ">
  940. d.demand_id
  941. in
  942. <foreach collection="vo.demandIdAll" item="item" index="index"
  943. separator="," open="(" close=")">
  944. #{item}
  945. </foreach>
  946. </if>
  947. <if test="(vo.deptList != null and vo.deptList.size != 0) or (vo.demandIdAll != null and vo.demandIdAll.size != 0)">
  948. AND
  949. </if>
  950. </sql>
  951. <sql id="dDeptListOrDemandIdAllNoAnd">
  952. WHERE
  953. <if test="vo.deptList != null and vo.deptList.size != 0 ">
  954. d.purchase_dept_id
  955. in
  956. <foreach collection="vo.deptList" item="item" index="index"
  957. separator="," open="(" close=")">
  958. #{item}
  959. </foreach>
  960. </if>
  961. <if test="(vo.deptList != null and vo.deptList.size != 0) and (vo.demandIdAll != null and vo.demandIdAll.size != 0)">
  962. AND
  963. </if>
  964. <if test="vo.demandIdAll != null and vo.demandIdAll.size != 0 ">
  965. d.demand_id
  966. in
  967. <foreach collection="vo.demandIdAll" item="item" index="index"
  968. separator="," open="(" close=")">
  969. #{item}
  970. </foreach>
  971. </if>
  972. </sql>
  973. </mapper>