f1f563555ad72106a8b517b6d648302239dbceb9.svn-base 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941
  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="getHasObjSize" resultType="java.util.Map">
  288. SELECT ifnull(count(DISTINCT O.OBJ_ID),0) HASOBJSIZE
  289. FROM (
  290. SELECT * FROM BIS_INSP_ALL_OBJ
  291. <where>
  292. <if test="province != null and province != '' ">AND OBJ_AD_CODE LIKE CONCAT(#{province}, '%')</if>
  293. <if test="adCode != null and adCode != '' ">
  294. and OBJ_AD_CODE like '${adCode}%'
  295. </if>
  296. <if test="objType != null and objType != '' ">
  297. and PTYPE = #{objType}
  298. </if>
  299. <if test='sttm != null and sttm != "" '>
  300. and OBJ_INTM &gt;= STR_TO_DATE(#{sttm},'%Y-%m-%d')
  301. </if>
  302. <if test='entm != null and entm != "" '>
  303. and OBJ_INTM &lt; date_add( STR_TO_DATE(#{entm},'%Y-%m-%d'), INTERVAL 1 day )
  304. </if>
  305. </where>
  306. ) O
  307. RIGHT JOIN (
  308. <foreach collection="rgsterTable" index="index" item="item">
  309. <if test="index != 0">
  310. UNION ALL
  311. </if>
  312. <choose>
  313. <when test="item == 'BIS_INSP_GRW' ">
  314. SELECT OBJ_ID, INSP_STATE AS "STATE" FROM BIS_INSP_GRW WHERE INSP_STATE = '2'
  315. </when>
  316. <otherwise>
  317. SELECT OBJ_ID, STATE FROM ${item} WHERE STATE = '2'
  318. </otherwise>
  319. </choose>
  320. </foreach>
  321. ) R ON R.OBJ_ID = o.OBJ_ID
  322. </select>
  323. <select id="getObjTypeSizeMonth" resultType="java.util.Map">
  324. select ifnull(count(DISTINCT PTYPE), 0) OBJTYPESIZEMONTH
  325. from BIS_INSP_ALL_OBJ
  326. where
  327. OBJ_INTM between DATE_ADD(now(),INTERVAL -1 MONTH) and now()
  328. <if test="orgId != null and orgId != '' ">
  329. AND ORG_ID = #{orgId}
  330. </if>
  331. <if test="adCode != null and adCode != ''">AND OBJ_AD_CODE LIKE '${adCode}%'</if>
  332. </select>
  333. <select id="getPblmSizeMonth" resultType="java.util.Map">
  334. SELECT
  335. ifnull(COUNT(A.PBLM_ID), 0) PBLMSIZEMONTH
  336. FROM
  337. BIS_INSP_PBLM A
  338. JOIN
  339. BIS_INSP_ALL_OBJ B ON A.OBJ_ID=B.OBJ_ID
  340. WHERE
  341. A.DATA_STAT= '0'
  342. AND A.coll_time between DATE_ADD(now(),INTERVAL -1 MONTH) and now()
  343. <if test="orgId != null and orgId != '' ">AND B.ID LIKE '___${orgId}%'</if>
  344. <if test="adCode != null and adCode != '' ">AND B.OBJ_AD_CODE LIKE CONCAT(#{adCode}, '%')</if>
  345. </select>
  346. <select id="getDelPblmSizeMonth" resultType="java.util.Map">
  347. SELECT
  348. ifnull(COUNT(A.PBLM_ID), 0) PBLMLOGSIZEMONTH
  349. FROM BIS_INSP_PBLM_DEL_LOG A
  350. JOIN BIS_INSP_ALL_OBJ B ON A.OBJ_ID=B.OBJ_ID
  351. WHERE A.PBLM_DEL_TM between DATE_ADD(now(),INTERVAL -1 MONTH)and now()
  352. <if test="orgId != null and orgId != '' ">AND B.ID LIKE '___${orgId}%'</if>
  353. <if test="adCode != null and adCode != '' ">AND B.OBJ_AD_CODE LIKE CONCAT(#{adCode}, '%')</if>
  354. </select>
  355. <select id="getObjSizeJicha" resultType="java.util.Map">
  356. SELECT
  357. ifnull(COUNT( DISTINCT r.id ), 0) OBJSIZE
  358. FROM TAC_INSP_YEAR_BATCH_OBJ O
  359. JOIN tac_pawp_rgstr r on o.ID = r.obj_id
  360. <where>
  361. <if test="year != null and year != ''">and O.YEAR = #{year}</if>
  362. <if test="batch != null and batch != ''">and O.BATCH = #{batch}</if>
  363. <if test="adCode != null and adCode != ''">and r.AD_CODE LIKE '${adCode}%'</if>
  364. <if test="province != null and province != ''">and r.PROVINCE LIKE '${province}%'</if>
  365. </where>
  366. </select>
  367. <select id="getPblmSizeJicha" resultType="java.util.Map">
  368. /* WITH O AS (
  369. )*/
  370. SELECT
  371. IFNULL(SUM(PBLM_SIZE), 0) AS PBLMSIZE
  372. FROM
  373. (SELECT
  374. r.AD_CODE as OBJ_AD_CODE, '8' as "PTYPE", a.INTM as "OBJ_INTM", COUNT( a.ID )
  375. PBLM_SIZE
  376. FROM TAC_INSP_YEAR_BATCH_OBJ O
  377. LEFT JOIN tac_pawp_rgstr r ON o.ID = r.obj_id
  378. LEFT JOIN (SELECT * FROM TAC_PROVINCE_PBLM_INFO WHERE STEP_ID = #{lastStepId}) a ON a.rgstr_id = r.id
  379. <where>
  380. <if test="year != null and year != ''">and O.YEAR = #{year}</if>
  381. <if test="batch != null and batch != ''">and O.BATCH = #{batch}</if>
  382. </where>
  383. GROUP BY a.list_type, r.AD_CODE, A.INTM) b
  384. <where>
  385. <if test="adCode != null and adCode != ''">OBJ_AD_CODE LIKE '${adCode}%'</if>
  386. </where>
  387. </select>
  388. <select id="getPblmSizeJichaZg" resultType="java.util.Map">
  389. /* WITH O AS (
  390. )*/
  391. SELECT
  392. IFNULL(SUM(PBLM_SIZE), 0) AS MENDSIZE
  393. FROM
  394. (SELECT
  395. r.AD_CODE as OBJ_AD_CODE, '8' as "PTYPE", a.INTM as "OBJ_INTM", COUNT( a.ID )
  396. PBLM_SIZE
  397. FROM TAC_INSP_YEAR_BATCH_OBJ O
  398. LEFT JOIN tac_pawp_rgstr r ON o.ID = r.obj_id
  399. LEFT JOIN (SELECT * FROM TAC_PROVINCE_PBLM_MEND_INFO WHERE STEP_ID = #{lastStepId} and CRT_STATE='1') a ON
  400. a.rgstr_id = r.id
  401. <where>
  402. <if test="year != null and year != ''">and O.YEAR = #{year}</if>
  403. <if test="batch != null and batch != ''">and O.BATCH = #{batch}</if>
  404. </where>
  405. GROUP BY a.list_type, r.AD_CODE, A.INTM
  406. ) a
  407. <where>
  408. <if test="adCode != null and adCode != ''">OBJ_AD_CODE LIKE '${adCode}%'</if>
  409. </where>
  410. </select>
  411. <select id="getPblmSizeJichaFc" resultType="java.util.Map">
  412. /* WITH O AS (
  413. )*/
  414. SELECT
  415. IFNULL(SUM(PBLM_SIZE), 0) AS PBLMLOGSIZE
  416. FROM (
  417. SELECT
  418. 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,
  419. r.AD_CODE as OBJ_AD_CODE, '8' as "PTYPE", a.INTM as "OBJ_INTM", COUNT( a.ID )
  420. PBLM_SIZE
  421. FROM TAC_INSP_YEAR_BATCH_OBJ O
  422. LEFT JOIN tac_pawp_rgstr r ON o.ID = r.obj_id
  423. LEFT JOIN (SELECT * FROM TAC_PROVINCE_PBLM_MEND_INFO WHERE STEP_ID = #{lastStepId} and pblm_out='1') a ON
  424. a.rgstr_id = r.id
  425. <where>
  426. <if test="year != null and year != ''">and O.YEAR = #{year}</if>
  427. <if test="batch != null and batch != ''">and O.BATCH = #{batch}</if>
  428. </where>
  429. GROUP BY a.list_type, r.AD_CODE, A.INTM
  430. ) z
  431. <where>
  432. <if test="adCode != null and adCode != ''">OBJ_AD_CODE LIKE '${adCode}%'</if>
  433. </where>
  434. </select>
  435. <select id="getHasObjSizeJicha" resultType="java.util.Map">
  436. SELECT ifnull(count(DISTINCT O.OBJ_ID),0) HASOBJSIZE
  437. FROM (
  438. SELECT * FROM BIS_INSP_ALL_OBJ
  439. <where>
  440. PTYPE = '8'
  441. <if test="adCode != null and adCode != '' ">
  442. and OBJ_AD_CODE like '${adCode}%'
  443. </if>
  444. </where>
  445. ) O
  446. LEFT JOIN (
  447. <foreach collection="rgsterTable" index="index" item="item">
  448. <if test="index != 0">
  449. UNION ALL
  450. </if>
  451. <choose>
  452. <when test="item == 'BIS_INSP_GRW' ">
  453. SELECT OBJ_ID, INSP_STATE AS "STATE" FROM BIS_INSP_GRW WHERE INSP_STATE = '2'
  454. </when>
  455. <otherwise>
  456. SELECT OBJ_ID, STATE FROM ${item} WHERE STATE = '2'
  457. </otherwise>
  458. </choose>
  459. </foreach>
  460. ) r ON r.OBJ_ID = o.OBJ_ID
  461. </select>
  462. <select id="getBisInspAllSize" resultType="java.util.Map">
  463. select IFNULL(count(*),0) as BISINSPALLSIZE from BIS_INSP_ALL A
  464. JOIN (select * FROM ATT_INSP_TYPE where code IN (select INSP_TYPE FROM REL_ORG_INSP_TYPE
  465. <where>
  466. <if test="orgId != null and orgId != '' ">
  467. AND ORG_ID = #{orgId}
  468. </if>
  469. </where>
  470. )) T ON substr(A.ID,1,3) = T.CODE
  471. <where>
  472. LENGTH(A.ID) = 9
  473. <if test="orgId != null and orgId != '' ">AND A.ID LIKE '___${orgId}%'</if>
  474. <if test="province != null and province != '' ">AND A.PROVINCE LIKE CONCAT(#{province}, '%')</if>
  475. <if test="objType != null and objType != '' ">and A.ID LIKE concat(#{objType},'%') </if>
  476. <if test="sttm != null and sttm != '' ">and A.STTM &gt;= str_to_date(#{sttm}, '%Y-%m-%d')</if>
  477. <if test="entm != null and entm != '' ">and A.INTM &lt; date_add( str_to_date(#{entm},'%Y-%m-%d'), INTERVAL 1 day )</if>
  478. </where>
  479. </select>
  480. <select id="getBisInspAllGroupSize" resultType="java.util.Map">
  481. SELECT ifnull(COUNT(DISTINCT C.ID),0) BISINSPALLGROUPSIZE
  482. FROM BIS_INSP_ALL C
  483. JOIN (select * FROM ATT_INSP_TYPE where code IN (select INSP_TYPE FROM REL_ORG_INSP_TYPE
  484. <where>
  485. <if test="orgId != null and orgId != '' ">
  486. AND ORG_ID = #{orgId}
  487. </if>
  488. </where>
  489. )) T ON SUBSTR(C.ID, 1, 3) = T.CODE
  490. LEFT JOIN BIS_INSP_ALL_OBJ O ON O.ID = C.ID
  491. WHERE LENGTH(C.ID) = '12'
  492. <if test="adCode != null and adCode != ''">AND O.OBJ_AD_CODE LIKE '${adCode}%'</if>
  493. <if test="orgId != null and orgId != '' ">
  494. AND C.ID LIKE '___${orgId}%'
  495. </if>
  496. <if test="objType != null and objType != '' ">
  497. and cast(C.ID as signed ) LIKE '${objType}%'
  498. </if>
  499. <if test='sttm != null and sttm != "" '>
  500. and C.STTM &gt;= STR_TO_DATE(#{sttm}, '%Y-%m-%d')
  501. </if>
  502. <if test='entm != null and entm != "" '>
  503. and C.STTM &lt; date_add( STR_TO_DATE(#{entm},'%Y-%m-%d'), INTERVAL 1 day )
  504. </if>
  505. </select>
  506. <select id="getBisInspAllGroupSizeJicha" resultType="java.util.Map">
  507. SELECT ifnull(COUNT(*),0) GROUPSIZE
  508. FROM TAC_INSP_YEAR_BATCH_GROUP g
  509. where exists (select *
  510. from TAC_INSP_YEAR_BATCH y
  511. JOIN TAC_INSP_YEAR_BATCH_AREA aa ON aa.YEAR_BATCH_ID = y.ID
  512. where y.id = g.year_batch_id
  513. <if test="year != null and year != ''">and y.YEAR = #{year}</if>
  514. <if test="batch != null and batch != ''">and y.BATCH = #{batch}</if>
  515. <if test="adCode != null and adCode != ''">and aa.AD_CODE LIKE '${adCode}%'</if>
  516. <if test="province != null and province != ''">and y.PROVINCE LIKE '${province}%'</if>
  517. )
  518. </select>
  519. <select id="getBisInspAllSizeMonth" resultType="java.util.Map">
  520. SELECT ifnull(COUNT(distinct C.ID),0) BISINSPALLSIZEMONTH
  521. FROM BIS_INSP_ALL C
  522. LEFT JOIN BIS_INSP_ALL_OBJ O ON O.ID = C.ID
  523. WHERE LENGTH(C.ID) = '9'
  524. and C.INTM between DATE_ADD(now(),INTERVAL -1 MONTH) and now()
  525. <if test="orgId != null and orgId != '' ">
  526. AND C.ID LIKE '___${orgId}%'
  527. </if>
  528. <if test="adCode != null and adCode != ''">AND O.OBJ_AD_CODE LIKE '${adCode}%'</if>
  529. </select>
  530. <!-- 统计 全部人员数量 -->
  531. <select id="getAllPerSize" resultType="java.util.Map">
  532. select ifnull( count( DISTINCT rp.guid) ,0) as PERSIZEALL
  533. FROM BIS_INSP_ALL_RLATION_PERS rp ,
  534. Bis_Insp_Pers_Org g,
  535. bis_insp_org o
  536. WHERE rp.guid = g.pers_id and
  537. g.org_id = o.org_id
  538. <if test='orgId != null and orgId != "" '>
  539. AND o.ORG_ID = #{orgId}
  540. </if>
  541. <if test='adCode != null and adCode != "" '>
  542. AND o.ad_code LIKE CONCAT(#{adCode}, '%' )
  543. </if>
  544. </select>
  545. <select id="getBisInspAllRlationPerSize" resultType="java.util.Map">
  546. SELECT ifnull(COUNT(DISTINCT B.PERSID),0) PERSIZE
  547. FROM BIS_INSP_ALL_RLATION B
  548. JOIN BIS_INSP_ALL C ON B.ID = C.ID
  549. JOIN BIS_INSP_ALL_RLATION_PERS P ON P.GUID = B.PERSID
  550. JOIN (select * FROM ATT_INSP_TYPE where code IN (select INSP_TYPE FROM REL_ORG_INSP_TYPE
  551. <where>
  552. <if test="orgId != null and orgId != '' ">
  553. AND ORG_ID = #{orgId}
  554. </if>
  555. </where>
  556. )) T ON SUBSTR(C.ID, 1, 3) = T.CODE
  557. LEFT JOIN BIS_INSP_ALL_OBJ O ON O.ID = C.ID
  558. <where>
  559. LENGTH( C.ID ) = 12
  560. <if test="adCode != null and adCode != ''">AND O.OBJ_AD_CODE LIKE '${adCode}%'</if>
  561. <if test="orgId != null and orgId != '' ">
  562. AND C.ID LIKE '___${orgId}%'
  563. </if>
  564. <if test="objType != null and objType != '' ">
  565. and cast(C.ID as signed) LIKE '${objType}%'
  566. </if>
  567. <if test='sttm != null and sttm != "" '>
  568. and C.STTM &gt;= STR_TO_DATE(#{sttm}, '%Y-%m-%d')
  569. </if>
  570. <if test='entm != null and entm != "" '>
  571. and C.INTM &lt; date_add( STR_TO_DATE(#{entm},'%Y-%m-%d'), INTERVAL 1 day )
  572. </if>
  573. </where>
  574. </select>
  575. <select id="getBisInspAllRlationPerNumSize" resultType="java.util.Map">
  576. SELECT ifnull(COUNT(B.PERSID),0) PERNUMSIZE
  577. FROM BIS_INSP_ALL_RLATION B
  578. JOIN BIS_INSP_ALL C ON B.ID = C.ID
  579. JOIN BIS_INSP_ALL_RLATION_PERS P ON P.GUID = B.PERSID
  580. JOIN (select * FROM ATT_INSP_TYPE where code IN (select INSP_TYPE FROM REL_ORG_INSP_TYPE
  581. <where>
  582. <if test="orgId != null and orgId != '' ">
  583. AND ORG_ID = #{orgId}
  584. </if>
  585. </where>
  586. )) T ON SUBSTR(C.ID, 1, 3) = T.CODE
  587. LEFT JOIN BIS_INSP_ALL_OBJ O ON O.ID = C.ID
  588. <where>
  589. LENGTH( C.ID ) = 12
  590. <if test="adCode != null and adCode != ''">AND O.OBJ_AD_CODE LIKE '${adCode}%'</if>
  591. <if test="orgId != null and orgId != '' ">
  592. AND C.ID LIKE '___${orgId}%'
  593. </if>
  594. <if test="objType != null and objType != '' ">
  595. and cast(C.ID as signed) LIKE '${objType}%'
  596. </if>
  597. <if test='sttm != null and sttm != "" '>
  598. and C.STTM &gt;= STR_TO_DATE(#{sttm}, '%Y-%m-%d')
  599. </if>
  600. <if test='entm != null and entm != "" '>
  601. and C.INTM &lt; date_add( STR_TO_DATE(#{entm},'%Y-%m-%d'), INTERVAL 1 day )
  602. </if>
  603. </where>
  604. </select>
  605. <select id="getBisInspAllRlationPerSizeJicha" resultType="java.util.Map">
  606. SELECT ifnull(COUNT(*),0) PERSIZE
  607. FROM TAC_INSP_YEAR_BATCH_GROUP_PERS P
  608. where exists (select *
  609. from TAC_INSP_YEAR_BATCH y
  610. JOIN TAC_INSP_YEAR_BATCH_AREA aa ON aa.YEAR_BATCH_ID = y.ID
  611. where y.id = p.year_batch_id
  612. <if test="year != null and year != ''">and y.YEAR = #{year}</if>
  613. <if test="batch != null and batch != ''">and y.BATCH = #{batch}</if>
  614. <if test="adCode != null and adCode != ''">and aa.AD_CODE LIKE '${adCode}%'</if>
  615. <if test="province != null and province != ''">and y.PROVINCE LIKE '${province}%'</if>
  616. )
  617. AND GROUP_ID IS NOT NULL
  618. AND GROUP_NM IS NOT NULL
  619. </select>
  620. <select id="statisticsBySpecialtyType" resultType="java.util.Map">
  621. WITH O AS (
  622. <choose>
  623. <when test='objType == "8" '>
  624. SELECT
  625. (
  626. CASE WHEN a.LIST_TYPE = '1' THEN '前期与设计'
  627. WHEN a.LIST_TYPE = '2' THEN '建设管理'
  628. WHEN a.LIST_TYPE = '3' THEN '计划下达与执行'
  629. WHEN a.LIST_TYPE = '4' THEN '资金使用与管理'
  630. WHEN a.LIST_TYPE = '5' THEN '工程质量'
  631. WHEN a.LIST_TYPE = '6' THEN '工程安全'
  632. else ''
  633. end
  634. )as NAME, r.AD_CODE as OBJ_AD_CODE, a.LIST_TYPE as "PTYPE", a.INTM as "OBJ_INTM", COUNT(
  635. a.ID ) PBLM_SIZE
  636. FROM TAC_INSP_YEAR_BATCH_OBJ O
  637. LEFT JOIN tac_pawp_rgstr r ON o.ID = r.obj_id
  638. LEFT JOIN (SELECT * FROM TAC_PROVINCE_PBLM_INFO WHERE STEP_ID = #{lastStepId}) a ON a.rgstr_id = r.id
  639. <where>
  640. <if test="year != null and year != ''">and O.YEAR = #{year}</if>
  641. <if test="batch != null and batch != ''">and O.BATCH = #{batch}</if>
  642. </where>
  643. GROUP BY a.list_type, r.AD_CODE, A.INTM
  644. </when>
  645. <otherwise>
  646. SELECT
  647. A.NAME,
  648. <!-- 把福建省福州市下的平潭县 提到到平潭综合实验区 -->
  649. <!-- 把山东省莱芜市下的市辖区、莱芜区 归属到济南市莱芜区,钢城区 归属到济南市的钢城区, -->
  650. ( 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 ,
  651. O.PTYPE,
  652. (CASE WHEN P.COLL_TIME IS NULL THEN O.OBJ_INTM ELSE P.COLL_TIME END) AS "OBJ_INTM",
  653. COUNT( P.PBLM_ID ) PBLM_SIZE
  654. FROM
  655. BIS_INSP_ALL_OBJ O
  656. JOIN (select * FROM ATT_INSP_TYPE where code IN (select INSP_TYPE FROM REL_ORG_INSP_TYPE
  657. <where>
  658. <if test='orgId != null and orgId != "" '>
  659. AND ORG_ID = #{orgId}
  660. </if>
  661. </where>
  662. )) A ON A.PTYPE = O.PTYPE
  663. JOIN BIS_INSP_PBLM P ON P.OBJ_ID = O.OBJ_ID
  664. <where>
  665. <if test="orgId != null and orgId != '' ">AND O.ID LIKE '___${orgId}%'</if>
  666. <if test="objType != null and objType != ''">and O.PTYPE = #{objType}</if>
  667. <if test="sttm != null and sttm != '' and entm != null and entm != '' ">
  668. and O.OBJ_INTM &gt;= STR_TO_DATE(#{sttm}, '%Y-%m-%d')
  669. and O.OBJ_INTM &lt; DATE_ADD( STR_TO_DATE(#{entm},'%Y-%m-%d'), INTERVAL 1 day )
  670. </if>
  671. </where>
  672. 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)
  673. </otherwise>
  674. </choose>
  675. )
  676. SELECT
  677. PTYPE, NAME, SUM(PBLM_SIZE) AS "VALUE"
  678. FROM O
  679. WHERE name is not null
  680. <if test="adCode != null and adCode != ''">and OBJ_AD_CODE LIKE '${adCode}%'</if>
  681. GROUP BY PTYPE, NAME
  682. ORDER BY cast(PTYPE as unsigned)
  683. </select>
  684. <!-- 福建省督查首页 统计 督查类型 查询 -->
  685. <select id="statisticsFjIndexBySpecialtyType" resultType="java.util.Map">
  686. WITH O AS (
  687. SELECT
  688. A.NAME,
  689. <!-- 把福建省福州市下的平潭县 提到到平潭综合实验区 -->
  690. <!-- 把山东省莱芜市下的市辖区、莱芜区 归属到济南市莱芜区,钢城区 归属到济南市的钢城区, -->
  691. ( 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 ,
  692. O.PTYPE,
  693. COUNT( P.PBLM_ID ) PBLM_SIZE
  694. FROM
  695. BIS_INSP_ALL_OBJ O
  696. JOIN (select * FROM ATT_INSP_TYPE where code IN (select INSP_TYPE FROM REL_ORG_INSP_TYPE
  697. <where>
  698. <if test='orgId != null and orgId != "" '>
  699. AND ORG_ID = #{orgId}
  700. </if>
  701. </where>
  702. )) A ON A.PTYPE = O.PTYPE
  703. JOIN BIS_INSP_PBLM P ON P.OBJ_ID = O.OBJ_ID
  704. <where>
  705. <if test="orgId != null and orgId != '' ">AND O.ID LIKE '___${orgId}%'</if>
  706. <if test="objType != null and objType != ''">and O.PTYPE = #{objType}</if>
  707. <if test="sttm != null and sttm != '' and entm != null and entm != '' ">
  708. and O.OBJ_INTM &gt;= STR_TO_DATE(#{sttm}, '%Y-%m-%d')
  709. and O.OBJ_INTM &lt; DATE_ADD( STR_TO_DATE(#{entm},'%Y-%m-%d'), INTERVAL 1 day )
  710. </if>
  711. </where>
  712. GROUP BY A.NAME,O.OBJ_AD_CODE, O.PTYPE
  713. )
  714. SELECT
  715. PTYPE, NAME
  716. FROM O
  717. WHERE name is not null
  718. <if test="adCode != null and adCode != ''">and OBJ_AD_CODE LIKE '${adCode}%'</if>
  719. GROUP BY PTYPE, NAME
  720. ORDER BY cast(PTYPE as unsigned)
  721. </select>
  722. <!-- 福建省首页 按 督查类别 问题类别进行 统计 -->
  723. <select id="statisticsByPblmType" resultType="java.util.Map">
  724. SELECT
  725. PTYPE, NAME, PBLMNAME, SUM(PBLM_SIZE) AS "VALUE"
  726. FROM (
  727. SELECT
  728. A.NAME,
  729. <!-- 把福建省福州市下的平潭县 提到到平潭综合实验区 -->
  730. <!-- 把山东省莱芜市下的市辖区、莱芜区 归属到济南市莱芜区,钢城区 归属到济南市的钢城区, -->
  731. ( 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 ,
  732. O.PTYPE,
  733. (CASE WHEN P.COLL_TIME IS NULL THEN O.OBJ_INTM ELSE P.COLL_TIME END) AS "OBJ_INTM",
  734. COUNT(P.PBLM_ID ) PBLM_SIZE,
  735. (CASE WHEN P.PBLM_NAME_BZ IS NULL THEN P.INSP_PBLM_NAME ELSE P.PBLM_NAME_BZ END) AS "PBLMNAME"
  736. FROM
  737. BIS_INSP_ALL_OBJ O
  738. JOIN (select * FROM ATT_INSP_TYPE where code IN (select INSP_TYPE FROM REL_ORG_INSP_TYPE
  739. <where>
  740. <if test='orgId != null and orgId != "" '>
  741. AND ORG_ID = #{orgId}
  742. </if>
  743. </where>
  744. )) A ON A.PTYPE = O.PTYPE
  745. JOIN BIS_INSP_PBLM P ON P.OBJ_ID = O.OBJ_ID
  746. <where>
  747. <if test="orgId != null and orgId != '' ">AND O.ID LIKE '___${orgId}%'</if>
  748. <if test="objType != null and objType != ''">and O.PTYPE = #{objType}</if>
  749. <if test="sttm != null and sttm != '' and entm != null and entm != '' ">
  750. and O.OBJ_INTM &gt;= STR_TO_DATE(#{sttm}, '%Y-%m-%d')
  751. and O.OBJ_INTM &lt; DATE_ADD( STR_TO_DATE(#{entm},'%Y-%m-%d'), INTERVAL 1 day )
  752. </if>
  753. </where>
  754. GROUP BY A.NAME,O.OBJ_AD_CODE, O.PTYPE,
  755. (CASE WHEN P.COLL_TIME IS NULL THEN O.OBJ_INTM ELSE P.COLL_TIME END),
  756. (CASE WHEN P.PBLM_NAME_BZ IS NULL THEN P.INSP_PBLM_NAME ELSE P.PBLM_NAME_BZ END)
  757. ) O
  758. WHERE name is not null
  759. <if test="adCode != null and adCode != ''">and OBJ_AD_CODE LIKE '${adCode}%'</if>
  760. GROUP BY PTYPE, NAME, PBLMNAME
  761. ORDER BY cast(PTYPE as unsigned)
  762. </select>
  763. <!-- 福建省督查首页 统计年度的批次 组数 每年1条记录 -->
  764. <select id="selectBatchAndGroupSize" resultType="java.util.Map">
  765. SELECT IFNULL(yi.YEAR_BATH,0) AS "YEARBATHSIZE", IFNULL(yi.YEAR_GROUP,0) AS "YEARGROUPSIZE"
  766. FROM (select cast(#{year} as unsigned) as YEAR from dual ) y
  767. LEFT JOIN (
  768. select * from BIS_INSP_YEAR_INFO
  769. <where>
  770. <if test="year != null and year != ''">and YEAR = cast(#{year} as unsigned) </if>
  771. <if test="batch != null and batch != ''">and YEAR_BATH = cast(#{batch} as unsigned) </if>
  772. <if test="adCode != null and adCode != '' ">AND AD_CODE LIKE CONCAT(#{adCode}, '%')</if>
  773. </where>
  774. ) yi ON yi.YEAR = y.YEAR
  775. </select>
  776. <select id="statisticsByEngType" resultType="java.util.Map">
  777. /*WITH O AS (
  778. )
  779. */
  780. SELECT
  781. NAME, SUM(PBLM_SIZE) AS "VALUE"
  782. FROM ( SELECT B.TYPE AS "NAME",
  783. R.AD_CODE AS OBJ_AD_CODE,
  784. A.INTM AS "OBJ_INTM",
  785. ifnull(COUNT(A.ID),0) PBLM_SIZE
  786. FROM TAC_INSP_YEAR_BATCH_OBJ O
  787. LEFT JOIN TAC_ATT_PAWP_BASE B ON B.ID = O.OJB_ID
  788. LEFT JOIN TAC_PAWP_RGSTR R ON O.ID = R.OBJ_ID
  789. LEFT JOIN (SELECT * FROM TAC_PROVINCE_PBLM_INFO) A ON A.RGSTR_ID = R.ID
  790. <where>
  791. <if test="year != null and year != ''">and O.YEAR = #{year}</if>
  792. <if test="batch != null and batch != ''">and O.BATCH = #{batch}</if>
  793. </where>
  794. GROUP BY B.TYPE, r.AD_CODE, A.INTM) O
  795. WHERE name is not null
  796. <if test="adCode != null and adCode != ''">and OBJ_AD_CODE LIKE '${adCode}%'</if>
  797. <if test="sttm != null and sttm != '' and entm != null and entm != '' ">
  798. and OBJ_INTM &gt;= STR_TO_DATE(#{sttm}, '%Y-%m-%d')
  799. and OBJ_INTM &lt; date_add( STR_TO_DATE(#{entm},'%Y-%m-%d'), INTERVAL 1 day )
  800. </if>
  801. GROUP BY NAME
  802. ORDER BY NAME
  803. </select>
  804. <select id="statisticsByResubType" resultType="java.util.Map">
  805. /* WITH O AS (
  806. )*/
  807. SELECT
  808. PTYPE, NAME, SUM(PBLM_SIZE) AS "VALUE"
  809. FROM (SELECT
  810. PS.SYS_TYPE AS "PTYPE",
  811. PS.SYS_NAME AS "NAME",
  812. R.AD_CODE AS OBJ_AD_CODE,
  813. A.INTM AS "OBJ_INTM",
  814. ifnull(COUNT(A.ID),0) PBLM_SIZE
  815. FROM TAC_INSP_YEAR_BATCH_OBJ O
  816. LEFT JOIN TAC_ATT_PAWP_BASE B ON B.ID = O.OJB_ID
  817. LEFT JOIN TAC_PAWP_RGSTR R ON O.ID = R.OBJ_ID
  818. LEFT JOIN (SELECT * FROM TAC_PROVINCE_PBLM_INFO) A ON A.RGSTR_ID = R.ID
  819. LEFT JOIN (
  820. SELECT PS.PBLM_ID,
  821. IF('101'=OS.SYS_TYPE,'100', OS.SYS_TYPE ) SYS_TYPE,
  822. IF('-'=OS.SYS_NAME,'其他', IF(null =OS.SYS_NAME,'其他', OS.SYS_NAME ) ) SYS_NAME
  823. FROM TAC_PBLM_SUBJECT PS
  824. JOIN TAC_OBJ_SUBJECT OS ON PS.SUB_ID = OS.ID
  825. ) PS ON PS.PBLM_ID = A.ID
  826. <where>
  827. <if test="year != null and year != ''">and O.YEAR = #{year}</if>
  828. <if test="batch != null and batch != ''">and O.BATCH = #{batch}</if>
  829. </where>
  830. GROUP BY PS.SYS_TYPE,PS.SYS_NAME, R.AD_CODE, A.INTM) O
  831. WHERE name is not null
  832. <if test="adCode != null and adCode != ''">and OBJ_AD_CODE LIKE '${adCode}%'</if>
  833. <if test="sttm != null and sttm != '' and entm != null and entm != '' ">
  834. and OBJ_INTM &gt;= STR_TO_DATE(#{sttm}, '%Y-%m-%d')
  835. and OBJ_INTM &lt; DATE_ADD( STR_TO_DATE(#{entm},'%Y-%m-%d'), INTERVAL 1 day )
  836. </if>
  837. GROUP BY PTYPE, NAME
  838. ORDER BY cast(PTYPE as unsigned)
  839. </select>
  840. <select id="personCount" resultType="java.util.Map">
  841. select TYPE, GROUP_NAME, count(PERSID) AS VALUE
  842. from (
  843. select
  844. T.NAME AS TYPE, concat(ifnull(BIA.PNM,'') ,'(', ifnull(PBIA.PNM,''),')') AS GROUP_NAME, T.CODE, BIA.ID, R.PERSID
  845. from ATT_INSP_TYPE T
  846. join BIS_INSP_ALL BIA on T.CODE = substr(BIA.ID, 1, 3)
  847. left join BIS_INSP_ALL_RLATION R on R.ID = BIA.ID
  848. left join BIS_INSP_ALL PBIA on PBIA.ID = BIA.PID
  849. where length(BIA.ID) = 12
  850. <if test="orgId != null and orgId != ''">and BIA.ID like '___${orgId}%'</if>
  851. <if test="objType != null and objType != ''">and BIA.ID like '${objType}%'</if>
  852. <if test='sttm != null and sttm != "" and entm != null and entm != "" '>
  853. and BIA.INTM &gt;= STR_TO_DATE(#{sttm}, '%Y-%m-%d')
  854. and BIA.INTM &lt; date_add( STR_TO_DATE(#{entm},'%Y-%m-%d'), INTERVAL 1 day )
  855. </if>
  856. )
  857. group by CODE ,TYPE, ID, GROUP_NAME
  858. ORDER BY CODE, ID
  859. </select>
  860. <select id="getZgSize" resultType="java.util.Map">
  861. select ifnull(count(pl.id),0) AS "MENDSIZE"
  862. <!-- 不统计非系统来源整改数 add lxf 2022/11/19 系统来源 数量-->
  863. ,ifnull(count( case when pl.PBLM_ID is not null then pl.PBLM_ID end ),0) as "MENDSIZESYS"
  864. ,ifnull(count( case when pl.PBLM_ID is null then pl.PBLM_ID end ),0) as "MENDSIZENO"
  865. from BIS_INSP_PBLM_PLIST pl
  866. LEFT JOIN BIS_INSP_PBLM P ON P.PBLM_ID = pl.PBLM_ID
  867. left join BIS_INSP_ALL_OBJ O ON P.OBJ_ID = O.OBJ_ID
  868. JOIN (select * FROM ATT_INSP_TYPE where code IN (select INSP_TYPE FROM REL_ORG_INSP_TYPE
  869. <where>
  870. <if test='orgId != null and orgId != "" '>
  871. AND ORG_ID = #{orgId}
  872. </if>
  873. </where>
  874. )) A ON A.PTYPE = O.PTYPE
  875. where pl.DATA_STAT='0'
  876. and (
  877. pl.PERS_ID = #{persId}
  878. OR pl.pblm_classify in (select pblm_classify from bis_insp_pblm_mend_pri where MAND_PERS_ID =#{persId} and
  879. DATA_STAT='0')
  880. )
  881. <if test="province != null and province != '' ">AND pl.OBJ_AD_CODE LIKE CONCAT(#{province}, '%')</if>
  882. <if test="adCode != null and adCode != '' ">and pl.OBJ_AD_CODE LIKE CONCAT(#{adCode}, '%')</if>
  883. <if test="objType != null and objType != '' ">and pl.OBJ_TYPE = #{objType}</if>
  884. <if test='sttm != null and sttm != "" '>and O.OBJ_INTM &gt;= STR_TO_DATE(#{sttm}, '%Y-%m-%d') </if>
  885. <if test='entm != null and entm != "" '>and O.OBJ_INTM &lt; DATE_ADD( STR_TO_DATE(#{entm},'%Y-%m-%d'), INTERVAL 1 day ) </if>
  886. </select>
  887. <select id="getPdZgSize" resultType="java.util.Map">
  888. select ifnull(count(pl.id),0) AS "PBLMLOGSIZE"
  889. from BIS_INSP_PBLM_PLIST pl
  890. LEFT JOIN BIS_INSP_PBLM P ON P.PBLM_ID = pl.PBLM_ID
  891. left join BIS_INSP_ALL_OBJ O ON P.OBJ_ID = O.OBJ_ID
  892. JOIN (select * FROM ATT_INSP_TYPE where code IN (select INSP_TYPE FROM REL_ORG_INSP_TYPE
  893. <where>
  894. <if test='orgId != null and orgId != "" '>
  895. AND ORG_ID = #{orgId}
  896. </if>
  897. </where>
  898. )) A ON A.PTYPE = O.PTYPE
  899. where pl.DATA_STAT='0'
  900. AND pl.PBLM_OUT = '1'
  901. and (
  902. pl.PERS_ID = #{persId}
  903. OR pl.pblm_classify in (select pblm_classify from bis_insp_pblm_mend_pri where MAND_PERS_ID =#{persId} and
  904. DATA_STAT='0')
  905. )
  906. <if test="province != null and province != '' ">AND pl.OBJ_AD_CODE LIKE CONCAT(#{province}, '%')</if>
  907. <if test="adCode != null and adCode != '' ">and pl.OBJ_AD_CODE LIKE CONCAT(#{adCode}, '%')</if>
  908. <if test="objType != null and objType != '' ">and pl.OBJ_TYPE = #{objType}</if>
  909. <if test='sttm != null and sttm != "" '>and O.OBJ_INTM &gt;= STR_TO_DATE(#{sttm}, '%Y-%m-%d')</if>
  910. <if test='entm != null and entm != "" '>and O.OBJ_INTM &lt; date_add( STR_TO_DATE(#{entm},'%Y-%m-%d'), INTERVAL 1 day )</if>
  911. </select>
  912. </mapper>