BisInspTaskDthDayDao.xml 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757
  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.BisInspTaskDthDayDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspTaskDthDay" id="bisInspTaskDthDayResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="orgId" column="ORG_ID"/>
  7. <result property="adCode" column="AD_CODE"/>
  8. <result property="adName" column="AD_NAME"/>
  9. <result property="adFullName" column="AD_FULL_NAME"/>
  10. <result property="adGrad" column="AD_GRAD"/>
  11. <result property="tm" column="TM"/>
  12. <result property="objType" column="OBJ_TYPE"/>
  13. <result property="objName" column="OBJ_NAME"/>
  14. <result property="objSize" column="OBJ_SIZE"/>
  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="intm" column="INTM"/>
  19. <result property="uptm" column="UPTM"/>
  20. <result property="dataStat" column="DATA_STAT"/>
  21. <result property="infoPlbm" column="INFO_PLBM"/>
  22. <result property="warmPlbm" column="WARM_PLBM"/>
  23. <result property="errorPlbm" column="ERROR_PLBM"/>
  24. <result property="errorsPlbm" column="ERRORS_PLBM"/>
  25. <result property="checkYear" column="CHECK_YEAR"/>
  26. <result property="submitPlbm" column="SUBMIT_PLBM"/>
  27. </resultMap>
  28. <sql id="table_columns">
  29. ID,
  30. ORG_ID,
  31. AD_CODE,
  32. AD_NAME,
  33. AD_FULL_NAME,
  34. AD_GRAD,
  35. TM,
  36. OBJ_TYPE,
  37. OBJ_NAME,
  38. OBJ_SIZE,
  39. PBLM_SIZE,
  40. MEND_SIZE,
  41. PBLM_LOG_SIZE,
  42. INTM,
  43. UPTM,
  44. INFO_PLBM,
  45. WARM_PLBM,
  46. ERROR_PLBM,
  47. DATA_STAT
  48. </sql>
  49. <sql id="entity_properties">
  50. #{id},
  51. #{orgId},
  52. #{adCode},
  53. #{adName},
  54. #{adFullName},
  55. #{adGrad},
  56. #{tm},
  57. #{objType},
  58. #{objName},
  59. #{objSize},
  60. #{pblmSize},
  61. #{mendSize},
  62. #{pblmLogSize},
  63. #{intm},
  64. #{uptm},
  65. #{infoPlbm},
  66. #{warmPlbm},
  67. #{errorPlbm},
  68. #{dataStat}
  69. </sql>
  70. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  71. <sql id="page_where">
  72. <trim prefix="where" prefixOverrides="and | or ">
  73. <if test="orgId != null and orgId != ''">and ORG_ID = #{orgId}</if>
  74. <if test="adCode != null and adCode != ''">and AD_CODE = #{adCode}</if>
  75. <if test="adName != null and adName != ''">and AD_NAME = #{adName}</if>
  76. <if test="adFullName != null and adFullName != ''">and AD_FULL_NAME = #{adFullName}</if>
  77. <if test="adGrad != null and adGrad != ''">and AD_GRAD = #{adGrad}</if>
  78. <if test="tm != null">and to_CHAR(TM, 'yyyy-MM-dd') = to_CHAR(#{tm}, 'yyyy-MM-dd')</if>
  79. <if test="objType != null and objType != ''">and OBJ_TYPE = #{objType}</if>
  80. <if test="objName != null and objName != ''">and OBJ_NAME = #{objName}</if>
  81. <if test="objSize != null and objSize != ''">and OBJ_SIZE = #{objSize}</if>
  82. <if test="pblmSize != null and pblmSize != ''">and PBLM_SIZE = #{pblmSize}</if>
  83. <if test="mendSize != null and mendSize != ''">and MEND_SIZE = #{mendSize}</if>
  84. <if test="pblmLogSize != null and pblmLogSize != ''">and PBLM_LOG_SIZE = #{pblmLogSize}</if>
  85. <if test="infoPlbm != null and infoPlbm != ''">and infoPlbm = #{INFO_PLBM}</if>
  86. <if test="warmPlbm != null and warmPlbm != ''">and warmPlbm = #{WARM_PLBM}</if>
  87. <if test="errorPlbm != null and errorPlbm != ''">and errorPlbm = #{ERROR_PLBM}</if>
  88. <if test="intm != null">and INTM = #{intm}</if>
  89. <if test="uptm != null">and UPTM = #{uptm}</if>
  90. <if test="sttm != null and sttm != '' and entm != null and entm != '' ">
  91. and to_date(to_CHAR(TM, 'yyyy-MM-dd'), 'yyyy-MM-dd')
  92. between to_date(substr(#{sttm}, 0, 10), 'yyyy-MM-dd') and to_date(substr(#{entm}, 0, 10), 'yyyy-MM-dd')
  93. </if>
  94. <if test="dataStat != null and dataStat != ''">and DATA_STAT = #{dataStat}</if>
  95. and DATA_STAT='0'
  96. </trim>
  97. </sql>
  98. <select id="get" resultMap="bisInspTaskDthDayResultMap" parameterType="String">
  99. select
  100. <include refid="table_columns"/>
  101. from BIS_INSP_TASK_DTH_DAY where ID = #{id}
  102. </select>
  103. <select id="getBy" resultMap="bisInspTaskDthDayResultMap">
  104. select
  105. <include refid="table_columns"/>
  106. from BIS_INSP_TASK_DTH_DAY
  107. <include refid="page_where"/>
  108. </select>
  109. <select id="findAll" resultMap="bisInspTaskDthDayResultMap">
  110. select
  111. <include refid="table_columns"/>
  112. from BIS_INSP_TASK_DTH_DAY
  113. </select>
  114. <select id="findList" resultMap="bisInspTaskDthDayResultMap">
  115. select
  116. <include refid="table_columns"/>
  117. from BIS_INSP_TASK_DTH_DAY
  118. <include refid="page_where"/>
  119. </select>
  120. <select id="selectCount" resultType="int">
  121. select count(ID) from BIS_INSP_TASK_DTH_DAY
  122. <include refid="page_where"/>
  123. </select>
  124. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspTaskDthDay">
  125. insert into BIS_INSP_TASK_DTH_DAY(
  126. <include refid="table_columns"/>
  127. )
  128. values (
  129. <include refid="entity_properties"/>
  130. )
  131. </insert>
  132. <delete id="delete" parameterType="java.lang.String">
  133. update BIS_INSP_TASK_DTH_DAY set DATA_STAT='9' where ID = #{id}
  134. </delete>
  135. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspTaskDthDay">
  136. update BIS_INSP_TASK_DTH_DAY set DATA_STAT='9'
  137. <include refid="page_where"/>
  138. </delete>
  139. <update id="deleteInFlag" parameterType="java.lang.String">
  140. update BIS_INSP_TASK_DTH_DAY set DATA_STAT = '9' where ID = #{id}
  141. </update>
  142. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspTaskDthDay">
  143. update BIS_INSP_TASK_DTH_DAY
  144. <trim prefix="set" suffixOverrides=",">
  145. <if test="orgId != null and orgId != ''">ORG_ID = #{orgId},</if>
  146. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  147. <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
  148. <if test="adFullName != null and adFullName != ''">AD_FULL_NAME = #{adFullName},</if>
  149. <if test="adGrad != null and adGrad != ''">AD_GRAD = #{adGrad},</if>
  150. <if test="tm != null">TM = #{tm},</if>
  151. <if test="objType != null and objType != ''">OBJ_TYPE = #{objType},</if>
  152. <if test="objName != null and objName != ''">OBJ_NAME = #{objName},</if>
  153. <if test="objSize != null and objSize != ''">OBJ_SIZE = #{objSize},</if>
  154. <if test="pblmSize != null and pblmSize != ''">PBLM_SIZE = #{pblmSize},</if>
  155. <if test="mendSize != null and mendSize != ''">MEND_SIZE = #{mendSize},</if>
  156. <if test="pblmLogSize != null and pblmLogSize != ''">PBLM_LOG_SIZE = #{pblmLogSize},</if>
  157. <if test="infoPlbm != null and infoPlbm != ''">infoPlbm = #{INFO_PLBM},</if>
  158. <if test="warmPlbm != null and warmPlbm != ''">warmPlbm = #{WARM_PLBM},</if>
  159. <if test="errorPlbm != null and errorPlbm != ''">errorPlbm = #{ERROR_PLBM},</if>
  160. <if test="intm != null">INTM = #{intm},</if>
  161. <if test="uptm != null">UPTM = #{uptm},</if>
  162. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  163. </trim>
  164. <where>ID = #{id}</where>
  165. </update>
  166. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspTaskDthDay">
  167. update BIS_INSP_TASK_DTH_DAY
  168. <trim prefix="set" suffixOverrides=",">
  169. <if test="orgId != null and orgId != ''">ORG_ID = #{orgId},</if>
  170. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  171. <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
  172. <if test="adFullName != null and adFullName != ''">AD_FULL_NAME = #{adFullName},</if>
  173. <if test="adGrad != null and adGrad != ''">AD_GRAD = #{adGrad},</if>
  174. <if test="tm != null">TM = #{tm},</if>
  175. <if test="objType != null and objType != ''">OBJ_TYPE = #{objType},</if>
  176. <if test="objName != null and objName != ''">OBJ_NAME = #{objName},</if>
  177. <if test="objSize != null and objSize != ''">OBJ_SIZE = #{objSize},</if>
  178. <if test="pblmSize != null and pblmSize != ''">PBLM_SIZE = #{pblmSize},</if>
  179. <if test="mendSize != null and mendSize != ''">MEND_SIZE = #{mendSize},</if>
  180. <if test="pblmLogSize != null and pblmLogSize != ''">PBLM_LOG_SIZE = #{pblmLogSize},</if>
  181. <if test="infoPlbm != null and infoPlbm != ''">infoPlbm = #{INFO_PLBM},</if>
  182. <if test="warmPlbm != null and warmPlbm != ''">warmPlbm = #{WARM_PLBM},</if>
  183. <if test="errorPlbm != null and errorPlbm != ''">errorPlbm = #{ERROR_PLBM},</if>
  184. <if test="intm != null">INTM = #{intm},</if>
  185. <if test="uptm != null">UPTM = #{uptm},</if>
  186. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  187. </trim>
  188. <include refid="page_where"/>
  189. </update>
  190. <!-- 其他自定义SQL -->
  191. <select id="findForCity" resultType="cn.com.goldenwater.dcproj.model.BisInspTaskDthDay">
  192. WITH O AS (
  193. <choose>
  194. <when test='objType == "8" '>
  195. SELECT
  196. '稽察工作' as NAME, r.AD_CODE, '8' as "OBJ_TYPE",
  197. COUNT( DISTINCT r.id ) OBJ_SIZE, COUNT( A.ID ) PBLM_SIZE,
  198. 0 as SUBMIT_PLBM,
  199. NVL( SUM( CASE A.PBLM_PASI WHEN '0' THEN 1 ELSE 0 END ), 0 ) INFO_PLBM,
  200. NVL( SUM( CASE A.PBLM_PASI WHEN '1' THEN 1 ELSE 0 END ), 0 ) WARM_PLBM,
  201. NVL( SUM( CASE A.PBLM_PASI WHEN '2' THEN 1 ELSE 0 END ), 0 ) ERROR_PLBM,
  202. NVL( SUM( CASE A.PBLM_PASI WHEN '3' THEN 1 ELSE 0 END ), 0 ) ERRORS_PLBM,
  203. 0 as PBLM_LOG_SIZE , 0 as MEND_SIZE
  204. FROM TAC_INSP_YEAR_BATCH_OBJ O
  205. LEFT JOIN tac_pawp_rgstr r ON o.id = r.obj_id
  206. <!--LEFT JOIN (SELECT * FROM TAC_PROVINCE_PBLM_INFO WHERE STEP_ID = #{lastStepId}) A ON A.rgstr_id = r.id-->
  207. LEFT JOIN TAC_PBLM_INFO A ON A.rgstr_id = r.id
  208. <where>
  209. <if test="year != null and year != ''">and O.YEAR = #{year}</if>
  210. <if test="batch != null and batch != ''">and O.BATCH = #{batch}</if>
  211. <if test="province != null and province != ''">and O.PROVINCE = #{province}</if>
  212. <if test="sttm != null and sttm != '' and entm != null and entm != '' ">
  213. and R.INTM BETWEEN TO_DATE(#{sttm}, 'YYYY-MM-DD') and TO_DATE(#{entm}, 'YYYY-MM-DD')
  214. </if>
  215. </where>
  216. GROUP BY r.AD_CODE, '8', R.INTM
  217. </when>
  218. <otherwise>
  219. SELECT
  220. A.NAME,
  221. <!-- 把福建省福州市下的平潭县 提到到平潭综合实验区 -->
  222. <!-- 把山东省莱芜市下的市辖区、莱芜区 归属到济南市莱芜区,钢城区 归属到济南市的钢城区, -->
  223. ( case when SUBSTR(O.OBJ_AD_CODE, 0, 6) = '350128' then '351000000000' when SUBSTR(O.OBJ_AD_CODE, 0, 6) = '371201' then '370116000000' when SUBSTR(O.OBJ_AD_CODE, 0, 6) = '371202' then '370116000000' when SUBSTR(O.OBJ_AD_CODE, 0, 6) = '371203' then '370117000000' else O.OBJ_AD_CODE end) AS "AD_CODE",
  224. O.PTYPE as "OBJ_TYPE",
  225. COUNT( DISTINCT O.OBJ_ID ) OBJ_SIZE,
  226. COUNT(DISTINCT case when P.PBLM_ID is not null then P.PBLM_ID end ) PBLM_SIZE,
  227. NVL( SUM( CASE WHEN P.STATE = '2' THEN 1 ELSE 0 END ), 0 ) SUBMIT_PLBM,
  228. NVL( SUM( CASE P.INSP_PBLM_CATE WHEN '0' THEN 1 ELSE 0 END ), 0 ) INFO_PLBM,
  229. NVL( SUM( CASE P.INSP_PBLM_CATE WHEN '1' THEN 1 ELSE 0 END ), 0 ) WARM_PLBM,
  230. NVL( SUM( CASE P.INSP_PBLM_CATE WHEN '2' THEN 1 ELSE 0 END ), 0 ) ERROR_PLBM,
  231. NVL( SUM( CASE P.INSP_PBLM_CATE WHEN '3' THEN 1 ELSE 0 END ), 0 ) ERRORS_PLBM,
  232. NVL( SUM( CASE PL.PBLM_OUT WHEN '1' THEN 1 ELSE 0 END ), 0 ) PBLM_LOG_SIZE,
  233. NVL( COUNT(DISTINCT CASE when PL.PBLM_ID is not null then P.PBLM_ID end ), 0 ) MEND_SIZE
  234. FROM
  235. BIS_INSP_ALL_OBJ O
  236. JOIN (select * FROM ATT_INSP_TYPE where code IN (select INSP_TYPE FROM REL_ORG_INSP_TYPE
  237. <where>
  238. <if test='orgId != null and orgId != "" '>
  239. AND ORG_ID = #{orgId}
  240. </if>
  241. </where>
  242. )) A ON A.PTYPE = O.PTYPE
  243. LEFT JOIN BIS_INSP_PBLM P ON P.OBJ_ID = O.OBJ_ID
  244. LEFT JOIN BIS_INSP_PBLM_PLIST Pl ON PL.PBLM_ID = P.PBLM_ID and PL.DATA_STAT='0'
  245. <where>
  246. <if test="objType != null and objType != ''">and O.PTYPE = #{objType}</if>
  247. <if test="orgId != null and orgId != ''">AND O.ID LIKE '___${orgId}%'</if>
  248. <if test="sttm != null and sttm != '' and entm != null and entm != '' ">
  249. and O.OBJ_INTM &gt;= TO_DATE(#{sttm}, 'YYYY-MM-DD') and O.OBJ_INTM &lt; TO_DATE(#{entm}, 'YYYY-MM-DD') +1
  250. </if>
  251. </where>
  252. GROUP BY A.NAME,O.OBJ_AD_CODE, O.PTYPE
  253. </otherwise>
  254. </choose>
  255. )
  256. SELECT
  257. ( case when SUBSTR(A.AD_CODE, 0, 6) = '350000' then '359900000000' else A.AD_CODE end) as AD_CODE, A.AD_NAME, A.LGTD, A.LTTD,
  258. SUM(OBJ_SIZE) OBJ_SIZE,
  259. SUM(PBLM_SIZE) PBLM_SIZE, SUM(SUBMIT_PLBM) SUBMIT_PLBM, SUM(INFO_PLBM) INFO_PLBM,
  260. SUM(WARM_PLBM) WARM_PLBM, SUM(ERROR_PLBM) ERROR_PLBM, SUM(ERRORS_PLBM) ERRORS_PLBM, SUM(PBLM_LOG_SIZE) PBLM_LOG_SIZE, SUM(MEND_SIZE) MEND_SIZE
  261. FROM
  262. <choose>
  263. <when test='adGrad == "4" '>
  264. <!-- 县区 -->
  265. <choose>
  266. <when test=' adCode == "3501" '>
  267. <!-- 福建省 福州市 排除 平潭县 -->
  268. (select AD_CODE, AD_NAME, LGTD, LTTD from ATT_AD_BASE WHERE ad_grad= '4' and AD_CODE LIKE '${adCode}%' and SUBSTR(AD_CODE, 0, 6) !='350128' )A
  269. </when>
  270. <when test=' adCode == "3510" '>
  271. <!-- 福建省 平潭实验区-->
  272. (select (case when SUBSTR(AD_CODE, 0, 6) = '350128' then '351000000000' else AD_CODE end) AS "AD_CODE", AD_NAME, LGTD, LTTD from ATT_AD_BASE WHERE (ad_grad= '4' and AD_CODE LIKE '${adCode}%' ) or SUBSTR(AD_CODE, 0, 6) ='350128' )A
  273. </when>
  274. <otherwise>
  275. <!-- 除去福建省 的其他省份-->
  276. (select AD_CODE, AD_NAME, LGTD, LTTD from ATT_AD_BASE WHERE ad_grad= '4' and AD_CODE LIKE '${adCode}%') A
  277. </otherwise>
  278. </choose>
  279. </when>
  280. <otherwise>
  281. <choose>
  282. <when test=' adCode == "35" '>
  283. <!-- 福建省 增加省本级 -->
  284. (select AD_CODE, AD_NAME, LGTD, LTTD from ATT_AD_BASE WHERE ad_grad= '3' and AD_CODE LIKE '${adCode}%'
  285. UNION ALL
  286. select '350000000000' as AD_CODE , '省本级' as AD_NAME, null as LGTD, null as LTTD from ATT_AD_BASE where ad_code = '350100000000'
  287. )A
  288. </when>
  289. <when test=' adCode == "3500" '>
  290. <!-- 省本级 -->
  291. (
  292. select '350000000000' as AD_CODE , '省本级' as AD_NAME, null as LGTD, null as LTTD from dual
  293. )A
  294. </when>
  295. <otherwise>
  296. <!-- 除去福建省 的其他省份-->
  297. (select AD_CODE, AD_NAME, LGTD, LTTD from ATT_AD_BASE WHERE ad_grad= '3' and AD_CODE LIKE '${adCode}%') A
  298. </otherwise>
  299. </choose>
  300. </otherwise>
  301. </choose>
  302. LEFT JOIN (
  303. SELECT
  304. <choose>
  305. <when test='adGrad == "4" '>
  306. SUBSTR(AD_CODE, 0, 6) || '000000' AD_CODE,
  307. </when>
  308. <otherwise>
  309. SUBSTR(AD_CODE, 0, 4) || '00000000' AD_CODE,
  310. </otherwise>
  311. </choose>
  312. OBJ_TYPE, OBJ_SIZE, PBLM_SIZE, SUBMIT_PLBM,INFO_PLBM, WARM_PLBM, ERROR_PLBM, ERRORS_PLBM,PBLM_LOG_SIZE,MEND_SIZE
  313. FROM o
  314. <where>
  315. <if test="adCode != null and adCode != ''">and o.AD_CODE LIKE '${adCode}%'</if>
  316. </where>
  317. ) T ON T.AD_CODE = A.AD_CODE
  318. <where>
  319. <if test="adCode != null and adCode != ''">and A.AD_CODE LIKE '${adCode}%'</if>
  320. <if test="adCode == '66'">and a.ad_code != '661100000000'</if> <!--为了去除首页三维地图没有十一师的坐标-->
  321. </where>
  322. GROUP BY A.AD_CODE, A.AD_NAME, A.LGTD, A.LTTD
  323. ORDER BY A.AD_CODE
  324. </select>
  325. <select id="findForObjType" resultType="cn.com.goldenwater.dcproj.model.BisInspTaskDthDay">
  326. SELECT
  327. OBJ_NAME,
  328. OBJ_TYPE,
  329. SUM(OBJ_SIZE) OBJ_SIZE,
  330. SUM(PBLM_SIZE) PBLM_SIZE, SUM(SUBMIT_PLBM) SUBMIT_PLBM,SUM(INFO_PLBM) INFO_PLBM,
  331. SUM(WARM_PLBM) WARM_PLBM, SUM(ERROR_PLBM) ERROR_PLBM, SUM(ERRORS_PLBM) ERRORS_PLBM, SUM(PBLM_LOG_SIZE) PBLM_LOG_SIZE, SUM(MEND_SIZE) MEND_SIZE
  332. FROM
  333. (
  334. SELECT OBJ_NAME,
  335. <choose>
  336. <when test='adGrad == "4" '>
  337. SUBSTR(AD_CODE, 0, 6) || '000000' AD_CODE,
  338. </when>
  339. <otherwise>
  340. SUBSTR(AD_CODE, 0, 4) || '00000000' AD_CODE,
  341. </otherwise>
  342. </choose>
  343. OBJ_TYPE, OBJ_SIZE, PBLM_SIZE,SUBMIT_PLBM, INFO_PLBM, WARM_PLBM, ERROR_PLBM, ERRORS_PLBM,PBLM_LOG_SIZE,MEND_SIZE
  344. FROM (
  345. SELECT
  346. AIT.NAME AS "OBJ_NAME",
  347. <!-- 把福建省福州市下的平潭县 提到到平潭综合实验区 -->
  348. <!-- 把山东省莱芜市下的市辖区、莱芜区 归属到济南市莱芜区,钢城区 归属到济南市的钢城区, -->
  349. ( case when SUBSTR(O.OBJ_AD_CODE, 0, 6) = '350128' then '351000000000' when SUBSTR(O.OBJ_AD_CODE, 0, 6) = '371201' then '370116000000' when SUBSTR(O.OBJ_AD_CODE, 0, 6) = '371202' then '370116000000' when SUBSTR(O.OBJ_AD_CODE, 0, 6) = '371203' then '370117000000' else O.OBJ_AD_CODE end) AS "AD_CODE",
  350. O.PTYPE as "OBJ_TYPE",
  351. COUNT( DISTINCT O.OBJ_ID ) OBJ_SIZE,
  352. COUNT(DISTINCT case when P.PBLM_ID is not null then P.PBLM_ID end ) PBLM_SIZE,
  353. NVL( SUM( CASE WHEN P.STATE = '2' THEN 1 ELSE 0 END ), 0 ) SUBMIT_PLBM,
  354. NVL( SUM( CASE P.INSP_PBLM_CATE WHEN '0' THEN 1 ELSE 0 END ), 0 ) INFO_PLBM,
  355. NVL( SUM( CASE P.INSP_PBLM_CATE WHEN '1' THEN 1 ELSE 0 END ), 0 ) WARM_PLBM,
  356. NVL( SUM( CASE P.INSP_PBLM_CATE WHEN '2' THEN 1 ELSE 0 END ), 0 ) ERROR_PLBM,
  357. NVL( SUM( CASE P.INSP_PBLM_CATE WHEN '3' THEN 1 ELSE 0 END ), 0 ) ERRORS_PLBM,
  358. NVL( SUM( CASE PL.PBLM_OUT WHEN '1' THEN 1 ELSE 0 END ), 0 ) PBLM_LOG_SIZE,
  359. NVL( COUNT(DISTINCT CASE when PL.PBLM_ID is not null then P.PBLM_ID end ), 0 ) MEND_SIZE
  360. FROM
  361. BIS_INSP_ALL_OBJ O
  362. JOIN (select * FROM ATT_INSP_TYPE where code IN (select INSP_TYPE FROM REL_ORG_INSP_TYPE
  363. <where>
  364. <if test='orgId != null and orgId != "" '>
  365. AND ORG_ID = #{orgId}
  366. </if>
  367. </where>
  368. )) AIT ON AIT.PTYPE = O.PTYPE
  369. LEFT JOIN BIS_INSP_PBLM P ON P.OBJ_ID = O.OBJ_ID
  370. LEFT JOIN BIS_INSP_PBLM_PLIST Pl ON PL.PBLM_ID = P.PBLM_ID and PL.DATA_STAT='0'
  371. <where>
  372. <if test="objType != null and objType != ''">and O.PTYPE = #{objType}</if>
  373. <if test="orgId != null and orgId != ''">AND O.ID LIKE '___${orgId}%'</if>
  374. <if test="sttm != null and sttm != '' and entm != null and entm != '' ">
  375. and O.OBJ_INTM &gt;= TO_DATE(#{sttm}, 'YYYY-MM-DD') and O.OBJ_INTM &lt; TO_DATE(#{entm}, 'YYYY-MM-DD') +1
  376. </if>
  377. </where>
  378. GROUP BY AIT.NAME,O.OBJ_AD_CODE, O.PTYPE
  379. ) o
  380. <where>
  381. <if test="adCode != null and adCode != ''">and o.AD_CODE LIKE '${adCode}%'</if>
  382. </where>
  383. ) T
  384. GROUP BY T.OBJ_NAME, T.OBJ_TYPE
  385. ORDER BY TO_NUMBER(T.OBJ_TYPE)
  386. </select>
  387. <select id="findForObjType1" resultType="cn.com.goldenwater.dcproj.model.BisInspTaskDthDay">
  388. SELECT AAA.*, NVL(BBB.PERNUMSIZE,0) as PERS_SIZE1 ,NVL(CCC.BISINSPALLGROUPSIZE,0) as GROUP_SIZE1 from
  389. (SELECT
  390. OBJ_NAME,
  391. OBJ_TYPE,
  392. SUM(OBJ_SIZE) OBJ_SIZE,
  393. SUM(PBLM_SIZE) PBLM_SIZE, SUM(SUBMIT_PLBM) SUBMIT_PLBM,SUM(INFO_PLBM) INFO_PLBM,
  394. SUM(WARM_PLBM) WARM_PLBM, SUM(ERROR_PLBM) ERROR_PLBM, SUM(ERRORS_PLBM) ERRORS_PLBM, SUM(PBLM_LOG_SIZE) PBLM_LOG_SIZE, SUM(MEND_SIZE) MEND_SIZE,
  395. count(distinct(substr(ad_code,0,4)))AD_CODE_SIZE_S ,count(distinct(substr(ad_code,0,6))) AD_CODE_SIZE_X
  396. FROM
  397. (
  398. SELECT OBJ_NAME,
  399. AD_CODE,
  400. OBJ_TYPE, OBJ_SIZE, PBLM_SIZE,SUBMIT_PLBM, INFO_PLBM, WARM_PLBM, ERROR_PLBM, ERRORS_PLBM,PBLM_LOG_SIZE,MEND_SIZE
  401. FROM (
  402. SELECT
  403. AIT.NAME AS "OBJ_NAME",
  404. <!-- 把福建省福州市下的平潭县 提到到平潭综合实验区 -->
  405. <!-- 把山东省莱芜市下的市辖区、莱芜区 归属到济南市莱芜区,钢城区 归属到济南市的钢城区, -->
  406. ( case when SUBSTR(O.OBJ_AD_CODE, 0, 6) = '350128' then '351000000000' when SUBSTR(O.OBJ_AD_CODE, 0, 6) = '371201' then '370116000000' when SUBSTR(O.OBJ_AD_CODE, 0, 6) = '371202' then '370116000000' when SUBSTR(O.OBJ_AD_CODE, 0, 6) = '371203' then '370117000000' else O.OBJ_AD_CODE end) AS "AD_CODE",
  407. O.PTYPE as "OBJ_TYPE",
  408. COUNT( DISTINCT O.OBJ_ID ) OBJ_SIZE,
  409. COUNT(DISTINCT case when P.PBLM_ID is not null then P.PBLM_ID end ) PBLM_SIZE,
  410. NVL( SUM( CASE WHEN P.STATE = '2' THEN 1 ELSE 0 END ), 0 ) SUBMIT_PLBM,
  411. NVL( SUM( CASE P.INSP_PBLM_CATE WHEN '0' THEN 1 ELSE 0 END ), 0 ) INFO_PLBM,
  412. NVL( SUM( CASE P.INSP_PBLM_CATE WHEN '1' THEN 1 ELSE 0 END ), 0 ) WARM_PLBM,
  413. NVL( SUM( CASE P.INSP_PBLM_CATE WHEN '2' THEN 1 ELSE 0 END ), 0 ) ERROR_PLBM,
  414. NVL( SUM( CASE P.INSP_PBLM_CATE WHEN '3' THEN 1 ELSE 0 END ), 0 ) ERRORS_PLBM,
  415. NVL( SUM( CASE PL.PBLM_OUT WHEN '1' THEN 1 ELSE 0 END ), 0 ) PBLM_LOG_SIZE,
  416. NVL( COUNT(DISTINCT CASE when PL.PBLM_ID is not null then P.PBLM_ID end ), 0 ) MEND_SIZE
  417. FROM
  418. BIS_INSP_ALL_OBJ O
  419. JOIN (select * FROM ATT_INSP_TYPE where code IN (select INSP_TYPE FROM REL_ORG_INSP_TYPE
  420. <where>
  421. <if test='orgId != null and orgId != "" '>
  422. AND ORG_ID = #{orgId}
  423. </if>
  424. </where>
  425. )) AIT ON AIT.PTYPE = O.PTYPE
  426. LEFT JOIN BIS_INSP_PBLM P ON P.OBJ_ID = O.OBJ_ID
  427. LEFT JOIN BIS_INSP_PBLM_PLIST Pl ON PL.PBLM_ID = P.PBLM_ID and PL.DATA_STAT='0'
  428. <where>
  429. <if test="objType != null and objType != ''">and O.PTYPE = #{objType}</if>
  430. <if test="orgId != null and orgId != ''">AND O.ID LIKE '___${orgId}%'</if>
  431. <if test="sttm != null and sttm != '' and entm != null and entm != '' ">
  432. and O.OBJ_INTM &gt;= TO_DATE(#{sttm}, 'YYYY-MM-DD') and O.OBJ_INTM &lt; TO_DATE(#{entm}, 'YYYY-MM-DD') +1
  433. </if>
  434. </where>
  435. GROUP BY AIT.NAME,O.OBJ_AD_CODE, O.PTYPE
  436. ) o
  437. <where>
  438. <if test="adCode != null and adCode != ''">and o.AD_CODE LIKE '${adCode}%'</if>
  439. </where>
  440. ) T
  441. GROUP BY T.OBJ_NAME, T.OBJ_TYPE ) AAA
  442. LEFT JOIN
  443. (SELECT BB.PTYPE , COUNT(BB.PERSID) PERNUMSIZE
  444. FROM(
  445. SELECT B.ID , B.PERSID ,O.PTYPE
  446. FROM BIS_INSP_ALL_RLATION B
  447. JOIN BIS_INSP_ALL C ON B.ID = C.ID
  448. JOIN BIS_INSP_ALL_RLATION_PERS P ON P.GUID = B.PERSID
  449. JOIN (select * FROM ATT_INSP_TYPE where code IN (select INSP_TYPE FROM REL_ORG_INSP_TYPE
  450. <where>
  451. <if test="orgId != null and orgId != '' ">
  452. AND ORG_ID = #{orgId}
  453. </if>
  454. </where>
  455. )) T ON SUBSTR(C.ID, 1, 3) = T.CODE
  456. LEFT JOIN BIS_INSP_ALL_OBJ O ON O.ID = C.ID
  457. <where>
  458. LENGTH( C.ID ) = 12
  459. <if test="adCode != null and adCode != ''">AND O.OBJ_AD_CODE LIKE '${adCode}%'</if>
  460. <if test="orgId != null and orgId != '' ">
  461. AND C.ID LIKE '___${orgId}%'
  462. </if>
  463. <if test="objType != null and objType != '' ">
  464. and to_number(C.ID) LIKE '${objType}%'
  465. </if>
  466. <if test="sttm != null and sttm != '' ">
  467. and C.STTM &gt;= to_date(#{sttm}, 'yyyy-MM-dd')
  468. </if>
  469. <if test="entm != null and entm != '' ">
  470. and C.INTM &lt; to_date(#{entm}, 'yyyy-MM-dd') + 1
  471. </if>
  472. </where>
  473. GROUP BY B.ID , B.PERSID ,O.PTYPE
  474. ) BB GROUP BY BB.PTYPE
  475. ) BBB ON AAA.OBJ_TYPE = BBB.PTYPE
  476. left join ( SELECT O.PTYPE , NVL(COUNT(DISTINCT C.ID),0) BISINSPALLGROUPSIZE
  477. FROM BIS_INSP_ALL C
  478. JOIN (select * FROM ATT_INSP_TYPE where code IN (select INSP_TYPE FROM REL_ORG_INSP_TYPE
  479. <where>
  480. <if test="orgId != null and orgId != '' ">
  481. AND ORG_ID = #{orgId}
  482. </if>
  483. </where>
  484. )) T ON SUBSTR(C.ID, 0, 3) = T.CODE
  485. LEFT JOIN BIS_INSP_ALL_OBJ O ON O.ID = C.ID
  486. WHERE LENGTH(C.ID) = '12'
  487. <if test="adCode != null and adCode != ''">AND O.OBJ_AD_CODE LIKE '${adCode}%'</if>
  488. <if test="orgId != null and orgId != '' ">
  489. AND C.ID LIKE '___${orgId}%'
  490. </if>
  491. <if test="objType != null and objType != '' ">
  492. and to_number(C.ID) LIKE '${objType}%'
  493. </if>
  494. <if test="sttm != null and sttm != '' ">
  495. and C.STTM &gt;= to_date(#{sttm}, 'yyyy-MM-dd')
  496. </if>
  497. <if test="entm != null and entm != '' ">
  498. and C.STTM &lt; to_date(#{entm}, 'yyyy-MM-dd') + 1
  499. </if>
  500. GROUP BY O.PTYPE
  501. )CCC ON AAA.OBJ_TYPE = CCC.PTYPE
  502. ORDER BY TO_NUMBER(AAA.OBJ_TYPE)
  503. </select>
  504. <select id="findForCityObjType" resultType="cn.com.goldenwater.dcproj.model.BisInspTaskDthDay">
  505. WITH O AS (
  506. SELECT
  507. A.NAME as "OBJ_NAME",
  508. <!-- 把福建省福州市下的平潭县 提到到平潭综合实验区 -->
  509. <!-- 把山东省莱芜市下的市辖区、莱芜区 归属到济南市莱芜区,钢城区 归属到济南市的钢城区, -->
  510. ( case when SUBSTR(O.OBJ_AD_CODE, 0, 6) = '350128' then '351000000000' when SUBSTR(O.OBJ_AD_CODE, 0, 6) = '371201' then '370116000000' when SUBSTR(O.OBJ_AD_CODE, 0, 6) = '371202' then '370116000000' when SUBSTR(O.OBJ_AD_CODE, 0, 6) = '371203' then '370117000000' else O.OBJ_AD_CODE end) AS "AD_CODE",
  511. O.PTYPE as "OBJ_TYPE",
  512. COUNT( DISTINCT O.OBJ_ID ) OBJ_SIZE,
  513. COUNT(DISTINCT case when P.PBLM_ID is not null then P.PBLM_ID end ) PBLM_SIZE,
  514. NVL( SUM( CASE WHEN P.STATE = '2' THEN 1 ELSE 0 END ), 0 ) SUBMIT_PLBM,
  515. NVL( SUM( CASE P.INSP_PBLM_CATE WHEN '0' THEN 1 ELSE 0 END ), 0 ) INFO_PLBM,
  516. NVL( SUM( CASE P.INSP_PBLM_CATE WHEN '1' THEN 1 ELSE 0 END ), 0 ) WARM_PLBM,
  517. NVL( SUM( CASE P.INSP_PBLM_CATE WHEN '2' THEN 1 ELSE 0 END ), 0 ) ERROR_PLBM,
  518. NVL( SUM( CASE P.INSP_PBLM_CATE WHEN '3' THEN 1 ELSE 0 END ), 0 ) ERRORS_PLBM,
  519. NVL( SUM( CASE PL.PBLM_OUT WHEN '1' THEN 1 ELSE 0 END ), 0 ) PBLM_LOG_SIZE,
  520. NVL( COUNT(DISTINCT CASE when PL.PBLM_ID is not null then P.PBLM_ID end ), 0 ) MEND_SIZE
  521. FROM
  522. BIS_INSP_ALL_OBJ O
  523. JOIN (select * FROM ATT_INSP_TYPE where code IN (select INSP_TYPE FROM REL_ORG_INSP_TYPE
  524. <where>
  525. <if test='orgId != null and orgId != "" '>
  526. AND ORG_ID = #{orgId}
  527. </if>
  528. </where>
  529. )) A ON A.PTYPE = O.PTYPE
  530. LEFT JOIN BIS_INSP_PBLM P ON P.OBJ_ID = O.OBJ_ID
  531. LEFT JOIN BIS_INSP_PBLM_PLIST Pl ON PL.PBLM_ID = P.PBLM_ID and PL.DATA_STAT='0'
  532. <where>
  533. <if test="objType != null and objType != ''">and O.PTYPE = #{objType}</if>
  534. <if test="orgId != null and orgId != ''">AND O.ID LIKE '___${orgId}%'</if>
  535. <if test="sttm != null and sttm != '' and entm != null and entm != '' ">
  536. and O.OBJ_INTM &gt;= TO_DATE(#{sttm}, 'YYYY-MM-DD') and O.OBJ_INTM &lt; TO_DATE(#{entm}, 'YYYY-MM-DD') +1
  537. </if>
  538. </where>
  539. GROUP BY A.NAME,O.OBJ_AD_CODE, O.PTYPE
  540. )
  541. SELECT
  542. ( case when SUBSTR(A.AD_CODE, 0, 6) = '350000' then '359900000000' else A.AD_CODE end) as AD_CODE, A.AD_NAME, A.LGTD, A.LTTD,
  543. T.OBJ_NAME, T.OBJ_TYPE,
  544. SUM(OBJ_SIZE) OBJ_SIZE,
  545. SUM(PBLM_SIZE) PBLM_SIZE, SUM(SUBMIT_PLBM) SUBMIT_PLBM,SUM(INFO_PLBM) INFO_PLBM,
  546. SUM(WARM_PLBM) WARM_PLBM, SUM(ERROR_PLBM) ERROR_PLBM, SUM(ERRORS_PLBM) ERRORS_PLBM, SUM(PBLM_LOG_SIZE) PBLM_LOG_SIZE, SUM(MEND_SIZE) MEND_SIZE
  547. FROM
  548. <choose>
  549. <when test='adGrad == "4" '>
  550. <!-- 县区 -->
  551. <choose>
  552. <when test=' adCode == "3501" '>
  553. <!-- 福建省 福州市 排除 平潭县 -->
  554. (select AD_CODE, AD_NAME, LGTD, LTTD from ATT_AD_BASE WHERE ad_grad= '4' and AD_CODE LIKE '${adCode}%' and SUBSTR(AD_CODE, 0, 6) !='350128' )A
  555. </when>
  556. <when test=' adCode == "3510" '>
  557. <!-- 福建省 平潭实验区-->
  558. (select (case when SUBSTR(AD_CODE, 0, 6) = '350128' then '351000000000' else AD_CODE end) AS "AD_CODE", AD_NAME, LGTD, LTTD from ATT_AD_BASE WHERE (ad_grad= '4' and AD_CODE LIKE '${adCode}%' ) or SUBSTR(AD_CODE, 0, 6) ='350128' )A
  559. </when>
  560. <otherwise>
  561. <!-- 除去福建省 的其他省份-->
  562. (select AD_CODE, AD_NAME, LGTD, LTTD from ATT_AD_BASE WHERE ad_grad= '4' and AD_CODE LIKE '${adCode}%') A
  563. </otherwise>
  564. </choose>
  565. </when>
  566. <otherwise>
  567. <choose>
  568. <when test=' adCode == "35" '>
  569. <!-- 福建省 增加省本级 -->
  570. (select AD_CODE, AD_NAME, LGTD, LTTD from ATT_AD_BASE WHERE ad_grad= '3' and AD_CODE LIKE '${adCode}%'
  571. UNION ALL
  572. select '350000000000' as AD_CODE , '省本级' as AD_NAME, LGTD, LTTD from ATT_AD_BASE where ad_code = '350100000000'
  573. )A
  574. </when>
  575. <when test=' adCode == "3500" '>
  576. <!-- 省本级 -->
  577. (
  578. select '350000000000' as AD_CODE , '省本级' as AD_NAME, LGTD, LTTD from ATT_AD_BASE where ad_code = '350100000000'
  579. )A
  580. </when>
  581. <otherwise>
  582. <!-- 除去福建省 的其他省份-->
  583. (select AD_CODE, AD_NAME, LGTD, LTTD from ATT_AD_BASE WHERE ad_grad= '3' and AD_CODE LIKE '${adCode}%') A
  584. </otherwise>
  585. </choose>
  586. </otherwise>
  587. </choose>
  588. LEFT JOIN (
  589. SELECT
  590. <choose>
  591. <when test='adGrad == "4" '>
  592. SUBSTR(AD_CODE, 0, 6) || '000000' AD_CODE,
  593. </when>
  594. <otherwise>
  595. SUBSTR(AD_CODE, 0, 4) || '00000000' AD_CODE,
  596. </otherwise>
  597. </choose>
  598. OBJ_NAME, OBJ_TYPE, OBJ_SIZE, PBLM_SIZE,SUBMIT_PLBM,INFO_PLBM, WARM_PLBM, ERROR_PLBM, ERRORS_PLBM,PBLM_LOG_SIZE,MEND_SIZE
  599. FROM o
  600. <where>
  601. <if test="adCode != null and adCode != ''">and o.AD_CODE LIKE '${adCode}%'</if>
  602. </where>
  603. ) T ON T.AD_CODE = A.AD_CODE
  604. <where>
  605. <if test="adCode != null and adCode != ''">and A.AD_CODE LIKE '${adCode}%'</if>
  606. <if test="adCode == '66'">and a.ad_code != '661100000000'</if> <!--为了去除首页三维地图没有十一师的坐标-->
  607. </where>
  608. GROUP BY A.AD_CODE, A.AD_NAME, A.LGTD, A.LTTD ,T.OBJ_NAME, T.OBJ_TYPE
  609. ORDER BY A.AD_CODE , TO_NUMBER(T.OBJ_TYPE)
  610. </select>
  611. <select id="findForCityObjTypeYearsCompare" resultMap="bisInspTaskDthDayResultMap" >
  612. SELECT CHECK_YEAR,OBJ_TYPE,OBJ_NAME,OBJ_SIZE, PBLM_SIZE,INFO_PLBM,SUBMIT_PLBM,WARM_PLBM,ERROR_PLBM,ERRORS_PLBM,MEND_SIZE,PBLM_LOG_SIZE
  613. FROM (
  614. SELECT O1.OTM AS "CHECK_YEAR", O1.OBJ_TYPE, O1.OBJ_NAME, O1.OBJ_SIZE, NVL(O2.PBLM_SIZE,0) AS "PBLM_SIZE", NVL(O2.INFO_PLBM,0) AS "INFO_PLBM",NVL(O2.SUBMIT_PLBM,0) AS "SUBMIT_PLBM", NVL(O2.WARM_PLBM,0) AS "WARM_PLBM", NVL(O2.ERROR_PLBM,0) AS "ERROR_PLBM", NVL(O2.ERRORS_PLBM,0) AS "ERRORS_PLBM", NVL(O2.MEND_SIZE,0) AS "MEND_SIZE", NVL(O2.PBLM_LOG_SIZE ,0) AS "PBLM_LOG_SIZE"
  615. from ( SELECT
  616. OTM ,COUNT( DISTINCT O.OBJ_ID ) OBJ_SIZE, OBJ_TYPE, OBJ_NAME
  617. FROM (
  618. SELECT
  619. A.NAME as "OBJ_NAME",
  620. <!-- 把福建省福州市下的平潭县 提到到平潭综合实验区 -->
  621. <!-- 把山东省莱芜市下的市辖区、莱芜区 归属到济南市莱芜区,钢城区 归属到济南市的钢城区, -->
  622. ( case when SUBSTR(O.OBJ_AD_CODE, 0, 6) = '350128' then '351000000000' when SUBSTR(O.OBJ_AD_CODE, 0, 6) = '371201' then '370116000000' when SUBSTR(O.OBJ_AD_CODE, 0, 6) = '371202' then '370116000000' when SUBSTR(O.OBJ_AD_CODE, 0, 6) = '371203' then '370117000000' else O.OBJ_AD_CODE end) AS "AD_CODE",
  623. O.PTYPE as "OBJ_TYPE",
  624. O.OBJ_ID,
  625. (case when O.OBJ_INTM is null then TO_CHAR(P.COLL_TIME, 'YYYY') else TO_CHAR(O.OBJ_INTM, 'YYYY') end ) OTM,
  626. P.PBLM_ID,
  627. P.INSP_PBLM_CATE,
  628. P.DATA_STAT,
  629. P.STATE,
  630. PL.PBLM_ID PL_PBLM_ID,
  631. PL.PBLM_OUT PL_PBLM_OUT
  632. FROM BIS_INSP_ALL_OBJ O
  633. JOIN (select * FROM ATT_INSP_TYPE where code IN (select INSP_TYPE FROM REL_ORG_INSP_TYPE
  634. <where>
  635. <if test='orgId != null and orgId != "" '>
  636. AND ORG_ID = #{orgId}
  637. </if>
  638. </where>
  639. )) A ON A.PTYPE = O.PTYPE
  640. LEFT JOIN BIS_INSP_PBLM P ON P.OBJ_ID = O.OBJ_ID
  641. LEFT JOIN BIS_INSP_PBLM_PLIST Pl ON PL.PBLM_ID = P.PBLM_ID and PL.DATA_STAT='0'
  642. <where>
  643. <if test="objType != null and objType != ''">and O.PTYPE = #{objType}</if>
  644. <if test="orgId != null and orgId != ''">AND O.ID LIKE '___${orgId}%'</if>
  645. <if test="sttm != null and sttm != '' and entm != null and entm != '' ">
  646. and O.OBJ_INTM &gt;= TO_DATE(#{sttm}, 'YYYY-MM-DD') and O.OBJ_INTM &lt; TO_DATE(#{entm}, 'YYYY-MM-DD') +1
  647. </if>
  648. </where>
  649. ) O
  650. <where>
  651. <if test="adCode != null and adCode != ''">and AD_CODE LIKE '${adCode}%'</if>
  652. <if test='adCode == "66"'>and ad_code != '661100000000'</if> <!--为了去除首页三维地图没有十一师的坐标-->
  653. </where>
  654. GROUP BY OTM, OBJ_TYPE, OBJ_NAME
  655. ) O1
  656. LEFT JOIN
  657. ( SELECT
  658. OTM ,COUNT(DISTINCT case when O.PBLM_ID is not null then O.PBLM_ID end ) PBLM_SIZE,
  659. NVL( SUM( CASE WHEN O.STATE = '2' THEN 1 ELSE 0 END ), 0 ) SUBMIT_PLBM,
  660. NVL( SUM( CASE O.INSP_PBLM_CATE WHEN '0' THEN 1 ELSE 0 END ), 0 ) INFO_PLBM,
  661. NVL( SUM( CASE O.INSP_PBLM_CATE WHEN '1' THEN 1 ELSE 0 END ), 0 ) WARM_PLBM,
  662. NVL( SUM( CASE O.INSP_PBLM_CATE WHEN '2' THEN 1 ELSE 0 END ), 0 ) ERROR_PLBM,
  663. NVL( SUM( CASE O.INSP_PBLM_CATE WHEN '3' THEN 1 ELSE 0 END ), 0 ) ERRORS_PLBM,
  664. NVL( SUM( CASE O.PL_PBLM_OUT WHEN '1' THEN 1 ELSE 0 END ), 0 ) PBLM_LOG_SIZE,
  665. NVL( COUNT(DISTINCT CASE when O.PL_PBLM_ID is not null then O.PL_PBLM_ID end ), 0 ) MEND_SIZE
  666. , OBJ_TYPE, OBJ_NAME
  667. FROM (
  668. SELECT
  669. A.NAME as "OBJ_NAME",
  670. <!-- 把福建省福州市下的平潭县 提到到平潭综合实验区 -->
  671. <!-- 把山东省莱芜市下的市辖区、莱芜区 归属到济南市莱芜区,钢城区 归属到济南市的钢城区, -->
  672. ( case when SUBSTR(O.OBJ_AD_CODE, 0, 6) = '350128' then '351000000000' when SUBSTR(O.OBJ_AD_CODE, 0, 6) = '371201' then '370116000000' when SUBSTR(O.OBJ_AD_CODE, 0, 6) = '371202' then '370116000000' when SUBSTR(O.OBJ_AD_CODE, 0, 6) = '371203' then '370117000000' else O.OBJ_AD_CODE end) AS "AD_CODE",
  673. O.PTYPE as "OBJ_TYPE",
  674. O.OBJ_ID,
  675. (case when O.OBJ_INTM is null then TO_CHAR(P.COLL_TIME, 'YYYY') else TO_CHAR(O.OBJ_INTM, 'YYYY') end ) OTM,
  676. P.PBLM_ID,
  677. P.INSP_PBLM_CATE,
  678. P.DATA_STAT,
  679. P.STATE,
  680. PL.PBLM_ID PL_PBLM_ID,
  681. PL.PBLM_OUT PL_PBLM_OUT
  682. FROM BIS_INSP_ALL_OBJ O
  683. JOIN (select * FROM ATT_INSP_TYPE where code IN (select INSP_TYPE FROM REL_ORG_INSP_TYPE
  684. <where>
  685. <if test='orgId != null and orgId != "" '>
  686. AND ORG_ID = #{orgId}
  687. </if>
  688. </where>
  689. )) A ON A.PTYPE = O.PTYPE
  690. LEFT JOIN BIS_INSP_PBLM P ON P.OBJ_ID = O.OBJ_ID
  691. LEFT JOIN BIS_INSP_PBLM_PLIST Pl ON PL.PBLM_ID = P.PBLM_ID and PL.DATA_STAT='0'
  692. <where>
  693. <if test="objType != null and objType != ''">and O.PTYPE = #{objType}</if>
  694. <if test="orgId != null and orgId != ''">AND O.ID LIKE '___${orgId}%'</if>
  695. <if test="sttm != null and sttm != '' and entm != null and entm != '' ">
  696. and O.OBJ_INTM &gt;= TO_DATE(#{sttm}, 'YYYY-MM-DD') and O.OBJ_INTM &lt; TO_DATE(#{entm}, 'YYYY-MM-DD') +1
  697. </if>
  698. </where>
  699. ) O
  700. <where>
  701. <if test="adCode != null and adCode != ''">and AD_CODE LIKE '${adCode}%'</if>
  702. <if test='adCode == "66"'>and ad_code != '661100000000'</if> <!--为了去除首页三维地图没有十一师的坐标-->
  703. </where>
  704. GROUP BY OTM, OBJ_TYPE, OBJ_NAME
  705. ) O2 on O1.OTM = O2.OTM and O1.OBJ_TYPE = O2.OBJ_TYPE and O1.OBJ_NAME = O2.OBJ_NAME
  706. ) W
  707. </select>
  708. <select id="selectCurObjTypeList" resultType="cn.com.goldenwater.dcproj.model.BisInspTaskDthDay">
  709. SELECT
  710. AIT.NAME AS "OBJ_NAME",
  711. O.PTYPE as "OBJ_TYPE"
  712. FROM
  713. BIS_INSP_ALL_OBJ O
  714. JOIN (select * FROM ATT_INSP_TYPE where code IN (select INSP_TYPE FROM REL_ORG_INSP_TYPE
  715. <where>
  716. <if test='orgId != null and orgId != "" '>
  717. AND ORG_ID = #{orgId}
  718. </if>
  719. </where>
  720. )) AIT ON AIT.PTYPE = O.PTYPE
  721. <where>
  722. <if test="objType != null and objType != ''">and O.PTYPE = #{objType}</if>
  723. <if test="orgId != null and orgId != ''">AND O.ID LIKE '___${orgId}%'</if>
  724. <if test="sttm != null and sttm != '' and entm != null and entm != '' ">
  725. and O.OBJ_INTM &gt;= TO_DATE(#{sttm}, 'YYYY-MM-DD') and O.OBJ_INTM &lt; TO_DATE(#{entm}, 'YYYY-MM-DD') +1
  726. </if>
  727. <if test="adCode != null and adCode != ''">and SUBSTR(O.OBJ_AD_CODE, 0, 2) = SUBSTR(#{adCode}, 0, 2) </if>
  728. </where>
  729. GROUP BY AIT.NAME, O.PTYPE
  730. ORDER BY TO_NUMBER(O.PTYPE)
  731. </select>
  732. </mapper>