BisInspTaskDthDayDao.xml 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756
  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, OBJ_TYPE, 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 ,
  477. case when C.ID IS NOT NULL THEN COUNT(DISTINCT C.ID) ELSE '0' END BISINSPALLGROUPSIZE
  478. FROM BIS_INSP_ALL C
  479. JOIN (select * FROM ATT_INSP_TYPE where code IN (select INSP_TYPE FROM REL_ORG_INSP_TYPE
  480. <where>
  481. <if test="orgId != null and orgId != '' ">
  482. AND ORG_ID = #{orgId}
  483. </if>
  484. </where>
  485. )) T ON SUBSTR(C.ID, 0, 3) = T.CODE
  486. LEFT JOIN BIS_INSP_ALL_OBJ O ON O.ID = C.ID
  487. WHERE LENGTH(C.ID) = '12'
  488. <if test="adCode != null and adCode != ''">AND O.OBJ_AD_CODE LIKE '${adCode}%'</if>
  489. <if test="orgId != null and orgId != '' ">
  490. AND C.ID LIKE '___${orgId}%'
  491. </if>
  492. <if test="objType != null and objType != '' ">
  493. and to_number(C.ID) LIKE '${objType}%'
  494. </if>
  495. <if test="sttm != null and sttm != '' ">
  496. and C.STTM &gt;= to_date(#{sttm}, 'yyyy-MM-dd')
  497. </if>
  498. <if test="entm != null and entm != '' ">
  499. and C.STTM &lt; to_date(#{entm}, 'yyyy-MM-dd') + 1
  500. </if>
  501. GROUP BY O.PTYPE,c.id
  502. )CCC ON AAA.OBJ_TYPE = CCC.PTYPE
  503. ORDER BY TO_NUMBER(AAA.OBJ_TYPE)
  504. </select>
  505. <select id="findForCityObjType" resultType="cn.com.goldenwater.dcproj.model.BisInspTaskDthDay">
  506. WITH O AS (
  507. SELECT
  508. A.NAME as OBJ_NAME,
  509. <!-- 把福建省福州市下的平潭县 提到到平潭综合实验区 -->
  510. <!-- 把山东省莱芜市下的市辖区、莱芜区 归属到济南市莱芜区,钢城区 归属到济南市的钢城区, -->
  511. ( 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,
  512. O.PTYPE as OBJ_TYPE,
  513. COUNT( DISTINCT O.OBJ_ID ) OBJ_SIZE,
  514. COUNT(DISTINCT case when P.PBLM_ID is not null then P.PBLM_ID end ) PBLM_SIZE,
  515. NVL( SUM( CASE WHEN P.STATE = '2' THEN 1 ELSE 0 END ), 0 ) SUBMIT_PLBM,
  516. NVL( SUM( CASE P.INSP_PBLM_CATE WHEN '0' THEN 1 ELSE 0 END ), 0 ) INFO_PLBM,
  517. NVL( SUM( CASE P.INSP_PBLM_CATE WHEN '1' THEN 1 ELSE 0 END ), 0 ) WARM_PLBM,
  518. NVL( SUM( CASE P.INSP_PBLM_CATE WHEN '2' THEN 1 ELSE 0 END ), 0 ) ERROR_PLBM,
  519. NVL( SUM( CASE P.INSP_PBLM_CATE WHEN '3' THEN 1 ELSE 0 END ), 0 ) ERRORS_PLBM,
  520. NVL( SUM( CASE PL.PBLM_OUT WHEN '1' THEN 1 ELSE 0 END ), 0 ) PBLM_LOG_SIZE,
  521. NVL( COUNT(DISTINCT CASE when PL.PBLM_ID is not null then P.PBLM_ID end ), 0 ) MEND_SIZE
  522. FROM
  523. BIS_INSP_ALL_OBJ O
  524. JOIN (select * FROM ATT_INSP_TYPE where code IN (select INSP_TYPE FROM REL_ORG_INSP_TYPE
  525. <where>
  526. <if test='orgId != null and orgId != "" '>
  527. AND ORG_ID = #{orgId}
  528. </if>
  529. </where>
  530. )) A ON A.PTYPE = O.PTYPE
  531. LEFT JOIN BIS_INSP_PBLM P ON P.OBJ_ID = O.OBJ_ID
  532. LEFT JOIN BIS_INSP_PBLM_PLIST Pl ON PL.PBLM_ID = P.PBLM_ID and PL.DATA_STAT='0'
  533. <where>
  534. <if test="objType != null and objType != ''">and O.PTYPE = #{objType}</if>
  535. <if test="orgId != null and orgId != ''">AND O.ID LIKE '___${orgId}%'</if>
  536. <if test="sttm != null and sttm != '' and entm != null and entm != '' ">
  537. and O.OBJ_INTM &gt;= TO_DATE(#{sttm}, 'YYYY-MM-DD') and O.OBJ_INTM &lt; TO_DATE(#{entm}, 'YYYY-MM-DD') +1
  538. </if>
  539. </where>
  540. GROUP BY A.NAME,O.OBJ_AD_CODE, O.PTYPE
  541. )
  542. SELECT
  543. ( 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,
  544. T.OBJ_NAME, T.OBJ_TYPE,
  545. SUM(OBJ_SIZE) OBJ_SIZE,
  546. SUM(PBLM_SIZE) PBLM_SIZE, SUM(SUBMIT_PLBM) SUBMIT_PLBM,SUM(INFO_PLBM) INFO_PLBM,
  547. 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
  548. FROM
  549. <choose>
  550. <when test='adGrad == "4" '>
  551. <!-- 县区 -->
  552. <choose>
  553. <when test=' adCode == "3501" '>
  554. <!-- 福建省 福州市 排除 平潭县 -->
  555. (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
  556. </when>
  557. <when test=' adCode == "3510" '>
  558. <!-- 福建省 平潭实验区-->
  559. (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
  560. </when>
  561. <otherwise>
  562. <!-- 除去福建省 的其他省份-->
  563. (select AD_CODE, AD_NAME, LGTD, LTTD from ATT_AD_BASE WHERE ad_grad= '4' and AD_CODE LIKE '${adCode}%') A
  564. </otherwise>
  565. </choose>
  566. </when>
  567. <otherwise>
  568. <choose>
  569. <when test=' adCode == "35" '>
  570. <!-- 福建省 增加省本级 -->
  571. (select AD_CODE, AD_NAME, LGTD, LTTD from ATT_AD_BASE WHERE ad_grad= '3' and AD_CODE LIKE '${adCode}%'
  572. UNION ALL
  573. select '350000000000' as AD_CODE , '省本级' as AD_NAME, LGTD, LTTD from ATT_AD_BASE where AD_CODE = '350100000000'
  574. )A
  575. </when>
  576. <when test=' adCode == "3500" '>
  577. <!-- 省本级 -->
  578. (
  579. select '350000000000' as AD_CODE , '省本级' as AD_NAME, LGTD, LTTD from ATT_AD_BASE where AD_CODE = '350100000000'
  580. )A
  581. </when>
  582. <otherwise>
  583. <!-- 除去福建省 的其他省份-->
  584. (select AD_CODE, AD_NAME, LGTD, LTTD from ATT_AD_BASE WHERE ad_grad= '3' and AD_CODE LIKE '${adCode}%') A
  585. </otherwise>
  586. </choose>
  587. </otherwise>
  588. </choose>
  589. LEFT JOIN (
  590. SELECT
  591. <choose>
  592. <when test='adGrad == "4" '>
  593. SUBSTR(AD_CODE, 0, 6) || '000000' AD_CODE,
  594. </when>
  595. <otherwise>
  596. SUBSTR(AD_CODE, 0, 4) || '00000000' AD_CODE,
  597. </otherwise>
  598. </choose>
  599. OBJ_NAME, OBJ_TYPE, OBJ_SIZE, PBLM_SIZE,SUBMIT_PLBM,INFO_PLBM, WARM_PLBM, ERROR_PLBM, ERRORS_PLBM,PBLM_LOG_SIZE,MEND_SIZE
  600. FROM o
  601. <where>
  602. <if test="adCode != null and adCode != ''">and o.AD_CODE LIKE '${adCode}%'</if>
  603. </where>
  604. ) T ON T.AD_CODE = A.AD_CODE
  605. <where>
  606. <if test="adCode != null and adCode != ''">and A.AD_CODE LIKE '${adCode}%'</if>
  607. <if test="adCode == '66'">and A.AD_CODE != '661100000000'</if> <!--为了去除首页三维地图没有十一师的坐标-->
  608. </where>
  609. GROUP BY A.AD_CODE, A.AD_NAME, A.LGTD, A.LTTD ,T.OBJ_NAME, T.OBJ_TYPE
  610. ORDER BY A.AD_CODE , TO_NUMBER(T.OBJ_TYPE)
  611. </select>
  612. <select id="findForCityObjTypeYearsCompare" resultMap="bisInspTaskDthDayResultMap" >
  613. 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
  614. FROM (
  615. 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
  616. from ( SELECT
  617. OTM ,COUNT( DISTINCT O.OBJ_ID ) OBJ_SIZE, OBJ_TYPE, OBJ_NAME
  618. FROM (
  619. SELECT
  620. A.NAME as OBJ_NAME,
  621. ( 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,
  622. O.PTYPE as OBJ_TYPE,
  623. O.OBJ_ID,
  624. (case when O.OBJ_INTM is null then TO_CHAR(P.COLL_TIME, 'YYYY') else TO_CHAR(O.OBJ_INTM, 'YYYY') end ) OTM,
  625. P.PBLM_ID,
  626. P.INSP_PBLM_CATE,
  627. P.DATA_STAT,
  628. P.STATE,
  629. PL.PBLM_ID PL_PBLM_ID,
  630. PL.PBLM_OUT PL_PBLM_OUT
  631. FROM BIS_INSP_ALL_OBJ O
  632. JOIN (select * FROM ATT_INSP_TYPE where code IN (select INSP_TYPE FROM REL_ORG_INSP_TYPE
  633. <where>
  634. <if test='orgId != null and orgId != "" '>
  635. AND ORG_ID = #{orgId}
  636. </if>
  637. </where>
  638. )) A ON A.PTYPE = O.PTYPE
  639. LEFT JOIN BIS_INSP_PBLM P ON P.OBJ_ID = O.OBJ_ID
  640. LEFT JOIN BIS_INSP_PBLM_PLIST Pl ON PL.PBLM_ID = P.PBLM_ID and PL.DATA_STAT='0'
  641. <where>
  642. <if test="objType != null and objType != ''">and O.PTYPE = #{objType}</if>
  643. <if test="orgId != null and orgId != ''">AND O.ID LIKE '___${orgId}%'</if>
  644. <if test="sttm != null and sttm != '' and entm != null and entm != '' ">
  645. and O.OBJ_INTM &gt;= TO_DATE(#{sttm}, 'YYYY-MM-DD') and O.OBJ_INTM &lt; TO_DATE(#{entm}, 'YYYY-MM-DD') +1
  646. </if>
  647. </where>
  648. ) O
  649. <where>
  650. <if test="adCode != null and adCode != ''">and AD_CODE LIKE '${adCode}%'</if>
  651. <if test='adCode == "66"'>and AD_CODE != '661100000000'</if> <!--为了去除首页三维地图没有十一师的坐标-->
  652. </where>
  653. GROUP BY OTM, OBJ_TYPE, OBJ_NAME
  654. ) O1
  655. LEFT JOIN
  656. ( SELECT
  657. OTM ,COUNT(DISTINCT case when O.PBLM_ID is not null then O.PBLM_ID end ) PBLM_SIZE,
  658. NVL( SUM( CASE WHEN O.STATE = '2' THEN 1 ELSE 0 END ), 0 ) SUBMIT_PLBM,
  659. NVL( SUM( CASE O.INSP_PBLM_CATE WHEN '0' THEN 1 ELSE 0 END ), 0 ) INFO_PLBM,
  660. NVL( SUM( CASE O.INSP_PBLM_CATE WHEN '1' THEN 1 ELSE 0 END ), 0 ) WARM_PLBM,
  661. NVL( SUM( CASE O.INSP_PBLM_CATE WHEN '2' THEN 1 ELSE 0 END ), 0 ) ERROR_PLBM,
  662. NVL( SUM( CASE O.INSP_PBLM_CATE WHEN '3' THEN 1 ELSE 0 END ), 0 ) ERRORS_PLBM,
  663. NVL( SUM( CASE O.PL_PBLM_OUT WHEN '1' THEN 1 ELSE 0 END ), 0 ) PBLM_LOG_SIZE,
  664. NVL( COUNT(DISTINCT CASE when O.PL_PBLM_ID is not null then O.PL_PBLM_ID end ), 0 ) MEND_SIZE
  665. , OBJ_TYPE, OBJ_NAME
  666. FROM (
  667. SELECT
  668. A.NAME as OBJ_NAME,
  669. <!-- 把福建省福州市下的平潭县 提到到平潭综合实验区 -->
  670. <!-- 把山东省莱芜市下的市辖区、莱芜区 归属到济南市莱芜区,钢城区 归属到济南市的钢城区, -->
  671. ( 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,
  672. O.PTYPE as OBJ_TYPE,
  673. O.OBJ_ID,
  674. (case when O.OBJ_INTM is null then TO_CHAR(P.COLL_TIME, 'YYYY') else TO_CHAR(O.OBJ_INTM, 'YYYY') end ) OTM,
  675. P.PBLM_ID,
  676. P.INSP_PBLM_CATE,
  677. P.DATA_STAT,
  678. P.STATE,
  679. PL.PBLM_ID PL_PBLM_ID,
  680. PL.PBLM_OUT PL_PBLM_OUT
  681. FROM BIS_INSP_ALL_OBJ O
  682. JOIN (select * FROM ATT_INSP_TYPE where code IN (select INSP_TYPE FROM REL_ORG_INSP_TYPE
  683. <where>
  684. <if test='orgId != null and orgId != "" '>
  685. AND ORG_ID = #{orgId}
  686. </if>
  687. </where>
  688. )) A ON A.PTYPE = O.PTYPE
  689. LEFT JOIN BIS_INSP_PBLM P ON P.OBJ_ID = O.OBJ_ID
  690. LEFT JOIN BIS_INSP_PBLM_PLIST Pl ON PL.PBLM_ID = P.PBLM_ID and PL.DATA_STAT='0'
  691. <where>
  692. <if test="objType != null and objType != ''">and O.PTYPE = #{objType}</if>
  693. <if test="orgId != null and orgId != ''">AND O.ID LIKE '___${orgId}%'</if>
  694. <if test="sttm != null and sttm != '' and entm != null and entm != '' ">
  695. and O.OBJ_INTM &gt;= TO_DATE(#{sttm}, 'YYYY-MM-DD') and O.OBJ_INTM &lt; TO_DATE(#{entm}, 'YYYY-MM-DD') +1
  696. </if>
  697. </where>
  698. ) O
  699. <where>
  700. <if test="adCode != null and adCode != ''">and AD_CODE LIKE '${adCode}%'</if>
  701. <if test='adCode == "66"'>and AD_CODE != '661100000000'</if> <!--为了去除首页三维地图没有十一师的坐标-->
  702. </where>
  703. GROUP BY OTM, OBJ_TYPE, OBJ_NAME
  704. ) O2 on O1.OTM = O2.OTM and O1.OBJ_TYPE = O2.OBJ_TYPE and O1.OBJ_NAME = O2.OBJ_NAME
  705. ) W
  706. </select>
  707. <select id="selectCurObjTypeList" resultType="cn.com.goldenwater.dcproj.model.BisInspTaskDthDay">
  708. SELECT
  709. AIT.NAME AS OBJ_NAME,
  710. O.PTYPE as OBJ_TYPE
  711. FROM
  712. BIS_INSP_ALL_OBJ O
  713. JOIN (select * FROM ATT_INSP_TYPE where code IN (select INSP_TYPE FROM REL_ORG_INSP_TYPE
  714. <where>
  715. <if test='orgId != null and orgId != "" '>
  716. AND ORG_ID = #{orgId}
  717. </if>
  718. </where>
  719. )) AIT ON AIT.PTYPE = O.PTYPE
  720. <where>
  721. <if test="objType != null and objType != ''">and O.PTYPE = #{objType}</if>
  722. <if test="orgId != null and orgId != ''">AND O.ID LIKE '___${orgId}%'</if>
  723. <if test="sttm != null and sttm != '' and entm != null and entm != '' ">
  724. and O.OBJ_INTM &gt;= TO_DATE(#{sttm}, 'YYYY-MM-DD') and O.OBJ_INTM &lt; TO_DATE(#{entm}, 'YYYY-MM-DD') +1
  725. </if>
  726. <if test="adCode != null and adCode != ''">and SUBSTR(O.OBJ_AD_CODE, 0, 2) = SUBSTR(#{adCode}, 0, 2) </if>
  727. </where>
  728. GROUP BY AIT.NAME, O.PTYPE
  729. ORDER BY TO_NUMBER(O.PTYPE)
  730. </select>
  731. </mapper>