TaskDthDayCountDao.xml 50 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="cn.com.goldenwater.dcproj.dao.TaskDthDayCountDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.dto.BisInspTaskTotal" id="BisInspTaskTotalResultMap">
  5. <result property="objSize" column="OBJ_SIZE"/>
  6. <result property="pblmSize" column="PBLM_SIZE"/>
  7. <result property="mendSize" column="MEND_SIZE"/>
  8. <result property="pblmLogSize" column="PBLM_LOG_SIZE"/>
  9. <result property="infoPlbm" column="INFO_PLBM"/>
  10. <result property="warmPlbm" column="WARM_PLBM"/>
  11. <result property="errorPlbm" column="ERROR_PLBM"/>
  12. </resultMap>
  13. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspTaskTypeItemTotal" id="BisInspTaskTypeItemTotalResultMap">
  14. <result property="itemName" column="INSP_PBLM_NAME"/>
  15. <result property="pblmSize" column="PBLM_SIZE"/>
  16. <result property="mendSize" column="MEND_SIZE"/>
  17. <result property="pblmLogSize" column="PBLM_LOG_SIZE"/>
  18. <result property="infoPlbm" column="INFO_PLBM"/>
  19. <result property="warmPlbm" column="WARM_PLBM"/>
  20. <result property="errorPlbm" column="ERROR_PLBM"/>
  21. </resultMap>
  22. <sql id="page_where">
  23. <trim prefix="where" prefixOverrides="and | or ">
  24. <if test="orgId != null and orgId != ''">and ORG_ID = #{orgId}</if>
  25. <if test="adCode != null and adCode != ''">and AD_CODE = #{adCode}</if>
  26. <if test="adName != null and adName != ''">and AD_NAME = #{adName}</if>
  27. <if test="adFullName != null and adFullName != ''">and AD_FULL_NAME = #{adFullName}</if>
  28. <if test="adGrad != null and adGrad != ''">and AD_GRAD = #{adGrad}</if>
  29. <if test="tm != null">and TM = #{tm}</if>
  30. <if test="objType != null and objType != ''">and OBJ_TYPE = #{objType}</if>
  31. <if test="objName != null and objName != ''">and OBJ_NAME = #{objName}</if>
  32. <if test="objSize != null and objSize != ''">and OBJ_SIZE = #{objSize}</if>
  33. <if test="pblmSize != null and pblmSize != ''">and PBLM_SIZE = #{pblmSize}</if>
  34. <if test="mendSize != null and mendSize != ''">and MEND_SIZE = #{mendSize}</if>
  35. <if test="pblmLogSize != null and pblmLogSize != ''">and PBLM_LOG_SIZE = #{pblmLogSize}</if>
  36. <if test="intm != null">and INTM = #{intm}</if>
  37. <if test="uptm != null">and UPTM = #{uptm}</if>
  38. <if test="dataStat != null and dataStat != ''">and DATA_STAT = #{dataStat}</if>
  39. and DATA_STAT='0'
  40. </trim>
  41. </sql>
  42. <select id="getListByTm" resultMap="BisInspTaskTotalResultMap">
  43. select
  44. count(*) OBJ_SIZE
  45. from
  46. BIS_INSP_ALL_OBJ O
  47. <where>
  48. <if test="objType != null and objType != '' ">
  49. and PTYPE = #{objType}
  50. </if>
  51. <if test='stTm != null and stTm != "" '>
  52. and OBJ_INTM &gt;= STR_TO_DATE(#{stTm}, '%Y-%m-%d')
  53. </if>
  54. <if test='enTm != null and enTm != "" '>
  55. and OBJ_INTM &lt; date_add( STR_TO_DATE(#{entm},'%Y-%m-%d'), INTERVAL 1 day )
  56. </if>
  57. <if test="adCode != null and adCode != '' ">
  58. and OBJ_AD_CODE like '${adCode}%'
  59. </if>
  60. </where>
  61. </select>
  62. <select id="getListJichaByTm" resultType="cn.com.goldenwater.dcproj.dto.BisInspTaskTotal">
  63. select
  64. count(*) OBJ_SIZE
  65. from
  66. TAC_PAWP_RGSTR O
  67. <where>
  68. DATA_STAT = '0'
  69. <if test='stTm != null and stTm != "" '>
  70. and INTM &gt;= STR_TO_DATE(#{stTm}, '%Y-%m-%d')
  71. </if>
  72. <if test='enTm != null and enTm != "" '>
  73. and INTM &lt; date_add( STR_TO_DATE(#{enTm},'%Y-%m-%d'), INTERVAL 1 day )
  74. </if>
  75. <if test="adCode != null and adCode != '' ">
  76. and AD_CODE like '${adCode}%'
  77. </if>
  78. </where>
  79. </select>
  80. <select id="getPblmListByTm" resultMap="BisInspTaskTotalResultMap">
  81. SELECT
  82. ifnull(COUNT(A.PBLM_ID),0) PBLM_SIZE,
  83. IFNULL(SUM( CASE A.INSP_PBLM_CATE WHEN '0' THEN 1 ELSE 0 END ), 0) INFO_PLBM,
  84. IFNULL(SUM( CASE A.INSP_PBLM_CATE WHEN '1' THEN 1 ELSE 0 END ), 0) WARM_PLBM,
  85. IFNULL(SUM( CASE A.INSP_PBLM_CATE WHEN '2' THEN 1 ELSE 0 END ), 0) ERROR_PLBM,
  86. IFNULL(SUM( CASE A.INSP_PBLM_CATE WHEN '3' THEN 1 ELSE 0 END ), 0) ERROR_PLBM
  87. FROM BIS_INSP_PBLM A
  88. WHERE a.obj_type = #{objType}
  89. and a.coll_time &gt;= STR_TO_DATE(#{stTm}, '%Y-%m-%d')
  90. and a.coll_time &lt; date_add(str_to_date(#{enTm}, '%Y-%m-%d'), INTERVAL 1 day )
  91. <if test="adCode != null and adCode != '' ">
  92. and A.OBJ_AD_CODE like '${adCode}%'
  93. </if>
  94. </select>
  95. <select id="getPblmListJichaByTm" resultMap="BisInspTaskTotalResultMap">
  96. SELECT
  97. ifnull(COUNT(A.ID),0) PBLM_SIZE,
  98. IFNULL(SUM( CASE A.PBLM_PASI WHEN '0' THEN 1 ELSE 0 END ), 0) INFO_PLBM,
  99. IFNULL(SUM( CASE A.PBLM_PASI WHEN '1' THEN 1 ELSE 0 END ), 0) WARM_PLBM,
  100. IFNULL(SUM( CASE A.PBLM_PASI WHEN '2' THEN 1 ELSE 0 END ), 0) ERROR_PLBM
  101. FROM TAC_PBLM_INFO A
  102. JOIN TAC_PAWP_RGSTR R ON A.RGSTR_ID=R.ID
  103. WHERE
  104. R.DATA_STAT= '0'
  105. AND A.INTM &gt;= str_to_date(#{stTm},'%Y-%m-%d')
  106. AND A.INTM &lt; date_add( str_to_date(#{enTm},'%Y-%m-%d'), INTERVAL 1 day )
  107. <if test="adCode != null and adCode != '' ">
  108. and r.AD_CODE like '${adCode}%'
  109. </if>
  110. </select>
  111. <select id="getPblmListTypeByTm" resultMap="BisInspTaskTypeItemTotalResultMap">
  112. SELECT
  113. A.INSP_PBLM_NAME, ifnull(COUNT( A.PBLM_ID ),0) PBLM_SIZE, 0 AS "MEND_SIZE", 0 AS "PBLM_LOG_SIZE",
  114. SUM( CASE A.INSP_PBLM_CATE WHEN '0' THEN 1 ELSE 0 END ) INFO_PLBM,
  115. SUM( CASE A.INSP_PBLM_CATE WHEN '1' THEN 1 ELSE 0 END ) WARM_PLBM,
  116. SUM( CASE A.INSP_PBLM_CATE WHEN '2' THEN 1 ELSE 0 END ) ERROR_PLBM
  117. FROM BIS_INSP_PBLM A
  118. WHERE
  119. A.INSP_PBLM_NAME IS NOT NULL
  120. and a.obj_type = #{objType}
  121. and a.coll_time &gt;= str_to_date(#{stTm},'%Y-%m-%d')
  122. and a.coll_time &lt; date_add( str_to_date(#{enTm},'%Y-%m-%d'), INTERVAL 1 day )
  123. <if test="adCode != null and adCode != '' ">
  124. and A.OBJ_AD_CODE like '${adCode}%'
  125. </if>
  126. GROUP BY INSP_PBLM_NAME
  127. </select>
  128. <select id="getPblmListTypeJichaByTm" resultMap="BisInspTaskTypeItemTotalResultMap">
  129. SELECT
  130. TB.SPFSNL_TYPE, ifnull(COUNT( A.ID ),0) PBLM_SIZE, 0 AS "MEND_SIZE", 0 AS "PBLM_LOG_SIZE",
  131. SUM( CASE A.PBLM_PASI WHEN '0' THEN 1 ELSE 0 END ) INFO_PLBM,
  132. SUM( CASE A.PBLM_PASI WHEN '1' THEN 1 ELSE 0 END ) WARM_PLBM,
  133. SUM( CASE A.PBLM_PASI WHEN '2' THEN 1 ELSE 0 END ) ERROR_PLBM
  134. FROM TAC_PBLM_INFO A JOIN TAC_PAWP_RGSTR R ON A.RGSTR_ID=R.ID
  135. LEFT JOIN TAC_OBJ_PBLMSTB TB ON TB.ID = A.PBLMSTD_ID
  136. WHERE
  137. R.DATA_STAT = '0'
  138. AND TB.SPFSNL_TYPE IS NOT NULL
  139. and a.INTM &gt;= str_to_date(#{stTm},'%Y-%m-%d')
  140. and a.INTM &lt; date_add( str_to_date(#{enTm},'%Y-%m-%d'), INTERVAL 1 day )
  141. <if test="adCode != null and adCode != '' ">
  142. and R.AD_CODE like '${adCode}%'
  143. </if>
  144. GROUP BY TB.SPFSNL_TYPE
  145. </select>
  146. <select id="getPblmListTypeJiChaByTm" resultMap="BisInspTaskTypeItemTotalResultMap">
  147. SELECT
  148. A.*, ifnull(B.PBLM_LOG_SIZE, 0) AS "PBLM_LOG_SIZE"
  149. FROM
  150. (
  151. SELECT
  152. A.INSP_PBLM_NAME, ifnull(COUNT( A.PBLM_ID ),0) PBLM_SIZE, 0 AS "MEND_SIZE",
  153. SUM( CASE A.INSP_PBLM_CATE WHEN '0' THEN 1 ELSE 0 END ) INFO_PLBM,
  154. SUM( CASE A.INSP_PBLM_CATE WHEN '1' THEN 1 ELSE 0 END ) WARM_PLBM,
  155. SUM( CASE A.INSP_PBLM_CATE WHEN '2' THEN 1 ELSE 0 END ) ERROR_PLBM
  156. FROM BIS_INSP_PBLM A
  157. JOIN BIS_INSP_ALL_OBJ B ON A.OBJ_ID = B.OBJ_ID
  158. WHERE
  159. A.DATA_STAT = '0'
  160. AND A.INSP_PBLM_NAME IS NOT NULL
  161. and a.coll_time &gt;= str_to_date(#{stTm}, '%Y-%m-%d')
  162. and a.coll_time &lt; date_add( str_to_date(#{enTm},'%Y-%m-%d'), INTERVAL 1 day )
  163. <if test="adCode != null and adCode != '' ">
  164. and B.OBJ_AD_CODE like '${adCode}%'
  165. </if>
  166. GROUP BY INSP_PBLM_NAME
  167. ) A
  168. LEFT JOIN (
  169. SELECT
  170. A.INSP_PBLM_NAME, ifnull(COUNT( A.PBLM_ID ),0) PBLM_LOG_SIZE
  171. FROM BIS_INSP_PBLM_DEL_LOG A
  172. JOIN BIS_INSP_ALL_OBJ B ON A.OBJ_ID = B.OBJ_ID
  173. WHERE
  174. a.obj_type = '8'
  175. and a.coll_time BETWEEN STR_TO_DATE(#{stTm}, '%Y-%m-%d') and STR_TO_DATE(#{enTm}, '%Y-%m-%d')
  176. <if test="adCode != null and adCode != '' ">
  177. and B.OBJ_AD_CODE like '${adCode}%'
  178. </if>
  179. GROUP BY A.INSP_PBLM_NAME
  180. ) B ON A.INSP_PBLM_NAME = B.INSP_PBLM_NAME
  181. </select>
  182. <select id="getObjSize" resultType="java.util.Map">
  183. select
  184. ifnull(count(*), 0) OBJSIZE
  185. from BIS_INSP_ALL_OBJ O
  186. JOIN (select * FROM ATT_INSP_TYPE where code IN (select INSP_TYPE FROM REL_ORG_INSP_TYPE
  187. <where>
  188. <if test="orgId != null and orgId != '' ">
  189. AND ORG_ID = #{orgId}
  190. </if>
  191. </where>
  192. )) A ON O.PTYPE = A.PTYPE
  193. JOIN BIS_INSP_ALL AL ON O.ID = AL.ID
  194. <where>
  195. <if test="orgId != null and orgId != '' ">AND O.ID LIKE '___${orgId}%'</if>
  196. <if test="province != null and province != '' ">AND O.OBJ_AD_CODE LIKE CONCAT(#{province}, '%')</if>
  197. <if test="adCode != null and adCode != '' ">and O.OBJ_AD_CODE LIKE CONCAT(#{adCode}, '%')</if>
  198. <if test="objType != null and objType != '' ">and O.PTYPE = #{objType}</if>
  199. <if test='sttm != null and "" != sttm '>and O.OBJ_INTM &gt;= str_to_date(#{sttm}, '%Y-%m-%d')</if>
  200. <if test='entm != null and "" != entm '>and O.OBJ_INTM &lt; date_add( str_to_date(#{entm},'%Y-%m-%d'), INTERVAL 1 day ) </if>
  201. </where>
  202. </select>
  203. <!-- lxf 2022/11/22 督查对象重复数量 -->
  204. <select id="getObjSizeRepeat" resultType="java.util.Map">
  205. select
  206. <!-- 统计督查对象 重复数量 add lxf 2022/11/19 -->
  207. IFNULL(count(*), 0) OBJSIZEREPEAT
  208. from BIS_INSP_ALL_OBJ O
  209. JOIN (select * FROM ATT_INSP_TYPE where code IN (select INSP_TYPE FROM REL_ORG_INSP_TYPE
  210. <where>
  211. <if test="orgId != null and orgId != '' ">
  212. AND ORG_ID = #{orgId}
  213. </if>
  214. </where>
  215. )) A ON O.PTYPE = A.PTYPE
  216. where O.code IN
  217. ( SELECT biaoin.code FROM BIS_INSP_ALL_OBJ biaoin
  218. <where>
  219. <if test="orgId != null and orgId != '' ">AND biaoin.ORG_ID = #{orgId} </if>
  220. <if test='adCode != null and adCode != "" '> AND biaoin.OBJ_AD_CODE like '${adCode}%'</if>
  221. <if test="orgId != null and orgId != '' ">AND biaoin.ID LIKE '___${orgId}%'</if>
  222. <if test="province != null and province != '' ">AND biaoin.OBJ_AD_CODE LIKE CONCAT(#{province}, '%')</if>
  223. <if test="adCode != null and adCode != '' ">and biaoin.OBJ_AD_CODE LIKE CONCAT(#{adCode}, '%')</if>
  224. <if test="objType != null and objType != '' ">and biaoin.PTYPE = #{objType}</if>
  225. <if test="sttm != null and sttm != '' ">and biaoin.OBJ_INTM &gt;= str_to_date(#{sttm}, '%Y-%m-%d')</if>
  226. <if test="entm != null and entm != '' ">and biaoin.OBJ_INTM &lt; date_add( str_to_date(#{entm},'%Y-%m-%d'), INTERVAL 1 day ) </if>
  227. </where>
  228. GROUP BY biaoin.code, biaoin.PTYPE HAVING count( biaoin.code ) > 1
  229. )
  230. </select>
  231. <select id="getPblmSize" resultType="java.util.Map">
  232. <!--WITH O AS (
  233. )-->
  234. SELECT
  235. ifnull(SUM(PBLM_SIZE),0) PBLMSIZE
  236. FROM (
  237. SELECT
  238. A.NAME,O.OBJ_AD_CODE, O.PTYPE,
  239. ifnull(COUNT(distinct P.PBLM_ID ),0) PBLM_SIZE
  240. FROM
  241. BIS_INSP_ALL_OBJ O
  242. JOIN (select * FROM ATT_INSP_TYPE where code IN (select INSP_TYPE FROM REL_ORG_INSP_TYPE
  243. <where>
  244. <if test='orgId != null and orgId != "" '>
  245. AND ORG_ID = #{orgId}
  246. </if>
  247. </where>
  248. )) A ON A.PTYPE = O.PTYPE
  249. JOIN BIS_INSP_PBLM P ON P.OBJ_ID = O.OBJ_ID
  250. <where>
  251. <if test="orgId != null and orgId != '' ">O.ID LIKE '___${orgId}%'</if>
  252. <if test="sttm != null and sttm != '' and entm != null and entm != '' ">
  253. and O.OBJ_INTM &gt;= STR_TO_DATE(#{sttm}, '%Y-%m-%d')
  254. and O.OBJ_INTM &lt; DATE_ADD( STR_TO_DATE(#{entm},'%Y-%m-%d'), INTERVAL 1 day )
  255. </if>
  256. </where>
  257. GROUP BY A.NAME,O.OBJ_AD_CODE, O.PTYPE
  258. ) O
  259. <where>
  260. <if test="adCode != null and adCode != '' ">AND OBJ_AD_CODE LIKE CONCAT(#{adCode}, '%')</if>
  261. <if test="province != null and province != '' ">AND OBJ_AD_CODE LIKE CONCAT(#{province}, '%')</if>
  262. <if test="objType != null and objType != '' ">AND PTYPE = #{objType}</if>
  263. </where>
  264. </select>
  265. <select id="getDelPblmSize" resultType="java.util.Map">
  266. SELECT
  267. ifnull(COUNT(A.PBLM_ID), 0) PBLMLOGSIZE
  268. FROM
  269. BIS_INSP_PBLM_DEL_LOG A
  270. JOIN
  271. BIS_INSP_ALL_OBJ B ON A.OBJ_ID=B.OBJ_ID
  272. <where>
  273. <if test="adCode != null and adCode != '' ">
  274. substr(b.OBJ_AD_CODE,1,2)=#{adCode}
  275. </if>
  276. </where>
  277. </select>
  278. <select id="getObjTypeSize" resultType="java.util.Map">
  279. select ifnull(count(*), 0) OBJTYPESIZE
  280. from REL_ORG_INSP_TYPE
  281. <where>
  282. <if test="orgId != null and orgId != '' ">
  283. ORG_ID = #{orgId}
  284. </if>
  285. </where>
  286. </select>
  287. <select id="getAllObjSize" resultType="java.util.Map">
  288. select ifnull(count(1),0) ALLOBJSIZE from (
  289. SELECT ptype FROM BIS_INSP_ALL_OBJ
  290. <where>
  291. <if test="adCode != null and adCode != '' ">
  292. OBJ_AD_CODE like '${adCode}%'
  293. </if>
  294. <if test="objType != null and objType != '' ">
  295. and PTYPE = #{objType}
  296. </if>
  297. <if test="sttm != null and sttm != '' ">
  298. and OBJ_INTM &gt;= STR_TO_DATE(#{sttm}, '%Y-%m-%d')
  299. </if>
  300. <if test="entm != null and entm != '' ">
  301. and OBJ_INTM &lt; DATE_ADD( STR_TO_DATE(#{entm},'%Y-%m-%d'), INTERVAL 1 day )
  302. </if>
  303. </where> group by ptype) ao
  304. </select>
  305. <select id="getObjAdCodeSizeX" resultType="java.util.Map">
  306. select IFNULL(sum(AD_CODE_SIZE_X),0) OBJADCODESIZEX from (
  307. SELECT
  308. count(distinct(substr(ad_code,1,6))) AD_CODE_SIZE_X
  309. FROM
  310. (
  311. SELECT OBJ_NAME,
  312. AD_CODE,
  313. OBJ_TYPE, OBJ_SIZE, PBLM_SIZE,SUBMIT_PLBM, INFO_PLBM, WARM_PLBM, ERROR_PLBM, ERRORS_PLBM,PBLM_LOG_SIZE,MEND_SIZE,GROUP_SIZE ,PERS_SIZE
  314. FROM (
  315. SELECT
  316. AIT.NAME AS "OBJ_NAME",
  317. <!-- 把福建省福州市下的平潭县 提到到平潭综合实验区 -->
  318. <!-- 把山东省莱芜市下的市辖区、莱芜区 归属到济南市莱芜区,钢城区 归属到济南市的钢城区, -->
  319. ( case when SUBSTR(O.OBJ_AD_CODE, 1, 6) = '350128' then '351000000000' when SUBSTR(O.OBJ_AD_CODE,1, 6) = '371201' then '370116000000' when SUBSTR(O.OBJ_AD_CODE, 1, 6) = '371202' then '370116000000' when SUBSTR(O.OBJ_AD_CODE, 1, 6) = '371203' then '370117000000' else O.OBJ_AD_CODE end) AS "AD_CODE",
  320. O.PTYPE as "OBJ_TYPE",
  321. COUNT( DISTINCT O.OBJ_ID ) OBJ_SIZE,
  322. COUNT(DISTINCT case when P.PBLM_ID is not null then P.PBLM_ID end ) PBLM_SIZE,
  323. IFNULL( SUM( CASE WHEN P.STATE = '2' THEN 1 ELSE 0 END ), 0 ) SUBMIT_PLBM,
  324. IFNULL( SUM( CASE P.INSP_PBLM_CATE WHEN '0' THEN 1 ELSE 0 END ), 0 ) INFO_PLBM,
  325. IFNULL( SUM( CASE P.INSP_PBLM_CATE WHEN '1' THEN 1 ELSE 0 END ), 0 ) WARM_PLBM,
  326. IFNULL( SUM( CASE P.INSP_PBLM_CATE WHEN '2' THEN 1 ELSE 0 END ), 0 ) ERROR_PLBM,
  327. IFNULL( SUM( CASE P.INSP_PBLM_CATE WHEN '3' THEN 1 ELSE 0 END ), 0 ) ERRORS_PLBM,
  328. IFNULL( SUM( CASE PL.PBLM_OUT WHEN '1' THEN 1 ELSE 0 END ), 0 ) PBLM_LOG_SIZE,
  329. IFNULL( COUNT(DISTINCT CASE when PL.PBLM_ID is not null then P.PBLM_ID end ), 0 ) MEND_SIZE,
  330. count(distinct(o.id)) GROUP_SIZE,
  331. SUM(( SELECT COUNT(DISTINCT(TT.PERSID)) FROM BIS_INSP_ALL_RLATION TT WHERE TT.ID = O.ID) )PERS_SIZE
  332. FROM
  333. BIS_INSP_ALL_OBJ O
  334. JOIN (select * FROM ATT_INSP_TYPE where code IN (select INSP_TYPE FROM REL_ORG_INSP_TYPE
  335. <where>
  336. <if test='orgId != null and orgId != "" '>
  337. AND ORG_ID = #{orgId}
  338. </if>
  339. </where>
  340. ) ) AIT ON AIT.PTYPE = O.PTYPE
  341. LEFT JOIN BIS_INSP_PBLM P ON P.OBJ_ID = O.OBJ_ID
  342. LEFT JOIN BIS_INSP_PBLM_PLIST Pl ON PL.PBLM_ID = P.PBLM_ID and PL.DATA_STAT='0'
  343. <where>
  344. <if test="objType != null and objType != ''">and O.PTYPE = #{objType}</if>
  345. <if test="orgId != null and orgId != ''">AND O.ID LIKE '___${orgId}%'</if>
  346. <if test="sttm != null and sttm != '' and entm != null and entm != '' ">
  347. and O.OBJ_INTM &gt;= STR_TO_DATE(#{sttm}, '%Y-%m-%d') and O.OBJ_INTM &lt; DATE_ADD( STR_TO_DATE(#{entm},'%Y-%m-%d'), INTERVAL 1 day )
  348. </if>
  349. </where>
  350. GROUP BY AIT.NAME,O.OBJ_AD_CODE, O.PTYPE
  351. ) o
  352. <where>
  353. <if test="adCode != null and adCode != ''">and o.AD_CODE LIKE '${adCode}%'</if>
  354. </where>
  355. ) T
  356. GROUP BY T.OBJ_NAME, T.OBJ_TYPE
  357. ORDER BY cast(T.OBJ_TYPE as signed ) ) ado
  358. </select>
  359. <select id="getObjAdCodeSizeS" resultType="java.util.Map">
  360. select IFNULL(sum(AD_CODE_SIZE_S),0) OBJADCODESIZES from (
  361. SELECT
  362. count(distinct(substr(ad_code,1,6))) AD_CODE_SIZE_S
  363. FROM
  364. (
  365. SELECT OBJ_NAME,
  366. AD_CODE,
  367. OBJ_TYPE, OBJ_SIZE, PBLM_SIZE,SUBMIT_PLBM, INFO_PLBM, WARM_PLBM, ERROR_PLBM, ERRORS_PLBM,PBLM_LOG_SIZE,MEND_SIZE,GROUP_SIZE ,PERS_SIZE
  368. FROM (
  369. SELECT
  370. AIT.NAME AS "OBJ_NAME",
  371. <!-- 把福建省福州市下的平潭县 提到到平潭综合实验区 -->
  372. <!-- 把山东省莱芜市下的市辖区、莱芜区 归属到济南市莱芜区,钢城区 归属到济南市的钢城区, -->
  373. ( case when SUBSTR(O.OBJ_AD_CODE, 1, 6) = '350128' then '351000000000' when SUBSTR(O.OBJ_AD_CODE, 1, 6) = '371201' then '370116000000' when SUBSTR(O.OBJ_AD_CODE, 1, 6) = '371202' then '370116000000' when SUBSTR(O.OBJ_AD_CODE, 1, 6) = '371203' then '370117000000' else O.OBJ_AD_CODE end) AS "AD_CODE",
  374. O.PTYPE as "OBJ_TYPE",
  375. COUNT( DISTINCT O.OBJ_ID ) OBJ_SIZE,
  376. COUNT(DISTINCT case when P.PBLM_ID is not null then P.PBLM_ID end ) PBLM_SIZE,
  377. IFNULL( SUM( CASE WHEN P.STATE = '2' THEN 1 ELSE 0 END ), 0 ) SUBMIT_PLBM,
  378. IFNULL( SUM( CASE P.INSP_PBLM_CATE WHEN '0' THEN 1 ELSE 0 END ), 0 ) INFO_PLBM,
  379. IFNULL( SUM( CASE P.INSP_PBLM_CATE WHEN '1' THEN 1 ELSE 0 END ), 0 ) WARM_PLBM,
  380. IFNULL( SUM( CASE P.INSP_PBLM_CATE WHEN '2' THEN 1 ELSE 0 END ), 0 ) ERROR_PLBM,
  381. IFNULL( SUM( CASE P.INSP_PBLM_CATE WHEN '3' THEN 1 ELSE 0 END ), 0 ) ERRORS_PLBM,
  382. IFNULL( SUM( CASE PL.PBLM_OUT WHEN '1' THEN 1 ELSE 0 END ), 0 ) PBLM_LOG_SIZE,
  383. IFNULL( COUNT(DISTINCT CASE when PL.PBLM_ID is not null then P.PBLM_ID end ), 0 ) MEND_SIZE,
  384. count(distinct(o.id)) GROUP_SIZE,
  385. SUM(( SELECT COUNT(DISTINCT(TT.PERSID)) FROM BIS_INSP_ALL_RLATION TT WHERE TT.ID = O.ID) )PERS_SIZE
  386. FROM
  387. BIS_INSP_ALL_OBJ O
  388. JOIN (select * FROM ATT_INSP_TYPE where code IN (select INSP_TYPE FROM REL_ORG_INSP_TYPE
  389. <where>
  390. <if test='orgId != null and orgId != "" '>
  391. AND ORG_ID = #{orgId}
  392. </if>
  393. </where>
  394. )) AIT ON AIT.PTYPE = O.PTYPE
  395. LEFT JOIN BIS_INSP_PBLM P ON P.OBJ_ID = O.OBJ_ID
  396. LEFT JOIN BIS_INSP_PBLM_PLIST Pl ON PL.PBLM_ID = P.PBLM_ID and PL.DATA_STAT='0'
  397. <where>
  398. <if test="objType != null and objType != ''">and O.PTYPE = #{objType}</if>
  399. <if test="orgId != null and orgId != ''">AND O.ID LIKE '___${orgId}%'</if>
  400. <if test="sttm != null and sttm != '' and entm != null and entm != '' ">
  401. and O.OBJ_INTM &gt;= STR_TO_DATE(#{sttm}, '%Y-%m-%d') and O.OBJ_INTM &lt; DATE_ADD( STR_TO_DATE(#{entm},'%Y-%m-%d'), INTERVAL 1 day )
  402. </if>
  403. </where>
  404. GROUP BY AIT.NAME,O.OBJ_AD_CODE, O.PTYPE
  405. ) o
  406. <where>
  407. <if test="adCode != null and adCode != ''">and o.AD_CODE LIKE '${adCode}%'</if>
  408. </where>
  409. ) T
  410. GROUP BY T.OBJ_NAME, T.OBJ_TYPE
  411. ORDER BY cast(T.OBJ_TYPE as signed )) ados
  412. </select>
  413. <select id="getHasObjSize" resultType="java.util.Map">
  414. SELECT ifnull(count(DISTINCT O.OBJ_ID),0) HASOBJSIZE
  415. FROM (
  416. SELECT * FROM BIS_INSP_ALL_OBJ
  417. <where>
  418. <if test="province != null and province != '' ">AND OBJ_AD_CODE LIKE CONCAT(#{province}, '%')</if>
  419. <if test="adCode != null and adCode != '' ">
  420. and OBJ_AD_CODE like '${adCode}%'
  421. </if>
  422. <if test="objType != null and objType != '' ">
  423. and PTYPE = #{objType}
  424. </if>
  425. <if test='sttm != null and sttm != "" '>
  426. and OBJ_INTM &gt;= STR_TO_DATE(#{sttm},'%Y-%m-%d')
  427. </if>
  428. <if test='entm != null and entm != "" '>
  429. and OBJ_INTM &lt; date_add( STR_TO_DATE(#{entm},'%Y-%m-%d'), INTERVAL 1 day )
  430. </if>
  431. </where>
  432. ) O
  433. RIGHT JOIN (
  434. <foreach collection="rgsterTable" index="index" item="item">
  435. <if test="index != 0">
  436. UNION ALL
  437. </if>
  438. <choose>
  439. <when test="item == 'BIS_INSP_GRW' ">
  440. SELECT OBJ_ID, INSP_STATE AS "STATE" FROM BIS_INSP_GRW WHERE INSP_STATE = '2'
  441. </when>
  442. <otherwise>
  443. SELECT OBJ_ID, STATE FROM ${item} WHERE STATE = '2'
  444. </otherwise>
  445. </choose>
  446. </foreach>
  447. ) R ON R.OBJ_ID = o.OBJ_ID
  448. </select>
  449. <select id="getObjTypeSizeMonth" resultType="java.util.Map">
  450. select ifnull(count(DISTINCT PTYPE), 0) OBJTYPESIZEMONTH
  451. from BIS_INSP_ALL_OBJ
  452. where
  453. OBJ_INTM between DATE_ADD(now(),INTERVAL -1 MONTH) and now()
  454. <if test="orgId != null and orgId != '' ">
  455. AND ORG_ID = #{orgId}
  456. </if>
  457. <if test="adCode != null and adCode != ''">AND OBJ_AD_CODE LIKE '${adCode}%'</if>
  458. </select>
  459. <select id="getPblmSizeMonth" resultType="java.util.Map">
  460. SELECT
  461. ifnull(COUNT(A.PBLM_ID), 0) PBLMSIZEMONTH
  462. FROM
  463. BIS_INSP_PBLM A
  464. JOIN
  465. BIS_INSP_ALL_OBJ B ON A.OBJ_ID=B.OBJ_ID
  466. WHERE
  467. A.DATA_STAT= '0'
  468. AND A.coll_time between DATE_ADD(now(),INTERVAL -1 MONTH) and now()
  469. <if test="orgId != null and orgId != '' ">AND B.ID LIKE '___${orgId}%'</if>
  470. <if test="adCode != null and adCode != '' ">AND B.OBJ_AD_CODE LIKE CONCAT(#{adCode}, '%')</if>
  471. </select>
  472. <select id="getDelPblmSizeMonth" resultType="java.util.Map">
  473. SELECT
  474. ifnull(COUNT(A.PBLM_ID), 0) PBLMLOGSIZEMONTH
  475. FROM BIS_INSP_PBLM_DEL_LOG A
  476. JOIN BIS_INSP_ALL_OBJ B ON A.OBJ_ID=B.OBJ_ID
  477. WHERE A.PBLM_DEL_TM between DATE_ADD(now(),INTERVAL -1 MONTH)and now()
  478. <if test="orgId != null and orgId != '' ">AND B.ID LIKE '___${orgId}%'</if>
  479. <if test="adCode != null and adCode != '' ">AND B.OBJ_AD_CODE LIKE CONCAT(#{adCode}, '%')</if>
  480. </select>
  481. <select id="getObjSizeJicha" resultType="java.util.Map">
  482. SELECT
  483. ifnull(COUNT( DISTINCT r.id ), 0) OBJSIZE
  484. FROM TAC_INSP_YEAR_BATCH_OBJ O
  485. JOIN tac_pawp_rgstr r on o.ID = r.obj_id
  486. <where>
  487. <if test="year != null and year != ''">and O.YEAR = #{year}</if>
  488. <if test="batch != null and batch != ''">and O.BATCH = #{batch}</if>
  489. <if test="adCode != null and adCode != ''">and r.AD_CODE LIKE '${adCode}%'</if>
  490. <if test="province != null and province != ''">and r.PROVINCE LIKE '${province}%'</if>
  491. </where>
  492. </select>
  493. <select id="getPblmSizeJicha" resultType="java.util.Map">
  494. /* WITH O AS (
  495. )*/
  496. SELECT
  497. IFNULL(SUM(PBLM_SIZE), 0) AS PBLMSIZE
  498. FROM
  499. (SELECT
  500. r.AD_CODE as OBJ_AD_CODE, '8' as "PTYPE", a.INTM as "OBJ_INTM", COUNT( a.ID )
  501. PBLM_SIZE
  502. FROM TAC_INSP_YEAR_BATCH_OBJ O
  503. LEFT JOIN tac_pawp_rgstr r ON o.ID = r.obj_id
  504. LEFT JOIN (SELECT * FROM TAC_PROVINCE_PBLM_INFO WHERE STEP_ID = #{lastStepId}) a ON a.rgstr_id = r.id
  505. <where>
  506. <if test="year != null and year != ''">and O.YEAR = #{year}</if>
  507. <if test="batch != null and batch != ''">and O.BATCH = #{batch}</if>
  508. </where>
  509. GROUP BY a.list_type, r.AD_CODE, A.INTM) b
  510. <where>
  511. <if test="adCode != null and adCode != ''">OBJ_AD_CODE LIKE '${adCode}%'</if>
  512. </where>
  513. </select>
  514. <select id="getPblmSizeJichaZg" resultType="java.util.Map">
  515. /* WITH O AS (
  516. )*/
  517. SELECT
  518. IFNULL(SUM(PBLM_SIZE), 0) AS MENDSIZE
  519. FROM
  520. (SELECT
  521. r.AD_CODE as OBJ_AD_CODE, '8' as "PTYPE", a.INTM as "OBJ_INTM", COUNT( a.ID )
  522. PBLM_SIZE
  523. FROM TAC_INSP_YEAR_BATCH_OBJ O
  524. LEFT JOIN tac_pawp_rgstr r ON o.ID = r.obj_id
  525. LEFT JOIN (SELECT * FROM TAC_PROVINCE_PBLM_MEND_INFO WHERE STEP_ID = #{lastStepId} and CRT_STATE='1') a ON
  526. a.rgstr_id = r.id
  527. <where>
  528. <if test="year != null and year != ''">and O.YEAR = #{year}</if>
  529. <if test="batch != null and batch != ''">and O.BATCH = #{batch}</if>
  530. </where>
  531. GROUP BY a.list_type, r.AD_CODE, A.INTM
  532. ) a
  533. <where>
  534. <if test="adCode != null and adCode != ''">OBJ_AD_CODE LIKE '${adCode}%'</if>
  535. </where>
  536. </select>
  537. <select id="getPblmSizeJichaFc" resultType="java.util.Map">
  538. /* WITH O AS (
  539. )*/
  540. SELECT
  541. IFNULL(SUM(PBLM_SIZE), 0) AS PBLMLOGSIZE
  542. FROM (
  543. SELECT
  544. IF('1'=a.LIST_TYPE,'前期与设计', IF('2'=a.LIST_TYPE,'建设管理', IF('3'=a.LIST_TYPE,'计划下达与执行', IF('4'=a.LIST_TYPE,'资金使用与管理', IF('5'=a.LIST_TYPE,'工程质量管理-工程实体质量', IF('6'=a.LIST_TYPE,'安全管理', '' )))))) as NAME,
  545. r.AD_CODE as OBJ_AD_CODE, '8' as "PTYPE", a.INTM as "OBJ_INTM", COUNT( a.ID )
  546. PBLM_SIZE
  547. FROM TAC_INSP_YEAR_BATCH_OBJ O
  548. LEFT JOIN tac_pawp_rgstr r ON o.ID = r.obj_id
  549. LEFT JOIN (SELECT * FROM TAC_PROVINCE_PBLM_MEND_INFO WHERE STEP_ID = #{lastStepId} and pblm_out='1') a ON
  550. a.rgstr_id = r.id
  551. <where>
  552. <if test="year != null and year != ''">and O.YEAR = #{year}</if>
  553. <if test="batch != null and batch != ''">and O.BATCH = #{batch}</if>
  554. </where>
  555. GROUP BY a.list_type, r.AD_CODE, A.INTM
  556. ) z
  557. <where>
  558. <if test="adCode != null and adCode != ''">OBJ_AD_CODE LIKE '${adCode}%'</if>
  559. </where>
  560. </select>
  561. <select id="getHasObjSizeJicha" resultType="java.util.Map">
  562. SELECT ifnull(count(DISTINCT O.OBJ_ID),0) HASOBJSIZE
  563. FROM (
  564. SELECT * FROM BIS_INSP_ALL_OBJ
  565. <where>
  566. PTYPE = '8'
  567. <if test="adCode != null and adCode != '' ">
  568. and OBJ_AD_CODE like '${adCode}%'
  569. </if>
  570. </where>
  571. ) O
  572. LEFT JOIN (
  573. <foreach collection="rgsterTable" index="index" item="item">
  574. <if test="index != 0">
  575. UNION ALL
  576. </if>
  577. <choose>
  578. <when test="item == 'BIS_INSP_GRW' ">
  579. SELECT OBJ_ID, INSP_STATE AS "STATE" FROM BIS_INSP_GRW WHERE INSP_STATE = '2'
  580. </when>
  581. <otherwise>
  582. SELECT OBJ_ID, STATE FROM ${item} WHERE STATE = '2'
  583. </otherwise>
  584. </choose>
  585. </foreach>
  586. ) r ON r.OBJ_ID = o.OBJ_ID
  587. </select>
  588. <select id="getBisInspAllSize" resultType="java.util.Map">
  589. select IFNULL(count(*),0) as BISINSPALLSIZE from BIS_INSP_ALL A
  590. JOIN (select * FROM ATT_INSP_TYPE where code IN (select INSP_TYPE FROM REL_ORG_INSP_TYPE
  591. <where>
  592. <if test="orgId != null and orgId != '' ">
  593. AND ORG_ID = #{orgId}
  594. </if>
  595. </where>
  596. )) T ON substr(A.ID,1,3) = T.CODE
  597. <where>
  598. LENGTH(A.ID) = 9
  599. <if test="orgId != null and orgId != '' ">AND A.ID LIKE '___${orgId}%'</if>
  600. <if test="province != null and province != '' ">AND A.PROVINCE LIKE CONCAT(#{province}, '%')</if>
  601. <if test="objType != null and objType != '' ">and A.ID LIKE concat(#{objType},'%') </if>
  602. <if test="sttm != null and sttm != '' ">and A.STTM &gt;= str_to_date(#{sttm}, '%Y-%m-%d')</if>
  603. <if test="entm != null and entm != '' ">and A.INTM &lt; date_add( str_to_date(#{entm},'%Y-%m-%d'), INTERVAL 1 day )</if>
  604. </where>
  605. </select>
  606. <select id="getBisInspAllGroupSize" resultType="java.util.Map">
  607. SELECT ifnull(COUNT(DISTINCT C.ID),0) BISINSPALLGROUPSIZE
  608. FROM BIS_INSP_ALL C
  609. JOIN (select * FROM ATT_INSP_TYPE where code IN (select INSP_TYPE FROM REL_ORG_INSP_TYPE
  610. <where>
  611. <if test="orgId != null and orgId != '' ">
  612. AND ORG_ID = #{orgId}
  613. </if>
  614. </where>
  615. )) T ON SUBSTR(C.ID, 1, 3) = T.CODE
  616. LEFT JOIN BIS_INSP_ALL_OBJ O ON O.ID = C.ID
  617. WHERE LENGTH(C.ID) = '12'
  618. <if test="adCode != null and adCode != ''">AND O.OBJ_AD_CODE LIKE '${adCode}%'</if>
  619. <if test="orgId != null and orgId != '' ">
  620. AND C.ID LIKE '___${orgId}%'
  621. </if>
  622. <if test="objType != null and objType != '' ">
  623. and cast(C.ID as signed ) LIKE '${objType}%'
  624. </if>
  625. <if test='sttm != null and sttm != "" '>
  626. and C.STTM &gt;= STR_TO_DATE(#{sttm}, '%Y-%m-%d')
  627. </if>
  628. <if test='entm != null and entm != "" '>
  629. and C.STTM &lt; date_add( STR_TO_DATE(#{entm},'%Y-%m-%d'), INTERVAL 1 day )
  630. </if>
  631. </select>
  632. <select id="getBisInspAllGroupSizeJicha" resultType="java.util.Map">
  633. SELECT ifnull(COUNT(*),0) GROUPSIZE
  634. FROM TAC_INSP_YEAR_BATCH_GROUP g
  635. where exists (select *
  636. from TAC_INSP_YEAR_BATCH y
  637. JOIN TAC_INSP_YEAR_BATCH_AREA aa ON aa.YEAR_BATCH_ID = y.ID
  638. where y.id = g.year_batch_id
  639. <if test="year != null and year != ''">and y.YEAR = #{year}</if>
  640. <if test="batch != null and batch != ''">and y.BATCH = #{batch}</if>
  641. <if test="adCode != null and adCode != ''">and aa.AD_CODE LIKE '${adCode}%'</if>
  642. <if test="province != null and province != ''">and y.PROVINCE LIKE '${province}%'</if>
  643. )
  644. </select>
  645. <select id="getBisInspAllSizeMonth" resultType="java.util.Map">
  646. SELECT ifnull(COUNT(distinct C.ID),0) BISINSPALLSIZEMONTH
  647. FROM BIS_INSP_ALL C
  648. LEFT JOIN BIS_INSP_ALL_OBJ O ON O.ID = C.ID
  649. WHERE LENGTH(C.ID) = '9'
  650. and C.INTM between DATE_ADD(now(),INTERVAL -1 MONTH) and now()
  651. <if test="orgId != null and orgId != '' ">
  652. AND C.ID LIKE '___${orgId}%'
  653. </if>
  654. <if test="adCode != null and adCode != ''">AND O.OBJ_AD_CODE LIKE '${adCode}%'</if>
  655. </select>
  656. <!-- 统计 全部人员数量 -->
  657. <select id="getAllPerSize" resultType="java.util.Map">
  658. select ifnull( count( DISTINCT rp.guid) ,0) as PERSIZEALL
  659. FROM BIS_INSP_ALL_RLATION_PERS rp ,
  660. Bis_Insp_Pers_Org g,
  661. bis_insp_org o
  662. WHERE rp.guid = g.pers_id and
  663. g.org_id = o.org_id
  664. <if test='orgId != null and orgId != "" '>
  665. AND o.ORG_ID = #{orgId}
  666. </if>
  667. <if test='adCode != null and adCode != "" '>
  668. AND o.ad_code LIKE CONCAT(#{adCode}, '%' )
  669. </if>
  670. </select>
  671. <select id="getBisInspAllRlationPerSize" resultType="java.util.Map">
  672. SELECT ifnull(COUNT(DISTINCT B.PERSID),0) PERSIZE
  673. FROM BIS_INSP_ALL_RLATION B
  674. JOIN BIS_INSP_ALL C ON B.ID = C.ID
  675. JOIN BIS_INSP_ALL_RLATION_PERS P ON P.GUID = B.PERSID
  676. JOIN (select * FROM ATT_INSP_TYPE where code IN (select INSP_TYPE FROM REL_ORG_INSP_TYPE
  677. <where>
  678. <if test="orgId != null and orgId != '' ">
  679. AND ORG_ID = #{orgId}
  680. </if>
  681. </where>
  682. )) T ON SUBSTR(C.ID, 1, 3) = T.CODE
  683. LEFT JOIN BIS_INSP_ALL_OBJ O ON O.ID = C.ID
  684. <where>
  685. LENGTH( C.ID ) = 12
  686. <if test="adCode != null and adCode != ''">AND O.OBJ_AD_CODE LIKE '${adCode}%'</if>
  687. <if test="orgId != null and orgId != '' ">
  688. AND C.ID LIKE '___${orgId}%'
  689. </if>
  690. <if test="objType != null and objType != '' ">
  691. and cast(C.ID as signed) LIKE '${objType}%'
  692. </if>
  693. <if test='sttm != null and sttm != "" '>
  694. and C.STTM &gt;= STR_TO_DATE(#{sttm}, '%Y-%m-%d')
  695. </if>
  696. <if test='entm != null and entm != "" '>
  697. and C.INTM &lt; date_add( STR_TO_DATE(#{entm},'%Y-%m-%d'), INTERVAL 1 day )
  698. </if>
  699. </where>
  700. </select>
  701. <select id="getBisInspAllRlationPerNumSize" resultType="java.util.Map">
  702. SELECT ifnull(COUNT(B.PERSID),0) PERNUMSIZE
  703. FROM BIS_INSP_ALL_RLATION B
  704. JOIN BIS_INSP_ALL C ON B.ID = C.ID
  705. JOIN BIS_INSP_ALL_RLATION_PERS P ON P.GUID = B.PERSID
  706. JOIN (select * FROM ATT_INSP_TYPE where code IN (select INSP_TYPE FROM REL_ORG_INSP_TYPE
  707. <where>
  708. <if test="orgId != null and orgId != '' ">
  709. AND ORG_ID = #{orgId}
  710. </if>
  711. </where>
  712. )) T ON SUBSTR(C.ID, 1, 3) = T.CODE
  713. LEFT JOIN BIS_INSP_ALL_OBJ O ON O.ID = C.ID
  714. <where>
  715. LENGTH( C.ID ) = 12
  716. <if test="adCode != null and adCode != ''">AND O.OBJ_AD_CODE LIKE '${adCode}%'</if>
  717. <if test="orgId != null and orgId != '' ">
  718. AND C.ID LIKE '___${orgId}%'
  719. </if>
  720. <if test="objType != null and objType != '' ">
  721. and cast(C.ID as signed) LIKE '${objType}%'
  722. </if>
  723. <if test='sttm != null and sttm != "" '>
  724. and C.STTM &gt;= STR_TO_DATE(#{sttm}, '%Y-%m-%d')
  725. </if>
  726. <if test='entm != null and entm != "" '>
  727. and C.INTM &lt; date_add( STR_TO_DATE(#{entm},'%Y-%m-%d'), INTERVAL 1 day )
  728. </if>
  729. </where>
  730. </select>
  731. <select id="getBisInspAllRlationPerSizeJicha" resultType="java.util.Map">
  732. SELECT ifnull(COUNT(*),0) PERSIZE
  733. FROM TAC_INSP_YEAR_BATCH_GROUP_PERS P
  734. where exists (select *
  735. from TAC_INSP_YEAR_BATCH y
  736. JOIN TAC_INSP_YEAR_BATCH_AREA aa ON aa.YEAR_BATCH_ID = y.ID
  737. where y.id = p.year_batch_id
  738. <if test="year != null and year != ''">and y.YEAR = #{year}</if>
  739. <if test="batch != null and batch != ''">and y.BATCH = #{batch}</if>
  740. <if test="adCode != null and adCode != ''">and aa.AD_CODE LIKE '${adCode}%'</if>
  741. <if test="province != null and province != ''">and y.PROVINCE LIKE '${province}%'</if>
  742. )
  743. AND GROUP_ID IS NOT NULL
  744. AND GROUP_NM IS NOT NULL
  745. </select>
  746. <select id="statisticsBySpecialtyType" resultType="java.util.Map">
  747. WITH O AS (
  748. <choose>
  749. <when test='objType == "8" '>
  750. SELECT
  751. (
  752. CASE WHEN a.LIST_TYPE = '1' THEN '前期与设计'
  753. WHEN a.LIST_TYPE = '2' THEN '建设管理'
  754. WHEN a.LIST_TYPE = '3' THEN '计划下达与执行'
  755. WHEN a.LIST_TYPE = '4' THEN '资金使用与管理'
  756. WHEN a.LIST_TYPE = '5' THEN '工程质量'
  757. WHEN a.LIST_TYPE = '6' THEN '工程安全'
  758. else ''
  759. end
  760. )as NAME, r.AD_CODE as OBJ_AD_CODE, a.LIST_TYPE as "PTYPE", a.INTM as "OBJ_INTM", COUNT(
  761. a.ID ) PBLM_SIZE
  762. FROM TAC_INSP_YEAR_BATCH_OBJ O
  763. LEFT JOIN tac_pawp_rgstr r ON o.ID = r.obj_id
  764. LEFT JOIN (SELECT * FROM TAC_PROVINCE_PBLM_INFO WHERE STEP_ID = #{lastStepId}) a ON a.rgstr_id = r.id
  765. <where>
  766. <if test="year != null and year != ''">and O.YEAR = #{year}</if>
  767. <if test="batch != null and batch != ''">and O.BATCH = #{batch}</if>
  768. </where>
  769. GROUP BY a.list_type, r.AD_CODE, A.INTM
  770. </when>
  771. <otherwise>
  772. SELECT
  773. A.NAME,
  774. <!-- 把福建省福州市下的平潭县 提到到平潭综合实验区 -->
  775. <!-- 把山东省莱芜市下的市辖区、莱芜区 归属到济南市莱芜区,钢城区 归属到济南市的钢城区, -->
  776. ( case when SUBSTR(O.OBJ_AD_CODE, 1, 6) = '350128' then '351000000000' when SUBSTR(O.OBJ_AD_CODE, 1, 6) = '371201' then '370116000000' when SUBSTR(O.OBJ_AD_CODE, 1, 6) = '371202' then '370116000000' when SUBSTR(O.OBJ_AD_CODE, 1, 6) = '371203' then '370117000000' else O.OBJ_AD_CODE end) as OBJ_AD_CODE ,
  777. O.PTYPE,
  778. (CASE WHEN P.COLL_TIME IS NULL THEN O.OBJ_INTM ELSE P.COLL_TIME END) AS "OBJ_INTM",
  779. COUNT( P.PBLM_ID ) PBLM_SIZE
  780. FROM
  781. BIS_INSP_ALL_OBJ O
  782. JOIN (select * FROM ATT_INSP_TYPE where code IN (select INSP_TYPE FROM REL_ORG_INSP_TYPE
  783. <where>
  784. <if test='orgId != null and orgId != "" '>
  785. AND ORG_ID = #{orgId}
  786. </if>
  787. </where>
  788. )) A ON A.PTYPE = O.PTYPE
  789. JOIN BIS_INSP_PBLM P ON P.OBJ_ID = O.OBJ_ID
  790. <where>
  791. <if test="orgId != null and orgId != '' ">AND O.ID LIKE '___${orgId}%'</if>
  792. <if test="objType != null and objType != ''">and O.PTYPE = #{objType}</if>
  793. <if test="sttm != null and sttm != '' and entm != null and entm != '' ">
  794. and O.OBJ_INTM &gt;= STR_TO_DATE(#{sttm}, '%Y-%m-%d')
  795. and O.OBJ_INTM &lt; DATE_ADD( STR_TO_DATE(#{entm},'%Y-%m-%d'), INTERVAL 1 day )
  796. </if>
  797. </where>
  798. GROUP BY A.NAME,O.OBJ_AD_CODE, O.PTYPE, (CASE WHEN P.COLL_TIME IS NULL THEN O.OBJ_INTM ELSE P.COLL_TIME END)
  799. </otherwise>
  800. </choose>
  801. )
  802. SELECT
  803. PTYPE, NAME, SUM(PBLM_SIZE) AS "VALUE"
  804. FROM O
  805. WHERE name is not null
  806. <if test="adCode != null and adCode != ''">and OBJ_AD_CODE LIKE '${adCode}%'</if>
  807. GROUP BY PTYPE, NAME
  808. ORDER BY cast(PTYPE as unsigned)
  809. </select>
  810. <!-- 福建省督查首页 统计 督查类型 查询 -->
  811. <select id="statisticsFjIndexBySpecialtyType" resultType="java.util.Map">
  812. WITH O AS (
  813. SELECT
  814. A.NAME,
  815. <!-- 把福建省福州市下的平潭县 提到到平潭综合实验区 -->
  816. <!-- 把山东省莱芜市下的市辖区、莱芜区 归属到济南市莱芜区,钢城区 归属到济南市的钢城区, -->
  817. ( case when SUBSTR(O.OBJ_AD_CODE, 1, 6) = '350128' then '351000000000' when SUBSTR(O.OBJ_AD_CODE, 1, 6) = '371201' then '370116000000' when SUBSTR(O.OBJ_AD_CODE, 1, 6) = '371202' then '370116000000' when SUBSTR(O.OBJ_AD_CODE, 1, 6) = '371203' then '370117000000' else O.OBJ_AD_CODE end) as OBJ_AD_CODE ,
  818. O.PTYPE,
  819. COUNT( P.PBLM_ID ) PBLM_SIZE
  820. FROM
  821. BIS_INSP_ALL_OBJ O
  822. JOIN (select * FROM ATT_INSP_TYPE where code IN (select INSP_TYPE FROM REL_ORG_INSP_TYPE
  823. <where>
  824. <if test='orgId != null and orgId != "" '>
  825. AND ORG_ID = #{orgId}
  826. </if>
  827. </where>
  828. )) A ON A.PTYPE = O.PTYPE
  829. JOIN BIS_INSP_PBLM P ON P.OBJ_ID = O.OBJ_ID
  830. <where>
  831. <if test="orgId != null and orgId != '' ">AND O.ID LIKE '___${orgId}%'</if>
  832. <if test="objType != null and objType != ''">and O.PTYPE = #{objType}</if>
  833. <if test="sttm != null and sttm != '' and entm != null and entm != '' ">
  834. and O.OBJ_INTM &gt;= STR_TO_DATE(#{sttm}, '%Y-%m-%d')
  835. and O.OBJ_INTM &lt; DATE_ADD( STR_TO_DATE(#{entm},'%Y-%m-%d'), INTERVAL 1 day )
  836. </if>
  837. </where>
  838. GROUP BY A.NAME,O.OBJ_AD_CODE, O.PTYPE
  839. )
  840. SELECT
  841. PTYPE, NAME
  842. FROM O
  843. WHERE name is not null
  844. <if test="adCode != null and adCode != ''">and OBJ_AD_CODE LIKE '${adCode}%'</if>
  845. GROUP BY PTYPE, NAME
  846. ORDER BY cast(PTYPE as unsigned)
  847. </select>
  848. <!-- 福建省首页 按 督查类别 问题类别进行 统计 -->
  849. <select id="statisticsByPblmType" resultType="java.util.Map">
  850. SELECT
  851. PTYPE, NAME, PBLMNAME, SUM(PBLM_SIZE) AS "VALUE"
  852. FROM (
  853. SELECT
  854. A.NAME,
  855. <!-- 把福建省福州市下的平潭县 提到到平潭综合实验区 -->
  856. <!-- 把山东省莱芜市下的市辖区、莱芜区 归属到济南市莱芜区,钢城区 归属到济南市的钢城区, -->
  857. ( case when SUBSTR(O.OBJ_AD_CODE, 1, 6) = '350128' then '351000000000' when SUBSTR(O.OBJ_AD_CODE, 1, 6) = '371201' then '370116000000' when SUBSTR(O.OBJ_AD_CODE, 1, 6) = '371202' then '370116000000' when SUBSTR(O.OBJ_AD_CODE, 1, 6) = '371203' then '370117000000' else O.OBJ_AD_CODE end) as OBJ_AD_CODE ,
  858. O.PTYPE,
  859. (CASE WHEN P.COLL_TIME IS NULL THEN O.OBJ_INTM ELSE P.COLL_TIME END) AS "OBJ_INTM",
  860. COUNT(P.PBLM_ID ) PBLM_SIZE,
  861. (CASE WHEN P.PBLM_NAME_BZ IS NULL THEN P.INSP_PBLM_NAME ELSE P.PBLM_NAME_BZ END) AS "PBLMNAME"
  862. FROM
  863. BIS_INSP_ALL_OBJ O
  864. JOIN (select * FROM ATT_INSP_TYPE where code IN (select INSP_TYPE FROM REL_ORG_INSP_TYPE
  865. <where>
  866. <if test='orgId != null and orgId != "" '>
  867. AND ORG_ID = #{orgId}
  868. </if>
  869. </where>
  870. )) A ON A.PTYPE = O.PTYPE
  871. JOIN BIS_INSP_PBLM P ON P.OBJ_ID = O.OBJ_ID
  872. <where>
  873. <if test="orgId != null and orgId != '' ">AND O.ID LIKE '___${orgId}%'</if>
  874. <if test="objType != null and objType != ''">and O.PTYPE = #{objType}</if>
  875. <if test="sttm != null and sttm != '' and entm != null and entm != '' ">
  876. and O.OBJ_INTM &gt;= STR_TO_DATE(#{sttm}, '%Y-%m-%d')
  877. and O.OBJ_INTM &lt; DATE_ADD( STR_TO_DATE(#{entm},'%Y-%m-%d'), INTERVAL 1 day )
  878. </if>
  879. </where>
  880. GROUP BY A.NAME,O.OBJ_AD_CODE, O.PTYPE,
  881. (CASE WHEN P.COLL_TIME IS NULL THEN O.OBJ_INTM ELSE P.COLL_TIME END),
  882. (CASE WHEN P.PBLM_NAME_BZ IS NULL THEN P.INSP_PBLM_NAME ELSE P.PBLM_NAME_BZ END)
  883. ) O
  884. WHERE name is not null
  885. <if test="adCode != null and adCode != ''">and OBJ_AD_CODE LIKE '${adCode}%'</if>
  886. GROUP BY PTYPE, NAME, PBLMNAME
  887. ORDER BY cast(PTYPE as unsigned)
  888. </select>
  889. <!-- 福建省督查首页 统计年度的批次 组数 每年1条记录 -->
  890. <select id="selectBatchAndGroupSize" resultType="java.util.Map">
  891. SELECT IFNULL(yi.YEAR_BATH,0) AS "YEARBATHSIZE", IFNULL(yi.YEAR_GROUP,0) AS "YEARGROUPSIZE"
  892. FROM (select cast(#{year} as unsigned) as YEAR from dual ) y
  893. LEFT JOIN (
  894. select * from BIS_INSP_YEAR_INFO
  895. <where>
  896. <if test="year != null and year != ''">and YEAR = cast(#{year} as unsigned) </if>
  897. <if test="batch != null and batch != ''">and YEAR_BATH = cast(#{batch} as unsigned) </if>
  898. <if test="adCode != null and adCode != '' ">AND AD_CODE LIKE CONCAT(#{adCode}, '%')</if>
  899. </where>
  900. ) yi ON yi.YEAR = y.YEAR
  901. </select>
  902. <select id="statisticsByEngType" resultType="java.util.Map">
  903. /*WITH O AS (
  904. )
  905. */
  906. SELECT
  907. NAME, SUM(PBLM_SIZE) AS "VALUE"
  908. FROM ( SELECT B.TYPE AS "NAME",
  909. R.AD_CODE AS OBJ_AD_CODE,
  910. A.INTM AS "OBJ_INTM",
  911. ifnull(COUNT(A.ID),0) PBLM_SIZE
  912. FROM TAC_INSP_YEAR_BATCH_OBJ O
  913. LEFT JOIN TAC_ATT_PAWP_BASE B ON B.ID = O.OJB_ID
  914. LEFT JOIN TAC_PAWP_RGSTR R ON O.ID = R.OBJ_ID
  915. LEFT JOIN (SELECT * FROM TAC_PROVINCE_PBLM_INFO) A ON A.RGSTR_ID = R.ID
  916. <where>
  917. <if test="year != null and year != ''">and O.YEAR = #{year}</if>
  918. <if test="batch != null and batch != ''">and O.BATCH = #{batch}</if>
  919. </where>
  920. GROUP BY B.TYPE, r.AD_CODE, A.INTM) O
  921. WHERE name is not null
  922. <if test="adCode != null and adCode != ''">and OBJ_AD_CODE LIKE '${adCode}%'</if>
  923. <if test="sttm != null and sttm != '' and entm != null and entm != '' ">
  924. and OBJ_INTM &gt;= STR_TO_DATE(#{sttm}, '%Y-%m-%d')
  925. and OBJ_INTM &lt; date_add( STR_TO_DATE(#{entm},'%Y-%m-%d'), INTERVAL 1 day )
  926. </if>
  927. GROUP BY NAME
  928. ORDER BY NAME
  929. </select>
  930. <select id="statisticsByResubType" resultType="java.util.Map">
  931. /* WITH O AS (
  932. )*/
  933. SELECT
  934. PTYPE, NAME, SUM(PBLM_SIZE) AS "VALUE"
  935. FROM (SELECT
  936. PS.SYS_TYPE AS "PTYPE",
  937. PS.SYS_NAME AS "NAME",
  938. R.AD_CODE AS OBJ_AD_CODE,
  939. A.INTM AS "OBJ_INTM",
  940. ifnull(COUNT(A.ID),0) PBLM_SIZE
  941. FROM TAC_INSP_YEAR_BATCH_OBJ O
  942. LEFT JOIN TAC_ATT_PAWP_BASE B ON B.ID = O.OJB_ID
  943. LEFT JOIN TAC_PAWP_RGSTR R ON O.ID = R.OBJ_ID
  944. LEFT JOIN (SELECT * FROM TAC_PROVINCE_PBLM_INFO) A ON A.RGSTR_ID = R.ID
  945. LEFT JOIN (
  946. SELECT PS.PBLM_ID,
  947. IF('101'=OS.SYS_TYPE,'100', OS.SYS_TYPE ) SYS_TYPE,
  948. IF('-'=OS.SYS_NAME,'其他', IF(null =OS.SYS_NAME,'其他', OS.SYS_NAME ) ) SYS_NAME
  949. FROM TAC_PBLM_SUBJECT PS
  950. JOIN TAC_OBJ_SUBJECT OS ON PS.SUB_ID = OS.ID
  951. ) PS ON PS.PBLM_ID = A.ID
  952. <where>
  953. <if test="year != null and year != ''">and O.YEAR = #{year}</if>
  954. <if test="batch != null and batch != ''">and O.BATCH = #{batch}</if>
  955. </where>
  956. GROUP BY PS.SYS_TYPE,PS.SYS_NAME, R.AD_CODE, A.INTM) O
  957. WHERE name is not null
  958. <if test="adCode != null and adCode != ''">and OBJ_AD_CODE LIKE '${adCode}%'</if>
  959. <if test="sttm != null and sttm != '' and entm != null and entm != '' ">
  960. and OBJ_INTM &gt;= STR_TO_DATE(#{sttm}, '%Y-%m-%d')
  961. and OBJ_INTM &lt; DATE_ADD( STR_TO_DATE(#{entm},'%Y-%m-%d'), INTERVAL 1 day )
  962. </if>
  963. GROUP BY PTYPE, NAME
  964. ORDER BY cast(PTYPE as unsigned)
  965. </select>
  966. <select id="personCount" resultType="java.util.Map">
  967. select TYPE, GROUP_NAME, count(PERSID) AS VALUE
  968. from (
  969. select
  970. T.NAME AS TYPE, concat(ifnull(BIA.PNM,'') ,'(', ifnull(PBIA.PNM,''),')') AS GROUP_NAME, T.CODE, BIA.ID, R.PERSID
  971. from ATT_INSP_TYPE T
  972. join BIS_INSP_ALL BIA on T.CODE = substr(BIA.ID, 1, 3)
  973. left join BIS_INSP_ALL_RLATION R on R.ID = BIA.ID
  974. left join BIS_INSP_ALL PBIA on PBIA.ID = BIA.PID
  975. where length(BIA.ID) = 12
  976. <if test="orgId != null and orgId != ''">and BIA.ID like '___${orgId}%'</if>
  977. <if test="objType != null and objType != ''">and BIA.ID like '${objType}%'</if>
  978. <if test='sttm != null and sttm != "" and entm != null and entm != "" '>
  979. and BIA.INTM &gt;= STR_TO_DATE(#{sttm}, '%Y-%m-%d')
  980. and BIA.INTM &lt; date_add( STR_TO_DATE(#{entm},'%Y-%m-%d'), INTERVAL 1 day )
  981. </if>
  982. )
  983. group by CODE ,TYPE, ID, GROUP_NAME
  984. ORDER BY CODE, ID
  985. </select>
  986. <select id="getZgSize" resultType="java.util.Map">
  987. select ifnull(count(pl.id),0) AS "MENDSIZE"
  988. <!-- 不统计非系统来源整改数 add lxf 2022/11/19 系统来源 数量-->
  989. ,ifnull(count( case when pl.PBLM_ID is not null then pl.PBLM_ID end ),0) as "MENDSIZESYS"
  990. ,ifnull(count( case when pl.PBLM_ID is null then pl.PBLM_ID end ),0) as "MENDSIZENO"
  991. from BIS_INSP_PBLM_PLIST pl
  992. LEFT JOIN BIS_INSP_PBLM P ON P.PBLM_ID = pl.PBLM_ID
  993. left join BIS_INSP_ALL_OBJ O ON P.OBJ_ID = O.OBJ_ID
  994. JOIN (select * FROM ATT_INSP_TYPE where code IN (select INSP_TYPE FROM REL_ORG_INSP_TYPE
  995. <where>
  996. <if test='orgId != null and orgId != "" '>
  997. AND ORG_ID = #{orgId}
  998. </if>
  999. </where>
  1000. )) A ON A.PTYPE = O.PTYPE
  1001. where pl.DATA_STAT='0'
  1002. and (
  1003. pl.PERS_ID = #{persId}
  1004. OR pl.pblm_classify in (select pblm_classify from bis_insp_pblm_mend_pri where MAND_PERS_ID =#{persId} and
  1005. DATA_STAT='0')
  1006. )
  1007. <if test="province != null and province != '' ">AND pl.OBJ_AD_CODE LIKE CONCAT(#{province}, '%')</if>
  1008. <if test="adCode != null and adCode != '' ">and pl.OBJ_AD_CODE LIKE CONCAT(#{adCode}, '%')</if>
  1009. <if test="objType != null and objType != '' ">and pl.OBJ_TYPE = #{objType}</if>
  1010. <if test='sttm != null and sttm != "" '>and O.OBJ_INTM &gt;= STR_TO_DATE(#{sttm}, '%Y-%m-%d') </if>
  1011. <if test='entm != null and entm != "" '>and O.OBJ_INTM &lt; DATE_ADD( STR_TO_DATE(#{entm},'%Y-%m-%d'), INTERVAL 1 day ) </if>
  1012. </select>
  1013. <select id="getPdZgSize" resultType="java.util.Map">
  1014. select ifnull(count(pl.id),0) AS "PBLMLOGSIZE"
  1015. from BIS_INSP_PBLM_PLIST pl
  1016. LEFT JOIN BIS_INSP_PBLM P ON P.PBLM_ID = pl.PBLM_ID
  1017. left join BIS_INSP_ALL_OBJ O ON P.OBJ_ID = O.OBJ_ID
  1018. JOIN (select * FROM ATT_INSP_TYPE where code IN (select INSP_TYPE FROM REL_ORG_INSP_TYPE
  1019. <where>
  1020. <if test='orgId != null and orgId != "" '>
  1021. AND ORG_ID = #{orgId}
  1022. </if>
  1023. </where>
  1024. )) A ON A.PTYPE = O.PTYPE
  1025. where pl.DATA_STAT='0'
  1026. AND pl.PBLM_OUT = '1'
  1027. and (
  1028. pl.PERS_ID = #{persId}
  1029. OR pl.pblm_classify in (select pblm_classify from bis_insp_pblm_mend_pri where MAND_PERS_ID =#{persId} and
  1030. DATA_STAT='0')
  1031. )
  1032. <if test="province != null and province != '' ">AND pl.OBJ_AD_CODE LIKE CONCAT(#{province}, '%')</if>
  1033. <if test="adCode != null and adCode != '' ">and pl.OBJ_AD_CODE LIKE CONCAT(#{adCode}, '%')</if>
  1034. <if test="objType != null and objType != '' ">and pl.OBJ_TYPE = #{objType}</if>
  1035. <if test='sttm != null and sttm != "" '>and O.OBJ_INTM &gt;= STR_TO_DATE(#{sttm}, '%Y-%m-%d')</if>
  1036. <if test='entm != null and entm != "" '>and O.OBJ_INTM &lt; date_add( STR_TO_DATE(#{entm},'%Y-%m-%d'), INTERVAL 1 day )</if>
  1037. </select>
  1038. </mapper>