BriefReportDao.xml 129 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993
  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.BriefReportDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BriefReport" id="brief">
  5. <result property="adCode" column="AD_CODE"/>
  6. <result property="adName" column="AD_NAME"/>
  7. <result property="code" column="CODE"/>
  8. <result property="pnm" column="PNM"/>
  9. <result property="num" column="NUM"/>
  10. </resultMap>
  11. <select id="getGroupCountByType" resultType="int" parameterType="String">
  12. select count(*)
  13. from BIS_INSP_ALL t
  14. where length(id) = 12 and id like '${type}${orgId}%'
  15. </select>
  16. <select id="getGroupCountListByType" resultMap="brief" parameterType="java.util.Map">
  17. select a.code, b.pnm, a.num
  18. from (select substr(t.id, 1, 6) as code, count(t.id) as num
  19. from BIS_INSP_ALL t,bis_insp_all_rlation o
  20. where t.id=o.id and length(t.id) = 12
  21. <include refid="ochoseSql"/>
  22. <if test="type != null and type != ''">
  23. and t.id like CONCAT(#{type},CONCAT(#{orgId},'%'))
  24. </if>
  25. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  26. AND ((STTM &gt;= TO_DATE(#{sttm},'YYYY-MM-DD') AND ENTM &lt; TO_DATE(#{entm},'YYYY-MM-DD') + 1)
  27. or( STTM &gt;= TO_DATE(#{sttm},'yyyy-MM-dd') and STTM &lt; TO_DATE(#{entm},'yyyy-MM-dd')+1)
  28. or( ENTM &gt;= TO_DATE(#{sttm},'yyyy-MM-dd') and ENTM &lt; TO_DATE(#{entm},'yyyy-MM-dd')+1)
  29. or( STTM &lt;= TO_DATE(#{sttm},'yyyy-MM-dd') and ENTM &gt;= TO_DATE(#{entm},'yyyy-MM-dd')+1))
  30. </if>
  31. group by substr(t.id, 1, 6)) a
  32. left join BIS_INSP_ALL b
  33. on a.code = b.id
  34. where 1=1
  35. <if test="orgName != null and orgName != ''">
  36. and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
  37. </if>
  38. <if test="orgId !=null and orgId !=''">
  39. and b.id like '___${orgId}%'
  40. </if>
  41. order by to_number(a.code)
  42. </select>
  43. <select id="getPersCountByType" resultType="int" parameterType="String">
  44. select count(distinct persid)
  45. from bis_insp_all_rlation t
  46. where length(id) = 12 and id like '${type}${orgId}%'
  47. <include refid="choseSql"/>
  48. </select>
  49. <sql id="choseSql">
  50. <choose>
  51. <when test="province !=null and province !=''">
  52. and t.ad_code =#{province}
  53. </when>
  54. <otherwise>
  55. and t.ad_code is null
  56. </otherwise>
  57. </choose>
  58. </sql>
  59. <select id="getPersCountListByType" resultMap="brief" parameterType="java.util.Map">
  60. select a.code, b.pnm, a.num
  61. from (select substr(id, 1, 6) as code, count(distinct persid) as num
  62. from bis_insp_all_rlation t
  63. where length(id) = 12
  64. <include refid="choseSql"/>
  65. <if test="type != null and type != ''">
  66. and id like CONCAT(#{type}, '%')
  67. </if>
  68. group by substr(id, 1, 6)) a
  69. left join BIS_INSP_ALL b
  70. on a.code = b.id
  71. where 1=1
  72. <if test="orgName != null and orgName != ''">
  73. and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
  74. </if>
  75. order by to_number(a.code)
  76. </select>
  77. <select id="getProCount" resultType="int" parameterType="String">
  78. select count(distinct ad_code) as num
  79. from (select distinct substr(ad_code, 1, 2) as ad_code
  80. from bis_insp_sel_area
  81. where length(id) > 3
  82. union all
  83. select distinct substr(code, 1, 2) as ad_code
  84. from bis_insp_all_obj t
  85. where t.ptype = '2'
  86. union all
  87. select distinct substr(b.loc_ad, 1, 2) as ad_code
  88. from bis_insp_all_obj a
  89. left join BIS_INSP_WTDST b
  90. on a.code = b.wtdst_id
  91. where a.ptype = '3'
  92. ) t
  93. where ad_code != '00'
  94. <include refid="choseSql"/>
  95. </select>
  96. <select id="getRectProCount" resultType="int" parameterType="String">
  97. select count(distinct substr(b.loc_ad, 1, 2)) as num
  98. from bis_insp_all_obj t
  99. left join BIS_INSP_WTDST b
  100. on t.code = b.wtdst_id
  101. where t.ptype = '3'
  102. <include refid="choseSql"/>
  103. </select>
  104. <select id="getRectProCountList" resultMap="brief">
  105. select a.code, b.pnm, a.num
  106. from (select q.id as code, count(distinct q.code) as num
  107. from (select substr(o.id, 1, 6) as id,
  108. substr(b.loc_ad, 1, 2) as code,o.ad_code
  109. from BIS_INSP_WTDST_TRACK t
  110. left join bis_insp_all_obj o
  111. on t.obj_id = o.obj_id
  112. left join BIS_INSP_WTDST b
  113. on o.code = b.wtdst_id
  114. where length(o.id) > 3
  115. <if test="state != null and state != ''">
  116. AND case when t.state is null then '0' else t.state end = #{state}
  117. </if>
  118. ) q where 1=1 <include refid="qchose"/>
  119. group by q.id) a
  120. left join BIS_INSP_ALL b
  121. on a.code = b.id
  122. where 1=1
  123. <if test="orgName != null and orgName != ''">
  124. and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
  125. </if>
  126. order by to_number(a.code)
  127. </select>
  128. <select id="getWagaProCountList" resultMap="brief">
  129. select a.code, b.pnm, a.num
  130. from (select q.id as code, count(distinct q.code) as num
  131. from (select substr(o.id, 1, 6) as id,
  132. substr(b.AD_CODE, 1, 2) as code
  133. from ATT_WAGA_RGSTR t
  134. left join bis_insp_all_obj o
  135. on t.obj_id = o.obj_id
  136. left join ATT_WAGA_BASE b
  137. on o.code = b.OBJ_CODE
  138. where length(o.id) > 3
  139. <include refid="ochoseSql"/>
  140. <if test="state != null and state != ''">
  141. AND case when t.state is null then '0' else t.state end = #{state}
  142. </if>
  143. ) q
  144. group by q.id) a
  145. left join BIS_INSP_ALL b
  146. on a.code = b.id
  147. where 1=1
  148. <if test="orgName != null and orgName != ''">
  149. and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
  150. </if>
  151. order by to_number(a.code)
  152. </select>
  153. <select id="getEmpwtProCountList" resultMap="brief">
  154. select a.code, b.pnm, a.num
  155. from (select q.id as code, count(distinct q.code) as num
  156. from (select substr(o.id, 1, 6) as id,
  157. substr(b.AD_CODE, 1, 2) as code
  158. from BIS_INSP_KEY_REGISTER t
  159. left join bis_insp_all_obj o
  160. on t.obj_id = o.obj_id
  161. left join ATT_EMPWTPRJ_BASE b
  162. on o.code = b.ID
  163. where length(o.id) > 3 and b.eng_sta = #{engSta}
  164. <include refid="ochoseSql"/>
  165. <if test="state != null and state != ''">
  166. AND case when t.state is null then '0' else t.state end = #{state}
  167. </if>
  168. ) q
  169. group by q.id) a
  170. left join BIS_INSP_ALL b
  171. on a.code = b.id
  172. where 1=1
  173. <if test="orgName != null and orgName != ''">
  174. and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
  175. </if>
  176. order by to_number(a.code)
  177. </select>
  178. <select id="getRectCtCountList" resultMap="brief" parameterType="String">
  179. select a.code, b.pnm, a.num
  180. from (select q.id as code, count(distinct q.code) as num
  181. from (select substr(o.id, 1, 6) as id,
  182. substr(b.loc_ad, 1, 6) as code,o.ad_code
  183. from BIS_INSP_WTDST_TRACK t
  184. left join bis_insp_all_obj o
  185. on t.obj_id = o.obj_id
  186. left join BIS_INSP_WTDST b
  187. on o.code = b.wtdst_id
  188. where length(o.id) > 3
  189. <if test="state != null and state != ''">
  190. AND case when t.state is null then '0' else t.state end = #{state}
  191. </if>
  192. ) q where 1=1 <include refid="qchose"/>
  193. group by q.id) a
  194. left join BIS_INSP_ALL b
  195. on a.code = b.id
  196. where 1=1
  197. <if test="orgName != null and orgName != ''">
  198. and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
  199. </if>
  200. order by to_number(a.code)
  201. </select>
  202. <select id="getRectCountList" resultMap="brief" parameterType="String">
  203. select a.code, b.pnm, a.num
  204. from (select q.id as code, count(q.code) as num
  205. from (select substr(o.id, 1, 6) as id,
  206. substr(b.loc_ad, 1, 6) as code,o.ad_code
  207. from BIS_INSP_WTDST_TRACK t
  208. left join bis_insp_all_obj o
  209. on t.obj_id = o.obj_id
  210. left join BIS_INSP_WTDST b
  211. on o.code = b.wtdst_id
  212. where length(o.id) > 3
  213. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  214. AND t.INTM &gt;= TO_DATE(#{sttm},'YYYY-MM-DD') AND t.INTM &lt; TO_DATE(#{entm},'YYYY-MM-DD') + 1
  215. </if>
  216. <if test="state != null and state != ''">
  217. AND case when t.state is null then '0' else t.state end = #{state}
  218. </if>
  219. ) q where 1=1 <include refid="qchose"/>
  220. group by q.id) a
  221. left join BIS_INSP_ALL b
  222. on a.code = b.id
  223. where 1=1
  224. <if test="orgName != null and orgName != ''">
  225. and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
  226. </if>
  227. order by to_number(a.code)
  228. </select>
  229. <select id="getRsvrProCount" resultType="int" parameterType="String">
  230. select count(distinct substr(ad_code, 1, 2)) as num
  231. from bis_insp_sel_area
  232. where length(id) > 3
  233. <choose>
  234. <when test="province !=null and province !=''">
  235. and ad_code like '${province}%'
  236. </when>
  237. </choose>
  238. </select>
  239. <select id="getRsvrProCountList" resultMap="brief" parameterType="String">
  240. select a.code, b.pnm, a.num
  241. from (select t.id as code, count(distinct t.code) as num
  242. from (select substr(o.id, 1, 6) as id,
  243. substr(t.ad_code, 1, 2) as code,o.ad_code
  244. from BIS_INSP_RSVR_RGSTR t
  245. left join bis_insp_all_obj o
  246. on t.obj_id = o.obj_id
  247. where
  248. o.id not like '001016%'
  249. and o.id not like '001017%'
  250. <include refid="ochoseSql"/>
  251. and length(o.id) > 3
  252. <if test="state != null and state != ''">
  253. AND case when t.state is null then '0' else t.state end = #{state}
  254. </if>
  255. ) t
  256. group by t.id) a
  257. left join BIS_INSP_ALL b
  258. on a.code = b.id
  259. where 1=1
  260. <if test="orgName != null and orgName != ''">
  261. and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
  262. </if>
  263. order by to_number(a.code)
  264. </select>
  265. <select id="getRsvrCtCountList" resultMap="brief" parameterType="String">
  266. select a.code, b.pnm, a.num
  267. from (select t.id as code, count(distinct t.code) as num
  268. from (select substr(o.id, 1, 6) as id,
  269. substr(t.ad_code, 1, 6) as code,o.ad_code
  270. from BIS_INSP_RSVR_RGSTR t
  271. left join bis_insp_all_obj o
  272. on t.obj_id = o.obj_id
  273. where
  274. o.id not like '001016%'
  275. and o.id not like '001017%'
  276. and length(o.id) > 3
  277. <include refid="ochoseSql"/>
  278. <if test="state != null and state != ''">
  279. AND case when t.state is null then '0' else t.state end = #{state}
  280. </if>
  281. ) t
  282. group by t.id) a
  283. left join BIS_INSP_ALL b
  284. on a.code = b.id
  285. where 1=1
  286. <if test="orgName != null and orgName != ''">
  287. and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
  288. </if>
  289. order by to_number(a.code)
  290. </select>
  291. <select id="getWagaCtCountList" resultMap="brief" parameterType="String">
  292. select a.code, b.pnm, a.num
  293. from (select q.id as code, count(distinct q.code) as num
  294. from (select substr(o.id, 1, 6) as id,
  295. substr(t.ad_code, 1, 6) as code
  296. from ATT_WAGA_RGSTR t
  297. left join bis_insp_all_obj o
  298. on t.obj_id = o.obj_id
  299. where length(o.id) > 3
  300. <include refid="ochoseSql"/>
  301. <if test="state != null and state != ''">
  302. AND case when t.state is null then '0' else t.state end = #{state}
  303. </if>
  304. ) q
  305. group by q.id) a
  306. left join BIS_INSP_ALL b
  307. on a.code = b.id
  308. where 1=1
  309. <if test="orgName != null and orgName != ''">
  310. and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
  311. </if>
  312. order by to_number(a.code)
  313. </select>
  314. <select id="getEmpwtCtCountList" resultMap="brief" parameterType="String">
  315. select a.code, b.pnm, a.num
  316. from (select q.id as code, count(distinct q.code) as num
  317. from (select substr(o.id, 1, 6) as id,
  318. substr(t.ad_code, 1, 6) as code
  319. from BIS_INSP_KEY_REGISTER t
  320. left join bis_insp_all_obj o
  321. on t.obj_id = o.obj_id
  322. where length(o.id) > 3 and t.eng_sta = #{engSta}
  323. <include refid="ochoseSql"/>
  324. <if test="state != null and state != ''">
  325. AND case when t.state is null then '0' else t.state end = #{state}
  326. </if>
  327. ) q
  328. group by q.id) a
  329. left join BIS_INSP_ALL b
  330. on a.code = b.id
  331. where 1=1
  332. <if test="orgName != null and orgName != ''">
  333. and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
  334. </if>
  335. order by to_number(a.code)
  336. </select>
  337. <select id="getRsvrCountByType" resultType="int" parameterType="String">
  338. select count(*)
  339. from bis_insp_all_obj t
  340. left join att_rs_base b
  341. on t.code = b.rs_code
  342. where t.id not like '001016%'
  343. and t.id not like '001017%'
  344. and length(t.id) > 3
  345. and t.ptype = '1'
  346. <if test="eng_scal != null and eng_scal != ''">
  347. and b.eng_scal = #{eng_scal}
  348. </if>
  349. <include refid="choseSql"/>
  350. </select>
  351. <select id="getRsvrCountListByType" resultMap="brief" parameterType="String">
  352. select a.code, b.pnm, a.num
  353. from (select q.id as code, count(q.code) as num
  354. from (select substr(o.id, 1, 6) as id,
  355. substr(t.ad_code, 1, 6) as code,o.ad_code
  356. from BIS_INSP_RSVR_RGSTR t
  357. left join bis_insp_all_obj o
  358. on t.obj_id = o.obj_id
  359. where
  360. length(o.id) > 3
  361. <include refid="choseSql"/>
  362. <if test="state != null and state != ''">
  363. AND case when t.state is null then '0' else t.state end = #{state}
  364. </if>
  365. <if test="eng_scal != null and eng_scal != ''">
  366. and t.eng_scal = #{eng_scal}
  367. </if>
  368. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  369. AND t.INTM &gt;= TO_DATE(#{sttm},'YYYY-MM-DD') AND t.INTM &lt; TO_DATE(#{entm},'YYYY-MM-DD') + 1
  370. </if>
  371. ) q
  372. where 1=1 <include refid="qchose"/>
  373. group by q.id) a
  374. left join BIS_INSP_ALL b
  375. on a.code = b.id
  376. where 1=1
  377. <if test="orgName != null and orgName != ''">
  378. and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
  379. </if>
  380. order by to_number(a.code)
  381. </select>
  382. <sql id="qchose">
  383. <choose>
  384. <when test="province !=null and province !=''">
  385. and q.ad_code =#{province}
  386. </when>
  387. <otherwise>
  388. and q.ad_code is null
  389. </otherwise>
  390. </choose>
  391. </sql>
  392. <select id="getWagaCountListByType" resultMap="brief" parameterType="String">
  393. select a.code, b.pnm, a.num
  394. from (select q.id as code, count(q.code) as num
  395. from (select substr(o.id, 1, 6) as id,
  396. substr(t.ad_code, 1, 6) as code
  397. from ATT_WAGA_RGSTR t
  398. left join bis_insp_all_obj o
  399. on t.obj_id = o.obj_id
  400. where length(o.id) > 3
  401. <include refid="ochoseSql"/>
  402. <if test="engScal != null and engScal != ''">
  403. and t.eng_scal = #{engScal}
  404. </if>
  405. <if test='engScal == null'>
  406. and t.eng_scal IS NULL
  407. </if>
  408. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  409. AND t.INTM &gt;= TO_DATE(#{sttm},'YYYY-MM-DD') AND t.INTM &lt; TO_DATE(#{entm},'YYYY-MM-DD') + 1
  410. </if>
  411. <if test="state != null and state != ''">
  412. AND case when t.state is null then '0' else t.state end = #{state}
  413. </if>
  414. ) q
  415. group by q.id) a
  416. left join BIS_INSP_ALL b
  417. on a.code = b.id
  418. where 1=1
  419. <if test="orgName != null and orgName != ''">
  420. and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
  421. </if>
  422. order by to_number(a.code)
  423. </select>
  424. <select id="getEmpwtCountListByType" resultMap="brief" parameterType="String">
  425. select a.code, b.pnm, a.num
  426. from (select q.id as code, count(q.code) as num
  427. from (select substr(o.id, 1, 6) as id,
  428. substr(t.ad_code, 1, 6) as code
  429. from BIS_INSP_KEY_REGISTER t
  430. left join bis_insp_all_obj o
  431. on t.obj_id = o.obj_id
  432. where length(o.id) > 3
  433. and t.eng_sta = #{engSta}
  434. <include refid="ochoseSql"/>
  435. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  436. AND t.INTM &gt;= TO_DATE(#{sttm},'YYYY-MM-DD') AND t.INTM &lt; TO_DATE(#{entm},'YYYY-MM-DD') + 1
  437. </if>
  438. <if test="state != null and state != ''">
  439. AND case when t.state is null then '0' else t.state end = #{state}
  440. </if>
  441. ) q
  442. group by q.id) a
  443. left join BIS_INSP_ALL b
  444. on a.code = b.id
  445. where 1=1
  446. <if test="orgName != null and orgName != ''">
  447. and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
  448. </if>
  449. order by to_number(a.code)
  450. </select>
  451. <select id="getVillProCount" resultType="int" parameterType="String">
  452. select count(distinct substr(code, 1, 2)) as num
  453. from bis_insp_all_obj t
  454. where t.ptype = '2'
  455. <include refid="choseSql"/>
  456. </select>
  457. <select id="getVillProCountList" resultMap="brief" parameterType="String">
  458. select b.code, c.pnm, b.num
  459. from (select a.id as code, count(distinct a.code) as num
  460. from (select substr(id, 1, 6) as id, substr(code, 1, 2) as code
  461. from bis_insp_all_obj t
  462. where t.ptype = '2'
  463. <include refid="choseSql"/>
  464. and t.id not like '002%') a
  465. group by a.id) b
  466. left join BIS_INSP_ALL c
  467. on b.code = c.id
  468. where 1=1
  469. <if test="orgName != null and orgName != ''">
  470. and c.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
  471. </if>
  472. order by to_number(b.code)
  473. </select>
  474. <select id="getVillCtCount" resultType="int" parameterType="String">
  475. select count(distinct substr(code, 1, 6)) as num
  476. from bis_insp_all_obj t
  477. where t.ptype = '2'
  478. <include refid="choseSql"/>
  479. </select>
  480. <select id="getVillCtCountList" resultMap="brief" parameterType="String">
  481. select b.code, c.pnm, b.num
  482. from (select a.id as code, count(distinct a.code) as num
  483. from (select substr(id, 1, 6) as id, substr(code, 1, 6) as code
  484. from bis_insp_all_obj t
  485. where t.ptype = '2'
  486. <include refid="choseSql"/>
  487. and t.id not like '002011%') a
  488. group by a.id) b
  489. left join BIS_INSP_ALL c
  490. on b.code = c.id
  491. where 1=1
  492. <if test="orgName != null and orgName != ''">
  493. and c.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
  494. </if>
  495. order by to_number(b.code)
  496. </select>
  497. <select id="getVillVillCount" resultType="int" parameterType="String">
  498. select count(distinct t.village_code) as num
  499. from BIS_INSP_SECSURVEY_VLG t
  500. where 1=1
  501. <choose>
  502. <when test="province !=null and province !=''">
  503. and t.village_code like '${province}%'
  504. </when>
  505. </choose>
  506. </select>
  507. <select id="getVillVillCountList" resultMap="brief" parameterType="String">
  508. select q.code, w.pnm, q.num
  509. from (select substr(t.id, 1, 6) as code,
  510. count( t.village_code) as num
  511. from (select t.village_code, o.id, o.nm, o.code,o.ad_code
  512. from BIS_INSP_SECSURVEY_VLG t
  513. join BIS_INSP_VILL_RGSTR r
  514. on t.eng_id = r.eng_id
  515. join bis_insp_all_obj o
  516. on r.obj_id = o.obj_id
  517. WHERE 1 = 1
  518. <include refid="ochoseSql"/>
  519. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  520. AND t.CREATE_TIME &gt;= TO_DATE(#{sttm},'YYYY-MM-DD') AND t.CREATE_TIME &lt; TO_DATE(#{entm},'YYYY-MM-DD') + 1
  521. </if>
  522. <if test="state != null and state != ''">
  523. AND case when r.state is null then '0' ELSE r.state end = #{state}
  524. </if>
  525. ) t where 1=1
  526. group by substr(t.id, 1, 6)) q
  527. left join BIS_INSP_ALL w
  528. on q.code = w.id
  529. where 1=1
  530. <if test="orgName != null and orgName != ''">
  531. and w.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
  532. </if>
  533. order by to_number(q.code)
  534. </select>
  535. <select id="getVillPersCount" resultType="int" parameterType="String">
  536. select count(*)
  537. from BIS_INSP_WATERUSER_INFO a
  538. where 1=1
  539. <choose>
  540. <when test="province !=null and province !=''">
  541. and a.village_code like '${province}%'
  542. </when>
  543. </choose>
  544. </select>
  545. <select id="getVillPersCountList" resultMap="brief" parameterType="String">
  546. select q.code, w.pnm, q.num
  547. from (select substr(t.id, 1, 6) as code,
  548. count(t.village_code) as num
  549. from (select t.village_code, o.id, o.nm, o.code,o.ad_code
  550. from BIS_INSP_WATERUSER_INFO t
  551. join BIS_INSP_VILL_RGSTR r
  552. on t.eng_id = r.eng_id
  553. join bis_insp_all_obj o
  554. on r.obj_id = o.obj_id
  555. WHERE 1 = 1
  556. <include refid="ochoseSql"/>
  557. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  558. AND t.CREATE_TIME &gt;= TO_DATE(#{sttm},'YYYY-MM-DD') AND t.CREATE_TIME &lt; TO_DATE(#{entm},'YYYY-MM-DD') + 1
  559. </if>
  560. <if test="state != null and state != ''">
  561. AND case when r.state is null then '0' ELSE r.state end = #{state}
  562. </if>
  563. ) t where 1=1
  564. group by substr(t.id, 1, 6)) q
  565. left join BIS_INSP_ALL w
  566. on q.code = w.id
  567. where 1=1
  568. <if test="orgName != null and orgName != ''">
  569. and w.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
  570. </if>
  571. order by to_number(q.code)
  572. </select>
  573. <select id="getVillCwsCountList" resultMap="brief" parameterType="String">
  574. select q.code, w.pnm, q.num
  575. from (select substr(t.id, 1, 6) as code,
  576. count(t.CWS_CODE) as num
  577. from (select t.CWS_CODE, o.id, o.nm, o.code,o.ad_code
  578. from BIS_INSP_VLGDRINK_PROJ_MANAGE t
  579. join BIS_INSP_VILL_RGSTR r
  580. on t.eng_id = r.eng_id
  581. join bis_insp_all_obj o
  582. on r.obj_id = o.obj_id
  583. WHERE 1 = 1
  584. <include refid="ochoseSql"/>
  585. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  586. AND t.CREATE_TIME &gt;= TO_DATE(#{sttm},'YYYY-MM-DD') AND t.CREATE_TIME &lt; TO_DATE(#{entm},'YYYY-MM-DD') + 1
  587. </if>
  588. <if test="state != null and state != ''">
  589. AND case when r.state is null then '0' ELSE r.state end = #{state}
  590. </if>
  591. ) t where 1=1
  592. group by substr(t.id, 1, 6)) q
  593. left join BIS_INSP_ALL w
  594. on q.code = w.id
  595. where 1=1
  596. <if test="orgName != null and orgName != ''">
  597. and w.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
  598. </if>
  599. order by to_number(q.code)
  600. </select>
  601. <select id="getVillWaterCountList" resultMap="brief">
  602. select q.code, w.pnm, q.num
  603. from (select substr(t.id, 1, 6) as code,
  604. count(t.WATER_SOURCE_NM) as num
  605. from (select t.WATER_SOURCE_NM, o.id, o.nm, o.code,o.ad_code
  606. from BIS_INSP_PRO_SOURCE_PROTECT t
  607. join BIS_INSP_VILL_RGSTR r
  608. on t.eng_id = r.eng_id
  609. join bis_insp_all_obj o
  610. on r.obj_id = o.obj_id
  611. WHERE 1 = 1
  612. <include refid="ochoseSql"/>
  613. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  614. AND t.CREATE_TIME &gt;= TO_DATE(#{sttm},'YYYY-MM-DD') AND t.CREATE_TIME &lt; TO_DATE(#{entm},'YYYY-MM-DD') + 1
  615. </if>
  616. <if test="state != null and state != ''">
  617. AND case when r.state is null then '0' ELSE r.state end = #{state}
  618. </if>
  619. ) t where 1=1
  620. group by substr(t.id, 1, 6)) q
  621. left join BIS_INSP_ALL w
  622. on q.code = w.id
  623. where 1=1
  624. <if test="orgName != null and orgName != ''">
  625. and w.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
  626. </if>
  627. order by to_number(q.code)
  628. </select>
  629. <select id="getPblmCountList" resultMap="brief" parameterType="java.util.Map">
  630. select a.code, b.pnm, a.num
  631. from (select t.code, count(t.pblm_id) as num
  632. from (select substr(o.id, 1, 6) as code, t.pblm_id,o.ad_code
  633. from BIS_INSP_PBLM t
  634. join bis_insp_all_obj o
  635. on t.obj_id = o.obj_id
  636. left join
  637. <if test='objType == "1" or objType=="36"'>
  638. BIS_INSP_RSVR_RGSTR
  639. </if>
  640. <if test='objType == "2"'>
  641. BIS_INSP_VILL_RGSTR
  642. </if>
  643. <if test='objType == "3"'>
  644. BIS_INSP_WTDST_TRACK
  645. </if>
  646. <if test='objType == "4"'>
  647. BIS_INSP_KEY_REGISTER
  648. </if>
  649. <if test='objType == "6"'>
  650. ATT_WAGA_RGSTR
  651. </if>
  652. <if test='objType == "7"'>
  653. BIS_INSP_KEY_REGISTER
  654. </if>
  655. B ON t.OBJ_ID = B.OBJ_ID
  656. where 1=1
  657. <include refid="ochoseSql"/>
  658. <if test="sttm != null and sttm != ''">
  659. and t.coll_time &gt;= to_date(#{sttm}, 'yyyy-MM-dd')
  660. </if>
  661. <if test="entm != null and entm != ''">
  662. and t.coll_time &lt; to_date(#{entm}, 'yyyy-MM-dd') + 1
  663. </if>
  664. <if test="cate != null and cate != ''">
  665. and t.insp_pblm_cate = #{cate}
  666. </if>
  667. <if test="objType != null and objType != ''">
  668. and t.obj_type = #{objType}
  669. </if>
  670. <if test="stat != null and stat != ''">
  671. and t.PBLM_STAT = #{stat}
  672. </if>
  673. <if test="state != null and state != ''">
  674. AND case when B.state is null then '0' else B.state end = #{state}
  675. </if>
  676. ) t
  677. group by t.code) a
  678. left join BIS_INSP_ALL b
  679. on a.code = b.id
  680. where a.code is not null
  681. <if test="orgName != null and orgName != ''">
  682. and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
  683. </if>
  684. order by to_number(a.code)
  685. </select>
  686. <select id="getPblmCount" resultType="int" parameterType="java.util.Map">
  687. select count(*)
  688. from BIS_INSP_PBLM t,BIS_INSP_ALL_OBJ o
  689. where t.OBJ_ID=o.OBJ_ID
  690. <if test="sttm != null and sttm != ''">
  691. and t.coll_time &gt;= to_date(#{sttm}, 'yyyy-MM-dd')
  692. </if>
  693. <if test="entm != null and entm != ''">
  694. and t.coll_time &lt; to_date(#{entm}, 'yyyy-MM-dd') + 1
  695. </if>
  696. <if test="cate != null and cate != ''">
  697. and t.insp_pblm_cate = #{cate}
  698. </if>
  699. <if test="objType != null and objType != ''">
  700. and t.obj_type = #{objType}
  701. </if>
  702. <if test="stat != null and stat != ''">
  703. and t.PBLM_STAT = #{stat}
  704. </if>
  705. <include refid="ochoseSql"/>
  706. </select>
  707. <sql id="ochoseSql">
  708. <choose>
  709. <when test="province !=null and province !=''">
  710. and o.ad_code =#{province}
  711. </when>
  712. <otherwise>
  713. and o.ad_code is null
  714. </otherwise>
  715. </choose>
  716. </sql>
  717. <select id="getPblmList" resultType="java.util.Map" parameterType="java.util.Map">
  718. select c.ad_full_name, t.pblm_id,t.obj_id,t.obj_type,t.insp_pblm_code,t.insp_pblm_name,t.insp_pblm_desc,t.if_case_pblm,t.insp_pblm_cate,t.pblm_stat,t.data_stat,to_char(t.coll_time,'yyyy-MM-dd HH24') as coll_time,t.rec_pers,t.note,t.regid,t.pblms_id,t.pblms_type_id,t.vill_type,t.cws_code,t.village_code,to_char(d.file_path) as file_path
  719. from BIS_INSP_PBLM t
  720. join BIS_INSP_ALL_OBJ o
  721. on t.OBJ_ID=o.OBJ_ID
  722. left join att_ad_x_base c
  723. on t.village_code = c.ad_code
  724. LEFT JOIN (SELECT BIZ_ID, LISTAGG(FILE_PATH, ',') AS file_path
  725. FROM gw_com_file
  726. GROUP BY BIZ_ID) d
  727. on t.pblm_id = d.biz_id
  728. where 1=1
  729. <if test="sttm != null and sttm != ''">
  730. and t.coll_time &gt;= to_date(#{sttm}, 'yyyy-MM-dd')
  731. </if>
  732. <if test="entm != null and entm != ''">
  733. and t.coll_time &lt; to_date(#{entm}, 'yyyy-MM-dd') + 1
  734. </if>
  735. <if test="cate != null and cate != ''">
  736. and t.insp_pblm_cate = #{cate}
  737. </if>
  738. <if test="objType != null and objType != ''">
  739. and t.obj_type = #{objType}
  740. </if>
  741. <if test="stat != null and stat != ''">
  742. and t.PBLM_STAT = #{stat}
  743. </if>
  744. <if test="ifCase != null and ifCase != ''">
  745. and t.IF_CASE_PBLM = #{ifCase}
  746. </if>
  747. <if test="villType != null and villType != ''">
  748. and t.vill_type = #{villType}
  749. </if>
  750. <include refid="ochoseSql"/>
  751. </select>
  752. <!--省加单位-组-->
  753. <select id="getOrgProGroupList" resultMap="brief" parameterType="String">
  754. SELECT CONCAT(H.AD_CODE, '${zero}') AS AD_CODE,
  755. G.AD_NAME,
  756. H.ID AS CODE,
  757. E.PNM,
  758. H.NUM
  759. FROM (SELECT SUBSTR(F.AD_CODE, 1, ${length}) AS AD_CODE,
  760. SUBSTR(F.ID, 1, 6) AS ID,
  761. COUNT(DISTINCT F.ID) AS NUM
  762. FROM (SELECT J.ID,J.PNM,
  763. A.PTYPE,A.AD_CODE as province,
  764. <if test='type == "001" or type=="036"'>
  765. OB.ADM_DIV AS AD_CODE
  766. FROM BIS_INSP_ALL J
  767. LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
  768. left join ATT_RS_BASE OB ON A.CODE = OB.RS_CODE
  769. </if>
  770. <if test='type == "002"'>
  771. A.CODE AS AD_CODE
  772. FROM BIS_INSP_ALL J
  773. LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
  774. </if>
  775. <if test='type == "003"'>
  776. OB.LOC_AD AS AD_CODE
  777. FROM BIS_INSP_ALL J
  778. LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
  779. left join BIS_INSP_WTDST OB ON A.CODE = OB.WTDST_ID
  780. </if>
  781. <if test='type == "004"'>
  782. OB.AD_CODE AS AD_CODE
  783. FROM BIS_INSP_ALL J
  784. LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
  785. left join ATT_EMPWTPRJ_BASE OB ON A.CODE = OB.ID
  786. </if>
  787. <if test='type == "005"'>
  788. OB.ADCD AS AD_CODE
  789. FROM BIS_INSP_ALL J
  790. LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
  791. left join ATT_GRW_BASE OB ON A.CODE = OB.STCD
  792. </if>
  793. <if test='type == "006"'>
  794. OB.AD_CODE AS AD_CODE
  795. FROM BIS_INSP_ALL J
  796. LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
  797. left join ATT_WAGA_BASE OB ON A.CODE = OB.OBJ_CODE
  798. </if>
  799. <if test='type == "007"'>
  800. OB.AD_CODE AS AD_CODE
  801. FROM BIS_INSP_ALL J
  802. LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
  803. left join ATT_EMPWTPRJ_BASE OB ON A.CODE = OB.ID
  804. </if>
  805. <if test='type == "009"'>
  806. r.AD_CODE AS AD_CODE
  807. FROM BIS_INSP_ALL J
  808. LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
  809. LEFT JOIN BIS_INSP_FSC_RGSTR r ON r.OBJ_ID = A.OBJ_ID
  810. </if>
  811. <if test='type == "010"'>
  812. r.AD_CODE AS AD_CODE
  813. FROM BIS_INSP_ALL J
  814. LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
  815. LEFT JOIN BIS_INSP_OTHER_RGSTR r ON r.OBJ_ID = A.OBJ_ID
  816. </if>
  817. <if test='type == "011"'>
  818. r.AD_CODE AS AD_CODE
  819. FROM BIS_INSP_ALL J
  820. LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
  821. LEFT JOIN BIS_INSP_SD_RGSTR r ON r.OBJ_ID = A.OBJ_ID
  822. </if>
  823. <if test='type == "012"'>
  824. r.AD_CODE AS AD_CODE
  825. FROM BIS_INSP_ALL J
  826. LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
  827. LEFT JOIN BIS_INSP_WIU_RGSTR r ON r.OBJ_ID = A.OBJ_ID
  828. </if>
  829. <if test='type == "013"'>
  830. r.AD_CODE AS AD_CODE
  831. FROM BIS_INSP_ALL J
  832. LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
  833. LEFT JOIN BIS_INSP_SWHS_RGSTR r ON r.OBJ_ID = A.OBJ_ID
  834. </if>
  835. <if test='type == "014"'>
  836. r.AD_CODE AS AD_CODE
  837. FROM BIS_INSP_ALL J
  838. LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
  839. LEFT JOIN BIS_INSP_WINT_RGSTR r ON r.OBJ_ID = A.OBJ_ID
  840. </if>
  841. <if test='type == "015"'>
  842. r.AD_CODE AS AD_CODE
  843. FROM BIS_INSP_ALL J
  844. LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
  845. LEFT JOIN BIS_INSP_SVWT_AREA_RGSTR r ON r.OBJ_ID = A.OBJ_ID
  846. </if>
  847. <if test='type == "016"'>
  848. r.AD_CODE AS AD_CODE
  849. FROM BIS_INSP_ALL J
  850. LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
  851. LEFT JOIN BIS_INSP_SVWT_WUNT_RGSTR r ON r.OBJ_ID = A.OBJ_ID
  852. </if>
  853. WHERE LENGTH(J.ID) = 12
  854. <if test="type != null and type != ''">
  855. AND J.ID LIKE CONCAT(#{type}, '%')
  856. </if>
  857. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  858. AND J.STTM &gt;= TO_DATE(#{sttm},'YYYY-MM-DD') AND J.ENTM &lt; TO_DATE(#{entm},'YYYY-MM-DD') + 1
  859. </if>
  860. ) F where 1=1
  861. <include refid="fchose"/>
  862. GROUP BY SUBSTR(F.AD_CODE, 1, ${length}), SUBSTR(F.ID, 1, 6)) H
  863. LEFT JOIN BIS_INSP_ALL E
  864. ON H.ID = E.ID
  865. LEFT JOIN ATT_AD_X_BASE G
  866. ON CONCAT(H.AD_CODE, '${zero}') = G.AD_CODE
  867. where 1=1
  868. <if test="orgName != null and orgName != ''">
  869. and E.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
  870. </if>
  871. <if test="adName != null and adName != ''">
  872. and G.ad_name like CONCAT('%',CONCAT(#{adName}, '%'))
  873. </if>
  874. ORDER BY H.AD_CODE, H.ID
  875. </select>
  876. <!--省加单位-人-->
  877. <select id="getOrgProPersList" resultMap="brief" parameterType="String">
  878. SELECT CONCAT(H.AD_CODE, '${zero}') AS AD_CODE,
  879. G.AD_NAME,
  880. H.ID AS CODE,
  881. E.PNM,
  882. H.NUM
  883. FROM (SELECT SUBSTR(F.AD_CODE, 1, ${length}) AS AD_CODE,
  884. SUBSTR(F.ID, 1, 6) AS ID,
  885. COUNT(DISTINCT F.PERSID) AS NUM
  886. FROM (SELECT J.ID,
  887. A.PTYPE,J.PERSID,A.AD_CODE as province,
  888. <if test='type == "001" or type="036"'>
  889. OB.ADM_DIV AS AD_CODE
  890. FROM BIS_INSP_ALL_RLATION J
  891. LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
  892. left join ATT_RS_BASE OB ON A.CODE = OB.RS_CODE
  893. </if>
  894. <if test='type == "002"'>
  895. A.CODE AS AD_CODE
  896. FROM BIS_INSP_ALL_RLATION J
  897. LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
  898. </if>
  899. <if test='type == "003"'>
  900. OB.LOC_AD AS AD_CODE
  901. FROM BIS_INSP_ALL_RLATION J
  902. LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
  903. left join BIS_INSP_WTDST OB ON A.CODE = OB.WTDST_ID
  904. </if>
  905. <if test='type == "004"'>
  906. OB.AD_CODE AS AD_CODE
  907. FROM BIS_INSP_ALL_RLATION J
  908. LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
  909. left join ATT_EMPWTPRJ_BASE OB ON A.CODE = OB.ID
  910. </if>
  911. <if test='type == "005"'>
  912. OB.ADCD AS AD_CODE
  913. FROM BIS_INSP_ALL_RLATION J
  914. LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
  915. left join ATT_GRW_BASE OB ON A.CODE = OB.STCD
  916. </if>
  917. <if test='type == "006"'>
  918. OB.AD_CODE AS AD_CODE
  919. FROM BIS_INSP_ALL_RLATION J
  920. LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
  921. left join ATT_WAGA_BASE OB ON A.CODE = OB.OBJ_CODE
  922. </if>
  923. <if test='type == "007"'>
  924. OB.AD_CODE AS AD_CODE
  925. FROM BIS_INSP_ALL_RLATION J
  926. LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
  927. left join ATT_EMPWTPRJ_BASE OB ON A.CODE = OB.ID
  928. </if>
  929. <if test='type == "009"'>
  930. r.AD_CODE AS AD_CODE
  931. FROM BIS_INSP_ALL_RLATION J
  932. LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
  933. LEFT JOIN BIS_INSP_FSC_RGSTR r ON r.OBJ_ID = A.OBJ_ID
  934. </if>
  935. <if test='type == "010"'>
  936. r.AD_CODE AS AD_CODE
  937. FROM BIS_INSP_ALL_RLATION J
  938. LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
  939. LEFT JOIN BIS_INSP_OTHER_RGSTR r ON r.OBJ_ID = A.OBJ_ID
  940. </if>
  941. <if test='type == "011"'>
  942. r.AD_CODE AS AD_CODE
  943. FROM BIS_INSP_ALL_RLATION J
  944. LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
  945. LEFT JOIN BIS_INSP_SD_RGSTR r ON r.OBJ_ID = A.OBJ_ID
  946. </if>
  947. <if test='type == "012"'>
  948. r.AD_CODE AS AD_CODE
  949. FROM BIS_INSP_ALL_RLATION J
  950. LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
  951. LEFT JOIN BIS_INSP_WIU_RGSTR r ON r.OBJ_ID = A.OBJ_ID
  952. </if>
  953. <if test='type == "013"'>
  954. r.AD_CODE AS AD_CODE
  955. FROM BIS_INSP_ALL_RLATION J
  956. LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
  957. LEFT JOIN BIS_INSP_SWHS_RGSTR r ON r.OBJ_ID = A.OBJ_ID
  958. </if>
  959. <if test='type == "014"'>
  960. r.AD_CODE AS AD_CODE
  961. FROM BIS_INSP_ALL_RLATION J
  962. LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
  963. LEFT JOIN BIS_INSP_WINT_RGSTR r ON r.OBJ_ID = A.OBJ_ID
  964. </if>
  965. <if test='type == "015"'>
  966. r.AD_CODE AS AD_CODE
  967. FROM BIS_INSP_ALL_RLATION J
  968. LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
  969. LEFT JOIN BIS_INSP_SVWT_AREA_RGSTR r ON r.OBJ_ID = A.OBJ_ID
  970. </if>
  971. <if test='type == "016"'>
  972. r.AD_CODE AS AD_CODE
  973. FROM BIS_INSP_ALL_RLATION J
  974. LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
  975. LEFT JOIN BIS_INSP_SVWT_WUNT_RGSTR r ON r.OBJ_ID = A.OBJ_ID
  976. </if>
  977. WHERE LENGTH(J.ID) = 12
  978. <if test="type != null and type != ''">
  979. AND J.ID LIKE CONCAT(#{type}, '%')
  980. </if>
  981. ) F where 1=1
  982. <include refid="repeatSql"/>
  983. GROUP BY SUBSTR(F.AD_CODE, 1, ${length}), SUBSTR(F.ID, 1, 6)) H
  984. LEFT JOIN BIS_INSP_ALL E
  985. ON H.ID = E.ID
  986. LEFT JOIN ATT_AD_X_BASE G
  987. ON CONCAT(H.AD_CODE, '${zero}') = G.AD_CODE
  988. where 1=1
  989. <if test="orgName != null and orgName != ''">
  990. and e.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
  991. </if>
  992. <if test="adName != null and adName != ''">
  993. and G.ad_name like CONCAT('%',CONCAT(#{adName}, '%'))
  994. </if>
  995. order by to_number(G.ad_code),to_number(e.id)
  996. </select>
  997. <sql id="repeatSql">
  998. <choose>
  999. <when test="province !=null and province !=''">
  1000. and F.province =#{province}
  1001. </when>
  1002. <otherwise>
  1003. and F.province is null
  1004. </otherwise>
  1005. </choose>
  1006. </sql>
  1007. <!--省加单位-小水库-县-->
  1008. <select id="getOrgProCountryList" resultMap="brief" parameterType="String">
  1009. select ad.ad_code,ad.ad_name,a.code, b.pnm, a.num
  1010. from (select q.id as code,q.code as ad_code, count(distinct q.xian) as num
  1011. from (select substr(o.id, 1, 6) as id,
  1012. substr(t.ad_code, 1, ${length}) as code,substr(t.ad_code, 1, 6) as xian,o.ad_code
  1013. from BIS_INSP_RSVR_RGSTR t
  1014. left join bis_insp_all_obj o
  1015. on t.obj_id = o.obj_id
  1016. where length(o.id) > 3
  1017. <if test="state != null and state != ''">
  1018. AND case when t.state is null then '0' else t.state end = #{state}
  1019. </if>
  1020. ) q where 1=1
  1021. <include refid="qchose"/>
  1022. group by q.id,q.code) a
  1023. left join BIS_INSP_ALL b
  1024. on a.code = b.id
  1025. left join att_ad_base ad on concat(a.ad_code,'${zero}') = ad.ad_code
  1026. where 1=1
  1027. <if test="orgName != null and orgName != ''">
  1028. and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
  1029. </if>
  1030. <if test="adName != null and adName != ''">
  1031. and ad.ad_name like CONCAT('%',CONCAT(#{adName}, '%'))
  1032. </if>
  1033. order by to_number(ad.ad_code),to_number(a.code)
  1034. </select>
  1035. <!--省加单位-小水库-水库-->
  1036. <select id="getOrgProRsvrList" resultMap="brief" parameterType="String">
  1037. select ad.ad_code, ad.ad_name, a.code, b.pnm, a.num
  1038. from (select q.id as code,
  1039. q.code as ad_code,
  1040. count( q.rs_code) as num
  1041. from (select substr(o.id, 1, 6) as id,
  1042. substr(t.ad_code, 1, ${length}) as code,
  1043. t.rs_code,o.ad_code
  1044. from BIS_INSP_RSVR_RGSTR t
  1045. left join bis_insp_all_obj o
  1046. on t.obj_id = o.obj_id
  1047. where length(o.id) > 3
  1048. <if test="state != null and state != ''">
  1049. AND case when t.state is null then '0' else t.state end = #{state}
  1050. </if>
  1051. <if test="eng_scal != null and eng_scal != ''">
  1052. and t.eng_scal = #{eng_scal}
  1053. </if>
  1054. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  1055. AND t.INTM &gt;= TO_DATE(#{sttm},'YYYY-MM-DD') AND t.INTM &lt; TO_DATE(#{entm},'YYYY-MM-DD') + 1
  1056. </if>
  1057. ) q where 1=1 <include refid="qchose"/>
  1058. group by q.id, q.code) a
  1059. left join BIS_INSP_ALL b
  1060. on a.code = b.id
  1061. left join att_ad_base ad
  1062. on concat(a.ad_code, '${zero}') = ad.ad_code
  1063. where 1=1
  1064. <if test="orgName != null and orgName != ''">
  1065. and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
  1066. </if>
  1067. <if test="adName != null and adName != ''">
  1068. and ad.ad_name like CONCAT('%',CONCAT(#{adName}, '%'))
  1069. </if>
  1070. order by to_number(ad.ad_code),to_number(a.code)
  1071. </select>
  1072. <!--省加单位-水闸数量-->
  1073. <select id="getOrgProWagaList" resultMap="brief" parameterType="String">
  1074. select ad.ad_code, ad.ad_name, a.code, b.pnm, a.num
  1075. from (select q.id as code,
  1076. q.code as ad_code,
  1077. count( q.OBJ_code) as num
  1078. from (select substr(o.id, 1, 6) as id,
  1079. substr(t.ad_code, 1, 2) as code,
  1080. t.OBJ_code
  1081. from ATT_WAGA_RGSTR t
  1082. left join bis_insp_all_obj o
  1083. on t.obj_id = o.obj_id
  1084. where length(o.id) > 3
  1085. <include refid="ochoseSql"/>
  1086. <if test="state != null and state != ''">
  1087. AND case when t.state is null then '0' ELSE t.state end = #{state}
  1088. </if>
  1089. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  1090. AND t.INTM &gt;= TO_DATE(#{sttm},'YYYY-MM-DD') AND t.INTM &lt; TO_DATE(#{entm},'YYYY-MM-DD') + 1
  1091. </if>
  1092. <if test="engScal != null and engScal != ''">
  1093. and t.eng_scal = #{engScal}
  1094. </if>
  1095. <if test='engScal == null'>
  1096. AND t.eng_scal IS NULL
  1097. </if>
  1098. ) q
  1099. group by q.id, q.code) a
  1100. left join BIS_INSP_ALL b
  1101. on a.code = b.id
  1102. left join att_ad_base ad
  1103. on concat(a.ad_code, '0000000000') = ad.ad_code
  1104. where 1=1
  1105. <if test="orgName != null and orgName != ''">
  1106. and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
  1107. </if>
  1108. <if test="adName != null and adName != ''">
  1109. and ad.ad_name like CONCAT('%',CONCAT(#{adName}, '%'))
  1110. </if>
  1111. order by to_number(ad.ad_code),to_number(a.code)
  1112. </select>
  1113. <!--省加单位-问题列表-->
  1114. <select id="getOrgProPblmList" resultMap="brief" parameterType="String">
  1115. select AD.AD_CODE,AD.AD_NAME,a.code, b.pnm, a.num
  1116. from (select SUBSTR(Q.AD_CODE,1,${length}) AS AD_CODE,q.code, count(q.pblm_id) as num
  1117. from (select substr(o.id, 1, 6) as code,o.ad_code as province,t.pblm_id,
  1118. <if test='objType == "1" or objType=="36"'>
  1119. OB.ADM_DIV AS AD_CODE
  1120. from BIS_INSP_PBLM t
  1121. left join bis_insp_all_obj o
  1122. on t.obj_id = o.obj_id
  1123. left join ATT_RS_BASE OB ON O.CODE = OB.RS_CODE
  1124. LEFT JOIN BIS_INSP_RSVR_RGSTR B ON t.OBJ_ID = B.OBJ_ID
  1125. </if>
  1126. <if test='objType == "2"'>
  1127. o.CODE AS AD_CODE
  1128. from BIS_INSP_PBLM t
  1129. left join bis_insp_all_obj o
  1130. on t.obj_id = o.obj_id
  1131. LEFT JOIN BIS_INSP_VILL_RGSTR B ON t.OBJ_ID = B.OBJ_ID
  1132. </if>
  1133. <if test='objType == "3"'>
  1134. OB.LOC_AD AS AD_CODE
  1135. from BIS_INSP_PBLM t
  1136. left join bis_insp_all_obj o
  1137. on t.obj_id = o.obj_id
  1138. left join BIS_INSP_WTDST OB ON O.CODE = OB.WTDST_ID
  1139. LEFT JOIN BIS_INSP_WTDST_TRACK B ON t.OBJ_ID = B.OBJ_ID
  1140. </if>
  1141. <if test='objType == "4"'>
  1142. OB.AD_CODE AS AD_CODE
  1143. from BIS_INSP_PBLM t
  1144. left join bis_insp_all_obj o
  1145. on t.obj_id = o.obj_id
  1146. left join ATT_EMPWTPRJ_BASE OB ON O.CODE = OB.ID
  1147. LEFT JOIN BIS_INSP_KEY_REGISTER B ON t.OBJ_ID = B.OBJ_ID
  1148. </if>
  1149. <if test='objType == "5"'>
  1150. OB.ADCD AS AD_CODE
  1151. from BIS_INSP_PBLM t
  1152. left join bis_insp_all_obj o
  1153. on t.obj_id = o.obj_id
  1154. left join ATT_GRW_BASE OB ON O.CODE = OB.STCD
  1155. left join BIS_INSP_GRW B on t.obj_id = B.obj_id
  1156. </if>
  1157. <if test='objType == "6"'>
  1158. OB.AD_CODE AS AD_CODE
  1159. from BIS_INSP_PBLM t
  1160. left join bis_insp_all_obj o
  1161. on t.obj_id = o.obj_id
  1162. left join ATT_WAGA_BASE OB ON O.CODE = OB.OBJ_CODE
  1163. LEFT JOIN ATT_WAGA_RGSTR B ON t.OBJ_ID = B.OBJ_ID
  1164. </if>
  1165. <if test='objType == "7"'>
  1166. OB.AD_CODE AS AD_CODE
  1167. from BIS_INSP_PBLM t
  1168. left join bis_insp_all_obj o
  1169. on t.obj_id = o.obj_id
  1170. left join ATT_EMPWTPRJ_BASE OB ON O.CODE = OB.ID
  1171. LEFT JOIN BIS_INSP_KEY_REGISTER B ON t.OBJ_ID = B.OBJ_ID
  1172. </if>
  1173. where 1=1
  1174. <if test="objType != null and objType != ''">
  1175. and T.OBJ_TYPE = #{objType}
  1176. </if>
  1177. <if test="sttm != null and sttm != ''">
  1178. and t.coll_time &gt;= to_date(#{sttm}, 'yyyy-MM-dd')
  1179. </if>
  1180. <if test="entm != null and entm != ''">
  1181. and t.coll_time &lt; to_date(#{entm}, 'yyyy-MM-dd') + 1
  1182. </if>
  1183. <if test="cate != null and cate != ''">
  1184. and t.insp_pblm_cate = #{cate}
  1185. </if>
  1186. <if test="state != null and state != ''">
  1187. AND case when B.state is null then '0' ELSE B.state end = #{state}
  1188. </if>
  1189. ) q
  1190. where 1=1
  1191. <include refid="qchose"/>
  1192. and length(q.code)=6
  1193. group by SUBSTR(Q.AD_CODE,1,${length}),q.code) a
  1194. left join BIS_INSP_ALL b
  1195. on a.code = b.id
  1196. LEFT JOIN ATT_AD_X_BASE AD ON CONCAT(A.AD_CODE,'${zero}') = AD.AD_CODE
  1197. where a.code is not null
  1198. <if test="orgName != null and orgName != ''">
  1199. and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
  1200. </if>
  1201. <if test="adName != null and adName != ''">
  1202. and ad.ad_name like CONCAT('%',CONCAT(#{adName}, '%'))
  1203. </if>
  1204. order by to_number(a.AD_CODE),to_number(a.code)
  1205. </select>
  1206. <!--省加单位-水毁县数-->
  1207. <select id="getOrgProRectCountryList" resultMap="brief" parameterType="String">
  1208. select AD.AD_CODE,AD.AD_NAME,a.code, b.pnm, a.num
  1209. from (select SUBSTR(q.loc_ad,1,2) as ad_code,q.id as code, count(distinct q.code) as num
  1210. from (select b.loc_ad,substr(o.id, 1, 6) as id,
  1211. substr(b.loc_ad, 1, 6) as code
  1212. from BIS_INSP_WTDST_TRACK t
  1213. left join bis_insp_all_obj o
  1214. on t.obj_id = o.obj_id
  1215. left join BIS_INSP_WTDST b
  1216. on o.code = b.wtdst_id
  1217. where length(o.id) > 3
  1218. <include refid="ochoseSql"/>
  1219. <if test="state != null and state != ''">
  1220. AND case when t.state is null then '0' else t.state end = #{state}
  1221. </if>
  1222. ) q
  1223. group by SUBSTR(q.loc_ad,1,2),q.id) a
  1224. left join BIS_INSP_ALL b
  1225. on a.code = b.id
  1226. left join ATT_AD_X_BASE AD ON CONCAT(A.AD_CODE,'0000000000') = AD.AD_CODE
  1227. where 1=1
  1228. <if test="adName != null and adName != ''">
  1229. and AD.ad_name like CONCAT('%',CONCAT(#{adName}, '%'))
  1230. </if>
  1231. <if test="orgName != null and orgName != ''">
  1232. and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
  1233. </if>
  1234. order by TO_NUMBER(AD.AD_CODE),to_number(a.code)
  1235. </select>
  1236. <!--172重点工程县-->
  1237. <select id="getOrgProEmpwtCountryList" resultMap="brief" parameterType="String">
  1238. select AD.AD_CODE,AD.AD_NAME,a.code, b.pnm, a.num
  1239. from (select SUBSTR(q.AD_CODE,1,2) as ad_code,q.id as code, count(distinct q.code) as num
  1240. from (select b.AD_CODE,substr(o.id, 1, 6) as id,
  1241. substr(b.AD_CODE, 1, 6) as code
  1242. from BIS_INSP_KEY_REGISTER t
  1243. left join bis_insp_all_obj o
  1244. on t.obj_id = o.obj_id
  1245. left join ATT_EMPWTPRJ_BASE b
  1246. on o.code = b.ID
  1247. where length(o.id) > 3 AND b.ENG_STA = #{engSta}
  1248. <include refid="ochoseSql"/>
  1249. <if test="state != null and state != ''">
  1250. AND case when t.state is null then '0' else t.state end = #{state}
  1251. </if>
  1252. ) q
  1253. group by SUBSTR(q.AD_CODE,1,2),q.id) a
  1254. left join BIS_INSP_ALL b
  1255. on a.code = b.id
  1256. left join ATT_AD_X_BASE AD ON CONCAT(A.AD_CODE,'0000000000') = AD.AD_CODE
  1257. where 1=1
  1258. <if test="adName != null and adName != ''">
  1259. and AD.ad_name like CONCAT('%',CONCAT(#{adName}, '%'))
  1260. </if>
  1261. <if test="orgName != null and orgName != ''">
  1262. and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
  1263. </if>
  1264. order by TO_NUMBER(AD.AD_CODE),to_number(a.code)
  1265. </select>
  1266. <!--水闸&#45;&#45;县-->
  1267. <select id="getOrgProWagaCountryList" resultMap="brief" parameterType="String">
  1268. select AD.AD_CODE,AD.AD_NAME,a.code, b.pnm, a.num
  1269. from (select SUBSTR(q.AD_CODE,1,2) as ad_code,q.id as code, count(distinct q.code) as num
  1270. from (select b.AD_CODE,substr(o.id, 1, 6) as id,
  1271. substr(b.AD_CODE, 1, 6) as code
  1272. from ATT_WAGA_RGSTR t
  1273. left join bis_insp_all_obj o
  1274. on t.obj_id = o.obj_id
  1275. left join ATT_WAGA_BASE b
  1276. on o.code = b.OBJ_CODE
  1277. where length(o.id) > 3
  1278. <include refid="ochoseSql"/>
  1279. <if test="state != null and state != ''">
  1280. AND case when t.state is null then '0' ELSE t.state end = #{state}
  1281. </if>
  1282. ) q
  1283. group by SUBSTR(q.AD_CODE,1,2),q.id) a
  1284. left join BIS_INSP_ALL b
  1285. on a.code = b.id
  1286. left join ATT_AD_X_BASE AD ON CONCAT(A.AD_CODE,'0000000000') = AD.AD_CODE
  1287. where 1=1
  1288. <if test="adName != null and adName != ''">
  1289. and AD.ad_name like CONCAT('%',CONCAT(#{adName}, '%'))
  1290. </if>
  1291. <if test="orgName != null and orgName != ''">
  1292. and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
  1293. </if>
  1294. order by TO_NUMBER(AD.AD_CODE),to_number(a.code)
  1295. </select>
  1296. <!--省加单位-水毁项目数-->
  1297. <select id="getOrgProRectList" resultMap="brief" parameterType="String">
  1298. select AD.AD_CODE,AD.AD_NAME,a.code, b.pnm, a.num
  1299. from (select SUBSTR(q.loc_ad,1,2) as ad_code,q.id as code, count(*) as num
  1300. from (select b.loc_ad,substr(o.id, 1, 6) as id,
  1301. substr(b.loc_ad, 1, 6) as code
  1302. from BIS_INSP_WTDST_TRACK t
  1303. left join bis_insp_all_obj o
  1304. on t.obj_id = o.obj_id
  1305. left join BIS_INSP_WTDST b
  1306. on o.code = b.wtdst_id
  1307. where length(o.id) > 3
  1308. <include refid="ochoseSql"/>
  1309. <if test="state != null and state != ''">
  1310. AND case when t.state is null then '0' else t.state end = #{state}
  1311. </if>
  1312. ) q
  1313. group by SUBSTR(q.loc_ad,1,2),q.id) a
  1314. left join BIS_INSP_ALL b
  1315. on a.code = b.id
  1316. left join ATT_AD_X_BASE AD ON CONCAT(A.AD_CODE,'0000000000') = AD.AD_CODE
  1317. where 1=1
  1318. <if test="adName != null and adName != ''">
  1319. and AD.ad_name like CONCAT('%',CONCAT(#{adName}, '%'))
  1320. </if>
  1321. <if test="orgName != null and orgName != ''">
  1322. and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
  1323. </if>
  1324. order by TO_NUMBER(AD.AD_CODE),to_number(a.code)
  1325. </select>
  1326. <!--省加单位-172项目数-->
  1327. <select id="getOrgProEmpwtList" resultMap="brief" parameterType="String">
  1328. select AD.AD_CODE,AD.AD_NAME,a.code, b.pnm, a.num
  1329. from (select SUBSTR(q.AD_CODE,1,2) as ad_code,q.id as code, count(*) as num
  1330. from (select b.AD_CODE,substr(o.id, 1, 6) as id,
  1331. substr(b.AD_CODE, 1, 6) as code
  1332. from BIS_INSP_KEY_REGISTER t
  1333. left join bis_insp_all_obj o
  1334. on t.obj_id = o.obj_id
  1335. left join ATT_EMPWTPRJ_BASE b
  1336. on o.code = b.ID
  1337. where length(o.id) > 3 AND b.ENG_STA = #{engSta}
  1338. <include refid="ochoseSql"/>
  1339. <if test="state != null and state != ''">
  1340. AND case when t.state is null then '0' else t.state end = #{state}
  1341. </if>
  1342. ) q
  1343. group by SUBSTR(q.AD_CODE,1,2),q.id) a
  1344. left join BIS_INSP_ALL b
  1345. on a.code = b.id
  1346. left join ATT_AD_X_BASE AD ON CONCAT(A.AD_CODE,'0000000000') = AD.AD_CODE
  1347. where 1=1
  1348. <if test="adName != null and adName != ''">
  1349. and AD.ad_name like CONCAT('%',CONCAT(#{adName}, '%'))
  1350. </if>
  1351. <if test="orgName != null and orgName != ''">
  1352. and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
  1353. </if>
  1354. order by TO_NUMBER(AD.AD_CODE),to_number(a.code)
  1355. </select>
  1356. <select id="getOrgProVillCountryList" resultMap="brief" parameterType="String">
  1357. select AD.AD_CODE,AD.AD_NAME,b.code, c.pnm, b.num
  1358. from (select substr(a.code,1,2) as ad_code,a.id as code, count(distinct a.code) as num
  1359. from (select substr(id, 1, 6) as id, substr(code, 1, 6) as code
  1360. from bis_insp_all_obj t
  1361. LEFT JOIN BIS_INSP_VILL_RGSTR VR ON t.OBJ_ID = VR.OBJ_ID
  1362. WHERE 1 = 1
  1363. <include refid="choseSql"/>
  1364. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  1365. AND VR.INTM &gt;= TO_DATE(#{sttm},'YYYY-MM-DD') AND VR.INTM &lt; TO_DATE(#{entm},'YYYY-MM-DD') + 1
  1366. </if>
  1367. <if test="state != null and state != ''">
  1368. AND case when VR.state is null then '0' ELSE VR.state end = #{state}
  1369. </if>
  1370. AND t.ptype = '2') a
  1371. group by substr(a.code,1,2),a.id) b
  1372. left join BIS_INSP_ALL c
  1373. on b.code = c.id
  1374. left join ATT_AD_X_BASE AD ON CONCAT(B.AD_CODE,'0000000000') = AD.AD_CODE
  1375. where 1=1
  1376. <if test="adName != null and adName != ''">
  1377. and AD.ad_name like CONCAT('%',CONCAT(#{adName}, '%'))
  1378. </if>
  1379. <if test="orgName != null and orgName != ''">
  1380. and c.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
  1381. </if>
  1382. order by TO_NUMBER(AD.AD_CODE),to_number(b.code)
  1383. </select>
  1384. <select id="getOrgProVillVillList" resultMap="brief" parameterType="String">
  1385. select AD.AD_CODE,AD.AD_NAME,q.code, w.pnm, q.num
  1386. from (select substr(t.village_code, 1, 2) as AD_CODE,substr(t.id, 1, 6) as code,
  1387. count( t.village_code) as num
  1388. from (select t.village_code, o.id, o.nm, o.code,o.ad_code
  1389. from BIS_INSP_SECSURVEY_VLG t
  1390. left join BIS_INSP_VILL_RGSTR r
  1391. on t.eng_id = r.eng_id
  1392. left join bis_insp_all_obj o
  1393. on r.obj_id = o.obj_id
  1394. where 1=1
  1395. <include refid="ochoseSql"/>
  1396. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  1397. AND t.CREATE_TIME &gt;= TO_DATE(#{sttm},'YYYY-MM-DD') AND t.CREATE_TIME &lt; TO_DATE(#{entm},'YYYY-MM-DD') + 1
  1398. </if>
  1399. <if test="state != null and state != ''">
  1400. AND case when r.state is null then '0' ELSE r.state end = #{state}
  1401. </if>
  1402. ) t
  1403. group by substr(t.village_code, 1, 2),substr(t.id, 1, 6)) q
  1404. left join BIS_INSP_ALL w
  1405. on q.code = w.id
  1406. left join ATT_AD_X_BASE AD ON CONCAT(Q.AD_CODE,'0000000000') = AD.AD_CODE
  1407. where 1=1
  1408. <if test="adName != null and adName != ''">
  1409. and AD.ad_name like CONCAT('%',CONCAT(#{adName}, '%'))
  1410. </if>
  1411. <if test="orgName != null and orgName != ''">
  1412. and w.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
  1413. </if>
  1414. order by TO_NUMBER(AD.AD_CODE),to_number(q.code)
  1415. </select>
  1416. <select id="getOrgProVillPersList" resultMap="brief" parameterType="String">
  1417. select AD.AD_CODE,AD.AD_NAME,q.code, w.pnm, q.num
  1418. from (select substr(a.village_code, 1, 2) as AD_CODE,substr(a.id, 1, 6) as code,
  1419. count(a.village_code) as num
  1420. from (select t.village_code, o.id, o.nm, o.code,o.ad_code
  1421. from BIS_INSP_WATERUSER_INFO t
  1422. left join BIS_INSP_VILL_RGSTR r
  1423. on t.eng_id = r.eng_id
  1424. left join bis_insp_all_obj o
  1425. on r.obj_id = o.obj_id
  1426. where 1=1
  1427. <include refid="ochoseSql"/>
  1428. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  1429. AND t.CREATE_TIME &gt;= TO_DATE(#{sttm},'YYYY-MM-DD') AND t.CREATE_TIME &lt; TO_DATE(#{entm},'YYYY-MM-DD') + 1
  1430. </if>
  1431. <if test="state != null and state != ''">
  1432. AND case when r.state is null then '0' ELSE r.state end = #{state}
  1433. </if>
  1434. ) a
  1435. group by substr(a.village_code, 1, 2),substr(a.id, 1, 6)) q
  1436. left join BIS_INSP_ALL w
  1437. on q.code = w.id
  1438. left join ATT_AD_X_BASE AD ON CONCAT(Q.AD_CODE,'0000000000') = AD.AD_CODE
  1439. where 1=1
  1440. <if test="adName != null and adName != ''">
  1441. and AD.ad_name like CONCAT('%',CONCAT(#{adName}, '%'))
  1442. </if>
  1443. <if test="orgName != null and orgName != ''">
  1444. and w.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
  1445. </if>
  1446. order by TO_NUMBER(AD.AD_CODE),to_number(q.code)
  1447. </select>
  1448. <select id="getOrgProVillCwsList" resultMap="brief" parameterType="String">
  1449. select AD.AD_CODE,AD.AD_NAME,q.code, w.pnm, q.num
  1450. from (select substr(a.code, 1, 2) as AD_CODE,substr(a.id, 1, 6) as code,
  1451. count(a.CWS_CODE) as num
  1452. from (select t.CWS_CODE, o.id, o.nm, o.code
  1453. from BIS_INSP_VLGDRINK_PROJ_MANAGE t
  1454. left join BIS_INSP_VILL_RGSTR r
  1455. on t.eng_id = r.eng_id
  1456. left join bis_insp_all_obj o
  1457. on r.obj_id = o.obj_id
  1458. where 1=1
  1459. <include refid="ochoseSql"/>
  1460. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  1461. AND t.CREATE_TIME &gt;= TO_DATE(#{sttm},'YYYY-MM-DD') AND t.CREATE_TIME &lt; TO_DATE(#{entm},'YYYY-MM-DD') + 1
  1462. </if>
  1463. <if test="state != null and state != ''">
  1464. AND case when r.state is null then '0' ELSE r.state end = #{state}
  1465. </if>
  1466. ) a
  1467. group by substr(a.code, 1, 2),substr(a.id, 1, 6)) q
  1468. left join BIS_INSP_ALL w
  1469. on q.code = w.id
  1470. left join ATT_AD_X_BASE AD ON CONCAT(Q.AD_CODE,'0000000000') = AD.AD_CODE
  1471. where 1=1
  1472. <if test="adName != null and adName != ''">
  1473. and AD.ad_name like CONCAT('%',CONCAT(#{adName}, '%'))
  1474. </if>
  1475. <if test="orgName != null and orgName != ''">
  1476. and w.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
  1477. </if>
  1478. order by TO_NUMBER(AD.AD_CODE),to_number(q.code)
  1479. </select>
  1480. <select id="getOrgProVillWaterList" resultMap="brief">
  1481. select AD.AD_CODE,AD.AD_NAME,q.code, w.pnm, q.num
  1482. from (select substr(a.code, 1, 2) as ad_code,substr(a.id, 1, 6) as code,
  1483. count(a.WATER_SOURCE_NM) as num
  1484. from (select t.WATER_SOURCE_NM, o.id, o.nm, o.code
  1485. from BIS_INSP_PRO_SOURCE_PROTECT t
  1486. left join BIS_INSP_VILL_RGSTR r
  1487. on t.eng_id = r.eng_id
  1488. left join bis_insp_all_obj o
  1489. on r.obj_id = o.obj_id
  1490. where 1=1
  1491. <include refid="ochoseSql"/>
  1492. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  1493. AND t.CREATE_TIME &gt;= TO_DATE(#{sttm},'YYYY-MM-DD') AND t.CREATE_TIME &lt; TO_DATE(#{entm},'YYYY-MM-DD') + 1
  1494. </if>
  1495. <if test="state != null and state != ''">
  1496. AND case when r.state is null then '0' ELSE r.state end = #{state}
  1497. </if>
  1498. ) a
  1499. group by substr(a.code, 1, 2),substr(a.id, 1, 6)) q
  1500. left join BIS_INSP_ALL w
  1501. on q.code = w.id
  1502. left join ATT_AD_X_BASE AD ON CONCAT(Q.AD_CODE,'0000000000') = AD.AD_CODE
  1503. where 1=1
  1504. <if test="adName != null and adName != ''">
  1505. and AD.ad_name like CONCAT('%',CONCAT(#{adName}, '%'))
  1506. </if>
  1507. <if test="orgName != null and orgName != ''">
  1508. and w.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
  1509. </if>
  1510. order by TO_NUMBER(AD.AD_CODE),to_number(q.code)
  1511. </select>
  1512. <!--流域督查统计(农饮)-获取组id和组名称-->
  1513. <select id="getRiverSupervisionCwsCount" parameterType="cn.com.goldenwater.dcproj.param.BriefReportParam" resultType="cn.com.goldenwater.dcproj.dto.RiverSupervisionCwsCount">
  1514. select A.ID basinId,A.PNM basinName,C.ID groupId,C.PNM groupName from BIS_INSP_ALL A LEFT JOIN BIS_INSP_ALL B ON A.ID = B.PID
  1515. LEFT JOIN BIS_INSP_ALL C ON B.ID = C.PID WHERE 1 = 1
  1516. <if test="basinId != null and basinId != ''">
  1517. AND A.ID = #{basinId}
  1518. </if>
  1519. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  1520. AND C.STTM &gt;= TO_DATE(#{sttm},'YYYY-MM-DD') AND C.ENTM &lt; TO_DATE(#{entm},'YYYY-MM-DD') + 1
  1521. </if>
  1522. AND A.ID LIKE '002${orgId}'
  1523. ORDER BY A.ID
  1524. </select>
  1525. <select id="getRiverSupervisionWtdCount" parameterType="cn.com.goldenwater.dcproj.param.BriefReportParam" resultType="cn.com.goldenwater.dcproj.dto.RiverSupervisionWtdCount">
  1526. select A.ID basinId,A.PNM basinName,C.ID groupId,C.PNM groupName from BIS_INSP_ALL A LEFT JOIN BIS_INSP_ALL B ON A.ID = B.PID
  1527. LEFT JOIN BIS_INSP_ALL C ON B.ID = C.PID WHERE 1 = 1
  1528. <if test="basinId != null and basinId != ''">
  1529. AND A.ID = #{basinId}
  1530. </if>
  1531. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  1532. AND C.STTM &gt;= TO_DATE(#{sttm},'YYYY-MM-DD') AND C.ENTM &lt; TO_DATE(#{entm},'YYYY-MM-DD') + 1
  1533. </if>
  1534. AND A.ID LIKE '003${orgId}'
  1535. ORDER BY A.ID
  1536. </select>
  1537. <select id="getRsCountByGroupId" resultType="cn.com.goldenwater.dcproj.dto.PersCountDto">
  1538. SELECT A.ENG_SCAL as TYPE ,b.id,COUNT(A.RGSTR_ID) as count FROM BIS_INSP_RSVR_RGSTR A LEFT JOIN BIS_INSP_ALL_OBJ B ON A.OBJ_ID = B.OBJ_ID
  1539. WHERE B.ID in (${groupId}) AND B.PTYPE = '1'
  1540. <if test="state != null and state != ''">
  1541. AND case when A.state is null then '0' else A.state end = #{state}
  1542. </if>
  1543. group by a.eng_scal,b.id
  1544. </select>
  1545. <select id="getRiverSupervisionRivCount" parameterType="cn.com.goldenwater.dcproj.param.BriefReportParam" resultType="cn.com.goldenwater.dcproj.dto.RiverSupervisionRivCount">
  1546. select A.ID basinId,A.PNM basinName,C.ID groupId,C.PNM groupName from BIS_INSP_ALL A LEFT JOIN BIS_INSP_ALL B ON A.ID = B.PID
  1547. LEFT JOIN BIS_INSP_ALL C ON B.ID = C.PID WHERE 1 = 1
  1548. <if test="basinId != null and basinId != ''">
  1549. AND A.ID = #{basinId}
  1550. </if>
  1551. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  1552. AND C.STTM &gt;= TO_DATE(#{sttm},'YYYY-MM-DD') AND C.ENTM &lt; TO_DATE(#{entm},'YYYY-MM-DD') + 1
  1553. </if>
  1554. AND A.ID LIKE '001${orgId}'
  1555. ORDER BY A.ID
  1556. </select>
  1557. <select id="getRivCountyCountById" resultType="cn.com.goldenwater.dcproj.dto.PersCountDto">
  1558. SELECT t1.id,COUNT(AD.AD_NAME) as count FROM
  1559. (SELECT distinct b.id,SUBSTR(A.ADM_DIV,0,6) subAd FROM ATT_RS_BASE A LEFT JOIN BIS_INSP_ALL_OBJ B ON A.RS_CODE = B.CODE
  1560. WHERE B.PTYPE = '1' AND B.ID in (${groupId})) T1 LEFT JOIN ATT_AD_X_BASE AD ON
  1561. CONCAT(T1.subAd,'000000') = AD.AD_CODE
  1562. group by t1.id
  1563. </select>
  1564. <!--获取水库行政区划名称-->
  1565. <select id="getRivAdNameDtoListByGroupIds" resultType="cn.com.goldenwater.dcproj.dto.AdNameDto">
  1566. SELECT t1.id, AD.AD_NAME FROM
  1567. (SELECT distinct b.id,SUBSTR(A.AD_CODE,0,2) subAd FROM BIS_INSP_RSVR_RGSTR A LEFT JOIN BIS_INSP_ALL_OBJ B ON A.OBJ_ID =
  1568. B.OBJ_ID
  1569. WHERE B.PTYPE = '1' AND B.ID in (${groupId})) T1 LEFT JOIN ATT_AD_X_BASE AD ON
  1570. CONCAT(T1.subAd,'0000000000') = AD.AD_CODE
  1571. where length(t1.id) = 12
  1572. </select>
  1573. <select id="getRiverSupervisionEmpwtConCount" parameterType="cn.com.goldenwater.dcproj.param.BriefReportParam" resultType="cn.com.goldenwater.dcproj.dto.RiverSupervisionEmpwtCount">
  1574. select A.ID basinId,A.PNM basinName,C.ID groupId,C.PNM groupName from BIS_INSP_ALL A LEFT JOIN BIS_INSP_ALL B ON A.ID = B.PID
  1575. LEFT JOIN BIS_INSP_ALL C ON B.ID = C.PID WHERE 1 = 1
  1576. <if test="basinId != null and basinId != ''">
  1577. AND A.ID = #{basinId}
  1578. </if>
  1579. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  1580. AND C.STTM &gt;= TO_DATE(#{sttm},'YYYY-MM-DD') AND C.ENTM &lt; TO_DATE(#{entm},'YYYY-MM-DD') + 1
  1581. </if>
  1582. AND A.ID LIKE '004${orgId}'
  1583. ORDER BY A.ID
  1584. </select>
  1585. <select id="getRiverSupervisionEmpwtRunCount" parameterType="cn.com.goldenwater.dcproj.param.BriefReportParam" resultType="cn.com.goldenwater.dcproj.dto.RiverSupervisionEmpwtCount">
  1586. select A.ID basinId,A.PNM basinName,C.ID groupId,C.PNM groupName from BIS_INSP_ALL A LEFT JOIN BIS_INSP_ALL B ON A.ID = B.PID
  1587. LEFT JOIN BIS_INSP_ALL C ON B.ID = C.PID WHERE 1 = 1
  1588. <if test="basinId != null and basinId != ''">
  1589. AND A.ID = #{basinId}
  1590. </if>
  1591. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  1592. AND C.STTM &gt;= TO_DATE(#{sttm},'YYYY-MM-DD') AND C.ENTM &lt; TO_DATE(#{entm},'YYYY-MM-DD') + 1
  1593. </if>
  1594. AND A.ID LIKE '007___'
  1595. ORDER BY A.ID
  1596. </select>
  1597. <select id="getRiverSupervisionWagaCount" parameterType="cn.com.goldenwater.dcproj.param.BriefReportParam" resultType="cn.com.goldenwater.dcproj.dto.RiverSupervisionWagaCount">
  1598. select A.ID basinId,A.PNM basinName,C.ID groupId,C.PNM groupName from BIS_INSP_ALL A LEFT JOIN BIS_INSP_ALL B ON A.ID = B.PID
  1599. LEFT JOIN BIS_INSP_ALL C ON B.ID = C.PID WHERE 1 = 1
  1600. <if test="basinId != null and basinId != ''">
  1601. AND A.ID = #{basinId}
  1602. </if>
  1603. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  1604. AND C.STTM &gt;= TO_DATE(#{sttm},'YYYY-MM-DD') AND C.ENTM &lt; TO_DATE(#{entm},'YYYY-MM-DD') + 1
  1605. </if>
  1606. AND A.ID LIKE '006___'
  1607. ORDER BY A.ID
  1608. </select>
  1609. <!--获取农饮行政区划名称-->
  1610. <select id="getCwsAdNameDtoList" resultType="cn.com.goldenwater.dcproj.dto.AdNameDto">
  1611. SELECT AD.AD_NAME FROM
  1612. (SELECT SUBSTR(A.AD_CODE,0,2) subAd FROM ATT_AD_X_BASE A LEFT JOIN BIS_INSP_ALL_OBJ t ON A.AD_CODE = t.CODE
  1613. WHERE t.PTYPE = '2'
  1614. <include refid="choseSql"/>
  1615. AND t.ID = #{groupId} GROUP BY SUBSTR(A.AD_CODE,0,2)) T1 LEFT JOIN ATT_AD_X_BASE AD ON CONCAT(T1.subAd,'0000000000') = AD.AD_CODE
  1616. </select>
  1617. <!--获取水库行政区划名称-->
  1618. <select id="getRivAdNameDtoList" resultType="cn.com.goldenwater.dcproj.dto.AdNameDto">
  1619. SELECT AD.AD_NAME FROM
  1620. (SELECT SUBSTR(A.AD_CODE,0,2) subAd FROM BIS_INSP_RSVR_RGSTR A LEFT JOIN BIS_INSP_ALL_OBJ t ON A.OBJ_ID = t.OBJ_ID
  1621. WHERE t.PTYPE = '1' AND t.ID = #{groupId}
  1622. <include refid="choseSql"/>
  1623. GROUP BY SUBSTR(A.AD_CODE,0,2)) T1 LEFT JOIN ATT_AD_X_BASE AD ON CONCAT(T1.subAd,'0000000000') = AD.AD_CODE
  1624. </select>
  1625. <!--获取水闸行政区划名称-->
  1626. <select id="getWagaAdNameDtoList" resultType="cn.com.goldenwater.dcproj.dto.AdNameDto">
  1627. SELECT AD.AD_NAME FROM
  1628. (SELECT SUBSTR(A.AD_CODE,0,2) subAd FROM ATT_WAGA_BASE A LEFT JOIN BIS_INSP_ALL_OBJ B ON A.OBJ_CODE = B.CODE
  1629. WHERE B.PTYPE = '6' AND B.ID = #{groupId} GROUP BY SUBSTR(A.AD_CODE,0,2)) T1 LEFT JOIN ATT_AD_X_BASE AD ON CONCAT(T1.subAd,'0000000000') = AD.AD_CODE
  1630. </select>
  1631. <!--获取172重点工程行政区划名称-->
  1632. <select id="getEmpwtAdNameDtoList" resultType="cn.com.goldenwater.dcproj.dto.AdNameDto">
  1633. SELECT AD.AD_NAME FROM
  1634. (SELECT SUBSTR(A.AD_CODE,0,2) subAd FROM ATT_EMPWTPRJ_BASE A LEFT JOIN BIS_INSP_ALL_OBJ t ON A.ID = t.CODE
  1635. WHERE t.PTYPE = #{type} AND B.ID = #{groupId}
  1636. <include refid="choseSql"/>
  1637. GROUP BY SUBSTR(A.AD_CODE,0,2)) T1
  1638. LEFT JOIN ATT_AD_X_BASE AD ON CONCAT(T1.subAd,'0000000000') = AD.AD_CODE
  1639. </select>
  1640. <!--获取水毁行政区划名称-->
  1641. <select id="getWtdAdNameDtoList" resultType="cn.com.goldenwater.dcproj.dto.AdNameDto">
  1642. SELECT AD.AD_NAME FROM
  1643. (SELECT SUBSTR(A.LOC_AD,0,2) subAd FROM BIS_INSP_WTDST A LEFT JOIN BIS_INSP_ALL_OBJ t ON A.WTDST_ID = t.CODE
  1644. WHERE t.PTYPE = '3'
  1645. <include refid="choseSql"/>
  1646. AND t.ID = #{groupId} GROUP BY SUBSTR(A.LOC_AD,0,2)) T1 LEFT JOIN ATT_AD_X_BASE AD ON CONCAT(T1.subAd,'0000000000') = AD.AD_CODE
  1647. </select>
  1648. <select id="getPersCount" resultType="Integer">
  1649. SELECT COUNT(PERSID) FROM BIS_INSP_ALL_RLATION t WHERE ID = #{groupId}
  1650. <include refid="choseSql"/>
  1651. </select>
  1652. <select id="getCwsCountyCount" resultType="Integer">
  1653. SELECT COUNT(AD.AD_NAME) FROM
  1654. (SELECT SUBSTR(A.AD_CODE,0,6) subAd FROM ATT_AD_X_BASE A LEFT JOIN BIS_INSP_ALL_OBJ t ON A.AD_CODE = t.CODE
  1655. WHERE t.PTYPE = '2'
  1656. <include refid="choseSql"/>
  1657. AND t.ID = #{groupId} GROUP BY SUBSTR(A.AD_CODE,0,6)) T1 LEFT JOIN ATT_AD_X_BASE AD ON CONCAT(T1.subAd,'000000') = AD.AD_CODE
  1658. </select>
  1659. <select id="getRivCountyCount" resultType="Integer">
  1660. SELECT COUNT(AD.AD_NAME) FROM
  1661. (SELECT SUBSTR(A.ADM_DIV,0,6) subAd FROM ATT_RS_BASE A LEFT JOIN BIS_INSP_ALL_OBJ t ON A.RS_CODE = t.CODE
  1662. WHERE t.PTYPE = '1'
  1663. <include refid="choseSql"/>
  1664. AND t.ID = #{groupId} GROUP BY SUBSTR(A.ADM_DIV,0,6)) T1 LEFT JOIN ATT_AD_X_BASE AD ON CONCAT(T1.subAd,'000000') = AD.AD_CODE
  1665. </select>
  1666. <select id="getWtdCountyCount" resultType="Integer">
  1667. SELECT COUNT(AD.AD_NAME) FROM
  1668. (SELECT SUBSTR(A.LOC_AD,0,6) subAd FROM BIS_INSP_WTDST A LEFT JOIN BIS_INSP_ALL_OBJ o ON A.WTDST_ID = o.CODE
  1669. LEFT JOIN BIS_INSP_WTDST_TRACK T ON o.OBJ_ID = T.OBJ_ID
  1670. WHERE o.PTYPE = '3' AND o.ID = #{groupId}
  1671. <include refid="ochoseSql"/>
  1672. <if test="state != null and state != ''">
  1673. AND case when t.state is null then '0' else t.state end = #{state}
  1674. </if>
  1675. GROUP BY SUBSTR(A.LOC_AD,0,6)) T1 LEFT JOIN ATT_AD_X_BASE AD ON CONCAT(T1.subAd,'000000') = AD.AD_CODE
  1676. </select>
  1677. <select id="getVillageCount" resultType="Integer">
  1678. SELECT COUNT(A.ENG_ID)
  1679. FROM
  1680. <if test='type == "1"'>
  1681. BIS_INSP_SECSURVEY_VLG
  1682. </if>
  1683. <if test='type == "2"'>
  1684. BIS_INSP_WATERUSER_INFO
  1685. </if>
  1686. <if test='type == "3"'>
  1687. BIS_INSP_VLGDRINK_PROJ_MANAGE
  1688. </if>
  1689. <if test='type == "4"'>
  1690. BIS_INSP_PRO_SOURCE_PROTECT
  1691. </if>
  1692. A LEFT JOIN BIS_INSP_VILL_RGSTR B ON A.ENG_ID = B.ENG_ID
  1693. LEFT JOIN BIS_INSP_ALL_OBJ t ON B.OBJ_ID = t.OBJ_ID
  1694. WHERE t.PTYPE = '2' AND t.ID = #{groupId}
  1695. <include refid="choseSql"/>
  1696. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  1697. AND A.CREATE_TIME &gt;= TO_DATE(#{sttm},'YYYY-MM-DD') AND A.CREATE_TIME &lt; TO_DATE(#{entm},'YYYY-MM-DD') + 1
  1698. </if>
  1699. <if test="state != null and state != ''">
  1700. AND case when B.state is null then '0' else B.state end = #{state}
  1701. </if>
  1702. </select>
  1703. <select id="getAllProCount" resultType="Integer">
  1704. select COUNT(PBLM_ID) cateCount from BIS_INSP_PBLM A LEFT JOIN BIS_INSP_ALL_OBJ t ON A.OBJ_ID = t.OBJ_ID
  1705. <if test='type == "1"'>
  1706. LEFT JOIN BIS_INSP_RSVR_RGSTR C ON A.OBJ_ID = C.OBJ_ID
  1707. </if>
  1708. <if test='type == "2"'>
  1709. LEFT JOIN BIS_INSP_VILL_RGSTR C ON A.OBJ_ID = C.OBJ_ID
  1710. </if>
  1711. <if test='type == "3"'>
  1712. LEFT JOIN BIS_INSP_WTDST_TRACK C ON A.OBJ_ID = C.OBJ_ID
  1713. </if>
  1714. <if test='type == "4"'>
  1715. LEFT JOIN BIS_INSP_KEY_REGISTER C ON A.OBJ_ID = C.OBJ_ID
  1716. </if>
  1717. <if test='type == "6"'>
  1718. LEFT JOIN ATT_WAGA_RGSTR C ON A.OBJ_ID = C.OBJ_ID
  1719. </if>
  1720. <if test='type == "7"'>
  1721. LEFT JOIN BIS_INSP_KEY_REGISTER C ON A.OBJ_ID = C.OBJ_ID
  1722. </if>
  1723. WHERE t.PTYPE = #{type} AND t.ID = #{groupId} AND A.OBJ_TYPE = #{type}
  1724. <include refid="choseSql"/>
  1725. AND INSP_PBLM_CATE = #{pblmType}
  1726. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  1727. AND A.COLL_TIME &gt;= TO_DATE(#{sttm},'YYYY-MM-DD') AND A.COLL_TIME &lt; TO_DATE(#{entm},'YYYY-MM-DD') + 1
  1728. </if>
  1729. <if test="state != null and state != '' and type != null and type != ''">
  1730. AND case when C.state is null then '0' ELSE C.state end = #{state}
  1731. </if>
  1732. </select>
  1733. <select id="getRsCount" resultType="Integer">
  1734. SELECT COUNT(A.RGSTR_ID) FROM BIS_INSP_RSVR_RGSTR A LEFT JOIN BIS_INSP_ALL_OBJ t ON A.OBJ_ID = t.OBJ_ID
  1735. WHERE t.ID = #{groupId} AND t.PTYPE = '1' AND A.ENG_SCAL = #{engScal}
  1736. <include refid="choseSql"/>
  1737. <if test="state != null and state != ''">
  1738. AND case when A.state is null then '0' else A.state end = #{state}
  1739. </if>
  1740. </select>
  1741. <select id="getWagaCount" resultType="Integer">
  1742. SELECT COUNT(A.OBJ_CODE) FROM ATT_WAGA_RGSTR A LEFT JOIN BIS_INSP_ALL_OBJ t ON A.OBJ_ID = t.OBJ_ID
  1743. WHERE t.ID = #{groupId} AND t.PTYPE = '6'
  1744. <include refid="choseSql"/>
  1745. <if test="engScal != null and engScal != ''">
  1746. AND A.ENG_SCAL = #{engScal}
  1747. </if>
  1748. <if test='engScal == null'>
  1749. AND A.ENG_SCAL IS NULL
  1750. </if>
  1751. <if test="state != null and state != ''">
  1752. AND case when A.state is null then '0' else A.state end = #{state}
  1753. </if>
  1754. </select>
  1755. <select id="getWtdCount" resultType="Integer">
  1756. SELECT COUNT(A.WTDST_ID) FROM BIS_INSP_WTDST A LEFT JOIN BIS_INSP_ALL_OBJ O ON A.WTDST_ID = O.CODE
  1757. LEFT JOIN BIS_INSP_KEY_REGISTER T ON O.OBJ_ID = T.OBJ_ID
  1758. WHERE O.ID = #{groupId} AND O.PTYPE = '3'
  1759. <include refid="ochoseSql"/>
  1760. <if test="state != null and state != ''">
  1761. AND case when t.state is null then '0' else t.state end = #{state}
  1762. </if>
  1763. </select>
  1764. <select id="getRiverNode" resultType="cn.com.goldenwater.dcproj.model.RiverNode">
  1765. SELECT ID ,PNM FROM BIS_INSP_ALL WHERE 1 = 1
  1766. <if test='type == "1" '>
  1767. AND PID = '001'
  1768. <if test="province !=null and province !=''">
  1769. AND ID like '001${orgId}%'
  1770. </if>
  1771. </if>
  1772. <if test='type == "36" '>
  1773. AND PID = '036'
  1774. <if test="province !=null and province !=''">
  1775. AND ID like '036${orgId}%'
  1776. </if>
  1777. </if>
  1778. <if test='type == "2"'>
  1779. AND PID = '002'
  1780. <if test="province !=null and province !=''">
  1781. AND ID like '002${orgId}%'
  1782. </if>
  1783. </if>
  1784. <if test='type == "3"'>
  1785. AND PID = '003'
  1786. <if test="province !=null and province !=''">
  1787. AND ID like '003${orgId}%'
  1788. </if>
  1789. </if>
  1790. <if test='type == "4"'>
  1791. AND PID = '004'
  1792. <if test="province !=null and province !=''">
  1793. AND ID like '004${orgId}%'
  1794. </if>
  1795. </if>
  1796. <if test='type == "5"'>
  1797. AND PID = '005'
  1798. <if test="province !=null and province !=''">
  1799. AND ID like '005${orgId}%'
  1800. </if>
  1801. </if>
  1802. <if test='type == "6"'>
  1803. AND PID = '006'
  1804. <if test="province !=null and province !=''">
  1805. AND ID like '006${orgId}%'
  1806. </if>
  1807. </if>
  1808. <if test='type == "7"'>
  1809. AND PID = '007'
  1810. <if test="province !=null and province !=''">
  1811. AND ID like '007${orgId}%'
  1812. </if>
  1813. </if>
  1814. <if test='type == "8"'>
  1815. AND PID = '008'
  1816. </if>
  1817. <if test='type == "9"'>
  1818. AND PID = '009'
  1819. </if>
  1820. <if test='type == "10"'>
  1821. AND PID = '010'
  1822. </if>
  1823. ORDER BY ID
  1824. </select>
  1825. <select id="getNmByPersid" parameterType="String" resultType="cn.com.goldenwater.dcproj.dto.ObjectNameDto">
  1826. SELECT A.id,A.PNM name FROM BIS_INSP_ALL A LEFT JOIN BIS_INSP_ALL_RLATION B ON A.ID = B.ID
  1827. WHERE B.PERSID = #{persid} AND A.ID LIKE '001%'
  1828. <choose>
  1829. <when test="province !=null and province !=''">
  1830. AND B.ad_code like '${province}%'
  1831. </when>
  1832. <otherwise>
  1833. AND B.ad_code is null
  1834. </otherwise>
  1835. </choose>
  1836. </select>
  1837. <select id="getbigNmByPersid" parameterType="String" resultType="cn.com.goldenwater.dcproj.dto.ObjectNameDto">
  1838. SELECT A.id,A.PNM name FROM BIS_INSP_ALL A LEFT JOIN BIS_INSP_ALL_RLATION B ON A.ID = B.ID
  1839. WHERE B.PERSID = #{persid} AND A.ID LIKE '036%'
  1840. <choose>
  1841. <when test="province !=null and province !=''">
  1842. AND B.ad_code like '${province}%'
  1843. </when>
  1844. <otherwise>
  1845. AND B.ad_code is null
  1846. </otherwise>
  1847. </choose>
  1848. </select>
  1849. <select id="getOrgName" parameterType="String" resultType="cn.com.goldenwater.dcproj.dto.ObjectNameDto">
  1850. SELECT ID,PNM name FROM BIS_INSP_ALL WHERE ID = #{substring}
  1851. </select>
  1852. <select id="getEmpwtCount" resultType="Integer">
  1853. SELECT COUNT(o.OBJ_ID) FROM BIS_INSP_ALL_OBJ o
  1854. LEFT JOIN BIS_INSP_KEY_REGISTER r on o.obj_id = r.obj_id
  1855. WHERE o.ID = #{groupId}
  1856. <include refid="ochoseSql"/>
  1857. <if test="state != null and state != ''">
  1858. AND case when r.state is null then '0' else r.state end = #{state}
  1859. </if>
  1860. </select>
  1861. <select id="getAdCodeByType" resultType="cn.com.goldenwater.dcproj.model.BriefReport">
  1862. SELECT CONCAT(H.AD_CODE, '${zero}') AS AD_CODE,
  1863. G.AD_NAME,
  1864. H.ID AS CODE,
  1865. E.PNM
  1866. FROM (SELECT SUBSTR(F.AD_CODE, 1, ${length}) AS AD_CODE,
  1867. SUBSTR(F.ID, 1, 6) AS ID,
  1868. COUNT(DISTINCT F.ID) AS NUM
  1869. FROM (SELECT J.ID,J.PNM,
  1870. A.PTYPE,A.AD_CODE as province,
  1871. <if test='type == "001" or type=="036"'>
  1872. OB.AD_CODE AS AD_CODE
  1873. FROM BIS_INSP_ALL J
  1874. LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
  1875. left join BIS_INSP_RSVR_RGSTR OB ON A.OBJ_ID = OB.OBJ_ID
  1876. </if>
  1877. <if test='type == "002"'>
  1878. A.CODE AS AD_CODE
  1879. FROM BIS_INSP_ALL J
  1880. LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
  1881. </if>
  1882. <if test='type == "003"'>
  1883. OB.LOC_AD AS AD_CODE
  1884. FROM BIS_INSP_ALL J
  1885. LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
  1886. left join BIS_INSP_WTDST OB ON A.CODE = OB.WTDST_ID
  1887. </if>
  1888. <if test='type == "004"'>
  1889. OB.AD_CODE AS AD_CODE
  1890. FROM BIS_INSP_ALL J
  1891. LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
  1892. left join ATT_EMPWTPRJ_BASE OB ON A.CODE = OB.ID
  1893. </if>
  1894. <if test='type == "005"'>
  1895. OB.ADCD AS AD_CODE
  1896. FROM BIS_INSP_ALL J
  1897. LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
  1898. left join ATT_GRW_BASE OB ON A.CODE = OB.STCD
  1899. </if>
  1900. <if test='type == "006"'>
  1901. OB.AD_CODE AS AD_CODE
  1902. FROM BIS_INSP_ALL J
  1903. LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
  1904. left join ATT_WAGA_RGSTR OB ON A.OBJ_ID = OB.OBJ_ID
  1905. </if>
  1906. <if test='type == "007"'>
  1907. OB.AD_CODE AS AD_CODE
  1908. FROM BIS_INSP_ALL J
  1909. LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
  1910. left join ATT_EMPWTPRJ_BASE OB ON A.CODE = OB.ID
  1911. </if>
  1912. <if test='type == "009"'>
  1913. r.AD_CODE AS AD_CODE
  1914. FROM BIS_INSP_ALL J
  1915. LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
  1916. LEFT JOIN BIS_INSP_FSC_RGSTR r ON r.OBJ_ID = A.OBJ_ID
  1917. </if>
  1918. <if test='type == "010"'>
  1919. r.AD_CODE AS AD_CODE
  1920. FROM BIS_INSP_ALL J
  1921. LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
  1922. LEFT JOIN BIS_INSP_OTHER_RGSTR r ON r.OBJ_ID = A.OBJ_ID
  1923. </if>
  1924. <if test='type == "011"'>
  1925. r.AD_CODE AS AD_CODE
  1926. FROM BIS_INSP_ALL J
  1927. LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
  1928. LEFT JOIN BIS_INSP_SD_RGSTR r ON r.OBJ_ID = A.OBJ_ID
  1929. </if>
  1930. <if test='type == "012"'>
  1931. r.AD_CODE AS AD_CODE
  1932. FROM BIS_INSP_ALL J
  1933. LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
  1934. LEFT JOIN BIS_INSP_WIU_RGSTR r ON r.OBJ_ID = A.OBJ_ID
  1935. </if>
  1936. <if test='type == "013"'>
  1937. r.AD_CODE AS AD_CODE
  1938. FROM BIS_INSP_ALL J
  1939. LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
  1940. LEFT JOIN BIS_INSP_SWHS_RGSTR r ON r.OBJ_ID = A.OBJ_ID
  1941. </if>
  1942. <if test='type == "014"'>
  1943. r.AD_CODE AS AD_CODE
  1944. FROM BIS_INSP_ALL J
  1945. LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
  1946. LEFT JOIN BIS_INSP_WINT_RGSTR r ON r.OBJ_ID = A.OBJ_ID
  1947. </if>
  1948. <if test='type == "015"'>
  1949. r.AD_CODE AS AD_CODE
  1950. FROM BIS_INSP_ALL J
  1951. LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
  1952. LEFT JOIN BIS_INSP_SVWT_AREA_RGSTR r ON r.OBJ_ID = A.OBJ_ID
  1953. </if>
  1954. <if test='type == "016"'>
  1955. r.AD_CODE AS AD_CODE
  1956. FROM BIS_INSP_ALL J
  1957. LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
  1958. LEFT JOIN BIS_INSP_SVWT_WUNT_RGSTR r ON r.OBJ_ID = A.OBJ_ID
  1959. </if>
  1960. WHERE LENGTH(J.ID) = 12
  1961. <if test="type != null and type != ''">
  1962. AND J.ID LIKE CONCAT(#{type}, '%')
  1963. </if>
  1964. ) F where 1=1
  1965. <include refid="fchose"/>
  1966. GROUP BY SUBSTR(F.AD_CODE, 1, ${length}), SUBSTR(F.ID, 1, 6)) H
  1967. LEFT JOIN BIS_INSP_ALL E
  1968. ON H.ID = E.ID
  1969. LEFT JOIN ATT_AD_X_BASE G
  1970. ON CONCAT(H.AD_CODE, '${zero}') = G.AD_CODE
  1971. where 1=1
  1972. <if test="orgName != null and orgName != ''">
  1973. and E.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
  1974. </if>
  1975. <if test="adName != null and adName != ''">
  1976. and G.ad_name like CONCAT('%',CONCAT(#{adName}, '%'))
  1977. </if>
  1978. ORDER BY H.AD_CODE, H.ID
  1979. </select>
  1980. <sql id="fchose">
  1981. <choose>
  1982. <when test="province !=null and province !=''">
  1983. AND F.province=#{province}
  1984. </when>
  1985. <otherwise>
  1986. AND F.province is null
  1987. </otherwise>
  1988. </choose>
  1989. </sql>
  1990. <sql id="qchosepro">
  1991. <choose>
  1992. <when test="province !=null and province !=''">
  1993. AND q.province=#{province}
  1994. </when>
  1995. <otherwise>
  1996. AND q.province is null
  1997. </otherwise>
  1998. </choose>
  1999. </sql>
  2000. <select id="getRiverPersSupervisionInfo" parameterType="cn.com.goldenwater.dcproj.param.BriefReportParam" resultType="cn.com.goldenwater.dcproj.dto.RiverSupervisionRivCount">
  2001. SELECT B.GUID persId,B.PERS_NAME persName,B.ORG_ID basinId,B.ORG_NM basinName FROM
  2002. (SELECT DISTINCT PERSID FROM BIS_INSP_ALL_RLATION t
  2003. WHERE ID LIKE '001%'
  2004. <include refid="choseSql"/>
  2005. ) A LEFT JOIN BIS_INSP_ALL_RLATION_PERS B
  2006. ON A.PERSID = B.GUID
  2007. WHERE B.GUID IS NOT NULL
  2008. <if test="basinId != null and basinId != ''">
  2009. AND CONCAT(#{type},B.ORG_ID) = #{basinId}
  2010. </if>
  2011. <if test="persName != null and persName != ''">
  2012. AND B.PERS_NAME LIKE '%${persName}%'
  2013. </if>
  2014. </select>
  2015. <select id="getPersAdFullNameDtoList" parameterType="String" resultType="cn.com.goldenwater.dcproj.dto.AdNameDto">
  2016. SELECT AD.AD_FULL_NAME adName
  2017. FROM (select DISTINCT A.AD_CODE AD_CODE
  2018. from BIS_INSP_SEL_AREA A
  2019. LEFT JOIN BIS_INSP_ALL_RLATION B
  2020. ON A.ID = B.ID
  2021. WHERE B.PERSID = #{persId} AND A.AD_CODE LIKE '${province}%') T
  2022. LEFT JOIN ATT_AD_X_BASE AD
  2023. ON T.AD_CODE = AD.AD_CODE
  2024. WHERE AD.AD_CODE IS NOT NULL
  2025. </select>
  2026. <select id="getPersRsCount" resultType="Integer">
  2027. SELECT count(C.RGSTR_ID) FROM BIS_INSP_RSVR_RGSTR C,BIS_INSP_ALL_OBJ t
  2028. WHERE C.OBJ_ID=T.OBJ_ID and C.REC_PERS_ID = #{persId} AND C.ENG_SCAL = #{engScal}
  2029. <include refid="choseSql"/>
  2030. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  2031. AND C.INTM &gt;= TO_DATE(#{sttm},'YYYY-MM-DD') AND C.INTM &lt; TO_DATE(#{entm},'YYYY-MM-DD') + 1
  2032. </if>
  2033. <if test="state != null and state != ''">
  2034. AND case when C.state is null then '0' else C.state end = #{state}
  2035. </if>
  2036. </select>
  2037. <select id="getPersAllProCount" resultType="Integer">
  2038. SELECT count(A.PBLM_ID) FROM BIS_INSP_PBLM A join BIS_INSP_ALL_OBJ t
  2039. on A.OBJ_ID=t.OBJ_ID
  2040. <if test='type == "1" or type=="36"'>
  2041. LEFT JOIN BIS_INSP_RSVR_RGSTR B ON A.OBJ_ID = B.OBJ_ID
  2042. </if>
  2043. <if test='type == "2"'>
  2044. LEFT JOIN BIS_INSP_VILL_RGSTR B ON A.OBJ_ID = B.OBJ_ID
  2045. </if>
  2046. <if test='type == "3"'>
  2047. LEFT JOIN BIS_INSP_WTDST_TRACK B ON A.OBJ_ID = B.OBJ_ID
  2048. </if>
  2049. <if test='type == "4"'>
  2050. LEFT JOIN BIS_INSP_KEY_REGISTER B ON A.OBJ_ID = B.OBJ_ID
  2051. </if>
  2052. <if test='type == "6"'>
  2053. LEFT JOIN ATT_WAGA_RGSTR B ON A.OBJ_ID = B.OBJ_ID
  2054. </if>
  2055. <if test='type == "7"'>
  2056. LEFT JOIN BIS_INSP_KEY_REGISTER B ON A.OBJ_ID = B.OBJ_ID
  2057. </if>
  2058. WHERE A.OBJ_TYPE = #{type} AND A.INSP_PBLM_CATE = #{s} AND A.REC_PERS = #{persId}
  2059. <include refid="choseSql"/>
  2060. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  2061. AND A.COLL_TIME &gt;= TO_DATE(#{sttm},'YYYY-MM-DD') AND A.COLL_TIME &lt; TO_DATE(#{entm},'YYYY-MM-DD') + 1
  2062. </if>
  2063. <if test="state != null and state != '' and type != null and type != ''">
  2064. AND case when B.state is null then '0' ELSE B.state end = #{state}
  2065. </if>
  2066. </select>
  2067. <select id="getRiverPersSupervisionCwsInfo" parameterType="cn.com.goldenwater.dcproj.param.BriefReportParam" resultType="cn.com.goldenwater.dcproj.dto.RiverSupervisionCwsCount">
  2068. SELECT B.GUID persId,B.PERS_NAME persName,B.ORG_ID basinId,B.ORG_NM basinName FROM
  2069. (SELECT DISTINCT PERSID FROM BIS_INSP_ALL_RLATION
  2070. WHERE ID LIKE '002%') A LEFT JOIN BIS_INSP_ALL_RLATION_PERS B
  2071. ON A.PERSID = B.GUID
  2072. WHERE B.GUID IS NOT NULL
  2073. <if test="basinId != null and basinId != ''">
  2074. AND CONCAT(#{type},B.ORG_ID) = #{basinId}
  2075. </if>
  2076. <if test="persName != null and persName != ''">
  2077. AND B.PERS_NAME LIKE '%${persName}%'
  2078. </if>
  2079. </select>
  2080. <select id="getPersVillageCount" resultType="Integer">
  2081. SELECT COUNT(*) FROM
  2082. <if test='type == "1" or type =="36"'>
  2083. BIS_INSP_SECSURVEY_VLG A
  2084. </if>
  2085. <if test='type == "2"'>
  2086. BIS_INSP_WATERUSER_INFO A
  2087. </if>
  2088. <if test='type == "3"'>
  2089. BIS_INSP_VLGDRINK_PROJ_MANAGE A
  2090. </if>
  2091. <if test='type == "4"'>
  2092. BIS_INSP_PRO_SOURCE_PROTECT A
  2093. </if>
  2094. LEFT JOIN BIS_INSP_VILL_RGSTR B ON A.ENG_ID = B.ENG_ID
  2095. WHERE A.REC_PERS_ID = #{persId}
  2096. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  2097. AND A.CREATE_TIME &gt;= TO_DATE(#{sttm},'YYYY-MM-DD') AND A.CREATE_TIME &lt; TO_DATE(#{entm},'YYYY-MM-DD') + 1
  2098. </if>
  2099. <if test="state != null and state != ''">
  2100. AND case when B.state is null then '0' else B.state end = #{state}
  2101. </if>
  2102. </select>
  2103. <select id="getPersRiverSupervisionWtdInfo" parameterType="cn.com.goldenwater.dcproj.param.BriefReportParam" resultType="cn.com.goldenwater.dcproj.dto.RiverSupervisionWtdCount">
  2104. SELECT B.GUID persId,B.PERS_NAME persName,B.ORG_ID basinId,B.ORG_NM basinName FROM
  2105. (SELECT DISTINCT PERSID FROM BIS_INSP_ALL_RLATION
  2106. WHERE ID LIKE '003%') A LEFT JOIN BIS_INSP_ALL_RLATION_PERS B
  2107. ON A.PERSID = B.GUID
  2108. WHERE B.GUID IS NOT NULL
  2109. <if test="basinId != null and basinId != ''">
  2110. AND CONCAT(#{type},B.ORG_ID) = #{basinId}
  2111. </if>
  2112. <if test="persName != null and persName != ''">
  2113. AND B.PERS_NAME LIKE '%${persName}%'
  2114. </if>
  2115. </select>
  2116. <select id="getPersWtdCount" parameterType="String" resultType="Integer">
  2117. SELECT count(TRACK_ID) FROM BIS_INSP_WTDST_TRACK
  2118. WHERE REC_PERS_ID = #{persId}
  2119. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  2120. AND INTM &gt;= TO_DATE(#{sttm},'YYYY-MM-DD') AND INTM &lt; TO_DATE(#{entm},'YYYY-MM-DD') + 1
  2121. </if>
  2122. <if test="state != null and state != ''">
  2123. AND case when state is null then '0' else state end = #{state}
  2124. </if>
  2125. </select>
  2126. <select id="getPersRiverSupervisionEmpwtConCount" parameterType="cn.com.goldenwater.dcproj.param.BriefReportParam" resultType="cn.com.goldenwater.dcproj.dto.RiverSupervisionEmpwtCount">
  2127. SELECT B.GUID persId,B.PERS_NAME persName,B.ORG_ID basinId,B.ORG_NM basinName FROM
  2128. (SELECT DISTINCT PERSID FROM BIS_INSP_ALL_RLATION
  2129. WHERE ID LIKE '004%') A LEFT JOIN BIS_INSP_ALL_RLATION_PERS B
  2130. ON A.PERSID = B.GUID
  2131. WHERE B.GUID IS NOT NULL
  2132. <if test="basinId != null and basinId != ''">
  2133. AND CONCAT(#{type},B.ORG_ID) = #{basinId}
  2134. </if>
  2135. <if test="persName != null and persName != ''">
  2136. AND B.PERS_NAME LIKE '%${persName}%'
  2137. </if>
  2138. </select>
  2139. <select id="getPersEmpwtCount" resultType="Integer">
  2140. SELECT COUNT(ID) FROM BIS_INSP_KEY_REGISTER r ,BIS_INSP_ALL_OBJ t
  2141. WHERE r.obj_id=t.obj_id and r.REC_PERS_ID = #{persId}
  2142. <include refid="choseSql"/>
  2143. AND ENG_STA = #{engSta}
  2144. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  2145. AND r.INTM &gt;= TO_DATE(#{sttm},'YYYY-MM-DD') AND r.INTM &lt; TO_DATE(#{entm},'YYYY-MM-DD') + 1
  2146. </if>
  2147. <if test="state != null and state != ''">
  2148. AND case when r.state is null then '0' else r.state end = #{state}
  2149. </if>
  2150. </select>
  2151. <select id="getPersRiverSupervisionEmpwtRunCount" parameterType="cn.com.goldenwater.dcproj.param.BriefReportParam" resultType="cn.com.goldenwater.dcproj.dto.RiverSupervisionEmpwtCount">
  2152. SELECT B.GUID persId,B.PERS_NAME persName,B.ORG_ID basinId,B.ORG_NM basinName FROM
  2153. (SELECT DISTINCT PERSID FROM BIS_INSP_ALL_RLATION
  2154. WHERE ID LIKE '007%') A LEFT JOIN BIS_INSP_ALL_RLATION_PERS B
  2155. ON A.PERSID = B.GUID
  2156. WHERE B.GUID IS NOT NULL
  2157. <if test="basinId != null and basinId != ''">
  2158. AND CONCAT(#{type},B.ORG_ID) = #{basinId}
  2159. </if>
  2160. <if test="persName != null and persName != ''">
  2161. AND B.PERS_NAME LIKE '%${persName}%'
  2162. </if>
  2163. </select>
  2164. <select id="getPersRiverSupervisionWagaCount" parameterType="cn.com.goldenwater.dcproj.param.BriefReportParam" resultType="cn.com.goldenwater.dcproj.dto.RiverSupervisionWagaCount">
  2165. SELECT B.GUID persId,B.PERS_NAME persName,B.ORG_ID basinId,B.ORG_NM basinName FROM
  2166. (SELECT DISTINCT PERSID FROM BIS_INSP_ALL_RLATION
  2167. WHERE ID LIKE '006%') A LEFT JOIN BIS_INSP_ALL_RLATION_PERS B
  2168. ON A.PERSID = B.GUID
  2169. WHERE B.GUID IS NOT NULL
  2170. <if test="basinId != null and basinId != ''">
  2171. AND CONCAT(#{type},B.ORG_ID) = #{basinId}
  2172. </if>
  2173. <if test="persName != null and persName != ''">
  2174. AND B.PERS_NAME LIKE '%${persName}%'
  2175. </if>
  2176. </select>
  2177. <select id="getPersWagaCount" resultType="Integer">
  2178. SELECT COUNT(ID) FROM ATT_WAGA_RGSTR r,BIS_INSP_ALL_OBJ t
  2179. WHERE r.obj_id=t.obj_id and r.PERS_ID = #{persId}
  2180. <include refid="choseSql"/>
  2181. <if test="engScal != null and engScal != ''">
  2182. AND r.ENG_SCAL = #{engScal}
  2183. </if>
  2184. <if test='engScal == null'>
  2185. AND r.ENG_SCAL IS NULL
  2186. </if>
  2187. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  2188. AND r.INTM &gt;= TO_DATE(#{sttm},'YYYY-MM-DD') AND r.INTM &lt; TO_DATE(#{entm},'YYYY-MM-DD') + 1
  2189. </if>
  2190. <if test="state != null and state != ''">
  2191. AND case when r.state is null then '0' else r.state end = #{state}
  2192. </if>
  2193. </select>
  2194. <select id="getPersCountById" resultType="cn.com.goldenwater.dcproj.dto.PersCountDto">
  2195. SELECT id,COUNT(PERSID) as count FROM BIS_INSP_ALL_RLATION WHERE ID in (${groupId}) group By Id
  2196. </select>
  2197. <select id="getCwsAdNameDtoListByGroupIds" resultType="cn.com.goldenwater.dcproj.dto.AdNameDto">
  2198. SELECT t1.id, AD.AD_NAME FROM
  2199. (SELECT distinct b.id,SUBSTR(A.AD_CODE,0,2) subAd FROM ATT_AD_X_BASE A LEFT JOIN BIS_INSP_ALL_OBJ B ON A.AD_CODE = B.CODE
  2200. WHERE B.PTYPE = '2' AND B.ID in (${groupId})) T1 LEFT JOIN ATT_AD_X_BASE AD ON
  2201. CONCAT(T1.subAd,'0000000000') = AD.AD_CODE
  2202. where length(t1.id) = 12
  2203. </select>
  2204. <select id="getCwsCountyCountById" resultType="cn.com.goldenwater.dcproj.dto.PersCountDto">
  2205. SELECT t1.id,COUNT(AD.AD_NAME) as count FROM
  2206. (SELECT distinct b.id,SUBSTR(A.AD_CODE,0,6) subAd FROM ATT_AD_X_BASE A LEFT JOIN BIS_INSP_ALL_OBJ B ON A.AD_CODE = B.CODE
  2207. WHERE B.PTYPE = '2' AND B.ID in (${groupId}) ) T1 LEFT JOIN ATT_AD_X_BASE AD ON
  2208. CONCAT(T1.subAd,'000000') = AD.AD_CODE
  2209. group by t1.id
  2210. </select>
  2211. <select id="getVillageCountByGroupId" resultType="cn.com.goldenwater.dcproj.dto.PersCountDto">
  2212. select A.type,C.id,count(*) as count from (
  2213. select '1' as type,A.ENG_ID from BIS_INSP_SECSURVEY_VLG A
  2214. union all
  2215. select '2' as type,A.ENG_ID from BIS_INSP_WATERUSER_INFO A
  2216. union all
  2217. select '3' as type,A.ENG_ID from BIS_INSP_VLGDRINK_PROJ_MANAGE A
  2218. union all
  2219. select '4' as type,A.ENG_ID from BIS_INSP_PRO_SOURCE_PROTECT A
  2220. ) A LEFT JOIN BIS_INSP_VILL_RGSTR B ON A.ENG_ID = B.ENG_ID
  2221. LEFT JOIN BIS_INSP_ALL_OBJ C ON B.OBJ_ID = C.OBJ_ID
  2222. where c.ptype = '2' and c.id in (${groupId})
  2223. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  2224. AND B.intm &gt;= TO_DATE(#{sttm},'YYYY-MM-DD') AND t.uptm &lt; TO_DATE(#{entm},'YYYY-MM-DD') +
  2225. 1
  2226. </if>
  2227. <if test="state != null and state != ''">
  2228. AND case when B.state is null then '0' else B.state end = #{state}
  2229. </if>
  2230. group by A.type,C.id
  2231. </select>
  2232. <select id="getAllProCountByGroupId" resultType="cn.com.goldenwater.dcproj.dto.PersCountDto">
  2233. select a.INSP_PBLM_CATE as type,b.id,COUNT(PBLM_ID) count from BIS_INSP_PBLM A LEFT JOIN BIS_INSP_ALL_OBJ B ON A.OBJ_ID = B.OBJ_ID
  2234. <if test='type == "1" and type=="36"'>
  2235. LEFT JOIN BIS_INSP_RSVR_RGSTR C ON A.OBJ_ID = C.OBJ_ID
  2236. </if>
  2237. <if test='type == "2"'>
  2238. LEFT JOIN BIS_INSP_VILL_RGSTR C ON A.OBJ_ID = C.OBJ_ID
  2239. </if>
  2240. <if test='type == "3"'>
  2241. LEFT JOIN BIS_INSP_WTDST_TRACK C ON A.OBJ_ID = C.OBJ_ID
  2242. </if>
  2243. <if test='type == "4"'>
  2244. LEFT JOIN BIS_INSP_KEY_REGISTER C ON A.OBJ_ID = C.OBJ_ID
  2245. </if>
  2246. <if test='type == "6"'>
  2247. LEFT JOIN ATT_WAGA_RGSTR C ON A.OBJ_ID = C.OBJ_ID
  2248. </if>
  2249. <if test='type == "7"'>
  2250. LEFT JOIN BIS_INSP_KEY_REGISTER C ON A.OBJ_ID = C.OBJ_ID
  2251. </if>
  2252. <if test='type == "11"'>
  2253. LEFT JOIN BIS_INSP_SD_RGSTR C ON A.OBJ_ID = C.OBJ_ID
  2254. </if>
  2255. <if test='type == "12"'>
  2256. LEFT JOIN BIS_INSP_WIU_RGSTR C ON A.OBJ_ID = C.OBJ_ID
  2257. </if>
  2258. <if test='type == "13"'>
  2259. LEFT JOIN BIS_INSP_SWHS_RGSTR C ON A.OBJ_ID = C.OBJ_ID
  2260. </if>
  2261. <if test='type == "14"'>
  2262. LEFT JOIN BIS_INSP_WINT_RGSTR C ON A.OBJ_ID = C.OBJ_ID
  2263. </if>
  2264. <if test='type == "15"'>
  2265. LEFT JOIN BIS_INSP_SVWT_AREA_RGSTR C ON A.OBJ_ID = C.OBJ_ID
  2266. </if>
  2267. <if test='type == "16"'>
  2268. LEFT JOIN BIS_INSP_SVWT_WUNT_RGSTR C ON A.OBJ_ID = C.OBJ_ID
  2269. </if>
  2270. WHERE B.PTYPE = #{type} AND B.ID in (${groupId}) AND A.OBJ_TYPE = #{type}
  2271. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  2272. AND A.COLL_TIME &gt;= TO_DATE(#{sttm},'YYYY-MM-DD') AND A.COLL_TIME &lt; TO_DATE(#{entm},'YYYY-MM-DD') + 1
  2273. </if>
  2274. <if test="state != null and state != '' and type != null and type != ''">
  2275. AND case when C.state is null then '0' ELSE C.state end = #{state}
  2276. </if>
  2277. group by a.INSP_PBLM_CATE,b.id
  2278. </select>
  2279. <select id="getPersRsCountByPersIds" resultType="cn.com.goldenwater.dcproj.dto.PersCountDto">
  2280. SELECT c.REC_PERS_ID as id,c.eng_scal as type,count(C.RGSTR_ID) as count FROM BIS_INSP_RSVR_RGSTR C
  2281. where c.REC_PERS_ID is not null and c.REC_PERS_ID in (${persId})
  2282. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  2283. AND C.INTM &gt;= TO_DATE(#{sttm},'YYYY-MM-DD') AND C.INTM &lt; TO_DATE(#{entm},'YYYY-MM-DD') + 1
  2284. </if>
  2285. <if test="state != null and state != ''">
  2286. AND case when C.state is null then '0' else C.state end = #{state}
  2287. </if>
  2288. group by c.REC_PERS_ID,c.eng_scal
  2289. </select>
  2290. <select id="getPersAdFullNameDtoListByPersIds" parameterType="String" resultType="cn.com.goldenwater.dcproj.dto.AdNameDto">
  2291. SELECT t.id,AD.AD_FULL_NAME adName
  2292. FROM (select DISTINCT b.persId ID,A.AD_CODE AD_CODE
  2293. from BIS_INSP_SEL_AREA A
  2294. LEFT JOIN BIS_INSP_ALL_RLATION B
  2295. ON A.ID = B.ID
  2296. WHERE b.persid in (${persId}) and A.AD_CODE LIKE '__0000000000') T
  2297. LEFT JOIN ATT_AD_X_BASE AD
  2298. ON T.AD_CODE = AD.AD_CODE
  2299. WHERE AD.AD_CODE IS NOT NULL
  2300. </select>
  2301. <select id="getPersAllProCountByPersIds" resultType="cn.com.goldenwater.dcproj.dto.PersCountDto">
  2302. SELECT a.REC_PERS as id,a.insp_pblm_cate as type,count(A.PBLM_ID) as count FROM BIS_INSP_PBLM A
  2303. <if test='type == "1"'>
  2304. LEFT JOIN BIS_INSP_RSVR_RGSTR B ON A.OBJ_ID = B.OBJ_ID
  2305. </if>
  2306. <if test='type == "2"'>
  2307. LEFT JOIN BIS_INSP_VILL_RGSTR B ON A.OBJ_ID = B.OBJ_ID
  2308. </if>
  2309. <if test='type == "3"'>
  2310. LEFT JOIN BIS_INSP_WTDST_TRACK B ON A.OBJ_ID = B.OBJ_ID
  2311. </if>
  2312. <if test='type == "4"'>
  2313. LEFT JOIN BIS_INSP_KEY_REGISTER B ON A.OBJ_ID = B.OBJ_ID
  2314. </if>
  2315. <if test='type == "6"'>
  2316. LEFT JOIN ATT_WAGA_RGSTR B ON A.OBJ_ID = B.OBJ_ID
  2317. </if>
  2318. <if test='type == "7"'>
  2319. LEFT JOIN BIS_INSP_KEY_REGISTER B ON A.OBJ_ID = B.OBJ_ID
  2320. </if>
  2321. <if test='type == "11"'>
  2322. LEFT JOIN BIS_INSP_SD_RGSTR B ON A.OBJ_ID = B.OBJ_ID
  2323. </if>
  2324. <if test='type == "12"'>
  2325. LEFT JOIN BIS_INSP_WIU_RGSTR B ON A.OBJ_ID = B.OBJ_ID
  2326. </if>
  2327. <if test='type == "13"'>
  2328. LEFT JOIN BIS_INSP_SWHS_RGSTR B ON A.OBJ_ID = B.OBJ_ID
  2329. </if>
  2330. <if test='type == "14"'>
  2331. LEFT JOIN BIS_INSP_WINT_RGSTR B ON A.OBJ_ID = B.OBJ_ID
  2332. </if>
  2333. <if test='type == "15"'>
  2334. LEFT JOIN BIS_INSP_SVWT_AREA_RGSTR B ON A.OBJ_ID = B.OBJ_ID
  2335. </if>
  2336. <if test='type == "16"'>
  2337. LEFT JOIN BIS_INSP_SVWT_WUNT_RGSTR B ON A.OBJ_ID = B.OBJ_ID
  2338. </if>
  2339. WHERE a.REC_PERS is not null and A.OBJ_TYPE = #{type} AND A.REC_PERS in (${persId})
  2340. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  2341. AND A.COLL_TIME &gt;= TO_DATE(#{sttm},'YYYY-MM-DD') AND A.COLL_TIME &lt; TO_DATE(#{entm},'YYYY-MM-DD') + 1
  2342. </if>
  2343. <if test="state != null and state != '' and type != null and type != ''">
  2344. AND case when B.state is null then '0' ELSE B.state end = #{state}
  2345. </if>
  2346. group by a.REC_PERS,a.insp_pblm_cate
  2347. </select>
  2348. <select id="getPersEmpwtCountByPersIds" resultType="cn.com.goldenwater.dcproj.dto.PersCountDto">
  2349. SELECT REC_PERS_ID as id,ENG_STA as type,COUNT(ID) as COUNT FROM BIS_INSP_KEY_REGISTER
  2350. WHERE REC_PERS_ID in (${persId}) and ENG_STA = #{engSta}
  2351. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  2352. AND INTM &gt;= TO_DATE(#{sttm},'YYYY-MM-DD') AND INTM &lt; TO_DATE(#{entm},'YYYY-MM-DD') + 1
  2353. </if>
  2354. <if test="state != null and state != ''">
  2355. AND case when state is null then '0' else state end = #{state}
  2356. </if>
  2357. group by REC_PERS_ID, ENG_STA
  2358. </select>
  2359. <select id="getOrgProList" parameterType="cn.com.goldenwater.dcproj.param.BriefReportParam" resultType="cn.com.goldenwater.dcproj.model.BriefReport">
  2360. select ad.ad_code, ad.ad_name, a.code, b.pnm, a.num, a.type from (
  2361. select A.id as code,A.code as ad_code,A.type,count(A.rgstrId) as num from (
  2362. select substr(o.id, 1, 6) as id,
  2363. substr(t.ad_code, 1, 2) as code,t.rgstrId,t.type from (
  2364. select o.id, o.obj_id from bis_insp_all_obj o where o.ptype = #{objType}
  2365. ) o left join
  2366. <if test='objType == "9"'>
  2367. (
  2368. select t.id as rgstrId,t.obj_id,'' as type, t.ad_code,(case when t.state is null then '0' else t.state end)
  2369. state,t.in_tm,t.up_tm from
  2370. BIS_INSP_FSC_RGSTR t
  2371. )
  2372. </if>
  2373. <if test='objType == "10"'>
  2374. (select t.id as rgstrId,t.obj_id,'' as type, t.ad_code,(case when t.state is null then '0' else t.state end) state,t.in_tm,t.up_tm from
  2375. BIS_INSP_OTHER_RGSTR t)
  2376. </if>
  2377. <if test='objType == "11"'>
  2378. (select t.id as rgstrId,t.obj_id,'' as type, t.ad_code,(case when t.state is null then '0' else t.state end) state,t.in_tm,t.up_tm from
  2379. BIS_INSP_SD_RGSTR t)
  2380. </if>
  2381. <if test='objType == "12"'>
  2382. (select t.id as rgstrId,t.obj_id,'' as type, t.ad_code,(case when t.state is null then '0' else t.state end) state,t.in_tm,t.up_tm from
  2383. BIS_INSP_WIU_RGSTR t)
  2384. </if>
  2385. <if test='objType == "13"'>
  2386. (select t.id as rgstrId,t.obj_id,'' as type, t.ad_code,(case when t.state is null then '0' else t.state end) state,t.in_tm,t.up_tm from
  2387. BIS_INSP_SWHS_RGSTR t)
  2388. </if>
  2389. <if test='objType == "14"'>
  2390. (select t.id as rgstrId,t.obj_id,'' as type, t.ad_code,(case when t.state is null then '0' else t.state end) state,t.in_tm,t.up_tm from
  2391. BIS_INSP_WINT_RGSTR t)
  2392. </if>
  2393. <if test='objType == "15"'>
  2394. (select t.id as rgstrId,t.obj_id,'' as type, t.ad_code,(case when t.state is null then '0' else t.state end) state,t.in_tm,t.up_tm from
  2395. BIS_INSP_SVWT_AREA_RGSTR t)
  2396. </if>
  2397. <if test='objType == "16"'>
  2398. (select t.id as rgstrId,t.obj_id,'' as type, t.ad_code,(case when t.state is null then '0' else t.state end) state,t.in_tm,t.up_tm from
  2399. BIS_INSP_SVWT_WUNT_RGSTR t)
  2400. </if>
  2401. t on o.obj_id = t.obj_id
  2402. where t.obj_id is not null and length(o.id) > 3
  2403. <if test="state != null and state != ''">
  2404. AND t.state = #{state}
  2405. </if>
  2406. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  2407. AND t.INTM &gt;= TO_DATE(#{sttm},'YYYY-MM-DD') AND t.INTM &lt; TO_DATE(#{entm},'YYYY-MM-DD') + 1
  2408. </if>
  2409. )A group by A.id,A.code,A.type
  2410. ) a left join BIS_INSP_ALL b
  2411. on a.code = b.id
  2412. left join att_ad_base ad
  2413. on concat(a.ad_code, '0000000000') = ad.ad_code
  2414. where 1=1
  2415. <if test="orgName != null and orgName != ''">
  2416. and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
  2417. </if>
  2418. <if test="adName != null and adName != ''">
  2419. and ad.ad_name like CONCAT('%',CONCAT(#{adName}, '%'))
  2420. </if>
  2421. order by to_number(ad.ad_code),to_number(a.code)
  2422. </select>
  2423. <select id="getOrgPblmList" parameterType="cn.com.goldenwater.dcproj.param.BriefReportParam" resultType="cn.com.goldenwater.dcproj.model.BriefReport">
  2424. select AD.AD_CODE,AD.AD_NAME,a.code, b.pnm, a.num, a.type
  2425. from (select SUBSTR(Q.AD_CODE,1,2) AS AD_CODE,q.code, count(q.pblm_id) as num, q.type FROM
  2426. <if test='objType == "9"'>
  2427. (
  2428. select t.id as pblm_id,t.rect_conc as type,substr(o.id, 1, 6) as code,r.ad_code,t.in_tm,(case when r.state is null then '0' else r.state end) state from BIS_INSP_FSC_PBLM t left join Bis_Insp_Fsc_Rgstr r on t.rgstr_id = r.id left join bis_insp_all_obj o on r.obj_id = o.obj_id
  2429. where r.obj_id is not null
  2430. )
  2431. </if>
  2432. <if test='objType == "10"'>
  2433. (select t.id as pblm_id,(case when t.rect_conc is null then '0' else t.rect_conc end) as type,substr(o.id, 1, 6) as code,r.ad_code,t.in_tm,(case when r.state is null then '0' else r.state end) state from BIS_INSP_OTHER_PBLM t left join Bis_Insp_OTHER_Rgstr r on t.rgstr_id = r.id left join bis_insp_all_obj o on r.obj_id = o.obj_id
  2434. where r.obj_id is not null)
  2435. </if>
  2436. <if test='objType == "11"'>
  2437. (select t.pblm_id,(case when t.INSP_PBLM_CATE is null then '0' else INSP_PBLM_CATE end) as type,substr(o.id, 1, 6) as code,r.ad_code,t.COLL_TIME as in_tm,(case when r.state is null then '0' else r.state end) state from Bis_Insp_Pblm t left join bis_insp_all_obj o on t.obj_id = o.obj_id left join BIS_INSP_SD_RGSTR r on o.obj_id = r.obj_id
  2438. where t.obj_type = #{objType} and r.obj_id is not null)
  2439. </if>
  2440. <if test='objType == "12"'>
  2441. (select t.pblm_id,(case when t.INSP_PBLM_CATE is null then '0' else INSP_PBLM_CATE end) as type,substr(o.id, 1, 6) as code,r.ad_code,t.COLL_TIME as in_tm,(case when r.state is null then '0' else r.state end) state from Bis_Insp_Pblm t left join bis_insp_all_obj o on t.obj_id = o.obj_id left join BIS_INSP_WIU_RGSTR r on o.obj_id = r.obj_id
  2442. where t.obj_type = #{objType} and r.obj_id is not null)
  2443. </if>
  2444. <if test='objType == "13"'>
  2445. (select t.pblm_id,(case when t.INSP_PBLM_CATE is null then '0' else INSP_PBLM_CATE end) as type,substr(o.id, 1, 6) as code,r.ad_code,t.COLL_TIME as in_tm,(case when r.state is null then '0' else r.state end) state from Bis_Insp_Pblm t left join bis_insp_all_obj o on t.obj_id = o.obj_id left join BIS_INSP_SWHS_RGSTR r on o.obj_id = r.obj_id
  2446. where t.obj_type = #{objType} and r.obj_id is not null)
  2447. </if>
  2448. <if test='objType == "14"'>
  2449. (select t.pblm_id,(case when t.INSP_PBLM_CATE is null then '0' else INSP_PBLM_CATE end) as type,substr(o.id, 1, 6) as code,r.ad_code,t.COLL_TIME as in_tm,(case when r.state is null then '0' else r.state end) state from Bis_Insp_Pblm t left join bis_insp_all_obj o on t.obj_id = o.obj_id left join BIS_INSP_WINT_RGSTR r on o.obj_id = r.obj_id
  2450. where t.obj_type = #{objType} and r.obj_id is not null)
  2451. </if>
  2452. <if test='objType == "15"'>
  2453. (select t.pblm_id,(case when t.INSP_PBLM_CATE is null then '0' else INSP_PBLM_CATE end) as type,substr(o.id, 1, 6) as code,r.ad_code,t.COLL_TIME as in_tm,(case when r.state is null then '0' else r.state end) state from Bis_Insp_Pblm t left join bis_insp_all_obj o on t.obj_id = o.obj_id left join BIS_INSP_SVWT_AREA_RGSTR r on o.obj_id = r.obj_id
  2454. where t.obj_type = #{objType} and r.obj_id is not null)
  2455. </if>
  2456. <if test='objType == "16"'>
  2457. (select t.pblm_id,(case when t.INSP_PBLM_CATE is null then '0' else INSP_PBLM_CATE end) as type,substr(o.id, 1, 6) as code,r.ad_code,t.COLL_TIME as in_tm,(case when r.state is null then '0' else r.state end) state from Bis_Insp_Pblm t left join bis_insp_all_obj o on t.obj_id = o.obj_id left join BIS_INSP_SVWT_WUNT_RGSTR r on o.obj_id = r.obj_id
  2458. where t.obj_type = #{objType} and r.obj_id is not null)
  2459. </if>
  2460. q where q.ad_code is not null and length(q.code)=6
  2461. <if test="sttm != null and sttm != ''">
  2462. and q.in_tm &gt;= to_date(#{sttm}, 'yyyy-MM-dd')
  2463. </if>
  2464. <if test="entm != null and entm != ''">
  2465. and q.in_tm &lt; to_date(#{entm}, 'yyyy-MM-dd') + 1
  2466. </if>
  2467. <if test="state != null and state != ''">
  2468. AND q.state = #{state}
  2469. </if>
  2470. group by SUBSTR(Q.AD_CODE,1,2),q.code, q.TYPE ) a
  2471. left join BIS_INSP_ALL b
  2472. on a.code = b.id
  2473. LEFT JOIN ATT_AD_X_BASE AD ON CONCAT(A.AD_CODE,'0000000000') = AD.AD_CODE
  2474. where a.code is not null
  2475. <if test="orgName != null and orgName != ''">
  2476. and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
  2477. </if>
  2478. <if test="adName != null and adName != ''">
  2479. and ad.ad_name like CONCAT('%',CONCAT(#{adName}, '%'))
  2480. </if>
  2481. order by to_number(a.AD_CODE),to_number(a.code)
  2482. </select>
  2483. <select id="getOrgWorkProCountList" parameterType="cn.com.goldenwater.dcproj.param.BriefReportParam" resultType="cn.com.goldenwater.dcproj.model.BriefReport">
  2484. select a.code, b.pnm, a.num
  2485. from (select q.id as code, count(distinct q.code) as num
  2486. from (select substr(o.id, 1, 6) as id,
  2487. substr(t.ad_code, 1, 2) as code
  2488. from
  2489. <if test='objType == "9"'>
  2490. BIS_INSP_FSC_RGSTR
  2491. </if>
  2492. <if test='objType == "10"'>
  2493. BIS_INSP_OTHER_RGSTR
  2494. </if>
  2495. <if test='objType == "11"'>
  2496. BIS_INSP_SD_RGSTR
  2497. </if>
  2498. <if test='objType == "12"'>
  2499. BIS_INSP_WIU_RGSTR
  2500. </if>
  2501. <if test='objType == "13"'>
  2502. BIS_INSP_SWHS_RGSTR
  2503. </if>
  2504. <if test='objType == "14"'>
  2505. BIS_INSP_WINT_RGSTR
  2506. </if>
  2507. <if test='objType == "15"'>
  2508. BIS_INSP_SVWT_AREA_RGSTR
  2509. </if>
  2510. <if test='objType == "16"'>
  2511. BIS_INSP_SVWT_WUNT_RGSTR
  2512. </if>
  2513. t left join bis_insp_all_obj o
  2514. on t.obj_id = o.obj_id
  2515. where o.id not like '001016%'
  2516. and o.id not like '001017%'
  2517. and length(o.id) > 3
  2518. <if test="state != null and state != ''">
  2519. AND case when t.state is null then '0' else t.state end = #{state}
  2520. </if>
  2521. ) q
  2522. group by q.id) a
  2523. left join BIS_INSP_ALL b
  2524. on a.code = b.id
  2525. where 1=1
  2526. <if test="orgName != null and orgName != ''">
  2527. and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
  2528. </if>
  2529. order by to_number(a.code)
  2530. </select>
  2531. <select id="getOrgWorkCtCountList" parameterType="cn.com.goldenwater.dcproj.param.BriefReportParam" resultType="cn.com.goldenwater.dcproj.model.BriefReport">
  2532. select a.code, b.pnm, a.num
  2533. from (select q.id as code, count(distinct q.code) as num
  2534. from (select substr(o.id, 1, 6) as id,
  2535. substr(t.ad_code, 1, 6) as code
  2536. from
  2537. <if test='objType == "9"'>
  2538. BIS_INSP_FSC_RGSTR
  2539. </if>
  2540. <if test='objType == "10"'>
  2541. BIS_INSP_OTHER_RGSTR
  2542. </if>
  2543. <if test='objType == "11"'>
  2544. BIS_INSP_SD_RGSTR
  2545. </if>
  2546. <if test='objType == "12"'>
  2547. BIS_INSP_WIU_RGSTR
  2548. </if>
  2549. <if test='objType == "13"'>
  2550. BIS_INSP_SWHS_RGSTR
  2551. </if>
  2552. <if test='objType == "14"'>
  2553. BIS_INSP_WINT_RGSTR
  2554. </if>
  2555. <if test='objType == "15"'>
  2556. BIS_INSP_SVWT_AREA_RGSTR
  2557. </if>
  2558. <if test='objType == "16"'>
  2559. BIS_INSP_SVWT_WUNT_RGSTR
  2560. </if>
  2561. t left join bis_insp_all_obj o
  2562. on t.obj_id = o.obj_id
  2563. where o.id not like '001016%'
  2564. and o.id not like '001017%'
  2565. and length(o.id) > 3
  2566. <if test="state != null and state != ''">
  2567. AND case when t.state is null then '0' else t.state end = #{state}
  2568. </if>
  2569. ) q
  2570. group by q.id) a
  2571. left join BIS_INSP_ALL b
  2572. on a.code = b.id
  2573. where 1=1
  2574. <if test="orgName != null and orgName != ''">
  2575. and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
  2576. </if>
  2577. order by to_number(a.code)
  2578. </select>
  2579. <select id="getOrgWorkObjCountListByType" parameterType="cn.com.goldenwater.dcproj.param.BriefReportParam" resultType="cn.com.goldenwater.dcproj.model.BriefReport">
  2580. select a.code, b.pnm, a.num,a.type
  2581. from (select q.id as code,q.type, count(q.code) as num
  2582. from (select substr(o.id, 1, 6) as id,
  2583. substr(t.ad_code, 1, 6) as code,t.type
  2584. from
  2585. <if test='objType == "9"'>
  2586. (SELECT t.ad_Code,'' as type, t.obj_id, (case when t.state is null then '0' else t.state end) state from BIS_INSP_FSC_RGSTR t)
  2587. </if>
  2588. <if test='objType == "10"'>
  2589. (SELECT t.ad_Code,'' as type, t.obj_id, (case when t.state is null then '0' else t.state end) state from BIS_INSP_OTHER_RGSTR t)
  2590. </if>
  2591. <if test='objType == "11"'>
  2592. (SELECT t.ad_Code,'' as type, t.obj_id, (case when t.state is null then '0' else t.state end) state from BIS_INSP_SD_RGSTR t)
  2593. </if>
  2594. <if test='objType == "12"'>
  2595. (SELECT t.ad_Code,'' as type, t.obj_id, (case when t.state is null then '0' else t.state end) state from BIS_INSP_WIU_RGSTR t)
  2596. </if>
  2597. <if test='objType == "13"'>
  2598. (SELECT t.ad_Code,'' as type, t.obj_id, (case when t.state is null then '0' else t.state end) state from BIS_INSP_SWHS_RGSTR t)
  2599. </if>
  2600. <if test='objType == "14"'>
  2601. (SELECT t.ad_Code,'' as type, t.obj_id, (case when t.state is null then '0' else t.state end) state from BIS_INSP_WINT_RGSTR t)
  2602. </if>
  2603. <if test='objType == "15"'>
  2604. (SELECT t.ad_Code,'' as type, t.obj_id, (case when t.state is null then '0' else t.state end) state from BIS_INSP_SVWT_AREA_RGSTR t)
  2605. </if>
  2606. <if test='objType == "16"'>
  2607. (SELECT t.ad_Code,'' as type, t.obj_id, (case when t.state is null then '0' else t.state end) state from BIS_INSP_SVWT_WUNT_RGSTR t)
  2608. </if>
  2609. t left join bis_insp_all_obj o
  2610. on t.obj_id = o.obj_id
  2611. where o.id not like '001016%'
  2612. and o.id not like '001017%'
  2613. and length(o.id) > 3
  2614. <if test="state != null and state != ''">
  2615. AND t.state = #{state}
  2616. </if>
  2617. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  2618. AND t.INTM &gt;= TO_DATE(#{sttm},'YYYY-MM-DD') AND t.INTM &lt; TO_DATE(#{entm},'YYYY-MM-DD') + 1
  2619. </if>
  2620. ) q
  2621. group by q.id, q.type) a
  2622. left join BIS_INSP_ALL b
  2623. on a.code = b.id
  2624. where 1=1
  2625. <if test="orgName != null and orgName != ''">
  2626. and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
  2627. </if>
  2628. order by to_number(a.code)
  2629. </select>
  2630. <select id="getPblmCountListByType" parameterType="cn.com.goldenwater.dcproj.param.BriefReportParam" resultType="cn.com.goldenwater.dcproj.model.BriefReport">
  2631. select a.code, b.pnm, a.num, a.type
  2632. from (select q.code,q.type, count(q.pblm_id) as num
  2633. from (
  2634. select t.*
  2635. from
  2636. <if test='objType == "9"'>
  2637. (
  2638. select t.id as pblm_id,t.rect_conc as type,substr(o.id, 1, 6) as code,r.ad_code,t.in_tm,(case when r.state is null then '0' else r.state end) state from BIS_INSP_FSC_PBLM t left join Bis_Insp_Fsc_Rgstr r on t.rgstr_id = r.id left join bis_insp_all_obj o on r.obj_id = o.obj_id
  2639. where r.obj_id is not null
  2640. )
  2641. </if>
  2642. <if test='objType == "10"'>
  2643. (select t.id as pblm_id,(case when t.rect_conc is null then '0' else t.rect_conc end) as type,substr(o.id, 1, 6) as code,r.ad_code,t.in_tm,(case when r.state is null then '0' else r.state end) state from BIS_INSP_OTHER_PBLM t left join Bis_Insp_OTHER_Rgstr r on t.rgstr_id = r.id left join bis_insp_all_obj o on r.obj_id = o.obj_id
  2644. where r.obj_id is not null)
  2645. </if>
  2646. <if test='objType == "11"'>
  2647. (select t.pblm_id,(case when t.INSP_PBLM_CATE is null then '0' else INSP_PBLM_CATE end) as type,substr(o.id, 1, 6) as code,r.ad_code,t.COLL_TIME as in_tm,(case when r.state is null then '0' else r.state end) state from Bis_Insp_Pblm t left join bis_insp_all_obj o on t.obj_id = o.obj_id left join BIS_INSP_SD_RGSTR r on o.obj_id = r.obj_id
  2648. where t.obj_type = #{objType} and r.obj_id is not null)
  2649. </if>
  2650. <if test='objType == "12"'>
  2651. (select t.pblm_id,(case when t.INSP_PBLM_CATE is null then '0' else INSP_PBLM_CATE end) as type,substr(o.id, 1, 6) as code,r.ad_code,t.COLL_TIME as in_tm,(case when r.state is null then '0' else r.state end) state from Bis_Insp_Pblm t left join bis_insp_all_obj o on t.obj_id = o.obj_id left join BIS_INSP_WIU_RGSTR r on o.obj_id = r.obj_id
  2652. where t.obj_type = #{objType} and r.obj_id is not null)
  2653. </if>
  2654. <if test='objType == "13"'>
  2655. (select t.pblm_id,(case when t.INSP_PBLM_CATE is null then '0' else INSP_PBLM_CATE end) as type,substr(o.id, 1, 6) as code,r.ad_code,t.COLL_TIME as in_tm,(case when r.state is null then '0' else r.state end) state from Bis_Insp_Pblm t left join bis_insp_all_obj o on t.obj_id = o.obj_id left join BIS_INSP_SWHS_RGSTR r on o.obj_id = r.obj_id
  2656. where t.obj_type = #{objType} and r.obj_id is not null)
  2657. </if>
  2658. <if test='objType == "14"'>
  2659. (select t.pblm_id,(case when t.INSP_PBLM_CATE is null then '0' else INSP_PBLM_CATE end) as type,substr(o.id, 1, 6) as code,r.ad_code,t.COLL_TIME as in_tm,(case when r.state is null then '0' else r.state end) state from Bis_Insp_Pblm t left join bis_insp_all_obj o on t.obj_id = o.obj_id left join BIS_INSP_WINT_RGSTR r on o.obj_id = r.obj_id
  2660. where t.obj_type = #{objType} and r.obj_id is not null)
  2661. </if>
  2662. <if test='objType == "15"'>
  2663. (select t.pblm_id,(case when t.INSP_PBLM_CATE is null then '0' else INSP_PBLM_CATE end) as type,substr(o.id, 1, 6) as code,r.ad_code,t.COLL_TIME as in_tm,(case when r.state is null then '0' else r.state end) state from Bis_Insp_Pblm t left join bis_insp_all_obj o on t.obj_id = o.obj_id left join BIS_INSP_SVWT_AREA_RGSTR r on o.obj_id = r.obj_id
  2664. where t.obj_type = #{objType} and r.obj_id is not null)
  2665. </if>
  2666. <if test='objType == "16"'>
  2667. (select t.pblm_id,(case when t.INSP_PBLM_CATE is null then '0' else INSP_PBLM_CATE end) as type,substr(o.id, 1, 6) as code,r.ad_code,t.COLL_TIME as in_tm,(case when r.state is null then '0' else r.state end) state from Bis_Insp_Pblm t left join bis_insp_all_obj o on t.obj_id = o.obj_id left join BIS_INSP_SVWT_WUNT_RGSTR r on o.obj_id = r.obj_id
  2668. where t.obj_type = #{objType} and r.obj_id is not null)
  2669. </if>
  2670. t
  2671. where 1=1
  2672. <!--t.rec_pers not in
  2673. (select guid from bis_insp_all_rlation_pers where org_id = '1209')-->
  2674. <if test="sttm != null and sttm != ''">
  2675. and t.in_tm &gt;= to_date(#{sttm}, 'yyyy-MM-dd')
  2676. </if>
  2677. <if test="entm != null and entm != ''">
  2678. and t.in_tm &lt; to_date(#{entm}, 'yyyy-MM-dd') + 1
  2679. </if>
  2680. <if test="state != null and state != ''">
  2681. AND t.state = #{state}
  2682. </if>
  2683. ) q
  2684. group by q.code, q.type) a
  2685. left join BIS_INSP_ALL b
  2686. on a.code = b.id
  2687. where a.code is not null
  2688. <if test="orgName != null and orgName != ''">
  2689. and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
  2690. </if>
  2691. order by to_number(a.code)
  2692. </select>
  2693. <select id="getRiverSupervisionCount" parameterType="cn.com.goldenwater.dcproj.param.BriefReportParam" resultType="cn.com.goldenwater.dcproj.dto.RiverSupervisionRivCount">
  2694. select A.ID basinId,A.PNM basinName,C.ID groupId,C.PNM groupName from BIS_INSP_ALL A LEFT JOIN BIS_INSP_ALL B ON
  2695. A.ID = B.PID
  2696. LEFT JOIN BIS_INSP_ALL C ON B.ID = C.PID WHERE 1 = 1
  2697. <if test="basinId != null and basinId != ''">
  2698. AND A.ID = #{basinId}
  2699. </if>
  2700. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  2701. AND ((C.STTM &lt;= TO_DATE(#{sttm},'YYYY-MM-DD') AND C.ENTM &gt; (TO_DATE(#{sttm},'YYYY-MM-DD') + 1)) OR
  2702. (C.STTM &lt;= TO_DATE(#{entm},'YYYY-MM-DD') AND C.ENTM &gt; (TO_DATE(#{entm},'YYYY-MM-DD') + 1)))
  2703. </if>
  2704. AND A.ID LIKE '${objType}___'
  2705. ORDER BY A.ID
  2706. </select>
  2707. <select id="getAdNameDtoListByGroupIds" resultType="cn.com.goldenwater.dcproj.dto.AdNameDto" parameterType="java.util.Map">
  2708. SELECT t1.id, AD.AD_NAME FROM
  2709. (SELECT distinct b.id,SUBSTR(A.AD_CODE,0,2) subAd FROM
  2710. <if test='objType == "9"'>
  2711. BIS_INSP_FSC_RGSTR
  2712. </if>
  2713. <if test='objType == "10"'>
  2714. BIS_INSP_OTHER_RGSTR
  2715. </if>
  2716. <if test='objType == "11"'>
  2717. BIS_INSP_SD_RGSTR
  2718. </if>
  2719. <if test='objType == "12"'>
  2720. BIS_INSP_WIU_RGSTR
  2721. </if>
  2722. <if test='objType == "13"'>
  2723. BIS_INSP_SWHS_RGSTR
  2724. </if>
  2725. <if test='objType == "14"'>
  2726. BIS_INSP_WINT_RGSTR
  2727. </if>
  2728. <if test='objType == "15"'>
  2729. BIS_INSP_SVWT_AREA_RGSTR
  2730. </if>
  2731. <if test='objType == "16"'>
  2732. BIS_INSP_SVWT_WUNT_RGSTR
  2733. </if>
  2734. A LEFT JOIN BIS_INSP_ALL_OBJ B ON A.OBJ_ID =
  2735. B.OBJ_ID
  2736. WHERE B.PTYPE = #{objType} AND B.ID in (${groupId})) T1 LEFT JOIN ATT_AD_X_BASE AD ON
  2737. CONCAT(T1.subAd,'0000000000') = AD.AD_CODE
  2738. where length(t1.id) = 12
  2739. </select>
  2740. <select id="getGroupCountyCountById" resultType="cn.com.goldenwater.dcproj.dto.PersCountDto" parameterType="java.util.Map">
  2741. SELECT t1.id,COUNT(AD.AD_NAME) as count FROM
  2742. (SELECT distinct b.id,SUBSTR(A.AD_CODE,0,6) subAd FROM
  2743. <if test='objType == "9"'>
  2744. BIS_INSP_FSC_RGSTR
  2745. </if>
  2746. <if test='objType == "10"'>
  2747. BIS_INSP_OTHER_RGSTR
  2748. </if>
  2749. <if test='objType == "11"'>
  2750. BIS_INSP_SD_RGSTR
  2751. </if>
  2752. <if test='objType == "12"'>
  2753. BIS_INSP_WIU_RGSTR
  2754. </if>
  2755. <if test='objType == "13"'>
  2756. BIS_INSP_SWHS_RGSTR
  2757. </if>
  2758. <if test='objType == "14"'>
  2759. BIS_INSP_WINT_RGSTR
  2760. </if>
  2761. <if test='objType == "15"'>
  2762. BIS_INSP_SVWT_AREA_RGSTR
  2763. </if>
  2764. <if test='objType == "16"'>
  2765. BIS_INSP_SVWT_WUNT_RGSTR
  2766. </if>
  2767. A LEFT JOIN BIS_INSP_ALL_OBJ B ON A.OBJ_ID = B.OBJ_ID
  2768. WHERE B.PTYPE = #{objType} AND B.ID in (${groupId})) T1 LEFT JOIN ATT_AD_X_BASE AD ON
  2769. CONCAT(T1.subAd,'000000') = AD.AD_CODE
  2770. group by t1.id
  2771. </select>
  2772. <select id="getGroupCountByGroupId" resultType="cn.com.goldenwater.dcproj.dto.PersCountDto" parameterType="java.util.Map">
  2773. SELECT t.TYPE ,b.id,COUNT(t.RGSTR_ID) as count FROM
  2774. (
  2775. <if test='objType == "9"'>
  2776. SELECT t.id as RGSTR_ID,'' as type, t.obj_id, (case when t.state is null then '0' else t.state end) state from BIS_INSP_FSC_RGSTR t
  2777. </if>
  2778. <if test='objType == "10"'>
  2779. SELECT t.id as RGSTR_ID,'' as type, t.obj_id, (case when t.state is null then '0' else t.state end) state from BIS_INSP_OTHER_RGSTR t
  2780. </if>
  2781. <if test='objType == "11"'>
  2782. SELECT t.id as RGSTR_ID,'' as type, t.obj_id, (case when t.state is null then '0' else t.state end) state from BIS_INSP_SD_RGSTR t
  2783. </if>
  2784. <if test='objType == "12"'>
  2785. SELECT t.id as RGSTR_ID,'' as type, t.obj_id, (case when t.state is null then '0' else t.state end) state from BIS_INSP_WIU_RGSTR t
  2786. </if>
  2787. <if test='objType == "13"'>
  2788. SELECT t.id as RGSTR_ID,'' as type, t.obj_id, (case when t.state is null then '0' else t.state end) state from BIS_INSP_SWHS_RGSTR t
  2789. </if>
  2790. <if test='objType == "14"'>
  2791. SELECT t.id as RGSTR_ID,'' as type, t.obj_id, (case when t.state is null then '0' else t.state end) state from BIS_INSP_WINT_RGSTR t
  2792. </if>
  2793. <if test='objType == "15"'>
  2794. SELECT t.id as RGSTR_ID,'' as type, t.obj_id, (case when t.state is null then '0' else t.state end) state from BIS_INSP_SVWT_AREA_RGSTR t
  2795. </if>
  2796. <if test='objType == "16"'>
  2797. SELECT t.id as RGSTR_ID,'' as type, t.obj_id, (case when t.state is null then '0' else t.state end) state from BIS_INSP_SVWT_WUNT_RGSTR t
  2798. </if>
  2799. )t LEFT JOIN BIS_INSP_ALL_OBJ B ON t.OBJ_ID = B.OBJ_ID
  2800. WHERE B.ID in (${groupId}) AND B.PTYPE = ${objType}
  2801. <if test="state != null and state != ''">
  2802. AND t.state end = #{state}
  2803. </if>
  2804. group by t.type,b.id
  2805. </select>
  2806. <select id="getFscOrOthProCountByGroupId" resultType="cn.com.goldenwater.dcproj.dto.PersCountDto" parameterType="cn.com.goldenwater.dcproj.param.BriefReportParam">
  2807. select t.type,t.id,COUNT(t.PBLM_ID) count from
  2808. <if test='objType == "009"'>
  2809. (
  2810. select t.id as pblm_id,t.rect_conc as type,o.id,r.ad_code,t.in_tm,(case when r.state is null then '0' else r.state end) state from BIS_INSP_FSC_PBLM t left join Bis_Insp_Fsc_Rgstr r on t.rgstr_id = r.id left join bis_insp_all_obj o on r.obj_id = o.obj_id
  2811. where r.obj_id is not null
  2812. )
  2813. </if>
  2814. <if test='objType == "010"'>
  2815. (select t.id as pblm_id,(case when t.rect_conc is null then '0' else t.rect_conc end) as type,o.id,r.ad_code,t.in_tm,(case when r.state is null then '0' else r.state end) state from BIS_INSP_OTHER_PBLM t left join Bis_Insp_OTHER_Rgstr r on t.rgstr_id = r.id left join bis_insp_all_obj o on r.obj_id = o.obj_id
  2816. where r.obj_id is not null)
  2817. </if>
  2818. t
  2819. WHERE t.ID in (${groupId})
  2820. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  2821. AND t.IN_TM &gt;= TO_DATE(#{sttm},'YYYY-MM-DD') AND t.IN_TM &lt; TO_DATE(#{entm},'YYYY-MM-DD') + 1
  2822. </if>
  2823. <if test="state != null and state != '' and type != null and type != ''">
  2824. AND t.state = #{state}
  2825. </if>
  2826. group by t.type,t.id
  2827. </select>
  2828. <select id="getPersWorkSupervisionInfo" parameterType="cn.com.goldenwater.dcproj.param.BriefReportParam"
  2829. resultType="cn.com.goldenwater.dcproj.dto.RiverSupervisionRivCount">
  2830. SELECT B.GUID persId,B.PERS_NAME persName,B.ORG_ID basinId,B.ORG_NM basinName FROM
  2831. (SELECT DISTINCT PERSID FROM BIS_INSP_ALL_RLATION
  2832. WHERE ID LIKE '${objType}%') A LEFT JOIN BIS_INSP_ALL_RLATION_PERS B
  2833. ON A.PERSID = B.GUID
  2834. WHERE B.GUID IS NOT NULL
  2835. <if test="basinId != null and basinId != ''">
  2836. AND CONCAT(#{type},B.ORG_ID) = #{basinId}
  2837. </if>
  2838. <if test="persName != null and persName != ''">
  2839. AND B.PERS_NAME LIKE '%${persName}%'
  2840. </if>
  2841. </select>
  2842. <select id="getPersCountByPersIds" resultType="cn.com.goldenwater.dcproj.dto.PersCountDto" parameterType="cn.com.goldenwater.dcproj.param.BriefReportParam">
  2843. SELECT c.pers_id as id,c.type,count(*) as count FROM
  2844. (
  2845. <if test='objType == "009"'>
  2846. select t.pers_id,'' as type,t.IN_TM,(case when t.state is null then '0' else t.state end) state from BIS_INSP_FSC_RGSTR t
  2847. </if>
  2848. <if test='objType == "010"'>
  2849. select t.pers_id,'' as type,t.IN_TM,(case when t.state is null then '0' else t.state end) state from BIS_INSP_OTHER_RGSTR t
  2850. </if>
  2851. <if test='objType == "011"'>
  2852. select t.pers_id,'' as type,t.IN_TM,(case when t.state is null then '0' else t.state end) state from BIS_INSP_SD_RGSTR t
  2853. </if>
  2854. <if test='objType == "012"'>
  2855. select t.pers_id,'' as type,t.IN_TM,(case when t.state is null then '0' else t.state end) state from BIS_INSP_WIU_RGSTR t
  2856. </if>
  2857. <if test='objType == "013"'>
  2858. select t.pers_id,'' as type,t.IN_TM,(case when t.state is null then '0' else t.state end) state from BIS_INSP_SWHS_RGSTR t
  2859. </if>
  2860. <if test='objType == "014"'>
  2861. select t.pers_id,'' as type,t.IN_TM,(case when t.state is null then '0' else t.state end) state from BIS_INSP_WINT_RGSTR t
  2862. </if>
  2863. <if test='objType == "015"'>
  2864. select t.pers_id,'' as type,t.IN_TM,(case when t.state is null then '0' else t.state end) state from BIS_INSP_SVWT_AREA_RGSTR t
  2865. </if>
  2866. <if test='objType == "016"'>
  2867. select t.pers_id,'' as type,t.IN_TM,(case when t.state is null then '0' else t.state end) state from BIS_INSP_SVWT_WUNT_RGSTR t
  2868. </if>
  2869. ) c
  2870. where c.pers_id is not null and c.pers_id in (${persIds})
  2871. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  2872. AND C.INTM &gt;= TO_DATE(#{sttm},'YYYY-MM-DD') AND C.INTM &lt; TO_DATE(#{entm},'YYYY-MM-DD') + 1
  2873. </if>
  2874. <if test="state != null and state != ''">
  2875. AND c.state = #{state}
  2876. </if>
  2877. group by c.pers_id,c.type
  2878. </select>
  2879. <select id="getPersFscOrOthProCountByPersIds" resultType="cn.com.goldenwater.dcproj.dto.PersCountDto" parameterType="cn.com.goldenwater.dcproj.param.BriefReportParam">
  2880. SELECT a.pers_id as id,a.type,count(A.id) as count FROM (
  2881. <if test='objType == "009"'>
  2882. SELECT p.id,p.pers_id,p.RECT_CONC as type,p.IN_TM,(case when r.state is null then '0' else r.state end) state from bis_insp_fsc_pblm p left join BIS_INSP_FSC_RGSTR r on p.rgstr_id = r.id
  2883. where r.id is not null
  2884. </if>
  2885. <if test='objType == "010"'>
  2886. SELECT p.id,p.pers_id,p.RECT_CONC as type,p.IN_TM,(case when r.state is null then '0' else r.state end) state from bis_insp_OTHER_pblm p left join BIS_INSP_OTHER_RGSTR r on p.rgstr_id = r.id
  2887. where r.id is not null
  2888. </if>
  2889. ) a
  2890. WHERE a.pers_id is not null AND A.pers_id in (${persIds})
  2891. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  2892. AND A.IN_TM &gt;= TO_DATE(#{sttm},'YYYY-MM-DD') AND A.IN_TM &lt; TO_DATE(#{entm},'YYYY-MM-DD') + 1
  2893. </if>
  2894. <if test="state != null and state != '' and type != null and type != ''">
  2895. AND a.state = #{state}
  2896. </if>
  2897. group by a.pers_id,a.type
  2898. </select>
  2899. </mapper>