BisInspAllObjDao.xml 66 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373
  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.BisInspAllObjDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspAllObj" id="bisInspAllObjResultMap">
  5. <result property="code" column="CODE"/>
  6. <result property="id" column="ID"/>
  7. <result property="nm" column="NM"/>
  8. <result property="provincial" column="PROVINCIAL"/>
  9. <result property="ptype" column="PTYPE"/>
  10. <result property="lgtd" column="LGTD"/>
  11. <result property="lttd" column="LTTD"/>
  12. <result property="objId" column="OBJ_ID"/>
  13. <result property="lgtdpc" column="LGTDPC"/>
  14. <result property="lttdpc" column="LTTDPC"/>
  15. <result property="orgId" column="ORG_ID"/>
  16. <result property="adCode" column="AD_CODE"/>
  17. <result property="objAdCode" column="OBJ_AD_CODE"/>
  18. </resultMap>
  19. <sql id="table_columns">
  20. CODE,
  21. ID,
  22. NM,
  23. PROVINCIAL,
  24. PTYPE,
  25. LGTD,
  26. LTTD,
  27. LGTDPC,
  28. LTTDPC,
  29. OBJ_ID,ORG_ID,AD_CODE,OBJ_AD_CODE
  30. </sql>
  31. <sql id="entity_properties">
  32. #{code},
  33. #{id},
  34. #{nm},
  35. #{provincial},
  36. #{ptype},
  37. #{lgtd},
  38. #{lttd},
  39. #{lgtdpc},
  40. #{lttdpc},
  41. #{objId},#{orgId},#{adCode},#{objAdCode}
  42. </sql>
  43. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  44. <sql id="page_where">
  45. <trim prefix="where" prefixOverrides="and | or ">
  46. <if test="id != null and id != ''">and ID = #{id}</if>
  47. <if test="nm != null and nm != ''">and NM = #{nm}</if>
  48. <if test="provincial != null and provincial != ''">and PROVINCIAL = #{provincial}</if>
  49. <if test="adCode != null and adCode != ''">and AD_CODE = #{adCode}</if>
  50. <if test="orgId != null and orgId != ''">and ORG_ID = #{orgId}</if>
  51. <if test="ptype != null and ptype != ''">and PTYPE = #{ptype}</if>
  52. <if test="lgtd != null and lgtd != ''">and LGTD = #{lgtd}</if>
  53. <if test="lttd != null and lttd != ''">and LTTD = #{lttd}</if>
  54. <if test="objId != null and objId != ''">and OBJ_ID = #{objId}</if>
  55. <if test="code != null and code != ''">and CODE = #{code}</if>
  56. <if test="lgtdpc != null and lgtdpc != ''">and LGTDPC = #{lgtdpc}</if>
  57. <if test="lttdpc != null and lttdpc != ''">and LTTDPC = #{lttdpc}</if>
  58. <if test="objAdCode != null and objAdCode != ''">and OBJ_AD_CODE = #{objAdCode}</if>
  59. </trim>
  60. </sql>
  61. <select id="get" resultMap="bisInspAllObjResultMap" parameterType="String">
  62. select
  63. <include refid="table_columns"/>
  64. from BIS_INSP_ALL_OBJ where obj_id = #{id}
  65. </select>
  66. <select id="getBy" resultMap="bisInspAllObjResultMap">
  67. select
  68. <include refid="table_columns"/>
  69. from BIS_INSP_ALL_OBJ
  70. <include refid="page_where"/>
  71. </select>
  72. <select id="findAll" resultMap="bisInspAllObjResultMap">
  73. select
  74. <include refid="table_columns"/>
  75. from BIS_INSP_ALL_OBJ
  76. </select>
  77. <select id="findList" resultMap="bisInspAllObjResultMap">
  78. select
  79. <include refid="table_columns"/>
  80. from BIS_INSP_ALL_OBJ
  81. <include refid="page_where"/>
  82. </select>
  83. <select id="selectCount" resultType="int">
  84. select count(ID) from BIS_INSP_ALL_OBJ
  85. <include refid="page_where"/>
  86. </select>
  87. <!--督查办-->
  88. <sql id="commonSql">
  89. <include refid="selSql"/>
  90. </sql>
  91. <sql id="commonChose">
  92. <include refid="commonSql"/>
  93. </sql>
  94. <!--督查问题-->
  95. <select id="findPblmByAdCode" resultType="cn.com.goldenwater.dcproj.model.BisInspPblm"
  96. parameterType="cn.com.goldenwater.dcproj.param.IndexParamPage">
  97. select w.nm,m.* from bis_insp_pblm m, (
  98. <include refid="commonChose"/>
  99. ) W where w.obj_id=m.obj_id and w.ad_code=#{adCode}
  100. <if test="startTime != null and startTime != ''">and w.obj_intm&gt;= TO_DATE(#{startTime},'YYYY-MM-DD')</if>
  101. <if test="endTime != null and endTime != ''">and w.obj_intm &lt; TO_DATE(#{endTime},'YYYY-MM-DD')+1</if>
  102. <if test="pTypes != null and pTypes != ''">
  103. and w.pType in (${pTypes})
  104. </if>
  105. <if test="orgIds != null and orgIds != ''">
  106. and substr(w.id,4,3) in (${orgIds})
  107. </if>
  108. </select>
  109. <sql id="selAdCode">
  110. <include refid="selSql"/>
  111. </sql>
  112. <!--查找督查对象-->
  113. <select id="findObjByAdCode" resultType="cn.com.goldenwater.dcproj.model.DuchaObj"
  114. parameterType="cn.com.goldenwater.dcproj.param.IndexParamPage">
  115. select * from (
  116. <include refid="selAdCode"/>
  117. ) W where w.ad_code=#{adCode}
  118. <if test="startTime != null and startTime != ''">and w.obj_intm&gt;= TO_DATE(#{startTime},'YYYY-MM-DD')</if>
  119. <if test="endTime != null and endTime != ''">and w.obj_intm &lt; TO_DATE(#{endTime},'YYYY-MM-DD')+1</if>
  120. <if test="pTypes != null and pTypes != ''">
  121. and w.pType in (${pTypes})
  122. </if>
  123. <if test="orgIds != null and orgIds != ''">
  124. and substr(w.id,4,3) in (${orgIds})
  125. </if>
  126. </select>
  127. <select id="findPerByAdCode" resultType="cn.com.goldenwater.dcproj.model.ObjPerson"
  128. parameterType="cn.com.goldenwater.dcproj.param.IndexParamPage">
  129. select D.ptype,e.name as
  130. name,D.id,p.pers_name,p.org_nm,p.org_id,p.dpnm,p.mobilenumb,p.dppost,p.guid,p.email,a.pnm from
  131. bis_insp_all_rlation l ,bis_insp_all_rlation_pers p,bis_insp_all a,(
  132. select distinct * from (
  133. select ptype, ID from (
  134. <include refid="commonChose"/>
  135. ) W where w.ad_code=#{adCode}
  136. <if test="startTime != null and startTime != ''">and w.obj_intm&gt;= TO_DATE(#{startTime},'YYYY-MM-DD')</if>
  137. <if test="endTime != null and endTime != ''">and w.obj_intm &lt; TO_DATE(#{endTime},'YYYY-MM-DD')+1</if>
  138. <if test="pTypes != null and pTypes != ''">
  139. and w.pType in (${pTypes})
  140. </if>
  141. <if test="orgIds != null and orgIds != ''">
  142. and substr(w.id,4,3) in (${orgIds})
  143. </if>
  144. ) S ) D,att_insp_type e where l.id=d.id and l.persid=p.guid and a.id=d.id and e.ptype=D.ptype
  145. </select>
  146. <select id="countGroupByAdCode" resultType="cn.com.goldenwater.dcproj.dto.ObjGroup"
  147. parameterType="cn.com.goldenwater.dcproj.param.IndexParamPage">
  148. select D.ptype,e.name as name,l.* from bis_insp_all l ,(
  149. select distinct * from (
  150. select ptype, ID from (
  151. <include refid="commonChose"/>
  152. ) W where w.ad_code=#{adCode}
  153. <if test="startTime != null and startTime != ''">and w.obj_intm&gt;= TO_DATE(#{startTime},'YYYY-MM-DD')</if>
  154. <if test="endTime != null and endTime != ''">and w.obj_intm &lt; TO_DATE(#{endTime},'YYYY-MM-DD')+1</if>
  155. <if test="pTypes != null and pTypes != ''">
  156. and w.pType in (${pTypes})
  157. </if>
  158. <if test="orgIds != null and orgIds != ''">
  159. and substr(w.id,4,3) in (${orgIds})
  160. </if>
  161. ) S ) D,att_insp_type e where l.id=d.id and e.ptype=D.ptype
  162. </select>
  163. <!--根据对象类型统计分组数量-->
  164. <select id="countGroup" resultType="cn.com.goldenwater.dcproj.dto.DcTypeDto"
  165. parameterType="cn.com.goldenwater.dcproj.param.IndexParam">
  166. select ss.total,f.name as name,ss.obj_type from (
  167. select count(w.obj_type) as total,w.obj_type from (
  168. select f.obj_type,f.pnm from (
  169. select
  170. ( case
  171. when t.sttm is null AND t.insp_year IS NOT NULL AND t.insp_mnth IS NOT NULL
  172. then to_date(t.insp_year ||'-'|| t.insp_mnth || '-01','yyyy-MM-dd')
  173. else t.sttm end ) as sttm,
  174. ( case when t.entm is null AND t.insp_year IS NOT NULL AND t.insp_mnth IS NOT NULL
  175. then to_date(t.insp_year ||'-'|| t.insp_mnth || '-01','yyyy-MM-dd')
  176. else t.entm end ) as entm,
  177. ltrim(substr(t.id,0,3),'0') as obj_type,
  178. t.pnm
  179. FROM (SELECT * FROM BIS_INSP_ALL WHERE LENGTH(ID) = 12) T
  180. WHERE 1 = 1
  181. <if test="orgIds != null and orgIds != ''">
  182. and substr(t.id,4,3) in (${orgIds})
  183. </if>
  184. <choose>
  185. <when test="province != null and province !=''">
  186. and t.PROVINCE = #{province}
  187. </when>
  188. <otherwise>
  189. and t.PROVINCE is null
  190. </otherwise>
  191. </choose>
  192. ) f where 1=1
  193. <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
  194. and ((f.sttm &gt;= to_date(#{startTime},'yyyy-MM-dd') and f.sttm &lt;= to_date(#{endTime},'yyyy-MM-dd'))
  195. or ( f.entm &gt;= to_date(#{startTime},'yyyy-MM-dd') and f.entm &lt;= to_date(#{endTime},'yyyy-MM-dd'))
  196. or( f.sttm &gt;= to_date(#{startTime},'yyyy-MM-dd') and f.entm &lt;= to_date(#{endTime}, 'yyyy-MM-dd'))
  197. or( f.sttm &lt;= to_date(#{startTime},'yyyy-MM-dd') and f.entm &gt;= to_date(#{endTime}, 'yyyy-MM-dd')))
  198. </if>
  199. <if test="startTime != null and endTime == null">
  200. and f.sttm &lt;= to_date(#{startTime},'yyyy-MM-dd')
  201. and f.entm &gt;= to_date(#{startTime},'yyyy-MM-dd')
  202. or f.sttm &gt;= to_date(#{startTime},'yyyy-MM-dd')
  203. </if>
  204. <if test="endTime != null and startTime == null">
  205. and f.sttm &gt;= to_date(#{endTime},'yyyy-MM-dd')
  206. and f.entm &lt;= to_date(#{endTime},'yyyy-MM-dd')
  207. or f.entm &lt;= to_date(#{endTime},'yyyy-MM-dd')
  208. </if>
  209. ) w where w.obj_type != '8'
  210. <if test="pTypes != null and pTypes != ''">
  211. and w.obj_type in (${pTypes})
  212. </if>
  213. group by w.obj_type)
  214. ss LEFT JOIN (
  215. select ltrim(t.code,'0') as code,t.name from ATT_INSP_TYPE t
  216. ) f on ss.obj_type = f.code order by to_number(ss.obj_type)
  217. </select>
  218. <!--根据对象类型统计督查人员-->
  219. <select id="countPerson" resultType="cn.com.goldenwater.dcproj.dto.DcTypeDto"
  220. parameterType="cn.com.goldenwater.dcproj.param.IndexParam">
  221. select ss.total,e.name as name,ss.obj_type from (
  222. select count(w.pType) as total,w.pType as obj_type from (
  223. select a.id, to_number(substr(a.id,0,3)) as ptype from bis_insp_all_rlation a where length(a.id)=12
  224. <choose>
  225. <when test="province != null and province !=''">
  226. and a.ad_code = #{province}
  227. </when>
  228. <otherwise>
  229. and a.ad_code is null
  230. </otherwise>
  231. </choose>
  232. and a.id in (
  233. select j.id from bis_insp_all_obj j where
  234. j.pType != '8'
  235. <if test="startTime != null and startTime != ''">and j.obj_intm &gt;= TO_DATE(#{startTime},'YYYY-MM-DD')</if>
  236. <if test="endTime != null and endTime != ''">and j.obj_intm &lt; TO_DATE(#{endTime},'YYYY-MM-DD')+1</if>
  237. <if test="pTypes != null and pTypes != ''">
  238. and j.pType in (${pTypes})
  239. </if>
  240. <if test="orgIds != null and orgIds != ''">
  241. and substr(j.id,4,3) in (${orgIds})
  242. </if>
  243. <choose>
  244. <when test="province != null and province !=''">
  245. and j.ad_code = #{province}
  246. </when>
  247. <otherwise>
  248. and j.ad_code is null
  249. </otherwise>
  250. </choose>
  251. )
  252. ) w group by w.pType ) ss,att_insp_type e where ss.obj_type=e.ptype and obj_type is not null order by
  253. ss.obj_type
  254. </select>
  255. <!--按省份统计督查人员-->
  256. <select id="countPersonByPro" resultType="cn.com.goldenwater.dcproj.dto.DcTypeDto"
  257. parameterType="cn.com.goldenwater.dcproj.param.IndexParam">
  258. select * from (
  259. select count(aa.ad_name) as total,aa.ad_name as name,aa.ad_code from (
  260. select distinct id,persid,ba.ad_name,ss.ad_code from (
  261. select a.persid,a.id,w.ad_code from bis_insp_all_rlation a left join (
  262. <include refid="commonChose"/>
  263. ) w on a.id=w.id where length(w.ad_code)=12
  264. <choose>
  265. <when test="province !=null and province !=''">
  266. and a.ad_code=#{province}
  267. </when>
  268. <otherwise>
  269. and a.ad_code is null
  270. </otherwise>
  271. </choose>
  272. <if test="startTime != null and startTime != ''">and w.obj_intm&gt;= TO_DATE(#{startTime},'YYYY-MM-DD')</if>
  273. <if test="endTime != null and endTime != ''">and w.obj_intm &lt; TO_DATE(#{endTime},'YYYY-MM-DD')+1</if>
  274. <if test="pTypes != null and pTypes != ''">
  275. and w.pType in (${pTypes})
  276. </if>
  277. <if test="orgIds != null and orgIds != ''">
  278. and substr(w.id,4,3) in (${orgIds})
  279. </if>
  280. ) ss,att_ad_x_base ba where ss.ad_code=ba.ad_code
  281. and ss.ad_code is not null) aa group by aa.ad_name,aa.ad_code ) p order by p.ad_code
  282. </select>
  283. <!--根据省份统计分组-->
  284. <select id="countGroupByPro" resultType="cn.com.goldenwater.dcproj.dto.DcTypeDto"
  285. parameterType="cn.com.goldenwater.dcproj.param.IndexParam">
  286. select
  287. ss.ad_Code,ba.ad_name as name,ss.total from (
  288. select c.adCode||'00000000' as ad_Code,c.total from (
  289. select count(w.adCode) as total,w.adCode from (
  290. select f.adCode,f.id from (
  291. select ( case when t.sttm is null AND t.insp_year IS NOT NULL AND t.insp_mnth IS NOT NULL then
  292. to_date(t.insp_year ||'-'|| t.insp_mnth || '-01','yyyy-MM-dd') else
  293. t.sttm end ) as sttm,
  294. ( case when t.entm is null AND t.insp_year IS NOT NULL AND t.insp_mnth IS NOT NULL then to_date(t.insp_year
  295. ||'-'|| t.insp_mnth || '-01','yyyy-MM-dd') else t.entm end )
  296. as entm,t.id,substr(a.ad_code,1,4) as adCode from bis_insp_all t left join BIS_INSP_SEL_AREA a on t.id = a.id
  297. where length (t.id) = 12 and a.ad_code is not null
  298. <if test="orgIds != null and orgIds != ''">
  299. and substr(t.id,4,3) in (${orgIds})
  300. </if>
  301. <if test="pTypes != null and pTypes != ''">
  302. and ltrim(substr(t.id,0,3),'0') in (${pTypes})
  303. </if>
  304. <choose>
  305. <when test="province != null and province !=''">
  306. and t.PROVINCE = #{province}
  307. </when>
  308. <otherwise>
  309. and t.PROVINCE is null
  310. </otherwise>
  311. </choose>
  312. ) f where 1=1
  313. <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
  314. and ((f.sttm &gt;= to_date(#{startTime},'yyyy-MM-dd') and f.sttm &lt;= to_date(#{endTime},'yyyy-MM-dd'))
  315. or ( f.entm &gt;= to_date(#{startTime},'yyyy-MM-dd') and f.entm &lt;= to_date(#{endTime},'yyyy-MM-dd'))
  316. or( f.sttm &gt;= to_date(#{startTime},'yyyy-MM-dd') and f.entm &lt;= to_date(#{endTime}, 'yyyy-MM-dd'))
  317. or( f.sttm &lt;= to_date(#{startTime},'yyyy-MM-dd') and f.entm &gt;= to_date(#{endTime}, 'yyyy-MM-dd')))
  318. </if>
  319. <if test="startTime != null and endTime == null">
  320. and f.sttm &lt;= to_date(#{startTime},'yyyy-MM-dd')
  321. and f.entm &gt;= to_date(#{startTime},'yyyy-MM-dd')
  322. or f.sttm &gt;= to_date(#{startTime},'yyyy-MM-dd')
  323. </if>
  324. <if test="endTime != null and startTime == null">
  325. and f.sttm &gt;= to_date(#{endTime},'yyyy-MM-dd')
  326. and f.entm &lt;= to_date(#{endTime},'yyyy-MM-dd')
  327. or f.entm &lt;= to_date(#{endTime},'yyyy-MM-dd')
  328. </if>
  329. ) w group by w.adCode) c
  330. ) ss left join att_ad_x_base ba on ss.ad_Code=ba.ad_code and ba.ad_grad = '3'
  331. </select>
  332. <!--根据省统计问题分类-->
  333. <select id="countPblmbyPro" resultType="cn.com.goldenwater.dcproj.dto.DcPblmDto"
  334. parameterType="cn.com.goldenwater.dcproj.param.IndexParam">
  335. select ss.*,ba.ad_name as name from (
  336. select count(m.insp_pblm_cate) as total,m.insp_pblm_cate,w.ad_code from (select * from bis_insp_pblm p where 1=1
  337. <if test="pTypes != null and pTypes != ''">
  338. and p.obj_type in (${pTypes})
  339. </if>
  340. ) m left join (
  341. <include refid="commonChose"/>
  342. ) w on m.obj_id=w.obj_id and length(w.ad_code)=12
  343. <if test="startTime != null and startTime != ''">and m.coll_time&gt;= TO_DATE(#{startTime},'YYYY-MM-DD')</if>
  344. <if test="endTime != null and endTime != ''">and m.coll_time &lt; TO_DATE(#{endTime},'YYYY-MM-DD')+1</if>
  345. <if test="orgIds != null and orgIds != ''">
  346. and substr(w.id,4,3) in (${orgIds})
  347. </if>
  348. group by m.insp_pblm_cate,w.ad_code
  349. ) ss ,att_ad_x_base ba where ss.ad_code=ba.ad_code order by ss.ad_code
  350. </select>
  351. <sql id="selPlan">
  352. select to_char(substr(e.adm_div,0,${length})||'${otherLength}') as ad_code,o.ptype,o.id,o.obj_id,r.uptm as
  353. obj_intm,o.nm,r.hyst_site as ad_name
  354. from bis_insp_all_obj o inner join bis_insp_rsvr_rgstr r on o.obj_id=r.obj_id left join att_rs_base e on
  355. o.code=e.rs_code where o.ptype in (1,36) and r.state='2'
  356. <include refid="choseSql"/>
  357. union all
  358. select substr(o.code,0,${length})||'${otherLength}' as ad_code,o.ptype,o.id,o.obj_id,r.uptm as
  359. obj_intm,o.nm,b.ad_full_name as ad_name from bis_insp_all_obj o
  360. ,BIS_INSP_VILL_RGSTR r,att_ad_x_base b where r.obj_id = o.obj_id and o.code=b.ad_code and r.state = '2' and
  361. o.ptype=2
  362. <include refid="choseSql"/>
  363. union all
  364. select substr(ob.loc_ad,0,${length})||'${otherLength}' as ad_code,o.ptype,o.id,o.obj_id,t.uptm as
  365. obj_intm,o.nm,t.loac as ad_name from bis_insp_all_obj o
  366. inner join bis_insp_wtdst_track t on o.obj_id=t.obj_id left join BIS_INSP_WTDST OB ON o.CODE = OB.WTDST_ID where
  367. o.ptype=3 and t.state='2'
  368. <include refid="choseSql"/>
  369. union all
  370. select substr(ke.ad_code,0,${length})||'${otherLength}' as ad_code,o.ptype,o.id,o.obj_id,t.uptm as
  371. obj_intm,o.nm,t.nm as ad_name
  372. from bis_insp_all_obj o inner join bis_insp_key_register t on o.obj_id=t.obj_id left join ATT_EMPWTPRJ_BASE ke
  373. ON o.code = ke.id
  374. where o.ptype in (4,7) and t.state='2'
  375. <include refid="choseSql"/>
  376. union all
  377. select substr(ob.adcd,0,${length})||'${otherLength}' as ad_code,o.ptype,o.id,o.obj_id,w.uptm as
  378. obj_intm,o.nm,ob.stlc as ad_name from bis_insp_all_obj o
  379. inner join BIS_INSP_GRW w on o.obj_id=w.obj_id left join ATT_GRW_BASE OB ON o.CODE = OB.stcd where o.ptype=5 and
  380. w.insp_state='2'
  381. <include refid="choseSql"/>
  382. union all
  383. select substr(ob.ad_code,0,${length})||'${otherLength}' as ad_code,o.ptype,o.id,o.obj_id,g.uptm as
  384. obj_intm,o.nm,ob.location_xiang as ad_name from bis_insp_all_obj o
  385. inner join att_waga_rgstr g on o.obj_id=g.obj_id left join ATT_WAGA_BASE OB ON o.CODE = OB.obj_code where
  386. o.ptype=6 and g.state='2'
  387. <include refid="choseSql"/>
  388. union all
  389. select substr(ob.ad_code,0,${length})||'${otherLength}' as
  390. ad_code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,ob.location as ad_name from bis_insp_all_obj o
  391. inner join bis_insp_fsc_rgstr g on o.obj_id=g.obj_id left join att_fsc_base OB ON o.CODE = OB.id where o.ptype=9
  392. and g.state='2'
  393. <include refid="choseSql"/>
  394. union all
  395. select substr(ob.ad_code,0,${length})||'${otherLength}' as
  396. ad_code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,ob.location as ad_name from bis_insp_all_obj o
  397. inner join bis_insp_other_rgstr g on o.obj_id=g.obj_id left join att_other_base OB ON o.CODE = OB.id where
  398. o.ptype=10 and g.state='2'
  399. <include refid="choseSql"/>
  400. union all
  401. select substr(ob.ad_code,0,${length})||'${otherLength}' as ad_code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.note
  402. as ad_name from bis_insp_all_obj o
  403. inner join bis_insp_sd_rgstr g on o.obj_id=g.obj_id left join att_sd_base OB ON o.CODE = OB.SD_CODE where
  404. o.ptype=11 and g.state='2'
  405. <include refid="choseSql"/>
  406. union all
  407. select substr(ob.ad_code,0,${length})||'${otherLength}' as
  408. ad_code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.WINT_POS as ad_name from bis_insp_all_obj o
  409. inner join bis_insp_wiu_rgstr g on o.obj_id=g.obj_id left join att_wain_base OB ON o.CODE = OB.OBJ_CODE where
  410. o.ptype=12 and g.state='2'
  411. <include refid="choseSql"/>
  412. union all
  413. select substr(ob.ad_code,0,${length})||'${otherLength}' as
  414. ad_code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.SWHS_LOC as ad_name from bis_insp_all_obj o
  415. inner join BIS_INSP_SWHS_RGSTR g on o.obj_id=g.obj_id left join ATT_SWHS_BASE OB ON o.CODE = OB.id where
  416. o.ptype=13 and g.state='2'
  417. <include refid="choseSql"/>
  418. union all
  419. select substr(ob.ad_code,0,${length})||'${otherLength}' as
  420. ad_code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.AD_FULL_NAME as ad_name from bis_insp_all_obj o
  421. inner join bis_insp_wint_rgstr g on o.obj_id=g.obj_id left join ATT_AD_X_BASE OB ON o.CODE = OB.AD_CODE where
  422. o.ptype=14 and g.state='2'
  423. <include refid="choseSql"/>
  424. union all
  425. select substr(ob.ad_code,0,${length})||'${otherLength}' as
  426. ad_code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.AD_FULL_NAME as ad_name from bis_insp_all_obj o
  427. inner join bis_insp_svwt_area_rgstr g on o.obj_id=g.obj_id left join ATT_AD_X_BASE OB ON o.CODE = OB.AD_CODE
  428. where o.ptype=15 and g.state='2'
  429. <include refid="choseSql"/>
  430. union all
  431. select substr(ob.ad_code,0,${length})||'${otherLength}' as
  432. ad_code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.ad_name from bis_insp_all_obj o
  433. inner join bis_insp_svwt_wunt_rgstr g on o.obj_id=g.obj_id left join att_wunt_base OB ON o.CODE = OB.ID where
  434. o.ptype=16 and g.state='2'
  435. <include refid="choseSql"/>
  436. union all
  437. select substr(ob.ad_code,0,${length})||'${otherLength}' as
  438. ad_code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.ad_name from bis_insp_all_obj o
  439. inner join BIS_INSP_OPRD_CSTR_PROJ_RGSTR g on o.obj_id=g.obj_id left join ATT_PRD_CSTR_PROJ_BASE OB ON o.CODE =
  440. OB.ID where o.ptype=17 and g.state='2'
  441. <include refid="choseSql"/>
  442. union all
  443. select substr(ob.ad_code,0,${length})||'${otherLength}' as
  444. ad_code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.ad_name from bis_insp_all_obj o
  445. inner join ATT_JSKEJIAN_FLKDIS_RGSTR g on o.obj_id=g.obj_id left join ATT_JSKEJIAN_FLKDIS_BASE OB ON o.CODE =
  446. OB.ID where o.ptype=18 and g.state='2'
  447. <include refid="choseSql"/>
  448. union all
  449. select substr(ob.ad_code,0,${length})||'${otherLength}' as
  450. ad_code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.ad_name from bis_insp_all_obj o
  451. inner join ATT_JSKEJIAN_WATER_RGSTR g on o.obj_id=g.obj_id left join ATT_JSKEJIAN_WATER_BASE OB ON o.CODE =
  452. OB.ID where o.ptype=19 and g.state='2'
  453. <include refid="choseSql"/>
  454. union all
  455. select substr(ob.ad_code,0,${length})||'${otherLength}' as
  456. ad_code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.ad_name from bis_insp_all_obj o
  457. inner join ATT_JSKEJIAN_ECOFRD_RGSTR g on o.obj_id=g.obj_id left join ATT_JSKEJIAN_ECOFRD_BASE OB ON o.CODE =
  458. OB.ID where o.ptype=20 and g.state='2'
  459. <include refid="choseSql"/>
  460. union all
  461. select to_char(substr(e.adm_div,0,${length})||'${otherLength}') as ad_code,o.ptype,o.id,o.obj_id,r.uptm as
  462. obj_intm,o.nm,r.hyst_site as ad_name
  463. from bis_insp_all_obj o inner join bis_insp_RSML_rgstr r on o.obj_id=r.obj_id left join att_rs_base e on
  464. o.code=e.rs_code where o.ptype = 22 and r.state='2'
  465. <include refid="choseSql"/>
  466. </sql>
  467. <!--根据省统计督查对象个数-->
  468. <select id="countPlanByPro" resultType="cn.com.goldenwater.dcproj.dto.DcTypeDto"
  469. parameterType="cn.com.goldenwater.dcproj.param.IndexParam">
  470. select c.total,c.ad_name as name,c.ad_code from (
  471. select count(ba.ad_name) as total,ba.ad_name,ba.ad_code from (
  472. <include refid="selPlan"/>
  473. ) w,att_ad_x_base ba where w.ad_code=ba.ad_code and length(w.ad_code)=12
  474. <if test="startTime != null and startTime != ''">and w.obj_intm&gt;= TO_DATE(#{startTime},'YYYY-MM-DD')</if>
  475. <if test="endTime != null and endTime != ''">and w.obj_intm &lt; TO_DATE(#{endTime},'YYYY-MM-DD')+1</if>
  476. <if test="pTypes != null and pTypes != ''">
  477. and w.pType in (${pTypes})
  478. </if>
  479. <if test="orgIds != null and orgIds != ''">
  480. and substr(w.id,4,3) in (${orgIds})
  481. </if>
  482. group by ba.ad_name,ba.ad_code ) c order by c.ad_code
  483. </select>
  484. <!--根据对象类型按按照分类统计-->
  485. <select id="countPblmByObjType" resultType="cn.com.goldenwater.dcproj.dto.DcPblmDto"
  486. parameterType="cn.com.goldenwater.dcproj.param.IndexParam">
  487. select w.total,(case when w.insp_pblm_cate ='0' then '一般' when w.insp_pblm_cate ='1' then '较重'
  488. when w.insp_pblm_cate ='2' then '严重' when w.insp_pblm_cate ='3' then '特别严重' else '' end ) as name,
  489. w.insp_pblm_cate from (
  490. select count(m.insp_pblm_cate) as total,m.insp_pblm_cate from bis_insp_pblm m
  491. left join bis_insp_all_obj j on m.obj_id=j.obj_id
  492. left join (select * from bis_insp_org where 1=1
  493. <if test="orgIds != null and orgIds != ''">
  494. and id in (${orgIds})
  495. </if>
  496. ) g on substr(j.id,4,3)=g.org_id
  497. <if test="pTypes != null and pTypes != ''">
  498. and m.obj_type=#{pTypes}
  499. </if>
  500. <choose>
  501. <when test="province != null and province !=''">
  502. and j.ad_code = '${province}'
  503. </when>
  504. <otherwise>
  505. and j.ad_code is null
  506. </otherwise>
  507. </choose>
  508. <if test="startTime != null and startTime != ''">and m.coll_time &gt;= TO_DATE(#{startTime},'YYYY-MM-DD')</if>
  509. <if test="endTime != null and endTime != ''">and m.coll_time &lt; TO_DATE(#{endTime},'YYYY-MM-DD')+1</if>
  510. group by m.insp_pblm_cate
  511. ) w order by w.insp_pblm_cate
  512. </select>
  513. <!--根据时间,机构,类型统计问题个数-->
  514. <select id="countPblmbyParam" resultType="cn.com.goldenwater.dcproj.dto.DcTypeDto"
  515. parameterType="cn.com.goldenwater.dcproj.param.IndexParam">
  516. select ss.total,e.name as name,ss.obj_type from (
  517. select count(m.obj_type) as total ,m.obj_type as obj_type from bis_insp_pblm m
  518. left join bis_insp_all_obj j on m.obj_id=j.obj_id
  519. left join (select * from bis_insp_org where 1=1
  520. <if test="orgIds != null and orgIds != ''">
  521. and id in (${orgIds})
  522. </if>
  523. ) g on substr(j.id,4,3)=g.org_id
  524. <if test="pTypes != null and pTypes != ''">
  525. and m.obj_type in (${pTypes})
  526. </if>
  527. <choose>
  528. <when test="province != null and province !=''">
  529. and j.ad_code = '${province}'
  530. </when>
  531. <otherwise>
  532. and j.ad_code is null
  533. </otherwise>
  534. </choose>
  535. <if test="startTime != null and startTime != ''">and m.coll_time &gt;= TO_DATE(#{startTime},'YYYY-MM-DD')</if>
  536. <if test="endTime != null and endTime != ''">and m.coll_time &lt; TO_DATE(#{endTime},'YYYY-MM-DD')+1</if>
  537. group by m.obj_type
  538. ) ss,att_insp_type e where ss.obj_type=e.ptype order by ss.obj_type
  539. </select>
  540. <!--根据时间,机构,类型统计督查对象个数-->
  541. <select id="countObjbyParam" resultType="cn.com.goldenwater.dcproj.dto.DcTypeDto"
  542. parameterType="cn.com.goldenwater.dcproj.param.IndexParam">
  543. select ss.total,e.name as name,ss.obj_type from (
  544. select
  545. count(j.ptype) as total ,j.ptype as obj_type
  546. from bis_insp_all_obj j,bis_insp_org g
  547. where substr(j.id,4,3)=g.org_id
  548. <if test="orgIds != null and orgIds != ''">
  549. and g.org_id in (${orgIds})
  550. </if>
  551. <if test="pTypes != null and pTypes != ''">
  552. and j.ptype in (${pTypes})
  553. </if>
  554. <choose>
  555. <when test="province != null and province !=''">
  556. and j.ad_code = '${province}'
  557. </when>
  558. <otherwise>
  559. and j.ad_code is null
  560. </otherwise>
  561. </choose>
  562. <if test="startTime != null and startTime != ''">and j.obj_intm&gt;= TO_DATE(#{startTime},'YYYY-MM-DD')</if>
  563. <if test="endTime != null and endTime != ''">and j.obj_intm &lt; TO_DATE(#{endTime},'YYYY-MM-DD')+1</if>
  564. group by j.ptype
  565. ) ss,att_insp_type e where ss.obj_type=e.ptype order by ss.obj_type
  566. </select>
  567. <!--根据类型统计督查个数-->
  568. <select id="countObjByType" resultType="cn.com.goldenwater.dcproj.dto.DcTypeDto"
  569. parameterType="cn.com.goldenwater.dcproj.param.IndexParam">
  570. select ss.total,e.name as name,ss.obj_type from (
  571. select count(j.ptype) as total,j.ptype as obj_type from bis_insp_all_obj j
  572. where 1=1
  573. <if test="orgIds != null and orgIds != ''">
  574. and substr(j.id,4,3) in (${orgIds})
  575. </if>
  576. <choose>
  577. <when test="province != null and province !=''">
  578. and j.ad_code = '${province}'
  579. </when>
  580. <otherwise>
  581. and j.ad_code is null
  582. </otherwise>
  583. </choose>
  584. group by j.ptype
  585. ) ss,att_insp_type e where ss.obj_type=e.ptype order by ss.obj_type
  586. </select>
  587. <!--根据机构统计督查个数-->
  588. <select id="countObjByOrg" resultType="cn.com.goldenwater.dcproj.dto.DcTypeDto"
  589. parameterType="cn.com.goldenwater.dcproj.param.IndexParam">
  590. select count(w.org_nm) as total,w.org_nm as name from (
  591. select o.org_nm,b.ptype,o.org_id from bis_insp_org o,bis_insp_all_obj b where o.org_id=substr(b.id,4,3)
  592. <if test="orgIds != null and orgIds != ''">
  593. and o.id in (${orgIds})
  594. </if>
  595. <if test="pTypes != null and pTypes != ''">
  596. and b.ptype in (${pTypes})
  597. </if>
  598. <choose>
  599. <when test="province != null and province !=''">
  600. and b.ad_code = '${province}'
  601. </when>
  602. <otherwise>
  603. and b.ad_code is null
  604. </otherwise>
  605. </choose>
  606. order by o.org_id
  607. ) w group by w.org_nm
  608. </select>
  609. <!--根据类型获取督查问题统计-->
  610. <select id="countPblmByType" resultType="cn.com.goldenwater.dcproj.dto.DcTypeDto"
  611. parameterType="cn.com.goldenwater.dcproj.param.IndexParam">
  612. select ss.total,e.name as name,ss.obj_type from (
  613. select count(p.obj_type) as total,p.obj_type from bis_insp_all_obj o ,bis_insp_pblm p where o.obj_id=p.obj_id
  614. <if test="startTime != null and startTime != ''">and p.coll_time &gt;= TO_DATE(#{startTime},'YYYY-MM-DD')</if>
  615. <if test="endTime != null and endTime != ''">and p.coll_time &lt; TO_DATE(#{endTime},'YYYY-MM-DD')+1</if>
  616. <if test="orgIds != null and orgIds != ''">
  617. and substr(o.id,4,3) in (${orgIds})
  618. </if>
  619. <if test="pTypes != null and pTypes != ''">
  620. and o.ptype in (${pTypes})
  621. </if>
  622. <include refid="choseSql"/>
  623. group by p.obj_type
  624. ) ss,att_insp_type e where ss.obj_type=e.ptype order by ss.obj_type
  625. </select>
  626. <sql id="choseSql">
  627. <choose>
  628. <when test="province != null and province !=''">
  629. and o.ad_code = '${province}'
  630. </when>
  631. <otherwise>
  632. and o.ad_code is null
  633. </otherwise>
  634. </choose>
  635. </sql>
  636. <!--督查对象(已督查)统计-->
  637. <select id="countDcByType" resultType="cn.com.goldenwater.dcproj.dto.DcTypeDto"
  638. parameterType="cn.com.goldenwater.dcproj.param.IndexParam">
  639. select e.ptype as objType,e.name as name,count(o.id) as total from bis_insp_all_obj o,
  640. bis_insp_rsvr_rgstr r,att_insp_type e
  641. where o.obj_id=r.obj_id and o.ptype=e.ptype and o.ptype in (1,36) and r.state='2'
  642. <if test="startTime != null and startTime != ''">and r.intm &gt;= TO_DATE(#{startTime},'YYYY-MM-DD')</if>
  643. <if test="endTime != null and endTime != ''">and r.intm &lt; TO_DATE(#{endTime},'YYYY-MM-DD')+1</if>
  644. <if test="orgIds != null and orgIds != ''">
  645. and substr(o.id,4,3) in (${orgIds})
  646. </if>
  647. <if test="pTypes != null and pTypes != ''">
  648. and o.ptype in (${pTypes})
  649. </if>
  650. <include refid="choseSql"/>
  651. group by e.name,e.ptype
  652. union all
  653. select e.ptype as objType,e.name as name,count(o.id) as total from bis_insp_all_obj o,BIS_INSP_VILL_RGSTR
  654. v,att_insp_type e
  655. where o.obj_id=v.obj_id and o.ptype=e.ptype and v.state='2'
  656. <if test="startTime != null and startTime != ''">and v.uptm &gt;= TO_DATE(#{startTime},'YYYY-MM-DD')</if>
  657. <if test="endTime != null and endTime != ''">and v.uptm &lt; TO_DATE(#{endTime},'YYYY-MM-DD')+1</if>
  658. <if test="orgIds != null and orgIds != ''">
  659. and substr(o.id,4,3) in (${orgIds})
  660. </if>
  661. <if test="pTypes != null and pTypes != ''">
  662. and o.ptype in (${pTypes})
  663. </if>
  664. <include refid="choseSql"/>
  665. group by e.name,e.ptype
  666. union all
  667. select e.ptype as objType,e.name as name,count(o.id) as total from bis_insp_all_obj o,bis_insp_wtdst_track
  668. t,att_insp_type e
  669. where o.obj_id=t.obj_id and o.ptype=e.ptype and t.state='2'
  670. <if test="startTime != null and startTime != ''">and t.uptm &gt;= TO_DATE(#{startTime},'YYYY-MM-DD')</if>
  671. <if test="endTime != null and endTime != ''">and t.uptm &lt; TO_DATE(#{endTime},'YYYY-MM-DD')+1</if>
  672. <if test="orgIds != null and orgIds != ''">
  673. and substr(o.id,4,3) in (${orgIds})
  674. </if>
  675. <if test="pTypes != null and pTypes != ''">
  676. and o.ptype in (${pTypes})
  677. </if>
  678. <include refid="choseSql"/>
  679. group by e.name,e.ptype
  680. union all
  681. select e.ptype as objType,e.name as name,count(o.id) as total from bis_insp_all_obj o,bis_insp_key_register t
  682. ,att_insp_type e
  683. where o.obj_id=t.obj_id and o.ptype=e.ptype and t.state='2' and o.ptype in (4,7)
  684. <if test="startTime != null and startTime != ''">and t.uptm &gt;= TO_DATE(#{startTime},'YYYY-MM-DD')</if>
  685. <if test="endTime != null and endTime != ''">and t.uptm &lt; TO_DATE(#{endTime},'YYYY-MM-DD')+1</if>
  686. <if test="orgIds != null and orgIds != ''">
  687. and substr(o.id,4,3) in (${orgIds})
  688. </if>
  689. <if test="pTypes != null and pTypes != ''">
  690. and o.ptype in (${pTypes})
  691. </if>
  692. <include refid="choseSql"/>
  693. group by e.name,e.ptype
  694. union all
  695. select e.ptype as objType,e.name as name,count(o.id) as total from bis_insp_all_obj o,BIS_INSP_GRW
  696. w,att_insp_type e
  697. where o.obj_id=w.obj_id and o.ptype=e.ptype and w.insp_state='2'
  698. <if test="startTime != null and startTime != ''">and w.uptm &gt;= TO_DATE(#{startTime},'YYYY-MM-DD')</if>
  699. <if test="endTime != null and endTime != ''">and w.uptm &lt; TO_DATE(#{endTime},'YYYY-MM-DD')+1</if>
  700. <if test="orgIds != null and orgIds != ''">
  701. and substr(o.id,4,3) in (${orgIds})
  702. </if>
  703. <if test="pTypes != null and pTypes != ''">
  704. and o.ptype in (${pTypes})
  705. </if>
  706. <include refid="choseSql"/>
  707. group by e.name,e.ptype
  708. union all
  709. select e.ptype as objType,e.name as name,count(o.id) as total from bis_insp_all_obj o,att_waga_rgstr
  710. g,att_insp_type e
  711. where o.obj_id=g.obj_id and o.ptype=e.ptype and g.state='2'
  712. <if test="startTime != null and startTime != ''">and g.uptm &gt;= TO_DATE(#{startTime},'YYYY-MM-DD')</if>
  713. <if test="endTime != null and endTime != ''">and g.uptm &lt; TO_DATE(#{endTime},'YYYY-MM-DD')+1</if>
  714. <if test="orgIds != null and orgIds != ''">
  715. and substr(o.id,4,3) in (${orgIds})
  716. </if>
  717. <if test="pTypes != null and pTypes != ''">
  718. and o.ptype in (${pTypes})
  719. </if>
  720. <include refid="choseSql"/>
  721. group by e.name,e.ptype
  722. union all
  723. select e.ptype as objType,e.name as name,count(o.id) as total from bis_insp_all_obj o,bis_insp_fsc_rgstr
  724. g,att_insp_type e
  725. where o.obj_id=g.obj_id and o.ptype=e.ptype and g.state='2'
  726. <if test="startTime != null and startTime != ''">and g.up_tm &gt;= TO_DATE(#{startTime},'YYYY-MM-DD')</if>
  727. <if test="endTime != null and endTime != ''">and g.up_tm &lt; TO_DATE(#{endTime},'YYYY-MM-DD')+1</if>
  728. <if test="orgIds != null and orgIds != ''">
  729. and substr(o.id,4,3) in (${orgIds})
  730. </if>
  731. <if test="pTypes != null and pTypes != ''">
  732. and o.ptype in (${pTypes})
  733. </if>
  734. <include refid="choseSql"/>
  735. group by e.name,e.ptype
  736. union all
  737. select e.ptype as objType,e.name as name,count(o.id) as total from bis_insp_all_obj o,bis_insp_other_rgstr g
  738. ,att_insp_type e
  739. where o.obj_id=g.obj_id and o.ptype=e.ptype and g.state='2'
  740. <if test="startTime != null and startTime != ''">and g.up_tm &gt;= TO_DATE(#{startTime},'YYYY-MM-DD')</if>
  741. <if test="endTime != null and endTime != ''">and g.up_tm &lt; TO_DATE(#{endTime},'YYYY-MM-DD')+1</if>
  742. <if test="orgIds != null and orgIds != ''">
  743. and substr(o.id,4,3) in (${orgIds})
  744. </if>
  745. <if test="pTypes != null and pTypes != ''">
  746. and o.ptype in (${pTypes})
  747. </if>
  748. <include refid="choseSql"/>
  749. group by e.name,e.ptype
  750. union all
  751. select e.ptype as objType,e.name as name,count(o.id) as total from bis_insp_all_obj o,bis_insp_sd_rgstr g
  752. ,att_insp_type e
  753. where o.obj_id=g.obj_id and o.ptype=e.ptype and g.state='2'
  754. <if test="startTime != null and startTime != ''">and g.up_tm &gt;= TO_DATE(#{startTime},'YYYY-MM-DD')</if>
  755. <if test="endTime != null and endTime != ''">and g.up_tm &lt; TO_DATE(#{endTime},'YYYY-MM-DD')+1</if>
  756. <if test="orgIds != null and orgIds != ''">
  757. and substr(o.id,4,3) in (${orgIds})
  758. </if>
  759. <if test="pTypes != null and pTypes != ''">
  760. and o.ptype in (${pTypes})
  761. </if>
  762. <include refid="choseSql"/>
  763. group by e.name,e.ptype
  764. union all
  765. select e.ptype as objType,e.name as name,count(o.id) as total from bis_insp_all_obj o,bis_insp_wiu_rgstr g
  766. ,att_insp_type e
  767. where o.obj_id=g.obj_id and o.ptype=e.ptype and g.state='2'
  768. <if test="startTime != null and startTime != ''">and g.up_tm &gt;= TO_DATE(#{startTime},'YYYY-MM-DD')</if>
  769. <if test="endTime != null and endTime != ''">and g.up_tm &lt; TO_DATE(#{endTime},'YYYY-MM-DD')+1</if>
  770. <if test="orgIds != null and orgIds != ''">
  771. and substr(o.id,4,3) in (${orgIds})
  772. </if>
  773. <if test="pTypes != null and pTypes != ''">
  774. and o.ptype in (${pTypes})
  775. </if>
  776. <include refid="choseSql"/>
  777. group by e.name,e.ptype
  778. union all
  779. select e.ptype as objType,e.name as name,count(o.id) as total from bis_insp_all_obj o,bis_insp_swhs_rgstr g
  780. ,att_insp_type e
  781. where o.obj_id=g.obj_id and o.ptype=e.ptype and g.state='2'
  782. <if test="startTime != null and startTime != ''">and g.up_tm &gt;= TO_DATE(#{startTime},'YYYY-MM-DD')</if>
  783. <if test="endTime != null and endTime != ''">and g.up_tm &lt; TO_DATE(#{endTime},'YYYY-MM-DD')+1</if>
  784. <if test="orgIds != null and orgIds != ''">
  785. and substr(o.id,4,3) in (${orgIds})
  786. </if>
  787. <if test="pTypes != null and pTypes != ''">
  788. and o.ptype in (${pTypes})
  789. </if>
  790. <include refid="choseSql"/>
  791. group by e.name,e.ptype
  792. union all
  793. select e.ptype as objType,e.name as name,count(o.id) as total from bis_insp_all_obj o,bis_insp_wint_rgstr g
  794. ,att_insp_type e
  795. where o.obj_id=g.obj_id and o.ptype=e.ptype and g.state='2'
  796. <if test="startTime != null and startTime != ''">and g.up_tm &gt;= TO_DATE(#{startTime},'YYYY-MM-DD')</if>
  797. <if test="endTime != null and endTime != ''">and g.up_tm &lt; TO_DATE(#{endTime},'YYYY-MM-DD')+1</if>
  798. <if test="orgIds != null and orgIds != ''">
  799. and substr(o.id,4,3) in (${orgIds})
  800. </if>
  801. <if test="pTypes != null and pTypes != ''">
  802. and o.ptype in (${pTypes})
  803. </if>
  804. <include refid="choseSql"/>
  805. group by e.name,e.ptype
  806. union all
  807. select e.ptype as objType,e.name as name,count(o.id) as total from bis_insp_all_obj o,bis_insp_svwt_area_rgstr g
  808. ,att_insp_type e
  809. where o.obj_id=g.obj_id and o.ptype=e.ptype and g.state='2'
  810. <if test="startTime != null and startTime != ''">and g.up_tm &gt;= TO_DATE(#{startTime},'YYYY-MM-DD')</if>
  811. <if test="endTime != null and endTime != ''">and g.up_tm &lt; TO_DATE(#{endTime},'YYYY-MM-DD')+1</if>
  812. <if test="orgIds != null and orgIds != ''">
  813. and substr(o.id,4,3) in (${orgIds})
  814. </if>
  815. <if test="pTypes != null and pTypes != ''">
  816. and o.ptype in (${pTypes})
  817. </if>
  818. <include refid="choseSql"/>
  819. group by e.name,e.ptype
  820. union all
  821. select e.ptype as objType,e.name as name,count(o.id) as total from bis_insp_all_obj o,bis_insp_svwt_wunt_rgstr
  822. g,att_insp_type e
  823. where o.obj_id=g.obj_id and o.ptype=e.ptype and g.state='2'
  824. <if test="startTime != null and startTime != ''">and g.up_tm &gt;= TO_DATE(#{startTime},'YYYY-MM-DD')</if>
  825. <if test="endTime != null and endTime != ''">and g.up_tm &lt; TO_DATE(#{endTime},'YYYY-MM-DD')+1</if>
  826. <if test="orgIds != null and orgIds != ''">
  827. and substr(o.id,4,3) in (${orgIds})
  828. </if>
  829. <if test="pTypes != null and pTypes != ''">
  830. and o.ptype in (${pTypes})
  831. </if>
  832. <include refid="choseSql"/>
  833. group by e.name,e.ptype
  834. union all
  835. select e.ptype as objType,e.name as name,count(o.id) as total from bis_insp_all_obj
  836. o,BIS_INSP_OPRD_CSTR_PROJ_RGSTR g,att_insp_type e
  837. where o.obj_id=g.obj_id and o.ptype=e.ptype and g.state='2'
  838. <if test="startTime != null and startTime != ''">and g.up_tm &gt;= TO_DATE(#{startTime},'YYYY-MM-DD')</if>
  839. <if test="endTime != null and endTime != ''">and g.up_tm &lt; TO_DATE(#{endTime},'YYYY-MM-DD')+1</if>
  840. <if test="orgIds != null and orgIds != ''">
  841. and substr(o.id,4,3) in (${orgIds})
  842. </if>
  843. <if test="pTypes != null and pTypes != ''">
  844. and o.ptype in (${pTypes})
  845. </if>
  846. <include refid="choseSql"/>
  847. group by e.name,e.ptype
  848. union all
  849. select e.ptype as objType,e.name as name,count(o.id) as total from bis_insp_all_obj o,ATT_JSKEJIAN_FLKDIS_RGSTR
  850. g ,att_insp_type e
  851. where o.obj_id=g.obj_id and o.ptype=e.ptype and g.state='2'
  852. <if test="startTime != null and startTime != ''">and g.uptm &gt;= TO_DATE(#{startTime},'YYYY-MM-DD')</if>
  853. <if test="endTime != null and endTime != ''">and g.uptm &lt; TO_DATE(#{endTime},'YYYY-MM-DD')+1</if>
  854. <if test="orgIds != null and orgIds != ''">
  855. and substr(o.id,4,3) in (${orgIds})
  856. </if>
  857. <if test="pTypes != null and pTypes != ''">
  858. and o.ptype in (${pTypes})
  859. </if>
  860. <include refid="choseSql"/>
  861. group by e.name,e.ptype
  862. union all
  863. select e.ptype as objType,e.name as name,count(o.id) as total from bis_insp_all_obj o,ATT_JSKEJIAN_WATER_RGSTR g
  864. ,att_insp_type e
  865. where o.obj_id=g.obj_id and o.ptype=e.ptype and g.state='2'
  866. <if test="startTime != null and startTime != ''">and g.uptm &gt;= TO_DATE(#{startTime},'YYYY-MM-DD')</if>
  867. <if test="endTime != null and endTime != ''">and g.uptm &lt; TO_DATE(#{endTime},'YYYY-MM-DD')+1</if>
  868. <if test="orgIds != null and orgIds != ''">
  869. and substr(o.id,4,3) in (${orgIds})
  870. </if>
  871. <if test="pTypes != null and pTypes != ''">
  872. and o.ptype in (${pTypes})
  873. </if>
  874. <include refid="choseSql"/>
  875. group by e.name,e.ptype
  876. union all
  877. select e.ptype as objType,e.name as name,count(o.id) as total from bis_insp_all_obj o,ATT_JSKEJIAN_ECOFRD_RGSTR
  878. g ,att_insp_type e
  879. where o.obj_id=g.obj_id and o.ptype=e.ptype and g.state='2'
  880. <if test="startTime != null and startTime != ''">and g.uptm &gt;= TO_DATE(#{startTime},'YYYY-MM-DD')</if>
  881. <if test="endTime != null and endTime != ''">and g.uptm &lt; TO_DATE(#{endTime},'YYYY-MM-DD')+1</if>
  882. <if test="orgIds != null and orgIds != ''">
  883. and substr(o.id,4,3) in (${orgIds})
  884. </if>
  885. <if test="pTypes != null and pTypes != ''">
  886. and o.ptype in (${pTypes})
  887. </if>
  888. <include refid="choseSql"/>
  889. group by e.name,e.ptype
  890. union ALL
  891. select e.ptype as objType,e.name as name,count(o.id) as total from bis_insp_all_obj o,BIS_INSP_RSML_RGSTR g
  892. ,att_insp_type e
  893. where o.obj_id=g.obj_id and o.ptype=e.ptype and g.state='2'
  894. <if test="startTime != null and startTime != ''">and g.uptm &gt;= TO_DATE(#{startTime},'YYYY-MM-DD')</if>
  895. <if test="endTime != null and endTime != ''">and g.uptm &lt; TO_DATE(#{endTime},'YYYY-MM-DD')+1</if>
  896. <if test="orgIds != null and orgIds != ''">
  897. and substr(o.id,4,3) in (${orgIds})
  898. </if>
  899. <if test="pTypes != null and pTypes != ''">
  900. and o.ptype in (${pTypes})
  901. </if>
  902. <include refid="choseSql"/>
  903. group by e.name,e.ptype
  904. </select>
  905. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspAllObj">
  906. insert into BIS_INSP_ALL_OBJ(
  907. <include refid="table_columns"/>
  908. )
  909. values (
  910. <include refid="entity_properties"/>
  911. )
  912. </insert>
  913. <insert id="insertObj" parameterType="cn.com.goldenwater.dcproj.dto.BisInspAllObjDto">
  914. insert into BIS_INSP_ALL_OBJ(
  915. <include refid="table_columns"/>
  916. )
  917. values (
  918. <include refid="entity_properties"/>
  919. )
  920. </insert>
  921. <delete id="delete" parameterType="java.lang.String">
  922. delete from BIS_INSP_ALL_OBJ where ID = #{id}
  923. </delete>
  924. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspAllObj">
  925. delete from BIS_INSP_ALL_OBJ
  926. <include refid="page_where"/>
  927. </delete>
  928. <update id="deleteInFlag" parameterType="java.lang.String">
  929. update BIS_INSP_ALL_OBJ set flag_valid = 0 where ID = #{id}
  930. </update>
  931. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspAllObj">
  932. update BIS_INSP_ALL_OBJ
  933. <trim prefix="set" suffixOverrides=",">
  934. <if test="id != null and id != ''">ID = #{id},</if>
  935. <if test="nm != null and nm != ''">NM = #{nm},</if>
  936. <if test="ptype != null and ptype != ''">PTYPE = #{ptype},</if>
  937. <if test="lgtd != null and lgtd != ''">LGTD = #{lgtd},</if>
  938. <if test="lttd != null and lttd != ''">LTTD = #{lttd},</if>
  939. <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
  940. <if test="lgtdpc != null and lgtdpc != ''">LGTDPC = #{lgtdpc},</if>
  941. <if test="lttdpc != null and lttdpc != ''">LTTDPC = #{lttdpc},</if>
  942. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  943. <if test="orgId != null and orgId != ''">ORG_ID = #{orgId},</if>
  944. <if test="objAdCode != null and objAdCode != ''">OBJ_AD_CODE = #{objAdCode},</if>
  945. </trim>
  946. <where>obj_id = #{objId}</where>
  947. </update>
  948. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspAllObj">
  949. update BIS_INSP_ALL_OBJ
  950. <trim prefix="set" suffixOverrides=",">
  951. <if test="id != null and id != ''">ID = #{id},</if>
  952. <if test="nm != null and nm != ''">NM = #{nm},</if>
  953. <if test="ptype != null and ptype != ''">PTYPE = #{ptype},</if>
  954. <if test="lgtd != null and lgtd != ''">LGTD = #{lgtd},</if>
  955. <if test="lttd != null and lttd != ''">LTTD = #{lttd},</if>
  956. <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
  957. <if test="lgtdpc != null and lgtdpc != ''">LGTDPC = #{lgtdpc},</if>
  958. <if test="lttdpc != null and lttdpc != ''">LTTDPC = #{lttdpc},</if>
  959. <if test="objAdCode != null and objAdCode != ''">OBJ_AD_CODE = #{objAdCode},</if>
  960. </trim>
  961. <include refid="page_where"/>
  962. </update>
  963. <!-- 其他自定义SQL -->
  964. <select id="getIdByUserId" resultType="cn.com.goldenwater.dcproj.model.BisInspAllRlation">
  965. SELECT * FROM BIS_INSP_ALL_RLATION T where persid=#{userid} and id like concat( #{ptype},'%')
  966. <choose>
  967. <when test="adCode != null and adCode !=''">
  968. and t.ad_code = #{adCode}
  969. </when>
  970. <otherwise>
  971. and t.ad_code is null
  972. </otherwise>
  973. </choose>
  974. </select>
  975. <select id="getObj" parameterType="cn.com.goldenwater.dcproj.model.BisInspAllObj"
  976. resultType="cn.com.goldenwater.dcproj.dto.BisInspAllObjDto">
  977. SELECT * FROM BIS_INSP_ALL_OBJ WHERE ID = #{id} AND CODE = #{code} AND ptype = #{ptype}
  978. <choose>
  979. <when test="province !=null and province !=''">
  980. and ad_code=#{province}
  981. </when>
  982. <otherwise>
  983. and ad_code is null
  984. </otherwise>
  985. </choose>
  986. </select>
  987. <select id="getGroup" parameterType="String" resultType="cn.com.goldenwater.dcproj.dto.ObjectNameDto">
  988. SELECT ID,PNM name FROM BIS_INSP_ALL WHERE ID = #{id}
  989. </select>
  990. <!--查询督查范围内的稽察对象-->
  991. <select id="getListByInspGroupIdObjType" resultType="cn.com.goldenwater.dcproj.model.TacAttPawpBase">
  992. select t.*,C.id AS GROUPID,C.PNM,o.OBJ_ID
  993. from TAC_ATT_PAWP_BASE t
  994. left join BIS_INSP_ALL_OBJ o
  995. on o.CODE = t.id
  996. LEFT JOIN BIS_INSP_ALL C ON o.ID = C.ID
  997. and o.ptype = #{objType}
  998. where 1 = 1
  999. <if test='isAll == "0"'>and o.ID = #{inspGroupId}</if>
  1000. <if test='isAll == "1"'>and o.ID LIKE '${inspGroupId}%'</if>
  1001. <if test="wtdstNm != null and wtdstNm != ''">and t.NAME LIKE '%${wtdstNm}%'</if>
  1002. <if test="wtdstType != null and wtdstType != ''">and t.TYPE LIKE '%${wtdstType}%'</if>
  1003. <if test="adCode != null and adCode != ''">and t.AD_CODE LIKE '${adCode}%'</if>
  1004. <include refid="choseProvinceSql"/>
  1005. </select>
  1006. <sql id="choseProvinceSql">
  1007. <choose>
  1008. <when test="province !=null and province !=''">
  1009. AND o.ad_code=#{province}
  1010. </when>
  1011. <otherwise>
  1012. AND o.ad_code is null
  1013. </otherwise>
  1014. </choose>
  1015. </sql>
  1016. <select id="findGroupCountByAdCode" resultType="cn.com.goldenwater.dcproj.dto.DcTypeDto">
  1017. select LTRIM(t.code,'00') as OBJTYPE,t.name,nvl(d.total,0) AS TOTAL from ATT_INSP_TYPE t left join (
  1018. select f.ptype,count(1) AS TOTAL from (
  1019. select D.ptype,l.* from bis_insp_all l ,(
  1020. select distinct * from (
  1021. select ptype, ID from (
  1022. <include refid="commonChose"/>
  1023. ) W where w.ad_code=#{adCode}
  1024. <if test="startTime != null and startTime != ''">and w.obj_intm&gt;= TO_DATE(#{startTime},'YYYY-MM-DD')</if>
  1025. <if test="endTime != null and endTime != ''">and w.obj_intm &lt; TO_DATE(#{endTime},'YYYY-MM-DD')+1</if>
  1026. <if test="pTypes != null and pTypes != ''">
  1027. and w.pType in (${pTypes})
  1028. </if>
  1029. <if test="orgIds != null and orgIds != ''">
  1030. and substr(w.id,4,3) in (${orgIds})
  1031. </if>
  1032. ) S ) D where l.id=d.id
  1033. ) F GROUP BY F.ptype
  1034. ) D on LTRIM(t.code,'0') = d.ptype
  1035. order by t.code
  1036. </select>
  1037. <select id="findPerCountByAdCode" resultType="cn.com.goldenwater.dcproj.dto.DcTypeDto"
  1038. parameterType="cn.com.goldenwater.dcproj.param.IndexParamPage">
  1039. select LTRIM(t.code,'00') as OBJTYPE,t.name,nvl(d.total,0) AS TOTAL from ATT_INSP_TYPE t left join (
  1040. select f.ptype,count(1) AS TOTAL from (
  1041. select D.ptype,D.id,p.pers_name,p.org_nm,p.org_id,p.dpnm,p.mobilenumb,p.dppost,p.guid,p.email,a.pnm from
  1042. bis_insp_all_rlation l ,bis_insp_all_rlation_pers p,bis_insp_all a,(
  1043. select distinct * from (
  1044. select ptype, ID from (
  1045. <include refid="commonChose"/>
  1046. ) W where w.ad_code=#{adCode}
  1047. <if test="startTime != null and startTime != ''">and w.obj_intm&gt;= TO_DATE(#{startTime},'YYYY-MM-DD')</if>
  1048. <if test="endTime != null and endTime != ''">and w.obj_intm &lt; TO_DATE(#{endTime},'YYYY-MM-DD')+1</if>
  1049. <if test="pTypes != null and pTypes != ''">
  1050. and w.pType in (${pTypes})
  1051. </if>
  1052. <if test="orgIds != null and orgIds != ''">
  1053. and substr(w.id,4,3) in (${orgIds})
  1054. </if>
  1055. ) S ) D where l.id=d.id and l.persid=p.guid and a.id=d.id
  1056. ) F GROUP BY F.ptype
  1057. ) D on LTRIM(t.code,'0') = d.ptype
  1058. order by t.code
  1059. </select>
  1060. <sql id="selSql">
  1061. select to_char(substr(e.adm_div,0,${length})||'${otherLength}') as
  1062. ad_code,o.code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,to_char(e.location) as ad_name
  1063. from bis_insp_all_obj o left join att_rs_base e on o.code=e.rs_code where o.ptype in (1,36,22)
  1064. <include refid="choseSql"/>
  1065. union all
  1066. select substr(o.code,0,${length})||'${otherLength}' as
  1067. ad_code,o.code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,s.ad_full_name as ad_name from bis_insp_all_obj
  1068. o,att_ad_x_base s where o.code=s.ad_code and o.ptype=2
  1069. <include refid="choseSql"/>
  1070. union all
  1071. select substr(ob.loc_ad,0,${length})||'${otherLength}' as
  1072. ad_code,o.code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,ob.loc_nm as ad_name from bis_insp_all_obj o left join
  1073. BIS_INSP_WTDST OB ON o.CODE = OB.WTDST_ID where o.ptype=3
  1074. <include refid="choseSql"/>
  1075. union all
  1076. select substr(ke.ad_code,0,${length})||'${otherLength}' as
  1077. ad_code,o.code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,ba.ad_full_name as ad_name from bis_insp_all_obj o
  1078. left join ATT_EMPWTPRJ_BASE ke ON o.code = ke.id
  1079. left join att_ad_x_base ba on ke.ad_code=ba.ad_code
  1080. where o.ptype in (4,7)
  1081. <include refid="choseSql"/>
  1082. union all
  1083. select substr(ob.adcd,0,${length})||'${otherLength}' as
  1084. ad_code,o.code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,ob.adnm as ad_name from bis_insp_all_obj o left join
  1085. ATT_GRW_BASE OB ON o.CODE = OB.stcd where o.ptype=5
  1086. <include refid="choseSql"/>
  1087. union all
  1088. select substr(ob.ad_code,0,${length})||'${otherLength}' as
  1089. ad_code,o.code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,ob.location_xiang as ad_name from bis_insp_all_obj o left
  1090. join ATT_WAGA_BASE OB ON o.CODE = OB.obj_code where o.ptype=6
  1091. <include refid="choseSql"/>
  1092. union all
  1093. select substr(ob.ad_code,0,${length})||'${otherLength}' as
  1094. ad_code,o.code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,ob.location as ad_name from bis_insp_all_obj o
  1095. left join att_fsc_base OB ON o.CODE = OB.id where o.ptype=9
  1096. <include refid="choseSql"/>
  1097. union all
  1098. select substr(ob.ad_code,0,${length})||'${otherLength}' as
  1099. ad_code,o.code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,ob.location as ad_name from bis_insp_all_obj o
  1100. left join att_other_base OB ON o.CODE = OB.id where o.ptype=10
  1101. <include refid="choseSql"/>
  1102. union all
  1103. select substr(ob.ad_code,0,${length})||'${otherLength}' as
  1104. ad_code,o.code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.note as ad_name from bis_insp_all_obj o
  1105. left join att_sd_base OB ON o.CODE = OB.SD_CODE where o.ptype=11
  1106. <include refid="choseSql"/>
  1107. union all
  1108. select substr(ob.ad_code,0,${length})||'${otherLength}' as
  1109. ad_code,o.code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.WINT_POS as ad_name from bis_insp_all_obj o
  1110. left join att_wain_base OB ON o.CODE = OB.OBJ_CODE where o.ptype=12
  1111. <include refid="choseSql"/>
  1112. union all
  1113. select substr(ob.ad_code,0,${length})||'${otherLength}' as
  1114. ad_code,o.code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.SWHS_LOC as ad_name from bis_insp_all_obj o
  1115. left join ATT_SWHS_BASE OB ON o.CODE = OB.id where o.ptype=13
  1116. <include refid="choseSql"/>
  1117. union all
  1118. select substr(ob.ad_code,0,${length})||'${otherLength}' as
  1119. ad_code,o.code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.AD_FULL_NAME as ad_name from bis_insp_all_obj o
  1120. left join ATT_AD_X_BASE OB ON o.CODE = OB.AD_CODE where o.ptype=14
  1121. <include refid="choseSql"/>
  1122. union all
  1123. select substr(ob.ad_code,0,${length})||'${otherLength}' as
  1124. ad_code,o.code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.AD_FULL_NAME as ad_name from bis_insp_all_obj o
  1125. left join ATT_AD_X_BASE OB ON o.CODE = OB.AD_CODE where o.ptype=15
  1126. <include refid="choseSql"/>
  1127. union all
  1128. select substr(ob.ad_code,0,${length})||'${otherLength}' as
  1129. ad_code,o.code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.ad_name from bis_insp_all_obj o
  1130. left join att_wunt_base OB ON o.CODE = OB.ID where o.ptype=16
  1131. <include refid="choseSql"/>
  1132. union all
  1133. select substr(ob.ad_code,0,${length})||'${otherLength}' as
  1134. ad_code,o.code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.ad_name from bis_insp_all_obj o
  1135. left join ATT_PRD_CSTR_PROJ_BASE OB ON o.CODE = OB.ID where o.ptype=17
  1136. <include refid="choseSql"/>
  1137. union all
  1138. select substr(ob.ad_code,0,${length})||'${otherLength}' as
  1139. ad_code,o.code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.ad_name from bis_insp_all_obj o
  1140. left join ATT_JSKEJIAN_FLKDIS_BASE OB ON o.CODE = OB.ID where o.ptype=18
  1141. <include refid="choseSql"/>
  1142. union all
  1143. select substr(ob.ad_code,0,${length})||'${otherLength}' as
  1144. ad_code,o.code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.ad_name from bis_insp_all_obj o
  1145. left join ATT_JSKEJIAN_WATER_BASE OB ON o.CODE = OB.ID where o.ptype=19
  1146. <include refid="choseSql"/>
  1147. union all
  1148. select substr(ob.ad_code,0,${length})||'${otherLength}' as
  1149. ad_code,o.code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.ad_name from bis_insp_all_obj o
  1150. left join ATT_JSKEJIAN_Ecofrd_BASE OB ON o.CODE = OB.ID where o.ptype=20
  1151. <include refid="choseSql"/>
  1152. </sql>
  1153. <select id="findObjCountByAdCode" resultType="cn.com.goldenwater.dcproj.dto.DcTypeDto"
  1154. parameterType="cn.com.goldenwater.dcproj.param.IndexParamPage">
  1155. select LTRIM(t.code,'00') as OBJTYPE,t.name,nvl(d.total,0) AS TOTAL from ATT_INSP_TYPE t left join (
  1156. select f.ptype,count(1) AS TOTAL from (
  1157. select W.* from (
  1158. <include refid="selSql"/>
  1159. ) W where w.ad_code=#{adCode}
  1160. <if test="startTime != null and startTime != ''">and w.obj_intm&gt;= TO_DATE(#{startTime},'YYYY-MM-DD')</if>
  1161. <if test="endTime != null and endTime != ''">and w.obj_intm &lt; TO_DATE(#{endTime},'YYYY-MM-DD')+1</if>
  1162. <if test="pTypes != null and pTypes != ''">
  1163. and w.pType in (${pTypes})
  1164. </if>
  1165. <if test="orgIds != null and orgIds != ''">
  1166. and substr(w.id,4,3) in (${orgIds})
  1167. </if>
  1168. ) F GROUP BY F.ptype
  1169. ) D ON LTRIM(t.code,'0') = d.ptype
  1170. order by t.code
  1171. </select>
  1172. <!--督查问题-->
  1173. <select id="findPblmCountByAdCode" resultType="cn.com.goldenwater.dcproj.dto.DcTypeDto"
  1174. parameterType="cn.com.goldenwater.dcproj.param.IndexParamPage">
  1175. select LTRIM(t.code,'00') as OBJTYPE,t.name,nvl(d.total,0) AS TOTAL from ATT_INSP_TYPE t left join (
  1176. select f.PTYPE,count(1) AS TOTAL from (
  1177. select w.ptype,w.nm,m.* from bis_insp_pblm m, (
  1178. <include refid="commonChose"/>
  1179. ) W where w.obj_id=m.obj_id and w.ad_code=#{adCode}
  1180. <if test="startTime != null and startTime != ''">and w.obj_intm&gt;= TO_DATE(#{startTime},'YYYY-MM-DD')</if>
  1181. <if test="endTime != null and endTime != ''">and w.obj_intm &lt; TO_DATE(#{endTime},'YYYY-MM-DD')+1</if>
  1182. <if test="pTypes != null and pTypes != ''">
  1183. and w.pType in (${pTypes})
  1184. </if>
  1185. <if test="orgIds != null and orgIds != ''">
  1186. and substr(w.id,4,3) in (${orgIds})
  1187. </if>
  1188. ) F GROUP BY F.ptype
  1189. ) D on LTRIM(t.code,'0') = d.ptype
  1190. order by t.code
  1191. </select>
  1192. <select id="listByMap" resultType="cn.com.goldenwater.dcproj.dto.BisInspAllObjDto">
  1193. SELECT O.*, A.NAME AS OBJ_TYPE_NAME, AB.AD_FULL_NAME, AL.PNM
  1194. FROM BIS_INSP_ALL_OBJ O
  1195. JOIN (select * FROM ATT_INSP_TYPE where code IN (select INSP_TYPE FROM REL_ORG_INSP_TYPE
  1196. <where>
  1197. <if test="orgId != null and orgId != '' ">
  1198. AND ORG_ID = #{orgId}
  1199. </if>
  1200. </where>
  1201. )) A ON O.PTYPE = A.PTYPE
  1202. JOIN BIS_INSP_ALL AL ON O.ID = AL.ID
  1203. LEFT JOIN ATT_AD_BASE AB ON O.OBJ_AD_CODE = AB.AD_CODE
  1204. <where>
  1205. <if test="depm != null and depm.size() > 0 ">
  1206. AND A.CODE IN (SELECT PTYPE FROM ATT_INSP_TYPE_DUTY where DUTY_DEP IN
  1207. <foreach item="item" index="index" collection="depm" open="(" separator="," close=")">
  1208. '${item}'
  1209. </foreach>
  1210. )
  1211. </if>
  1212. <if test="id != null and id != ''">and O.ID like '%${id}%'</if>
  1213. <if test="orgId != null and orgId != '' ">AND O.ID LIKE '___${orgId}%'</if>
  1214. <if test="objType != null and objType != ''">and O.PTYPE = #{objType}</if>
  1215. <if test="objTypeName != null and objTypeName != ''">and A.NAME LIKE '%${objTypeName}%'</if>
  1216. <if test="nm != null and nm != ''">and O.nm like '%${nm}%'</if>
  1217. <if test="adCode != null and adCode != ''">and O.OBJ_AD_CODE like '${adCode}%'</if>
  1218. <!-- 福建省 福州市排除 平潭县 把平潭县 归属到 平潭综合实验区-->
  1219. <if test='adCode != null and adCode == "3501" '>AND SUBSTR(O.OBJ_AD_CODE, 0, 6) !='350128'</if>
  1220. <if test='adCode != null and adCode == "3510" '>AND SUBSTR(O.OBJ_AD_CODE, 0, 6) ='350128'</if>
  1221. <if test="pnm != null and pnm != ''">and AL.PNM like '%${pnm}%'</if>
  1222. <if test="adFullName != null and adFullName != ''">and AB.AD_FULL_NAME like '%${adFullName}%'</if>
  1223. <if test="sttm != null and sttm != '' and entm != null and entm != '' ">
  1224. AND O.OBJ_INTM &gt;= TO_DATE(#{sttm}, 'YYYY-MM-DD')
  1225. AND O.OBJ_INTM &lt; TO_DATE(#{entm}, 'YYYY-MM-DD') + 1
  1226. </if>
  1227. <if test='null !=isRepeat and "" != isRepeat and "1" == isRepeat.toString() '>
  1228. AND O.code in ( select biaoin.code from BIS_INSP_ALL_OBJ biaoin
  1229. <where>
  1230. <if test='orgId != null and orgId != "" '>
  1231. AND biaoin.ORG_ID = #{orgId}
  1232. </if>
  1233. <if test='adCode != null and adCode != "" '>AND biaoin.OBJ_AD_CODE like '${adCode}%'</if>
  1234. </where>
  1235. group by biaoin.code having count(biaoin.code) &gt; 1
  1236. )
  1237. </if>
  1238. <if test='null !=isRepeat and "" != isRepeat and "1" != isRepeat.toString() '>
  1239. AND O.code in ( select biaoin.code from BIS_INSP_ALL_OBJ biaoin
  1240. <where>
  1241. <if test="orgId != null and orgId != '' ">
  1242. AND biaoin.ORG_ID = #{orgId}
  1243. </if>
  1244. <if test='adCode != null and adCode != "" '> AND biaoin.OBJ_AD_CODE like '${adCode}%'</if>
  1245. </where>
  1246. group by biaoin.code having count(biaoin.code) = 1
  1247. )
  1248. </if>
  1249. </where>
  1250. order by O.PTYPE, O.OBJ_AD_CODE, O.OBJ_ID
  1251. </select>
  1252. <select id="getTableName" resultType="String">
  1253. SELECT RGSTR_TABLE_NAME
  1254. FROM ATT_INSP_TYPE where PTYPE = #{ptype}
  1255. </select>
  1256. <select id="getRgstrIdAndState" resultType="cn.com.goldenwater.dcproj.dto.BisInspAllObjDto">
  1257. SELECT ${idName},STATE
  1258. FROM ${tableName} where OBJ_ID = #{objId}
  1259. </select>
  1260. <select id="listOfRgstr" resultType="java.util.Map">
  1261. select
  1262. O.ID AS "groupId", SUBSTR(O.ID, 4, 3) AS "orgId",
  1263. O.CODE AS "code", O.NM AS "nm", O.OBJ_AD_CODE AS "adCode",
  1264. R.OBJ_ID AS "objId", R.${stateName} AS "state"
  1265. FROM ${tableName} R
  1266. JOIN BIS_INSP_ALL_OBJ O ON O.OBJ_ID = R.OBJ_ID
  1267. JOIN BIS_INSP_ALL G ON G.ID = O.ID
  1268. <where>
  1269. <if test="adCode != null and adCode != ''">
  1270. O.OBJ_AD_CODE LIKE CONCAT(#{adCode}, '%')
  1271. </if>
  1272. <if test="groupIds != null and groupIds != ''">
  1273. O.ID IN (${groupIds})
  1274. </if>
  1275. <if test="objId != null and objId != ''">
  1276. AND O.OBJ_ID = #{objId}
  1277. </if>
  1278. <if test="objType != null and objType != ''">
  1279. AND O.PTYPE = #{objType}
  1280. </if>
  1281. <if test="orgIds != null and orgIds != ''">
  1282. AND O.ORG_ID IN (${orgIds})
  1283. </if>
  1284. <if test="orgId != null and orgId != ''">
  1285. AND O.ORG_ID = #{orgId}
  1286. </if>
  1287. <if test="state != null and state != ''">
  1288. AND R.${stateName} = #{state}
  1289. </if>
  1290. <if test="nm != null and nm != ''">
  1291. AND O.NM like '%${nm}%'
  1292. </if>
  1293. <if test="chkType != null and chkType != ''">
  1294. AND G.CHK_TYPE = #{chkType}
  1295. </if>
  1296. </where>
  1297. </select>
  1298. <update id="updateRgstrState">
  1299. update ${tableName} SET ${stateName} = ${state}
  1300. WHERE
  1301. <choose>
  1302. <when test="objIdList != null and objIdList.size() > 0">
  1303. OBJ_ID IN
  1304. <foreach item="objIds" index="index" collection="objIdList" open="(" separator=") OR OBJ_ID IN ("
  1305. close=")">
  1306. ${objIds}
  1307. </foreach>
  1308. </when>
  1309. <otherwise>
  1310. OBJ_ID = #{objId}
  1311. </otherwise>
  1312. </choose>
  1313. </update>
  1314. </mapper>