BisInspPblmDao.xml 178 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542
  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.BisInspPblmDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspPblm" id="bisInspPblmResultMap">
  5. <result property="pblmsTypeId" column="PBLMS_TYPE_ID"/>
  6. <result property="regid" column="REGID"/>
  7. <result property="commonFileIds" column="COMMON_FILE_IDS"/>
  8. <result property="fileNo" column="FILE_NO"/>
  9. <result property="fileNoNumber" column="FILE_NO_NUMBER"/>
  10. <result property="pblmsId" column="PBLMS_ID"/>
  11. <result property="pblmId" column="PBLM_ID"/>
  12. <result property="quote" column="QUOTE"/>
  13. <result property="waterUserId" column="WATER_USER_ID"/>
  14. <result property="objId" column="OBJ_ID"/>
  15. <result property="objType" column="OBJ_TYPE"/>
  16. <result property="inspGroupId" column="INSP_GROUP_ID"/>
  17. <result property="pguid" column="PGUID"/>
  18. <result property="inspPblmType" column="INSP_PBLM_TYPE"/>
  19. <result property="inspPblmCode" column="INSP_PBLM_CODE"/>
  20. <result property="inspPblmName" column="INSP_PBLM_NAME"/>
  21. <result property="inspPblmDesc" column="INSP_PBLM_DESC"/>
  22. <result property="inspAddDesc" column="INSP_ADD_DESC"/>
  23. <result property="pblmLong" column="PBLM_LONG"/>
  24. <result property="pblmLat" column="PBLM_LAT"/>
  25. <result property="ifCasePblm" column="IF_CASE_PBLM"/>
  26. <result property="inspPblmOrgName" column="INSP_PBLM_ORG_NAME"/>
  27. <result property="pblmPersName" column="PBLM_PERS_NAME"/>
  28. <result property="inspPblmCate" column="INSP_PBLM_CATE"/>
  29. <result property="pblmStat" column="PBLM_STAT"/>
  30. <result property="reviOpin" column="REVI_OPIN"/>
  31. <result property="reviConc" column="REVI_CONC"/>
  32. <result property="reviOrgGuid" column="REVI_ORG_GUID"/>
  33. <result property="dataStat" column="DATA_STAT"/>
  34. <result property="collTime" column="COLL_TIME"/>
  35. <result property="villType" column="VILL_TYPE"/>
  36. <result property="recPers" column="REC_PERS"/>
  37. <result property="note" column="NOTE"/>
  38. <result property="persName" column="PERS_NAME"/>
  39. <result property="inspPblmsName" column="insp_pblms_name"/>
  40. <result property="checkPoint" column="check_point"/>
  41. <result property="nm" column="nm"/>
  42. <result property="objNm" column="obj_nm"/>
  43. <result property="cwsName" column="cws_name"/>
  44. <result property="cwsCode" column="CWS_CODE"/>
  45. <result property="villageCode" column="VILLAGE_CODE"/>
  46. <result property="pblmDesc" column="pblm_desc"/>
  47. <result property="state" column="state"/>
  48. <result property="code" column="CODE"/>
  49. <result property="adFullName" column="AD_FULL_NAME"/>
  50. <result property="adCode" column="AD_CODE"/>
  51. <result property="orgNm" column="ORG_NM"/>
  52. <result property="orgId" column="ORG_ID"/>
  53. <result property="rsName" column="rs_name"/>
  54. <result property="hasVedio" column="HAS_VEDIO"/>
  55. <result property="problemType" column="PROBLEM_TYPE"/>
  56. <result property="nature" column="NATURE"/>
  57. <result property="reviOrg" column="revi_org"/>
  58. <result property="qualityTypeId" column="QUALITY_TYPE_ID"/>
  59. <result property="defectTypeId" column="DEFECT_TYPE_ID"/>
  60. <result property="fdbkId" column="FDBK_ID"/>
  61. <result property="unitNm" column="unit_nm"/>
  62. <result property="itemId" column="ITEM_ID"/>
  63. <result property="snNum" column="sn_num"/>
  64. <result property="attach" column="attach"/>
  65. <result property="sheet" column="sheet"/>
  66. <result property="engScal" column="eng_scal"/>
  67. <result property="wagaScal" column="waga_Scal"/>
  68. <result property="gateType" column="gate_type"/>
  69. <result property="sttp" column="sttp"/>
  70. <result property="rePtype" column="re_ptype"/>
  71. <result property="pnm" column="pnm"/>
  72. <result property="oid" column="oid"/>
  73. <result property="uptm" column="UP_TM"/>
  74. <result property="pblmNameBz" column="PBLM_NAME_BZ"/>
  75. <result property="checkPointBz" column="CHECK_POINT_BZ"/>
  76. <result property="checkPoint" column="CHECK_POINT"/>
  77. <result property="snNumBz" column="SN_NUM_BZ"/>
  78. <result property="pblmDescBz" column="PBLM_DESC_BZ"/>
  79. <result property="pblmReason" column="PBLM_REASON"/>
  80. <result property="pblmSggtn" column="PBLM_SGGTN"/>
  81. <result property="gongdiBzId" column="GONGDI_BZ_ID"/>
  82. <result property="objCode" column="OBJ_CODE"/>
  83. <result property="objName" column="OBJ_NAME"/>
  84. <result property="objAdCode" column="OBJ_AD_CODE"/>
  85. <result property="attachBz" column="attach_bz"/>
  86. <result property="wtdstNote" column="WTDST_NOTE"/>
  87. <result property="score" column="SCORE"/>
  88. <result property="provincial" column="PROVINCIAL"/>
  89. <result property="belongOrgId" column="BELONG_ORG_ID"/>
  90. <result property="belongAdCode" column="BELONG_AD_CODE"/>
  91. <result property="baseObjType" column="BASE_OBJ_TYPE"/>
  92. </resultMap>
  93. <!-- 这是问题删除表字段 -->
  94. <sql id="table_columns_pblmDelLog">
  95. PBLM_ID,PBLM_NAME_BZ,CHECK_POINT_BZ,SN_NUM_BZ,PBLM_DESC_BZ,
  96. OBJ_ID,
  97. OBJ_TYPE,
  98. INSP_GROUP_ID,
  99. PGUID,
  100. INSP_PBLM_TYPE,
  101. INSP_PBLM_CODE,
  102. INSP_PBLM_NAME,
  103. INSP_PBLM_DESC,
  104. INSP_ADD_DESC,
  105. PBLM_LONG,
  106. PBLM_LAT,
  107. IF_CASE_PBLM,
  108. INSP_PBLM_ORG_NAME,
  109. PBLM_PERS_NAME,
  110. INSP_PBLM_CATE,
  111. PBLM_STAT,
  112. REVI_OPIN,
  113. REVI_CONC,
  114. REVI_ORG_GUID,
  115. DATA_STAT,
  116. COLL_TIME,
  117. REC_PERS,
  118. NOTE,
  119. REGID,
  120. COMMON_FILE_IDS,
  121. FILE_NO,
  122. FILE_NO_NUMBER,
  123. PBLMS_ID,
  124. PBLMS_TYPE_ID,
  125. VILL_TYPE,
  126. CWS_CODE,
  127. VILLAGE_CODE,
  128. PBLM_DEL_ID,
  129. PBLM_DEL_PERS,
  130. PBLM_DEL_PERSNM,
  131. PBLM_DEL_TM,
  132. PBLM_DEL_NOTE,QUOTE,
  133. PROVINCIAL,
  134. BELONG_ORG_ID,
  135. BELONG_AD_CODE
  136. </sql>
  137. <sql id="entity_properties_pblmDelLog">
  138. #{pblmId},#{pblmNameBz},#{checkPointBz},#{snNumBz},#{pblmDescBz},
  139. #{objId},
  140. #{objType},
  141. #{inspGroupId},
  142. #{pguid},
  143. #{inspPblmType},
  144. #{inspPblmCode},
  145. #{inspPblmName},
  146. #{inspPblmDesc},
  147. #{inspAddDesc},
  148. #{pblmLong},
  149. #{pblmLat},
  150. #{ifCasePblm},
  151. #{inspPblmOrgName},
  152. #{pblmPersName},
  153. #{inspPblmCate},
  154. #{pblmStat},
  155. #{reviOpin},
  156. #{reviConc},
  157. #{reviOrgGuid},
  158. #{dataStat},
  159. #{collTime},
  160. #{recPers},
  161. #{note},
  162. #{regid},
  163. #{commonFileIds},
  164. #{fileNo},
  165. #{fileNoNumber},
  166. #{pblmsId},
  167. #{pblmsTypeId},
  168. #{villType},
  169. #{cwsCode},
  170. #{villageCode},
  171. #{pblmDelId},
  172. #{pblmDelPers},
  173. #{pblmDelPersnm},
  174. TO_DATE(#{pblmDelTm},'YYYY-MM-DD HH24:MI:SS'),
  175. #{pblmDelNote},#{quote},#{provincial},#{belongOrgId},#{belongAdCode}
  176. </sql>
  177. <!-- 这是问题表字段 -->
  178. <sql id="table_columns">
  179. attach_Bz,
  180. CWS_CODE,HAS_VEDIO,PROBLEM_TYPE,QUALITY_TYPE_ID,DEFECT_TYPE_ID,FDBK_ID,ITEM_ID,WATER_USER_ID,GONGDI_BZ_ID,
  181. VILLAGE_CODE,
  182. VILL_TYPE,
  183. PBLMS_TYPE_ID,
  184. REGID,
  185. COMMON_FILE_IDS,
  186. FILE_NO,
  187. FILE_NO_NUMBER,
  188. PBLMS_ID,
  189. PBLM_ID,
  190. OBJ_ID,
  191. OBJ_TYPE,
  192. INSP_GROUP_ID,
  193. PGUID,
  194. INSP_PBLM_TYPE,
  195. INSP_PBLM_CODE,
  196. INSP_PBLM_NAME,
  197. INSP_PBLM_DESC,
  198. INSP_ADD_DESC,
  199. PBLM_LONG,
  200. PBLM_LAT,
  201. IF_CASE_PBLM,
  202. INSP_PBLM_ORG_NAME,
  203. PBLM_PERS_NAME,
  204. <if test="inspPblmCate != null and inspPblmCate != ''">INSP_PBLM_CATE,</if>
  205. <if test="relBasis != null and relBasis != ''">REL_BASIS,</if>
  206. <if test="damRegCode != null and damRegCode != ''">DAM_REG_CODE,</if>
  207. PBLM_STAT,
  208. REVI_OPIN,
  209. REVI_CONC,
  210. REVI_ORG_GUID,
  211. DATA_STAT,
  212. COLL_TIME,
  213. REC_PERS,
  214. NOTE,QUOTE,
  215. UP_TM,PBLM_NAME_BZ,CHECK_POINT_BZ,SN_NUM_BZ,PBLM_DESC_BZ,NEW_VILL_NAME,
  216. PBLM_REASON,
  217. PBLM_SGGTN,WTDST_NOTE,
  218. OBJ_CODE,OBJ_NAME,OBJ_AD_CODE,SCORE,
  219. PROVINCIAL,BELONG_ORG_ID, BELONG_AD_CODE
  220. </sql>
  221. <sql id="entity_properties">
  222. #{attachBz},
  223. #{cwsCode},#{hasVedio},#{problemType},#{qualityTypeId},#{defectTypeId},#{fdbkId},#{itemId},#{waterUserId},#{gongdiBzId},
  224. #{villageCode},
  225. #{villType},
  226. #{pblmsTypeId},
  227. #{regid},
  228. #{commonFileIds},
  229. #{fileNo},
  230. #{fileNoNumber},
  231. #{pblmsId},
  232. #{pblmId},
  233. #{objId},
  234. #{objType},
  235. #{inspGroupId},
  236. #{pguid},
  237. #{inspPblmType},
  238. #{inspPblmCode},
  239. #{inspPblmName},
  240. #{inspPblmDesc},
  241. #{inspAddDesc},
  242. #{pblmLong},
  243. #{pblmLat},
  244. #{ifCasePblm},
  245. #{inspPblmOrgName},
  246. #{pblmPersName},
  247. <if test="inspPblmCate != null and inspPblmCate != ''">#{inspPblmCate},</if>
  248. <if test="relBasis != null and relBasis != ''">#{relBasis},</if>
  249. <if test="damRegCode != null and damRegCode != ''">#{damRegCode},</if>
  250. #{pblmStat},
  251. #{reviOpin},
  252. #{reviConc},
  253. #{reviOrgGuid},
  254. #{dataStat},
  255. #{collTime},
  256. #{recPers},
  257. #{note},#{quote},
  258. #{uptm},#{pblmNameBz},#{checkPointBz},#{snNumBz},#{pblmDescBz},#{newVillName},
  259. #{pblmReason},
  260. #{pblmSggtn}, #{wtdstNote},
  261. #{objCode}, #{objName}, #{objAdCode},
  262. #{score},
  263. #{provincial},
  264. #{belongOrgId},
  265. #{belongAdCode}
  266. </sql>
  267. <sql id="page_where">
  268. <trim prefix="where" prefixOverrides="and | or ">
  269. <if test="waterUserId != null and waterUserId != ''">and WATER_USER_ID = #{waterUserId}</if>
  270. <if test="cwsCode != null and cwsCode != ''">and CWS_CODE = #{cwsCode}</if>
  271. <if test="newVillName != null and newVillName != ''">and NEW_VILL_NAME = #{newVillName}</if>
  272. <if test="pblmNameBz != null and pblmNameBz != ''">and PBLM_NAME_BZ = #{pblmNameBz}</if>
  273. <if test="snNumBz != null and snNumBz != ''">and SN_NUM_BZ = #{snNumBz}</if>
  274. <if test="attachBz != null and attachBz != ''">and attach_Bz = #{attachBz}</if>
  275. <if test="gongdiBzId != null and gongdiBzId != ''">and gongdi_Bz_Id = #{gongdiBzId}</if>
  276. <if test="checkPointBz != null and checkPointBz != ''">and CHECK_POINT_BZ = #{checkPointBz}</if>
  277. <if test="pblmDescBz != null and pblmDescBz != ''">and PBLM_DESC_BZ = #{pblmDescBz}</if>
  278. <if test="regid != null and regid != ''">and REGID = #{regid}</if>
  279. <if test="quote != null and quote != ''">and QUOTE = #{quote}</if>
  280. <if test="hasVedio != null and hasVedio != ''">and HAS_VEDIO = #{hasVedio}</if>
  281. <if test="villType != null and villType != ''">and VILL_TYPE = #{villType}</if>
  282. <if test="commonFileIds != null and commonFileIds != ''">and COMMON_FILE_IDS = #{commonFileIds}</if>
  283. <if test="fileNo != null and fileNo != ''">and FILE_NO = #{fileNo}</if>
  284. <if test="fileNoNumber != null and fileNoNumber != ''">and FILE_NO_NUMBER = #{fileNoNumber}</if>
  285. <if test="pblmsId != null and pblmsId != ''">and PBLMS_ID = #{pblmsId}</if>
  286. <if test="pblmId != null and pblmId != ''">and PBLM_ID = #{pblmId}</if>
  287. <if test="problemType != null and problemType != ''">and problem_Type = #{problemType}</if>
  288. <if test="objId != null and objId != ''">and OBJ_ID = #{objId}</if>
  289. <if test="objType != null and objType != ''">and OBJ_TYPE = #{objType}</if>
  290. <if test="inspGroupId != null and inspGroupId != ''">and INSP_GROUP_ID = #{inspGroupId}</if>
  291. <if test="pguid != null and pguid != ''">and PGUID = #{pguid}</if>
  292. <if test="inspPblmType != null and inspPblmType != ''">and INSP_PBLM_TYPE = #{inspPblmType}</if>
  293. <if test="inspPblmCode != null and inspPblmCode != ''">and INSP_PBLM_CODE = #{inspPblmCode}</if>
  294. <if test="inspPblmName != null and inspPblmName != ''">and INSP_PBLM_NAME = #{inspPblmName}</if>
  295. <if test="inspPblmDesc != null and inspPblmDesc != ''">and INSP_PBLM_DESC like '%${inspPblmDesc}%'</if>
  296. <if test="inspAddDesc != null and inspAddDesc != ''">and INSP_ADD_DESC = #{inspAddDesc}</if>
  297. <if test="pblmLong != null and pblmLong != ''">and PBLM_LONG = #{pblmLong}</if>
  298. <if test="pblmLat != null and pblmLat != ''">and PBLM_LAT = #{pblmLat}</if>
  299. <if test="ifCasePblm != null and ifCasePblm != ''">and IF_CASE_PBLM = #{ifCasePblm}</if>
  300. <if test="inspPblmOrgName != null and inspPblmOrgName != ''">and INSP_PBLM_ORG_NAME = #{inspPblmOrgName}
  301. </if>
  302. <if test="pblmPersName != null and pblmPersName != ''">and PBLM_PERS_NAME = #{pblmPersName}</if>
  303. <if test="inspPblmCate != null and inspPblmCate != ''">and INSP_PBLM_CATE = #{inspPblmCate}</if>
  304. <if test="pblmStat != null and pblmStat != ''">and PBLM_STAT = #{pblmStat}</if>
  305. <if test="reviOpin != null and reviOpin != ''">and REVI_OPIN = #{reviOpin}</if>
  306. <if test="reviConc != null and reviConc != ''">and REVI_CONC = #{reviConc}</if>
  307. <if test="reviOrgGuid != null and reviOrgGuid != ''">and REVI_ORG_GUID = #{reviOrgGuid}</if>
  308. <if test="dataStat != null and dataStat != ''">and DATA_STAT = #{dataStat}</if>
  309. <if test="collTime != null">and COLL_TIME = #{collTime}</if>
  310. <if test="recPers != null and recPers != ''">and REC_PERS = #{recPers}</if>
  311. <if test="note != null and note != ''">and NOTE = #{note}</if>
  312. <if test="year != null and year != ''">and TO_CHAR(COLL_TIME,'YYYY') = #{year}</if>
  313. <if test="startTime != null and startTime != ''">and COLL_TIME &gt; TO_DATE(#{startTime},'YYYY-MM-DD
  314. HH24:MI:SS')
  315. </if>
  316. <if test="endTime != null and endTime != ''">and COLL_TIME &lt; TO_DATE(#{endTime},'YYYY-MM-DD
  317. HH24:MI:SS')
  318. </if>
  319. <if test="findTime != null and findTime != ''">and to_char(coll_time,'yyyy-MM-dd')=#{findTime}</if>
  320. <if test="monthTime != null and monthTime != ''">and to_char(coll_time,'yyyy-MM')=#{monthTime}</if>
  321. <if test="objCode != null and objCode != ''">and OBJ_CODE = #{objCode}</if>
  322. <if test="objName != null and objName != ''">and OBJ_NAME = #{objName}</if>
  323. <if test="objAdCode != null and objAdCode != ''">and OBJ_AD_CODE = #{objAdCode}</if>
  324. <if test="wtdstNote != null and wtdstNote != ''">and WTDST_NOTE = #{wtdstNote}</if>
  325. <if test="provincial != null and provincial != ''">and PROVINCIAL = #{provincial}</if>
  326. <if test="belongOrgId != null and belongOrgId != ''">and BELONG_ORG_ID = #{belongOrgId}</if>
  327. <if test="belongAdCode != null and belongAdCode != ''">and BELONG_AD_CODE LIKE CONCAT(#{belongAdCode},'%') </if>
  328. </trim>
  329. </sql>
  330. <select id="getListByMap" resultMap="bisInspPblmResultMap" parameterType="java.util.Map">
  331. select m.* from BIS_INSP_PBLM m where m.obj_type=#{objType} and m.regid=#{regId}
  332. </select>
  333. <select id="get" resultMap="bisInspPblmResultMap" parameterType="String">
  334. select
  335. S.*, S.PBLM_NAME_BZ AS INSP_PBLMS_NAME,
  336. S.CHECK_POINT_BZ AS CHECK_POINT, S.PBLM_DESC_BZ AS PBLM_DESC,
  337. J.NM, B.PERS_NAME, P.ORG_ID, CASE WHEN R.STATE IS NULL THEN '0' ELSE R.STATE END AS STATE
  338. FROM BIS_INSP_PBLM S
  339. LEFT JOIN BIS_INSP_ALL_OBJ J ON S.OBJ_ID=J.OBJ_ID
  340. LEFT JOIN BIS_INSP_RSVR_RGSTR R ON R.OBJ_ID=J.OBJ_ID
  341. LEFT JOIN BIS_INSP_ALL_RLATION_PERS B ON S.REC_PERS = B.GUID
  342. LEFT JOIN OBJ_INSP_PBLMS P ON P.GUID=S.PBLMS_TYPE_ID
  343. where s.PBLM_ID = #{id}
  344. </select>
  345. <select id="getBy" resultMap="bisInspPblmResultMap">
  346. select
  347. <include refid="table_columns"/>
  348. from bis_insp_pblm
  349. <include refid="page_where"/>
  350. </select>
  351. <select id="getCommonSingle" resultMap="bisInspPblmResultMap" parameterType="String">
  352. select w.*,s.insp_pblms_name,s.check_point,s.pblm_desc from (
  353. select e.OBJ_NM as nm,m.*,s.pers_name from view_reg_base e join bis_insp_pblm m
  354. on e.OBJ_ID=m.obj_id
  355. left join bis_insp_all_rlation_pers s
  356. on m.rec_pers=s.guid
  357. where 1=1
  358. <if test="pType !=null and pType !=''">
  359. and m.obj_type=#{pType}
  360. </if>
  361. and m.pblm_id=#{pblmId}
  362. ) w left join obj_insp_pblms s on w.pblms_type_id=s.guid
  363. </select>
  364. <select id="pblmRectPage" parameterType="cn.com.goldenwater.dcproj.param.BisInspVo"
  365. resultType="cn.com.goldenwater.dcproj.param.BisInspVo">
  366. select e.RGSTR_NM as name,e.ad_code,p.rec_pers as pers_id,m.rect_id,m.id,p.*,to_char(p.coll_time,'yyyy-MM-dd')
  367. as insp_pblm_tm
  368. from VIEW_REG_BASE e,bis_insp_pblm p,bis_insp_rect_pblm m
  369. LEFT JOIN BIS_INSP_ALL_OBJ J ON e.obj_id = J.OBJ_ID
  370. LEFT JOIN BIS_INSP_ALL L ON L.ID = J.ID
  371. LEFT JOIN BIS_INSP_ALL_RLATION_PERS R ON P.REC_PERS = R.GUID
  372. where e.obj_id=p.obj_id and p.pblm_id=m.pblm_id and m.data_stat='0'
  373. <include refid="pblmPageSql"/>
  374. </select>
  375. <sql id="pblmPageSql">
  376. <if test="inspPblmCate != null and inspPblmCate != ''">and p.INSP_PBLM_CATE = #{inspPblmCate}</if>
  377. <if test="ifCasePblm != null and ifCasePblm != ''">and p.IF_CASE_PBLM = #{ifCasePblm}</if>
  378. <if test="dataStat != null and dataStat != ''">and p.DATA_STAT = #{dataStat}</if>
  379. <if test="inspPblmName != null and inspPblmName != ''">
  380. and p.INSP_PBLM_NAME like '%${inspPblmName}%'
  381. </if>
  382. <if test="name != null and name != ''">
  383. and p.obj_name like '%${name}%'
  384. </if>
  385. <if test="objName != null and objName != ''">
  386. and p.obj_name like '%${objName}%'
  387. </if>
  388. <if test="adCode != null and adCode != ''">
  389. and p.obj_ad_code like '${adCode}%'
  390. </if>
  391. <if test="objAdCode != null and objAdCode != ''">
  392. and p.obj_ad_code like '${objAdCode}%'
  393. </if>
  394. <!-- 小水电站 通用督查 基础对象code是uuid没有遵循行政区域的编码规则 -->
  395. <if test="province != null and province != ''">
  396. and (p.obj_code like '${province}%' or p.belong_ad_code like '${province}%' )
  397. </if>
  398. <if test="regid != null and regid != ''">and p.regid = #{regid}</if>
  399. <if test="objType != null and objType != ''">and p.obj_type = #{objType}</if>
  400. <if test="startTime != null and startTime != ''">and p.COLL_TIME &gt;= TO_DATE(#{startTime},'YYYY-MM-DD')</if>
  401. <if test="inspPblmTm != null and inspPblmTm != ''">and p.COLL_TIME=TO_DATE(#{inspPblmTm},'YYYY-MM-DD')</if>
  402. <if test="endTime != null and endTime != ''">and p.COLL_TIME &lt; TO_DATE(#{endTime},'YYYY-MM-DD')+1</if>
  403. <if test="pblmStat != null and pblmStat != ''">and p.PBLM_Stat = #{pblmStat}</if>
  404. <if test="hasVedio != null and hasVedio != ''">and p.HAS_VEDIO = #{hasVedio}</if>
  405. <if test="objId != null and objId != ''">and p.OBJ_ID =#{objId}</if>
  406. <if test="provincial != null and provincial != ''">and p.PROVINCIAL =#{provincial}</if>
  407. <if test='belongOrgId != null and belongOrgId != "" '>and p.BELONG_ORG_ID =#{belongOrgId}</if>
  408. <if test='belongAdCode != null and belongAdCode != "" '>and p.BELONG_AD_CODE like '${belongAdCode}%'</if>
  409. <if test="year != null and year != ''">and to_char(p.coll_time,'yyyy')= #{year}</if>
  410. <!--isJoinRec 是否加入到整改 0-未加过 1-加入过-->
  411. <if test="isJoinRec != null and isJoinRec != ''">
  412. <if test="isJoinRec =='0'.toString()">
  413. and p.pblm_id not in (select pblm_id from BIS_INSP_PBLM_PLIST WHERE pblm_id IS NOT NULL)
  414. </if>
  415. <if test="isJoinRec =='1'.toString()">
  416. and p.pblm_id in (select pblm_id from BIS_INSP_PBLM_PLIST WHERE pblm_id IS NOT NULL)
  417. </if>
  418. </if>
  419. <!--isJoinRec 是否加入到整改 0-未加过 1-加入过-->
  420. <if test="orgNm != null and orgNm != ''">and L.PNM like '%${orgNm}%'</if>
  421. <if test="persId != null and persId != ''">and P.REC_PERS = #{persId} </if>
  422. <if test="persName != null and persName != ''">and R.PERS_NAME like '%${persName}%'</if>
  423. <if test="leadDep !=null and leadDep != ''">and L.lead_dep LIKE CONCAT('%', CONCAT(#{leadDep}, '%') ) </if>
  424. order by P.coll_time desc
  425. </sql>
  426. <select id="pblmPage" parameterType="cn.com.goldenwater.dcproj.param.BisInspVo"
  427. resultType="cn.com.goldenwater.dcproj.param.BisInspVo">
  428. SELECT P.OBJ_NAME AS NAME,P.OBJ_AD_CODE AD_CODE,P.REC_PERS AS PERS_ID,P.*,TO_CHAR(P.COLL_TIME,'YYYY-MM-DD') AS INSP_PBLM_TM,B.AD_FULL_NAME
  429. FROM BIS_INSP_PBLM P
  430. JOIN BIS_INSP_ALL_OBJ J ON P.OBJ_ID = J.OBJ_ID
  431. LEFT JOIN BIS_INSP_ALL L ON L.ID = J.ID
  432. LEFT JOIN ATT_AD_BASE B ON P.OBJ_AD_CODE = B.AD_CODE
  433. LEFT JOIN BIS_INSP_ALL_RLATION_PERS R ON P.REC_PERS = R.GUID
  434. WHERE 1 = 1
  435. <include refid="pblmPageSql"/>
  436. </select>
  437. <select id="getOnePblm" resultType="cn.com.goldenwater.dcproj.model.KeyRegPblm" parameterType="java.lang.String">
  438. select CWS_CODE,HAS_VEDIO,PROBLEM_TYPE,QUALITY_TYPE_ID,DEFECT_TYPE_ID,gongdi_Bz_Id,
  439. VILLAGE_CODE,
  440. VILL_TYPE,
  441. PBLMS_TYPE_ID,
  442. REGID,
  443. COMMON_FILE_IDS,
  444. FILE_NO,
  445. FILE_NO_NUMBER,
  446. PBLMS_ID,m.quote,
  447. m.PBLM_ID, m.OBJ_ID, OBJ_TYPE, INSP_GROUP_ID,
  448. PGUID, INSP_PBLM_TYPE, INSP_PBLM_CODE, INSP_PBLM_NAME, INSP_PBLM_DESC, INSP_ADD_DESC, PBLM_LONG, PBLM_LAT,
  449. IF_CASE_PBLM, INSP_PBLM_ORG_NAME,
  450. PBLM_PERS_NAME, INSP_PBLM_CATE, PBLM_STAT, REVI_OPIN, REVI_CONC, REVI_ORG_GUID,
  451. m.DATA_STAT, m.COLL_TIME, m.REC_PERS, m.PROVINCIAL, m.BELONG_ORG_ID, m.BELONG_AD_CODE
  452. ,(select s.attach||'-'||s.sheet from obj_key_pblms s where s.id=QUALITY_TYPE_ID) as attach_qua,
  453. (select s.sn from obj_key_pblms s where s.id=QUALITY_TYPE_ID) as attach_qua_sn,
  454. (select s.attach_name from obj_key_pblms s where s.id=QUALITY_TYPE_ID) as attach_qua_name,
  455. (select s.attach||'-'||s.sheet from obj_key_pblms s where s.id=DEFECT_TYPE_ID) as attach_def,
  456. (select s.sn from obj_key_pblms s where s.id=DEFECT_TYPE_ID) as attach_def_sn,
  457. (select s.attach_name from obj_key_pblms s where s.id=DEFECT_TYPE_ID) as attach_def_name,
  458. (select s.attach||'-'||s.sheet from obj_key_pblms s where s.id=PBLMS_TYPE_ID) as attach_wg,
  459. (select s.sn from obj_key_pblms s where s.id=PBLMS_TYPE_ID) as attach_wg_sn,
  460. (select s.attach_name from obj_key_pblms s where s.id=PBLMS_TYPE_ID) as attach_wg_name,
  461. (select s.attach||'-'||s.sheet from obj_key_pblms s where s.id=PBLMS_ID) as attach_hetong,
  462. (select s.sn from obj_key_pblms s where s.id=PBLMS_ID) as attach_hetong_sn,
  463. (select s.sn from obj_key_pblms s where s.id=gongdi_Bz_Id) as attach_gongdi_sn,
  464. (select s.attach_name from obj_key_pblms s where s.id=gongdi_Bz_Id) as attach_gongdi_name,
  465. (select s.attach||'-'||s.sheet from obj_key_pblms s where s.id=gongdi_Bz_Id) as attach_gongdi,
  466. (select s.attach_name from obj_key_pblms s where s.id=PBLMS_ID) as attach_hetong_name,
  467. k.rect_meas,k.guid,u.nm as unit_Nm,
  468. k.rect_conc,k.note as rectNote,k.org_guid,k.coll_time as rect_time,e.revi_org,u.nm as rect_name
  469. <if test="pType =='7'.toString()">
  470. ,case when mo.lev='1' then mo.nm else '' end as first_Name,case when mo.lev='2' then mo.nm else '' end as
  471. second_Name,case when mo.lev='3' then mo.nm else '' end as third_Name
  472. </if>
  473. ,bi.nm
  474. from bis_insp_pblm m
  475. left join BIS_INSP_KEY_REG_SEC_UNIT u on m.regid=u.id
  476. left join (
  477. select revi_org , org_type from obj_key_pblm_rel l where l.org_type is not null group by revi_org,org_type order
  478. by org_type
  479. ) e on e.org_type=u.nature
  480. left join bis_insp_rect_fdbk k on m.pblm_id=k.pblm_id and k.guid=m.FDBK_ID
  481. <if test="pType =='7'.toString()">
  482. left join ATT_MAMPU_INFO mo on m.regid = mo.id
  483. </if>
  484. <if test="pType=='4'.toString()">
  485. left join bis_insp_key_register_section mo on u.sec_id = mo.id
  486. </if>
  487. left join BIS_INSP_KEY_REGISTER bi on mo.reg_Id=bi.id
  488. where m.PBLM_ID=#{pblmId}
  489. </select>
  490. <select id="findAll" resultMap="bisInspPblmResultMap">
  491. select
  492. <include refid="table_columns"/>
  493. from bis_insp_pblm
  494. </select>
  495. <select id="findList" resultMap="bisInspPblmResultMap">
  496. select
  497. attach_Bz,
  498. CWS_CODE,HAS_VEDIO,PROBLEM_TYPE,QUALITY_TYPE_ID,DEFECT_TYPE_ID,FDBK_ID,ITEM_ID,WATER_USER_ID,GONGDI_BZ_ID,
  499. VILLAGE_CODE,
  500. VILL_TYPE,
  501. PBLMS_TYPE_ID,
  502. REGID,
  503. COMMON_FILE_IDS,
  504. FILE_NO,
  505. FILE_NO_NUMBER,
  506. PBLMS_ID,
  507. PBLM_ID,
  508. OBJ_ID,
  509. OBJ_TYPE,
  510. INSP_GROUP_ID,
  511. PGUID,
  512. INSP_PBLM_TYPE,
  513. INSP_PBLM_CODE,
  514. INSP_PBLM_NAME,
  515. INSP_PBLM_DESC,
  516. INSP_ADD_DESC,
  517. PBLM_LONG,
  518. PBLM_LAT,
  519. IF_CASE_PBLM,
  520. INSP_PBLM_ORG_NAME,
  521. PBLM_PERS_NAME,
  522. INSP_PBLM_CATE,
  523. REL_BASIS,
  524. PBLM_STAT,
  525. REVI_OPIN,
  526. REVI_CONC,
  527. REVI_ORG_GUID,
  528. DATA_STAT,
  529. COLL_TIME,
  530. REC_PERS,
  531. NOTE,QUOTE,
  532. UP_TM,PBLM_NAME_BZ,CHECK_POINT_BZ,SN_NUM_BZ,PBLM_DESC_BZ,NEW_VILL_NAME,
  533. PBLM_REASON,
  534. PBLM_SGGTN,WTDST_NOTE,
  535. OBJ_CODE,OBJ_NAME,OBJ_AD_CODE,PROVINCIAL,BELONG_ORG_ID,BELONG_AD_CODE
  536. from bis_insp_pblm
  537. <include refid="page_where"/>
  538. </select>
  539. <sql id="page_search">
  540. <trim prefix="where" prefixOverrides="and | or ">
  541. <if test="persName != null and persName != ''">and PERS_NAME like '%${persName}%'</if>
  542. <if test="inspPblmCate != null and inspPblmCate != ''">and INSP_PBLM_CATE = #{inspPblmCate}</if>
  543. <if test="ifCasePblm != null and ifCasePblm != ''">and IF_CASE_PBLM = #{ifCasePblm}</if>
  544. <if test="dataStat != null and dataStat != ''">and DATA_STAT = #{dataStat}</if>
  545. <if test="inspPblmName != null and inspPblmName != ''">and INSP_PBLM_NAME like '%${inspPblmName}%'</if>
  546. <if test="pblmDescBz != null and pblmDescBz != ''">and PBLM_DESC_BZ like '%${pblmDescBz}%'</if>
  547. <if test="inspPblmsName != null and inspPblmsName != ''">and INSP_PBLMS_NAME like '%${inspPblmsName}%'</if>
  548. <if test="newVillName != null and newVillName != ''">and NEW_VILL_NAME = #{newVillName}</if>
  549. <if test="regid != null and regid != ''">and regid = #{regid}</if>
  550. <if test="rgstrId != null and rgstrId != ''">and regid = #{rgstrId}</if>
  551. <if test="objType != null and objType != ''">and obj_type = #{objType}</if>
  552. <if test="waterUserId != null and waterUserId != ''">and WATER_USER_ID = #{waterUserId}</if>
  553. <choose>
  554. <when test="villType == '34' ">
  555. AND CWS_CODE IS NULL
  556. </when>
  557. <when test="villType == '33' ">
  558. AND WATER_USER_ID IS NULL
  559. </when>
  560. <when test="villType != null and villType != '' ">and VILL_TYPE in (${villType})</when>
  561. </choose>
  562. <if test="villageCode != null and villageCode != ''">and village_Code = #{villageCode}</if>
  563. <if test="cwsCode != null and cwsCode != ''">and cws_Code = #{cwsCode}</if>
  564. <if test="code != null and code != ''">and CODE = #{code}</if>
  565. <if test="codes != null and codes != ''">and CODE in (${codes})</if>
  566. <if test="hasVedio != null and hasVedio != ''">and HAS_VEDIO = #{hasVedio}</if>
  567. <if test="recPers != null and recPers != ''">and REC_PERS = #{recPers}</if>
  568. <if test="objId != null and objId != ''">and OBJ_ID =#{objId}</if>
  569. <if test="objIdes != null and objIdes != ''">and OBJ_ID in (${objIdes})</if>
  570. <if test="nm != null and nm != ''">and nm like '%${nm}%'</if>
  571. <if test="startTime != null and startTime != ''">and COLL_TIME &gt;= TO_DATE(#{startTime},'YYYY-MM-DD')</if>
  572. <if test="findTime != null and findTime != ''">and COLL_TIME=TO_DATE(#{findTime},'YYYY-MM-DD')</if>
  573. <if test="endTime != null and endTime != ''">and COLL_TIME &lt; TO_DATE(#{endTime},'YYYY-MM-DD')+1</if>
  574. <if test="pblmStat != null and pblmStat != ''">and PBLM_Stat = #{pblmStat}</if>
  575. <if test="srcDesc != null and srcDesc != ''">and srcDesc like '%${srcDesc}%'</if>
  576. <if test="oides != null and oides != ''">and oid in (${oides})</if>
  577. <if test="adCode != null and adCode != ''">and CODE like '${adCode}%'</if>
  578. <if test="engScal != null and engScal != ''">and eng_Scal =#{engScal}</if>
  579. <if test="wagaScal != null and wagaScal != ''">and waga_Scal =#{wagaScal}</if>
  580. <if test="gateType != null and gateType != ''">and gate_Type =#{gateType}</if>
  581. <if test="sttp != null and sttp != ''">and sttp =#{sttp}</if>
  582. <if test="rePtype != null and rePtype != ''">and re_Ptype =#{rePtype}</if>
  583. <if test="pnm != null and pnm != ''">and pnm =#{pnm}</if>
  584. <!--and COLL_TIME &gt;= TO_DATE('2020-01-01','YYYY-MM-DD')-->
  585. </trim>
  586. </sql>
  587. <sql id="orgIdSql">
  588. <choose>
  589. <when test="orgId !=null and orgId !=''">
  590. and ORG_ID=#{orgId}
  591. </when>
  592. <otherwise>
  593. and ORG_ID is null
  594. </otherwise>
  595. </choose>
  596. </sql>
  597. <select id="listOfPage" resultMap="bisInspPblmResultMap"
  598. parameterType="cn.com.goldenwater.dcproj.param.BisInspPblmParam">
  599. SELECT * FROM (
  600. SELECT
  601. P.*, O.NM, O.OBJ_AD_CODE AS AD_CODE,
  602. AAB.AD_NAME, AAB.AD_FULL_NAME, RP.PERS_NAME, A.PNM, T.NAME AS OBJ_TYPE_NAME
  603. FROM BIS_INSP_PBLM P
  604. JOIN BIS_INSP_ALL_OBJ O on P.OBJ_ID = O.OBJ_ID
  605. JOIN (select * FROM ATT_INSP_TYPE where code IN (select INSP_TYPE FROM REL_ORG_INSP_TYPE
  606. <where>
  607. <if test="orgId != null and orgId != '' ">
  608. AND ORG_ID = #{orgId}
  609. </if>
  610. </where>
  611. )) T on P.OBJ_TYPE = T.PTYPE
  612. <!-- JOIN (-->
  613. <!-- <foreach collection="rgsterTable" index="index" item="item">-->
  614. <!-- <if test="index != 0">-->
  615. <!-- UNION ALL-->
  616. <!-- </if>-->
  617. <!-- <choose>-->
  618. <!-- <when test="item == 'BIS_INSP_GRW' ">-->
  619. <!-- SELECT OBJ_ID, INSP_STATE AS "STATE" FROM BIS_INSP_GRW WHERE INSP_STATE = '2'-->
  620. <!-- </when>-->
  621. <!-- <otherwise>-->
  622. <!-- SELECT OBJ_ID, STATE FROM ${item} WHERE STATE = '2'-->
  623. <!-- </otherwise>-->
  624. <!-- </choose>-->
  625. <!-- </foreach>-->
  626. <!-- ) R ON R.OBJ_ID = o.OBJ_ID-->
  627. LEFT JOIN ATT_AD_BASE AAB on O.OBJ_AD_CODE = AAB.AD_CODE
  628. LEFT JOIN BIS_INSP_ALL_RLATION_PERS RP on P.REC_PERS = RP.GUID
  629. LEFT JOIN BIS_INSP_ALL A on A.ID = O.ID
  630. <if test='null != pblmStat and pblmStat != "" and "5" == pblmStat'>
  631. LEFT JOIN BIS_INSP_PBLM_PLIST Pl ON PL.PBLM_ID = P.PBLM_ID and PL.DATA_STAT='0'
  632. </if>
  633. <where>
  634. <if test="orgId != null and orgId != '' ">O.ID LIKE '___${orgId}%'</if>
  635. <if test='null != pblmStat and pblmStat != "" and "5" == pblmStat'>
  636. and PL.PBLM_OUT = '1'
  637. </if>
  638. </where>
  639. ) A
  640. <where>
  641. <if test="depm != null and depm.length > 0 ">
  642. AND OBJ_TYPE IN (SELECT TO_NUMBER(PTYPE) FROM ATT_INSP_TYPE_DUTY where DUTY_DEP IN
  643. <foreach item="item" index="index" collection="depm" open="(" separator="," close=")">
  644. '${item}'
  645. </foreach>
  646. )
  647. </if>
  648. <if test="persName != null and persName != ''">and PERS_NAME like '%${persName}%'</if>
  649. <if test="inspPblmCate != null and inspPblmCate != ''">and INSP_PBLM_CATE = #{inspPblmCate}</if>
  650. <if test="ifCasePblm != null and ifCasePblm != ''">and IF_CASE_PBLM = #{ifCasePblm}</if>
  651. <if test="inspPblmName != null and inspPblmName != ''">and INSP_PBLM_NAME like '%${inspPblmName}%'</if>
  652. <if test="objType != null and objType != ''">and obj_type = #{objType}</if>
  653. <if test="objTypeName != null and objTypeName != ''">and OBJ_TYPE_NAME LIKE '%${objTypeName}%'</if>
  654. <if test="hasVedio != null and hasVedio != ''">and HAS_VEDIO = #{hasVedio}</if>
  655. <if test="objId != null and objId != ''">and OBJ_ID =#{objId}</if>
  656. <if test="nm != null and nm != ''">and nm like '%${nm}%'</if>
  657. <if test="startTime != null and startTime != ''">and COLL_TIME &gt;= TO_DATE(#{startTime},'YYYY-MM-DD')</if>
  658. <if test="endTime != null and endTime != ''">and COLL_TIME &lt; TO_DATE(#{endTime},'YYYY-MM-DD') + 1</if>
  659. <if test="sttm != null and sttm != '' and entm != null and entm != '' ">
  660. AND COLL_TIME &gt;= TO_DATE(#{sttm}, 'YYYY-MM-DD')
  661. AND COLL_TIME &lt; TO_DATE(#{entm}, 'YYYY-MM-DD') + 1
  662. </if>
  663. <if test="adCode != null and adCode != ''">and AD_CODE like '${adCode}%'</if>
  664. <!-- 福建省 福州市排除 平潭县 把平潭县 归属到 平潭综合实验区-->
  665. <if test='adCode != null and adCode == "3501" '>AND SUBSTR(AD_CODE, 0, 6) !='350128'</if>
  666. <if test='adCode != null and adCode == "3510" '>AND SUBSTR(AD_CODE, 0, 6) ='350128'</if>
  667. <if test="pnm != null and pnm != ''">and pnm like '%${pnm}%'</if>
  668. <if test="orgNm != null and orgNm != ''">and pnm like '%${orgNm}%'</if>
  669. <if test="adFullName != null and adFullName != ''">and REPLACE(AD_FULL_NAME, '-', '') LIKE
  670. '%${adFullName}%'
  671. </if>
  672. </where>
  673. </select>
  674. <select id="list" resultMap="bisInspPblmResultMap"
  675. parameterType="cn.com.goldenwater.dcproj.param.BisInspPblmParam">
  676. SELECT
  677. *
  678. FROM BIS_INSP_PBLM
  679. <where>
  680. <if test="inspPblmCate != null and inspPblmCate != ''">and INSP_PBLM_CATE = #{inspPblmCate}</if>
  681. <if test="ifCasePblm != null and ifCasePblm != ''">and IF_CASE_PBLM = #{ifCasePblm}</if>
  682. <if test="inspPblmName != null and inspPblmName != ''">and INSP_PBLM_NAME like '%${inspPblmName}%'</if>
  683. <if test="objType != null and objType != ''">and obj_type = #{objType}</if>
  684. <if test="objTypeName != null and objTypeName != ''">and OBJ_TYPE_NAME LIKE '%${objTypeName}%'</if>
  685. <if test="hasVedio != null and hasVedio != ''">and HAS_VEDIO = #{hasVedio}</if>
  686. <if test="objId != null and objId != ''">and OBJ_ID =#{objId}</if>
  687. <if test="startTime != null and startTime != ''">and COLL_TIME &gt;= TO_DATE(#{startTime},'YYYY-MM-DD')</if>
  688. <if test="endTime != null and endTime != ''">and COLL_TIME &lt; TO_DATE(#{endTime},'YYYY-MM-DD') + 1</if>
  689. <if test="adCode != null and adCode != ''">and AD_CODE like '${adCode}%'</if>
  690. <if test="pnm != null and pnm != ''">and pnm like '%${pnm}%'</if>
  691. <if test="orgNm != null and orgNm != ''">and pnm like '%${orgNm}%'</if>
  692. <if test="regid != null and regid != ''">and REGID like '%${regid}%'</if>
  693. </where>
  694. </select>
  695. <select id="findPlbmList" resultMap="bisInspPblmResultMap"
  696. parameterType="cn.com.goldenwater.dcproj.param.PlbmParam">
  697. select * from (
  698. select w.* from (
  699. select
  700. CASE WHEN P.VILLAGE_CODE IS NOT NULL THEN AD.AD_NAME
  701. WHEN P.OBJ_TYPE='3' THEN H.AD_NM
  702. WHEN P.CWS_CODE IS NOT NULL THEN E.CWS_NAME
  703. ELSE J.NM END AS srcDesc,
  704. e.cws_name,j.code,j.nm,j.id as oid,ad.ad_code,
  705. R.PERS_NAME, P.*,
  706. NVL(P.INSP_PBLM_NAME,P.PBLM_NAME_BZ) AS INSP_PBLMS_NAME, P.PBLM_DESC_BZ AS PBLM_DESC,P.CHECK_POINT_BZ AS CHECK_POINT,
  707. S.ATTACH,S.SN_NUM,S.SHEET,
  708. <if test='villType == "8" or villType=="9" '>u.nm as unit_nm,</if>
  709. <if test='villType=="0" or objType=="1" or objType=="36"'>g.eng_scal,</if>
  710. <if test='villType=="7" or objType=="6"'>wa.eng_scal as waga_Scal,wa.gate_type,</if>
  711. <if test='villType=="5" or objType=="5"'>gr.sttp,</if>
  712. <if test='villType=="8" or villType=="9"'>BA.ptype as re_ptype,</if>
  713. (select l.pnm from bis_insp_all l where l.id=substr(al.id,0,6)) as pnm,
  714. al.sttm, al.entm
  715. from BIS_INSP_PBLM p
  716. join (select * from bis_insp_all_obj o
  717. <where>
  718. <include refid="choseSql"/>
  719. </where>
  720. ) J ON P.OBJ_ID=J.OBJ_ID
  721. LEFT JOIN BIS_INSP_ALL_RLATION_PERS R ON P.REC_PERS=R.GUID
  722. LEFT JOIN OBJ_INSP_PBLMS S ON P.PBLMS_TYPE_ID=S.GUID
  723. LEFT JOIN ATT_CWS_BASE E ON J.CODE=E.CWS_CODE
  724. LEFT JOIN ATT_AD_X_BASE AD ON P.VILLAGE_CODE = AD.AD_CODE
  725. LEFT JOIN BIS_INSP_WTDST_TRACK H ON P.REGID = H.TRACK_ID
  726. <if test='villType=="8"'>left join BIS_INSP_KEY_REG_SEC_UNIT u on p.regid=u.id</if>
  727. <if test='villType=="9"'>left join att_mampu_info u on p.regid=u.id</if>
  728. <if test='villType=="0" or objType=="1" or objType=="36"'>left join bis_insp_rsvr_rgstr g on
  729. j.obj_id=g.obj_id
  730. </if>
  731. <if test='villType=="7" or objType=="6"'>left join att_waga_rgstr wa on j.obj_id=wa.obj_id</if>
  732. <if test='villType=="5" or objType=="5"'>left join BIS_INSP_GRW gr on j.obj_id=gr.obj_id</if>
  733. <if test='villType=="8" or villType=="9"'>left join bis_insp_key_register BA on j.obj_id=BA.obj_id</if>
  734. <choose>
  735. <when test='objType=="17" '>left join BIS_INSP_OPRD_CSTR_PROJ_RGSTR BA on j.obj_id=BA.obj_id</when>
  736. <when test='objType=="18" '>left join ATT_JSKEJIAN_FLKDIS_RGSTR BA on j.obj_id=BA.obj_id</when>
  737. <when test='objType=="19" '>left join ATT_JSKEJIAN_WATER_RGSTR BA on j.obj_id=BA.obj_id</when>
  738. <when test='objType == "20"'>LEFT JOIN ATT_JSKEJIAN_ECOFRD_RGSTR BA on j.obj_id = BA.obj_id</when>
  739. <when test='objType == "22"'>LEFT JOIN BIS_INSP_RSML_RGSTR BA on j.obj_id = BA.obj_id</when>
  740. <when test='objType=="28"'>left join bis_insp_IRR_RGSTR BA on j.obj_id = BA.obj_id</when>
  741. <when test='objType=="62"'>left join BIS_INSP_CDEP_RGSTR BA on j.obj_id = BA.obj_id</when>
  742. <when test='objType=="67"'>left join BIS_INSP_BID_RGSTR BA on j.obj_id = BA.obj_id</when>
  743. <when test='objType=="68"'>left join BIS_INSP_RLRW_RGSTR BA on j.obj_id = BA.obj_id</when>
  744. <when test='objType=="69"'>left join BIS_INSP_DRDMP_RGSTR BA on j.obj_id = BA.obj_id</when>
  745. <when test='objType=="70"'>left join BIS_INSP_GROW_RGSTR BA on j.obj_id = BA.obj_id</when>
  746. <when test='objType=="73"'>left join BIS_INSP_HYST_RGSTR BA on j.obj_id = BA.obj_id</when>
  747. <when test='objType=="98"'>left join BIS_INSP_FUND_RGSTR BA on j.obj_id = BA.obj_id</when>
  748. <when test='objType == "99"'>LEFT JOIN BIS_INSP_KEYSAFQH_REGISTER BA ON BA.OBJ_ID = J.OBJ_ID</when>
  749. <when test='objType == "100"'>LEFT JOIN BIS_INSP_KEYCHKQH_REGISTER BA ON BA.OBJ_ID = J.OBJ_ID</when>
  750. <when test='objType == "101"'>LEFT JOIN BIS_INSP_SVWTQH BA ON BA.OBJ_ID = J.OBJ_ID</when>
  751. <when test='objType == "104"'>LEFT JOIN BIS_INSP_STSTN BA ON BA.OBJ_ID = J.OBJ_ID</when>
  752. <when test='objType == "105"'>LEFT JOIN BIS_INSP_QYMTEN BA ON BA.OBJ_ID = J.OBJ_ID</when>
  753. <when test='objType == "106"'>LEFT JOIN BIS_INSP_RSVRYN_RGSTR BA ON BA.OBJ_ID = J.OBJ_ID</when>
  754. <when test='objType == "108"'>LEFT JOIN BIS_INSP_XJVILL BA ON BA.OBJ_ID = J.OBJ_ID</when>
  755. <when test='objType == "110"'>LEFT JOIN BIS_INSP_FJWTENF BA ON BA.OBJ_ID = J.OBJ_ID</when>
  756. <when test='objType == "112"'>LEFT JOIN BIS_INSP_WIUJS_RGSTR BA ON BA.OBJ_ID = J.OBJ_ID</when>
  757. <when test='objType == "113"'>LEFT JOIN BIS_INSP_SWHSJS BA ON BA.OBJ_ID = J.OBJ_ID</when>
  758. <when test='objType == "115"'>LEFT JOIN BIS_INSP_RSVR_SD BA ON BA.OBJ_ID = J.OBJ_ID</when>
  759. <when test='objType == "116"'>LEFT JOIN BIS_INSP_HYSTP BA ON BA.OBJ_ID = J.OBJ_ID</when>
  760. <when test='objType == "119"'>LEFT JOIN BIS_INSP_FJQA BA ON BA.OBJ_ID = J.OBJ_ID</when>
  761. <when test='objType == "120"'>LEFT JOIN BIS_INSP_JSPWIU BA ON BA.OBJ_ID = J.OBJ_ID</when>
  762. <when test='objType == "126"'>LEFT JOIN BIS_INSP_JSPWIU2024 BA ON BA.OBJ_ID = J.OBJ_ID</when>
  763. <otherwise>LEFT JOIN BIS_INSP_GNRL_RGSTR BA ON BA.OBJ_ID = J.OBJ_ID</otherwise>
  764. </choose>
  765. left join bis_insp_all al on al.id=j.id
  766. ) w
  767. where 1=1
  768. <if test="tabType =='2'.toString()">
  769. and w.entm &lt;to_date(#{nowTime},'yyyy-MM-dd')+1
  770. </if>
  771. <if test="tabType =='1'.toString()">
  772. and w.entm &gt;=to_date(#{nowTime},'yyyy-MM-dd') and w.sttm &lt; to_date(#{nowTime},'yyyy-MM-dd')+1
  773. </if>
  774. <if test="timeType =='1'.toString()">
  775. and w.COLL_TIME >=to_date(#{nowTime},'yyyy-MM-dd')
  776. </if>
  777. <if test="timeType =='2'.toString()">
  778. and w.COLL_TIME &gt;=to_date(#{nowMonth},'yyyy-MM')
  779. </if>
  780. <if test="timeType =='3'.toString()">
  781. and w.COLL_TIME &gt;=to_date(#{nowYear},'yyyy')
  782. </if>
  783. <if test="inspPblmName !=null and inspPblmName !=''">
  784. and w.insp_pblm_name like '%${inspPblmName}%'
  785. </if>
  786. and REGEXP_LIKE(W.OID,'^('|| ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{presId}
  787. <include refid="orgIdSql"/>
  788. )>0 then
  789. (SELECT LISTAGG(id, '|') as id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{presId}
  790. <include refid="orgIdSql"/> group by persid
  791. ) else (select 'non' from dual) end) ||')')
  792. ) a
  793. <include refid="page_search"/>
  794. order by
  795. <if test="orderBy !=null and orderBy !=''">
  796. ${orderBy},
  797. </if>
  798. PBLM_ID
  799. </select>
  800. <!--精确获取每一个'+'后的数据-->
  801. <select id="findAddPlusPblm" resultMap="bisInspPblmResultMap">
  802. select j.nm,j.code,m.*,s.insp_pblms_name,s.check_point,r.pers_name from BIS_INSP_RSVR_PBLM p
  803. join bis_insp_pblm m on p.pblm_id=m.pblm_id and m.rec_pers=#{persId}
  804. left join BIS_INSP_ALL_OBJ j on m.obj_id=j.obj_id
  805. left join OBJ_INSP_PBLMS s on m.pblms_type_id=s.guid
  806. left join BIS_INSP_ALL_RLATION_PERS r on m.rec_pers=r.guid
  807. </select>
  808. <!--获取问题与文件关系-->
  809. <select id="findPblmBindFiles" resultType="cn.com.goldenwater.dcproj.model.PblmDoc"
  810. parameterType="cn.com.goldenwater.dcproj.param.DocType">
  811. select
  812. pblm_id,
  813. LISTAGG(f.file_path, ',') as filePathes,
  814. LISTAGG(f.file_ext, ',') as fileExtes
  815. from (
  816. select w.* from (
  817. select j.code,j.nm,j.id as oid,j.ptype,p.* from (
  818. select * from BIS_INSP_PBLM where 1=1
  819. <if test="hasVedio != null and hasVedio != ''">and HAS_VEDIO = #{hasVedio}</if>
  820. <if test="startTime != null and startTime != ''">and COLL_TIME &gt;= TO_DATE(#{startTime},'YYYY-MM-DD')</if>
  821. <if test="findTime != null and findTime != ''">and COLL_TIME=TO_DATE(#{findTime},'YYYY-MM-DD')</if>
  822. <if test="endTime != null and endTime != ''">and COLL_TIME &lt;= TO_DATE(#{endTime},'YYYY-MM-DD')+1</if>
  823. <if test="inspPblmCate != null and inspPblmCate != ''">and INSP_PBLM_CATE = #{inspPblmCate}</if>
  824. <if test="ifCasePblm != null and ifCasePblm != ''">and IF_CASE_PBLM = #{ifCasePblm}</if>
  825. <if test="pType != null and pType != ''">and obj_type = #{pType}</if>
  826. <if test="villType != null and villType != ''">and VILL_TYPE = #{villType}</if>
  827. <if test="problemType != null and problemType != ''">and problem_Type = #{problemType}</if>
  828. <if test="pblmIds != null and pblmIds != ''">and pblm_id in (${pblmIds})</if>
  829. ) p
  830. join (
  831. select * from BIS_INSP_ALL_OBJ o where o.ptype=#{pType}
  832. <include refid="choseSql"/>
  833. ) j on p.obj_id=j.obj_id
  834. ) w where
  835. REGEXP_LIKE(
  836. W.OID,'^('||
  837. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  838. <include refid="orgIdSql"/>
  839. )>0 then
  840. (SELECT LISTAGG(id, '|') as
  841. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  842. <include refid="orgIdSql"/>group BY PERSID
  843. )
  844. else (select 'non' from dual) end)
  845. ||')')
  846. ) a ,gw_com_file f where a.pblm_id=f.biz_id group by pblm_id
  847. </select>
  848. <!--172工程,该方法需要修改对应的标准库-->
  849. <select id="findKeyRegPlbmList" resultType="cn.com.goldenwater.dcproj.model.KeyRegPblm"
  850. parameterType="cn.com.goldenwater.dcproj.param.KeyRegPatam">
  851. select * from (
  852. select w.* from (
  853. select j.code,j.nm,j.id as oid,j.ptype,r.PERS_NAME,p.*,
  854. u.nature,e.revi_org,l.pnm as org_nm,l.entm,l.sttm,j.id as org_id,u.sec_id,
  855. (select s.attach||'-'||s.sheet from obj_key_pblms s where s.id=QUALITY_TYPE_ID) as attach_qua,
  856. (select s.sn from obj_key_pblms s where s.id=QUALITY_TYPE_ID) as attach_qua_sn,
  857. (select s.attach_name from obj_key_pblms s where s.id=QUALITY_TYPE_ID) as attach_qua_name,
  858. (select s.attach||'-'||s.sheet from obj_key_pblms s where s.id=DEFECT_TYPE_ID) as attach_def,
  859. (select s.sn from obj_key_pblms s where s.id=DEFECT_TYPE_ID) as attach_def_sn,
  860. (select s.attach_name from obj_key_pblms s where s.id=DEFECT_TYPE_ID) as attach_def_name,
  861. (select s.attach||'-'||s.sheet from obj_key_pblms s where s.id=PBLMS_TYPE_ID) as attach_wg,
  862. (select s.sn from obj_key_pblms s where s.id=PBLMS_TYPE_ID) as attach_wg_sn,
  863. (select s.attach_name from obj_key_pblms s where s.id=PBLMS_TYPE_ID) as attach_wg_name,
  864. (select s.attach||'-'||s.sheet from obj_key_pblms s where s.id=PBLMS_ID) as attach_hetong,
  865. (select s.sn from obj_key_pblms s where s.id=PBLMS_ID) as attach_hetong_sn,
  866. (select s.attach_name from obj_key_pblms s where s.id=PBLMS_ID) as attach_hetong_name,
  867. (select s.attach||'-'||s.sheet from obj_key_pblms s where s.id=gongdi_bz_id) as attach_Gongdi,
  868. (select s.sn from obj_key_pblms s where s.id=gongdi_bz_id) as attach_Gongdi_sn,
  869. (select s.attach_name from obj_key_pblms s where s.id=gongdi_bz_id) as attach_Gongdi_name
  870. ,u.nm as unit_nm,
  871. k.rect_meas,k.guid,(case when k.data_stat is null then '0' else k.data_stat end) as check_stat,
  872. k.rect_conc,k.note as rectNote,k.org_guid,k.coll_time as rect_time,case when mo.lev='1' then mo.nm else '' end
  873. as first_Name,case when mo.lev='2' then mo.nm else '' end as second_Name,case when mo.lev='3' then mo.nm else ''
  874. end as third_Name,
  875. s.nm as sec_name
  876. from (select * from BIS_INSP_PBLM pb where pb.obj_type=#{pType}
  877. <if test="inspPblmCate != null and inspPblmCate != ''">and pb.INSP_PBLM_CATE = #{inspPblmCate}</if>
  878. <if test="ifCasePblm != null and ifCasePblm != ''">and pb.IF_CASE_PBLM = #{ifCasePblm}</if>
  879. <if test="hasVedio != null and hasVedio != ''">and pb.HAS_VEDIO = #{hasVedio}</if>
  880. <if test="inspPblmName != null and inspPblmName != ''">and pb.INSP_PBLM_NAME like '%${inspPblmName}%'</if>
  881. <if test="reviConc =='0'.toString()">
  882. <if test="startTime != null and startTime != ''">
  883. AND pb.COLL_TIME &gt;= TO_DATE(#{startTime},'YYYY-MM-DD')
  884. </if>
  885. <if test="findTime != null and findTime != ''">and pb.COLL_TIME=TO_DATE(#{findTime},'YYYY-MM-DD')</if>
  886. <if test="endTime != null and endTime != ''">
  887. AND pb.COLL_TIME &lt;= TO_DATE(#{endTime},'YYYY-MM-DD')+1
  888. </if>
  889. </if>
  890. ) p
  891. join (select * from BIS_INSP_ALL_OBJ o where o.pType=#{pType}
  892. <if test="objId != null and objId != ''">and OBJ_ID = #{objId}</if>
  893. <include refid="choseSql"/>
  894. ) j on p.obj_id=j.obj_id
  895. join BIS_INSP_ALL_RLATION_PERS r on p.rec_pers=r.guid
  896. left join bis_insp_rect_fdbk k on p.pblm_id=k.pblm_id and k.guid=p.FDBK_ID
  897. <choose>
  898. <when test='pType == "99"'>
  899. left join BIS_INSP_KEYSAFQH_REGISTER_UNI u on p.regid=u.id
  900. </when>
  901. <when test='pType == "100"'>
  902. left join BIS_INSP_KEYCHKQH_UNIT u on p.regid=u.id
  903. </when>
  904. <otherwise>
  905. left join BIS_INSP_KEY_REG_SEC_UNIT u on p.regid=u.id
  906. </otherwise>
  907. </choose>
  908. left join (
  909. select revi_org , org_type from obj_key_pblm_rel l where l.org_type is not null group by revi_org,org_type order
  910. by org_type
  911. ) e on e.org_type=u.nature
  912. left join BIS_INSP_ALL l on l.id=j.id
  913. left join ATT_MAMPU_INFO mo on p.regid = mo.id
  914. <choose>
  915. <when test='pType == "99"'>
  916. left join BIS_INSP_KEYSAFQH_REGISTER_SEC s on u.sec_id = s.id
  917. </when>
  918. <when test='pType == "100"'>
  919. left join BIS_INSP_KEYCHKQH_SECTION s on u.sec_id = s.id
  920. </when>
  921. <otherwise>
  922. left join BIS_INSP_KEY_REGISTER_SECTION s on u.sec_id = s.id
  923. </otherwise>
  924. </choose>
  925. ) w where w.ptype=#{pType}
  926. <if test="tabType =='2'.toString()">
  927. and w.entm &lt;to_date(#{nowTime},'yyyy-MM-dd')+1
  928. </if>
  929. <if test="tabType =='1'.toString()">
  930. and w.entm &gt;=to_date(#{nowTime},'yyyy-MM-dd')
  931. </if>
  932. and
  933. REGEXP_LIKE(
  934. W.OID,'^('||
  935. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  936. <include refid="orgIdSql"/>
  937. )>0 then
  938. (SELECT LISTAGG(id, '|') as
  939. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  940. <include refid="orgIdSql"/> GROUP BY PERSID
  941. )
  942. else (select 'non' from dual) end)
  943. ||')')
  944. ) a where 1=1
  945. <if test="nm != null and nm != ''">and nm like '%${nm}%'</if>
  946. <if test="orgNm != null and orgNm != ''">and org_nm like '%${orgNm}%'</if>
  947. <if test="problemType != null and problemType != ''">and problem_Type = #{problemType}</if>
  948. <if test="persName != null and persName != ''">and PERS_NAME like '%${persName}%'</if>
  949. <if test="reviConc != null and reviConc != ''">and REVI_CONC = #{reviConc}</if>
  950. <if test="regId != null and regId != ''">and regId= #{regId}</if>
  951. <if test="villType != null and villType != ''">and vill_type = #{villType}</if>
  952. <if test="codes != null and codes != ''">and CODE in (${codes})</if>
  953. <if test="recPers !=null and recPers !=''">and rec_pers=#{recPers}</if>
  954. <if test="rectConc != null and rectConc != ''">and RECT_CONC in (${rectConc})</if>
  955. <if test="orgIds != null and orgIds != ''">and org_id in (${orgIds})</if>
  956. <if test="inspPblmType != null and inspPblmType != ''">and INSP_PBLM_TYPE = #{inspPblmType}</if>
  957. <if test="secId != null and secId != ''">and SEC_ID = #{secId}</if>
  958. <if test="state != null and state != ''">and STATE = #{state}</if>
  959. <if test="reviConc !='0'.toString()">
  960. <if test="startTime != null and startTime != ''">
  961. AND RECT_TIME &gt;= TO_DATE(#{startTime},'YYYY-MM-DD')
  962. </if>
  963. <if test="findTime != null and findTime != ''">and RECT_TIME=TO_DATE(#{findTime},'YYYY-MM-DD')</if>
  964. <if test="endTime != null and endTime != ''">
  965. AND RECT_TIME &lt; TO_DATE(#{endTime},'YYYY-MM-DD')+1
  966. </if>
  967. </if>
  968. <choose>
  969. <when test="orderBy !=null and orderBy !=''">
  970. ${orderBy}
  971. </when>
  972. <otherwise>
  973. order by coll_time desc
  974. </otherwise>
  975. </choose>
  976. </select>
  977. <select id="findJswaPlbmList" parameterType="cn.com.goldenwater.dcproj.param.PrdParam"
  978. resultMap="bisInspPblmResultMap">
  979. select * from (
  980. select w.* from (
  981. select ba.name ,j.code,j.nm,j.id as
  982. oid,j.ptype,r.PERS_NAME,l.sttm,l.entm,p.*,b.ad_full_name,
  983. b.ad_code,l.pnm as org_nm,j.id as org_id
  984. from (select * from BIS_INSP_PBLM pb where pb.obj_type=19
  985. <if test="inspPblmCate != null and inspPblmCate != ''">and pb.INSP_PBLM_CATE = #{inspPblmCate}</if>
  986. <if test="ifCasePblm != null and ifCasePblm != ''">and pb.IF_CASE_PBLM = #{ifCasePblm}</if>
  987. <if test="hasVedio != null and hasVedio != ''">and pb.HAS_VEDIO = #{hasVedio}</if>
  988. <if test="startTime != null and startTime != ''">
  989. AND pb.COLL_TIME &gt;= TO_DATE(#{startTime},'YYYY-MM-DD')
  990. </if>
  991. <if test="findTime != null and findTime != ''">and pb.COLL_TIME=TO_DATE(#{findTime},'YYYY-MM-DD')</if>
  992. <if test="endTime != null and endTime != ''">
  993. AND pb.COLL_TIME &lt; TO_DATE(#{endTime},'YYYY-MM-DD')+1
  994. </if>
  995. <if test="inspPblmName != null and inspPblmName != ''">and pb.INSP_PBLM_NAME like '%${inspPblmName}%'</if>
  996. ) p
  997. left join (select * from BIS_INSP_ALL_OBJ o where o.pType=19
  998. <if test="objId != null and objId != ''">and o.OBJ_ID = #{objId}</if>
  999. <include refid="choseSql"/>
  1000. ) j on p.obj_id=j.obj_id
  1001. left join BIS_INSP_ALL_RLATION_PERS r on p.rec_pers=r.guid
  1002. left join ATT_JSKEJIAN_WATER_BASE ba on ba.id=j.code
  1003. left join att_ad_x_base b on ba.ad_code=b.ad_code
  1004. left join BIS_INSP_ALL l on l.id=j.id
  1005. ) w where w.pType=19
  1006. <if test="tabType =='2'.toString()">
  1007. and w.entm &lt;to_date(#{nowTime},'yyyy-MM-dd')+1
  1008. </if>
  1009. <if test="tabType =='1'.toString()">
  1010. and w.entm &gt;=to_date(#{nowTime},'yyyy-MM-dd')
  1011. </if>
  1012. and
  1013. REGEXP_LIKE(
  1014. W.OID,'^('||
  1015. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  1016. <include refid="orgIdSql"/>
  1017. )>0 then
  1018. (SELECT LISTAGG(id, '|') as
  1019. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  1020. <include refid="orgIdSql"/> GROUP BY PERSID
  1021. )
  1022. else (select 'non' from dual) end)
  1023. ||')')
  1024. ) a where 1=1
  1025. <if test="orgNm != null and orgNm != ''">and org_nm like '%${orgNm}%'</if>
  1026. <if test="name != null and name != ''">and name like '%${name}%'</if>
  1027. <if test="adFullName != null and adFullName != ''">and ad_full_name like '%${adFullName}%'</if>
  1028. <if test="persName != null and persName != ''">and PERS_NAME like '%${persName}%'</if>
  1029. <if test="inspGroupId != null and inspGroupId != ''">and insp_Group_Id = #{inspGroupId}</if>
  1030. <if test="codes != null and codes != ''">and CODE in (${codes})</if>
  1031. <if test="adCodes != null and adCodes != ''">and AD_CODE in (${adCodes})</if>
  1032. <if test="orgIds != null and orgIds != ''">and org_id in (${orgIds})</if>
  1033. <if test="inspPblmType != null and inspPblmType != ''">and INSP_PBLM_TYPE = #{inspPblmType}</if>
  1034. order by ad_code asc,coll_time desc
  1035. </select>
  1036. <select id="findJsflPlbmList" parameterType="cn.com.goldenwater.dcproj.param.PrdParam"
  1037. resultMap="bisInspPblmResultMap">
  1038. select * from (
  1039. select w.* from (
  1040. select ba.name ,j.code,j.nm,j.id as
  1041. oid,j.ptype,r.PERS_NAME,p.*,b.ad_full_name,
  1042. b.ad_code,l.pnm as org_nm,l.sttm,l.entm,j.id as org_id
  1043. from (select * from BIS_INSP_PBLM pb where pb.obj_type=18
  1044. <if test="inspPblmCate != null and inspPblmCate != ''">and pb.INSP_PBLM_CATE = #{inspPblmCate}</if>
  1045. <if test="ifCasePblm != null and ifCasePblm != ''">and pb.IF_CASE_PBLM = #{ifCasePblm}</if>
  1046. <if test="hasVedio != null and hasVedio != ''">and pb.HAS_VEDIO = #{hasVedio}</if>
  1047. <if test="startTime != null and startTime != ''">
  1048. AND pb.COLL_TIME &gt;= TO_DATE(#{startTime},'YYYY-MM-DD')
  1049. </if>
  1050. <if test="findTime != null and findTime != ''">and pb.COLL_TIME=TO_DATE(#{findTime},'YYYY-MM-DD')</if>
  1051. <if test="endTime != null and endTime != ''">
  1052. AND pb.COLL_TIME &lt; TO_DATE(#{endTime},'YYYY-MM-DD')+1
  1053. </if>
  1054. <if test="inspPblmName != null and inspPblmName != ''">and pb.INSP_PBLM_NAME like '%${inspPblmName}%'</if>
  1055. ) p
  1056. left join (select * from BIS_INSP_ALL_OBJ o where o.pType=18
  1057. <if test="objId != null and objId != ''">and o.OBJ_ID = #{objId}</if>
  1058. <include refid="choseSql"/>
  1059. ) j on p.obj_id=j.obj_id
  1060. left join BIS_INSP_ALL_RLATION_PERS r on p.rec_pers=r.guid
  1061. left join ATT_JSKEJIAN_FLKDIS_BASE ba on ba.id=j.code
  1062. left join att_ad_x_base b on ba.ad_code=b.ad_code
  1063. left join BIS_INSP_ALL l on l.id=j.id
  1064. ) w where w.pType=18
  1065. <if test="tabType =='2'.toString()">
  1066. and w.entm &lt;to_date(#{nowTime},'yyyy-MM-dd')+1
  1067. </if>
  1068. <if test="tabType =='1'.toString()">
  1069. and w.entm &gt;=to_date(#{nowTime},'yyyy-MM-dd')
  1070. </if>
  1071. and
  1072. REGEXP_LIKE(
  1073. W.OID,'^('||
  1074. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  1075. <include refid="orgIdSql"/>
  1076. )>0 then
  1077. (SELECT LISTAGG(id, '|') as
  1078. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  1079. <include refid="orgIdSql"/> GROUP BY PERSID
  1080. )
  1081. else (select 'non' from dual) end)
  1082. ||')')
  1083. ) a where 1=1
  1084. <if test="orgNm != null and orgNm != ''">and org_nm like '%${orgNm}%'</if>
  1085. <if test="name != null and name != ''">and name like '%${name}%'</if>
  1086. <if test="adFullName != null and adFullName != ''">and ad_full_name like '%${adFullName}%'</if>
  1087. <if test="persName != null and persName != ''">and PERS_NAME like '%${persName}%'</if>
  1088. <if test="inspGroupId != null and inspGroupId != ''">and insp_Group_Id = #{inspGroupId}</if>
  1089. <if test="codes != null and codes != ''">and CODE in (${codes})</if>
  1090. <if test="adCodes != null and adCodes != ''">and AD_CODE in (${adCodes})</if>
  1091. <if test="orgIds != null and orgIds != ''">and org_id in (${orgIds})</if>
  1092. <if test="inspPblmType != null and inspPblmType != ''">and INSP_PBLM_TYPE = #{inspPblmType}</if>
  1093. order by ad_code asc,coll_time desc
  1094. </select>
  1095. <select id="findPrdPlbmList" parameterType="cn.com.goldenwater.dcproj.param.PrdParam"
  1096. resultMap="bisInspPblmResultMap">
  1097. select * from (
  1098. select w.* from (
  1099. select ba.name ,j.code,j.nm,l.sttm,l.entm,j.id as
  1100. oid,j.ptype,r.PERS_NAME,p.*,s.insp_pblms_name,s.check_point,s.attach,s.sheet,s.sn_num,b.ad_full_name,
  1101. b.ad_code,l.pnm as org_nm,j.id as org_id
  1102. from (select * from BIS_INSP_PBLM pb where pb.obj_type=17
  1103. <if test="inspPblmCate != null and inspPblmCate != ''">and pb.INSP_PBLM_CATE = #{inspPblmCate}</if>
  1104. <if test="ifCasePblm != null and ifCasePblm != ''">and pb.IF_CASE_PBLM = #{ifCasePblm}</if>
  1105. <if test="hasVedio != null and hasVedio != ''">and pb.HAS_VEDIO = #{hasVedio}</if>
  1106. <if test="startTime != null and startTime != ''">
  1107. AND pb.COLL_TIME &gt;= TO_DATE(#{startTime},'YYYY-MM-DD')
  1108. </if>
  1109. <if test="findTime != null and findTime != ''">and pb.COLL_TIME=TO_DATE(#{findTime},'YYYY-MM-DD')</if>
  1110. <if test="endTime != null and endTime != ''">
  1111. AND pb.COLL_TIME &lt; TO_DATE(#{endTime},'YYYY-MM-DD')+1
  1112. </if>
  1113. <if test="inspPblmName != null and inspPblmName != ''">and pb.INSP_PBLM_NAME like '%${inspPblmName}%'</if>
  1114. ) p
  1115. left join (select * from BIS_INSP_ALL_OBJ o where o.pType=17
  1116. <if test="objId != null and objId != ''">and o.OBJ_ID = #{objId}</if>
  1117. <include refid="choseSql"/>
  1118. ) j on p.obj_id=j.obj_id
  1119. left join BIS_INSP_ALL_RLATION_PERS r on p.rec_pers=r.guid
  1120. left join OBJ_INSP_PBLMS s on p.pblms_type_id=s.guid
  1121. left join ATT_PRD_CSTR_PROJ_BASE ba on ba.id=j.code
  1122. left join att_ad_x_base b on ba.ad_code=b.ad_code
  1123. left join BIS_INSP_ALL l on l.id=j.id
  1124. ) w where w.pType=17
  1125. <if test="tabType =='2'.toString()">
  1126. and w.entm &lt;to_date(#{nowTime},'yyyy-MM-dd')+1
  1127. </if>
  1128. <if test="tabType =='1'.toString()">
  1129. and w.entm &gt;=to_date(#{nowTime},'yyyy-MM-dd')
  1130. </if>
  1131. and
  1132. REGEXP_LIKE(
  1133. W.OID,'^('||
  1134. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  1135. <include refid="orgIdSql"/>
  1136. )>0 then
  1137. (SELECT LISTAGG(id, '|') as
  1138. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  1139. <include refid="orgIdSql"/> GROUP BY PERSID
  1140. )
  1141. else (select 'non' from dual) end)
  1142. ||')')
  1143. ) a where 1=1
  1144. <if test="orgNm != null and orgNm != ''">and org_nm like '%${orgNm}%'</if>
  1145. <if test="name != null and name != ''">and name like '%${name}%'</if>
  1146. <if test="adFullName != null and adFullName != ''">and ad_full_name like '%${adFullName}%'</if>
  1147. <if test="persName != null and persName != ''">and PERS_NAME like '%${persName}%'</if>
  1148. <if test="inspGroupId != null and inspGroupId != ''">and insp_Group_Id = #{inspGroupId}</if>
  1149. <if test="codes != null and codes != ''">and CODE in (${codes})</if>
  1150. <if test="adCodes != null and adCodes != ''">and AD_CODE in (${adCodes})</if>
  1151. <if test="orgIds != null and orgIds != ''">and org_id in (${orgIds})</if>
  1152. <if test="inspPblmType != null and inspPblmType != ''">and INSP_PBLM_TYPE = #{inspPblmType}</if>
  1153. order by ad_code asc,coll_time desc
  1154. </select>
  1155. <select id="findEcofrdPlbmList" parameterType="cn.com.goldenwater.dcproj.param.PrdParam"
  1156. resultMap="bisInspPblmResultMap">
  1157. select * from (
  1158. select w.* from (
  1159. select ba.name ,j.code,j.nm,l.sttm,l.entm,j.id as
  1160. oid,j.ptype,r.PERS_NAME,p.*,s.insp_pblms_name,s.check_point,s.attach,s.sheet,s.sn_num,b.ad_full_name,
  1161. b.ad_code,l.pnm as org_nm,j.id as org_id
  1162. from (select * from BIS_INSP_PBLM pb where pb.obj_type=20
  1163. <if test="inspPblmCate != null and inspPblmCate != ''">and pb.INSP_PBLM_CATE = #{inspPblmCate}</if>
  1164. <if test="ifCasePblm != null and ifCasePblm != ''">and pb.IF_CASE_PBLM = #{ifCasePblm}</if>
  1165. <if test="hasVedio != null and hasVedio != ''">and pb.HAS_VEDIO = #{hasVedio}</if>
  1166. <if test="startTime != null and startTime != ''">
  1167. AND pb.COLL_TIME &gt;= TO_DATE(#{startTime},'YYYY-MM-DD')
  1168. </if>
  1169. <if test="findTime != null and findTime != ''">and pb.COLL_TIME=TO_DATE(#{findTime},'YYYY-MM-DD')</if>
  1170. <if test="endTime != null and endTime != ''">
  1171. AND pb.COLL_TIME &lt; TO_DATE(#{endTime},'YYYY-MM-DD')+1
  1172. </if>
  1173. <if test="inspPblmName != null and inspPblmName != ''">and pb.INSP_PBLM_NAME like '%${inspPblmName}%'</if>
  1174. ) p
  1175. left join (select * from BIS_INSP_ALL_OBJ o where o.pType=20
  1176. <if test="objId != null and objId != ''">and o.OBJ_ID = #{objId}</if>
  1177. <include refid="choseSql"/>
  1178. ) j on p.obj_id=j.obj_id
  1179. left join BIS_INSP_ALL_RLATION_PERS r on p.rec_pers=r.guid
  1180. left join OBJ_INSP_PBLMS s on p.pblms_type_id=s.guid
  1181. left join ATT_PRD_CSTR_PROJ_BASE ba on ba.id=j.code
  1182. left join att_ad_x_base b on ba.ad_code=b.ad_code
  1183. left join BIS_INSP_ALL l on l.id=j.id
  1184. ) w where w.pType=20
  1185. <if test="tabType =='2'.toString()">
  1186. and w.entm &lt;to_date(#{nowTime},'yyyy-MM-dd')+1
  1187. </if>
  1188. <if test="tabType =='1'.toString()">
  1189. and w.entm &gt;=to_date(#{nowTime},'yyyy-MM-dd')
  1190. </if>
  1191. and
  1192. REGEXP_LIKE(
  1193. W.OID,'^('||
  1194. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  1195. <include refid="orgIdSql"/>
  1196. )>0 then
  1197. (SELECT LISTAGG(id, '|') as
  1198. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  1199. <include refid="orgIdSql"/> GROUP BY PERSID
  1200. )
  1201. else (select 'non' from dual) end)
  1202. ||')')
  1203. ) a where 1=1
  1204. <if test="orgNm != null and orgNm != ''">and org_nm like '%${orgNm}%'</if>
  1205. <if test="name != null and name != ''">and name like '%${name}%'</if>
  1206. <if test="adFullName != null and adFullName != ''">and ad_full_name like '%${adFullName}%'</if>
  1207. <if test="persName != null and persName != ''">and PERS_NAME like '%${persName}%'</if>
  1208. <if test="inspGroupId != null and inspGroupId != ''">and insp_Group_Id = #{inspGroupId}</if>
  1209. <if test="codes != null and codes != ''">and CODE in (${codes})</if>
  1210. <if test="adCodes != null and adCodes != ''">and AD_CODE in (${adCodes})</if>
  1211. <if test="orgIds != null and orgIds != ''">and org_id in (${orgIds})</if>
  1212. <if test="inspPblmType != null and inspPblmType != ''">and INSP_PBLM_TYPE = #{inspPblmType}</if>
  1213. order by ad_code asc,coll_time desc
  1214. </select>
  1215. <!--水闸问题列表-->
  1216. <select id="findWagaPlbmList" resultMap="bisInspPblmResultMap"
  1217. parameterType="cn.com.goldenwater.dcproj.param.WagaParam">
  1218. select * from (
  1219. select w.* from (
  1220. select ba.gate_name ,l.sttm,l.entm,j.code,j.nm,j.id as
  1221. oid,j.ptype,r.PERS_NAME,p.*,s.insp_pblms_name,s.check_point,s.attach,s.sheet,s.sn_num,b.ad_full_name,
  1222. b.ad_code,l.pnm as org_nm,j.id as org_id
  1223. from (select * from BIS_INSP_PBLM pb where pb.obj_type=6
  1224. <if test="inspPblmCate != null and inspPblmCate != ''">and pb.INSP_PBLM_CATE = #{inspPblmCate}</if>
  1225. <if test="ifCasePblm != null and ifCasePblm != ''">and pb.IF_CASE_PBLM = #{ifCasePblm}</if>
  1226. <if test="hasVedio != null and hasVedio != ''">and pb.HAS_VEDIO = #{hasVedio}</if>
  1227. <if test="startTime != null and startTime != ''">
  1228. AND pb.COLL_TIME &gt;= TO_DATE(#{startTime},'YYYY-MM-DD')
  1229. </if>
  1230. <if test="findTime != null and findTime != ''">and pb.COLL_TIME=TO_DATE(#{findTime},'YYYY-MM-DD')</if>
  1231. <if test="endTime != null and endTime != ''">
  1232. AND pb.COLL_TIME &lt; TO_DATE(#{endTime},'YYYY-MM-DD')+1
  1233. </if>
  1234. <if test="inspPblmName != null and inspPblmName != ''">and pb.INSP_PBLM_NAME like '%${inspPblmName}%'</if>
  1235. ) p
  1236. left join (select * from BIS_INSP_ALL_OBJ o where o.pType=6
  1237. <if test="objId != null and objId != ''">and o.OBJ_ID = #{objId}</if>
  1238. <include refid="choseSql"/>
  1239. ) j on p.obj_id=j.obj_id
  1240. left join BIS_INSP_ALL_RLATION_PERS r on p.rec_pers=r.guid
  1241. left join OBJ_INSP_PBLMS s on p.pblms_type_id=s.guid
  1242. left join att_waga_base ba on ba.obj_code=j.code
  1243. left join att_ad_x_base b on ba.ad_code=b.ad_code
  1244. left join BIS_INSP_ALL l on l.id=j.id
  1245. ) w
  1246. where 1=1
  1247. <if test="tabType =='2'.toString()">
  1248. and w.entm &lt;to_date(#{nowTime},'yyyy-MM-dd')+1
  1249. </if>
  1250. <if test="tabType =='1'.toString()">
  1251. and w.entm &gt;=to_date(#{nowTime},'yyyy-MM-dd')
  1252. </if>
  1253. and
  1254. REGEXP_LIKE(
  1255. W.OID,'^('||
  1256. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  1257. <include refid="orgIdSql"/>
  1258. )>0 then
  1259. (SELECT LISTAGG(id, '|') as
  1260. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  1261. <include refid="orgIdSql"/> GROUP BY PERSID
  1262. )
  1263. else (select 'non' from dual) end)
  1264. ||')')
  1265. ) a where 1=1
  1266. <if test="nm != null and nm != ''">and nm like '%${nm}%'</if>
  1267. <if test="orgNm != null and orgNm != ''">and org_nm like '%${orgNm}%'</if>
  1268. <if test="gateName != null and gateName != ''">and gate_name like '%${gateName}%'</if>
  1269. <if test="adFullName != null and adFullName != ''">and ad_full_name like '%${adFullName}%'</if>
  1270. <if test="persName != null and persName != ''">and PERS_NAME like '%${persName}%'</if>
  1271. <if test="inspGroupId != null and inspGroupId != ''">and insp_Group_Id = #{inspGroupId}</if>
  1272. <if test="codes != null and codes != ''">and CODE in (${codes})</if>
  1273. <if test="recPers !=null and recPers !=''">
  1274. and rec_pers=#{recPers}
  1275. </if>
  1276. <if test="adCodes != null and adCodes != ''">and AD_CODE in (${adCodes})</if>
  1277. <if test="orgIds != null and orgIds != ''">and org_id in (${orgIds})</if>
  1278. <if test="state != null and state != ''">and STATE = #{state}</if>
  1279. <if test="inspPblmType != null and inspPblmType != ''">and INSP_PBLM_TYPE = #{inspPblmType}</if>
  1280. order by ad_code asc,coll_time desc
  1281. </select>
  1282. <select id="findReverPlbmList" resultMap="bisInspPblmResultMap"
  1283. parameterType="cn.com.goldenwater.dcproj.param.ReverParam">
  1284. select * from (
  1285. select w.* from (
  1286. select
  1287. BA.RS_NAME, R.PERS_NAME, B.AD_FULL_NAME,B.AD_CODE,
  1288. J.CODE,J.NM,J.ID AS OID, J.ID AS ORG_ID, J.PTYPE,
  1289. P.*, P.INSP_PBLM_NAME AS INSP_PBLMS_NAME,P.PBLM_DESC_BZ AS PBLM_DESC, P.CHECK_POINT_BZ AS CHECK_POINT,
  1290. S.ATTACH,S.SHEET,S.SN_NUM,S.OLD_ATTACH,S.OLD_SN,
  1291. L.PNM AS ORG_NM, L.STTM,L.ENTM
  1292. from (select * from BIS_INSP_PBLM pb where pb.obj_type=#{objType}
  1293. <if test="inspPblmCate != null and inspPblmCate != ''">and pb.INSP_PBLM_CATE = #{inspPblmCate}</if>
  1294. <if test="ifCasePblm != null and ifCasePblm != ''">and pb.IF_CASE_PBLM = #{ifCasePblm}</if>
  1295. <if test="hasVedio != null and hasVedio != ''">and pb.HAS_VEDIO = #{hasVedio}</if>
  1296. <if test="startTime != null and startTime != ''">AND pb.COLL_TIME &gt;= TO_DATE(#{startTime},'YYYY-MM-DD')</if>
  1297. <if test="findTime != null and findTime != ''">and pb.COLL_TIME=TO_DATE(#{findTime},'YYYY-MM-DD')</if>
  1298. <if test="endTime != null and endTime != ''">AND pb.COLL_TIME &lt; TO_DATE(#{endTime},'YYYY-MM-DD')+1</if>
  1299. <if test="inspPblmName != null and inspPblmName != ''">and pb.INSP_PBLM_NAME like '%${inspPblmName}%'</if>
  1300. ) p
  1301. join (select * from BIS_INSP_ALL_OBJ o where o.pType=#{objType}
  1302. <if test="objId != null and objId != ''">and o.OBJ_ID = #{objId}</if>
  1303. <include refid="choseSql"/>
  1304. ) J ON P.OBJ_ID=J.OBJ_ID
  1305. LEFT JOIN BIS_INSP_ALL_RLATION_PERS R ON P.REC_PERS=R.GUID
  1306. LEFT JOIN OBJ_INSP_PBLMS S ON P.PBLMS_TYPE_ID=S.GUID
  1307. LEFT JOIN ATT_RS_BASE BA ON BA.RS_CODE=J.CODE
  1308. LEFT JOIN ATT_AD_X_BASE B ON BA.ADM_DIV=B.AD_CODE
  1309. LEFT JOIN BIS_INSP_ALL L ON L.ID=J.ID
  1310. ) W
  1311. WHERE W.PTYPE = 1
  1312. <if test="tabType =='2'.toString()">
  1313. and w.entm &lt;to_date(#{nowTime},'yyyy-MM-dd')+1
  1314. </if>
  1315. <if test="tabType =='1'.toString()">and w.entm &gt;=to_date(#{nowTime},'yyyy-MM-dd')</if>
  1316. and
  1317. REGEXP_LIKE(
  1318. W.OID,'^('||
  1319. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  1320. <include refid="orgIdSql"/>
  1321. )>0 then
  1322. (SELECT LISTAGG(id, '|') as
  1323. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  1324. <include refid="orgIdSql"/> GROUP BY PERSID
  1325. )
  1326. else (select 'non' from dual) end)
  1327. ||')')
  1328. ) a
  1329. <where>
  1330. <if test="nm != null and nm != ''">and nm like '%${nm}%'</if>
  1331. <if test="orgNm != null and orgNm != ''">and org_nm like '%${orgNm}%'</if>
  1332. <if test="rsName != null and rsName != ''">and rs_name like '%${rsName}%'</if>
  1333. <if test="adFullName != null and adFullName != ''">and ad_full_name like '%${adFullName}%'</if>
  1334. <if test="persName != null and persName != ''">and PERS_NAME like '%${persName}%'</if>
  1335. <if test="codes != null and codes != ''">and CODE in (${codes})</if>
  1336. <if test="recPers !=null and recPers !=''">and rec_pers=#{recPers}</if>
  1337. <if test="adCodes != null and adCodes != ''">and AD_CODE in (${adCodes})</if>
  1338. <if test="orgIds != null and orgIds != ''">and org_id in (${orgIds})</if>
  1339. <if test="state != null and state != ''">and STATE = #{state}</if>
  1340. <if test="inspPblmType != null and inspPblmType != ''">and INSP_PBLM_TYPE = #{inspPblmType}</if>
  1341. </where>
  1342. order by ad_code asc, CODE asc , coll_time desc
  1343. </select>
  1344. <select id="findVillType" resultType="java.lang.String">
  1345. select distinct m.insp_pblm_name from BIS_INSP_PBLM m,bis_insp_all_obj o where m.obj_id=o.obj_id and
  1346. m.obj_type=2
  1347. <include refid="choseSql"/>
  1348. </select>
  1349. <select id="findVillPlbmList" resultMap="bisInspPblmResultMap"
  1350. parameterType="cn.com.goldenwater.dcproj.param.VillParam">
  1351. select * from (
  1352. select w.* from (
  1353. select j.code,j.nm,j.id as
  1354. oid,j.ptype,r.PERS_NAME,p.*,s.insp_pblms_name,s.check_point,s.attach,s.sheet,s.sn_num,b.ad_full_name,b.ad_code,l.pnm
  1355. as org_nm,j.id as org_id
  1356. from (select * from BIS_INSP_PBLM pb where pb.obj_type=2
  1357. <if test="inspPblmCate != null and inspPblmCate != ''">and pb.INSP_PBLM_CATE = #{inspPblmCate}</if>
  1358. <if test="ifCasePblm != null and ifCasePblm != ''">and pb.IF_CASE_PBLM = #{ifCasePblm}</if>
  1359. <if test="hasVedio != null and hasVedio != ''">and pb.HAS_VEDIO = #{hasVedio}</if>
  1360. <if test="startTime != null and startTime != ''">
  1361. AND pb.COLL_TIME &gt;= TO_DATE(#{startTime},'YYYY-MM-DD')
  1362. </if>
  1363. <if test="findTime != null and findTime != ''">and pb.COLL_TIME=TO_DATE(#{findTime},'YYYY-MM-DD')</if>
  1364. <if test="endTime != null and endTime != ''">
  1365. AND pb.COLL_TIME &lt;TO_DATE(#{endTime},'YYYY-MM-DD')+1
  1366. </if>
  1367. <if test="inspPblmName != null and inspPblmName != ''">and pb.INSP_PBLM_NAME like '%${inspPblmName}%'</if>
  1368. <if test="villType != null and villType != '' and villType != '0'.toString()">and pb.vill_Type =#{villType}</if>
  1369. <if test="villageCode != null and villageCode != ''">and pb.village_Code =#{villageCode}</if>
  1370. <if test="cwsCode != null and cwsCode != ''">and pb.cws_code =#{cwsCode}</if>
  1371. <if test="engSurId != null and engSurId != ''">and pb.REGID =#{engSurId}</if>
  1372. ) p
  1373. join (select * from BIS_INSP_ALL_OBJ o where o.pType=2
  1374. <if test="objId != null and objId != ''">and OBJ_ID = #{objId}</if>
  1375. <include refid="choseSql"/>
  1376. ) j on p.obj_id=j.obj_id
  1377. join BIS_INSP_ALL_RLATION_PERS r on p.rec_pers=r.guid
  1378. left join OBJ_INSP_PBLMS s on p.pblms_type_id=s.guid
  1379. left join BIS_INSP_VILL_RGSTR ba on ba.obj_id=j.obj_id
  1380. left join att_ad_x_base b on j.code=b.ad_code
  1381. left join BIS_INSP_ALL l on l.id=j.id
  1382. ) w where w.ptype=2 and
  1383. REGEXP_LIKE(
  1384. W.OID,'^('||
  1385. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  1386. <include refid="orgIdSql"/>
  1387. )>0 then
  1388. (SELECT LISTAGG(id, '|') as
  1389. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  1390. <include refid="orgIdSql"/> GROUP BY PERSID
  1391. )
  1392. else (select 'non' from dual) end)
  1393. ||')')
  1394. ) a where 1=1
  1395. <if test="nm != null and nm != ''">and nm like '%${nm}%'</if>
  1396. <if test="orgNm != null and orgNm != ''">and org_nm like '%${orgNm}%'</if>
  1397. <if test="adFullName != null and adFullName != ''">and ad_full_name like '%${adFullName}%'</if>
  1398. <if test="persName != null and persName != ''">and PERS_NAME like '%${persName}%'</if>
  1399. <if test="codes != null and codes != ''">and CODE in (${codes})</if>
  1400. <if test="recPers !=null and recPers !=''">
  1401. and rec_pers=#{recPers}
  1402. </if>
  1403. <if test="adCodes != null and adCodes != ''">and AD_CODE in (${adCodes})</if>
  1404. <if test="orgIds != null and orgIds != ''">and org_id in (${orgIds})</if>
  1405. <if test="inspPblmType != null and inspPblmType != ''">and INSP_PBLM_TYPE = #{inspPblmType}</if>
  1406. order by ad_code asc,coll_time desc
  1407. </select>
  1408. <!--地下水-->
  1409. <select id="findWaterPlbmList" resultMap="bisInspPblmResultMap"
  1410. parameterType="cn.com.goldenwater.dcproj.param.UnderWaterParam">
  1411. select * from (
  1412. select w.* from (
  1413. select j.code,j.nm,j.id as oid,l.sttm,l.entm,j.ptype,r.PERS_NAME,p.*,e.ad_full_name as
  1414. ad_full_name,s.insp_pblms_name,s.check_point,s.attach,s.sheet,s.sn_num,b.stcd as ad_code,l.pnm as org_nm,j.id as
  1415. org_id
  1416. from (select * from BIS_INSP_PBLM pb where pb.obj_type=5
  1417. <if test="inspPblmCate != null and inspPblmCate != ''">and pb.INSP_PBLM_CATE = #{inspPblmCate}</if>
  1418. <if test="ifCasePblm != null and ifCasePblm != ''">and pb.IF_CASE_PBLM = #{ifCasePblm}</if>
  1419. <if test="hasVedio != null and hasVedio != ''">and pb.HAS_VEDIO = #{hasVedio}</if>
  1420. <if test="startTime != null and startTime != ''">
  1421. AND pb.COLL_TIME &gt;= TO_DATE(#{startTime},'YYYY-MM-DD')
  1422. </if>
  1423. <if test="findTime != null and findTime != ''">and pb.COLL_TIME=TO_DATE(#{findTime},'YYYY-MM-DD')</if>
  1424. <if test="endTime != null and endTime != ''">
  1425. AND pb.COLL_TIME &lt;= TO_DATE(#{endTime},'YYYY-MM-DD')+1
  1426. </if>
  1427. <if test="inspPblmName != null and inspPblmName != ''">and pb.INSP_PBLM_NAME like '%${inspPblmName}%'</if>
  1428. ) p
  1429. join (select * from BIS_INSP_ALL_OBJ o where o.pType=5
  1430. <if test="objId != null and objId != ''">and OBJ_ID = #{objId}</if>
  1431. <include refid="choseSql"/>
  1432. ) j on p.obj_id=j.obj_id
  1433. join BIS_INSP_ALL_RLATION_PERS r on p.rec_pers=r.guid
  1434. left join OBJ_INSP_PBLMS s on p.pblms_type_id=s.guid
  1435. left join BIS_INSP_GRW t on t.obj_id=p.obj_id
  1436. left join att_grw_base b on t.stcd=b.stcd and j.code=b.stcd
  1437. left join att_ad_x_base e on b.adcd=e.ad_code
  1438. left join BIS_INSP_ALL l on l.id=j.id
  1439. ) w where w.ptype='5'
  1440. <if test="tabType =='2'.toString()">
  1441. and w.entm &lt;to_date(#{nowTime},'yyyy-MM-dd')+1
  1442. </if>
  1443. <if test="tabType =='1'.toString()">
  1444. and w.entm &gt;=to_date(#{nowTime},'yyyy-MM-dd')
  1445. </if>
  1446. and
  1447. REGEXP_LIKE(
  1448. W.OID,'^('||
  1449. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  1450. <include refid="orgIdSql"/>
  1451. )>0 then
  1452. (SELECT LISTAGG(id, '|') as
  1453. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  1454. <include refid="orgIdSql"/> GROUP BY PERSID
  1455. )
  1456. else (select 'non' from dual) end)
  1457. ||')')
  1458. ) a where 1=1
  1459. <if test="persName != null and persName != ''">and PERS_NAME like '%${persName}%'</if>
  1460. <if test="orgNm != null and orgNm != ''">and org_nm like '%${orgNm}%'</if>
  1461. <if test="codes != null and codes != ''">and CODE in (${codes})</if>
  1462. <if test="adCodes != null and adCodes != ''">and AD_CODE in (${adCodes})</if>
  1463. <if test="orgIds != null and orgIds != ''">and org_id in (${orgIds})</if>
  1464. <if test="recPers !=null and recPers !=''">
  1465. and rec_pers=#{recPers}
  1466. </if>
  1467. <if test="nm != null and nm != ''">and nm like '%${nm}%'</if>
  1468. <if test="adFullName != null and adFullName != ''">and ad_full_name like '%${adFullName}%'</if>
  1469. order by ad_code asc,coll_time desc
  1470. </select>
  1471. <select id="findTrackPlbmList" resultMap="bisInspPblmResultMap"
  1472. parameterType="cn.com.goldenwater.dcproj.param.TrackParam">
  1473. select * from (
  1474. select w.* from (
  1475. select j.code,j.nm,j.id as oid,j.ptype,l.sttm,l.entm,r.PERS_NAME,p.*,
  1476. b.ad_full_name,s.insp_pblms_name,s.pblm_desc,s.check_point,s.attach,s.sheet,s.sn_num,b.ad_code,l.pnm
  1477. as org_nm,j.id as org_id
  1478. from (select * from BIS_INSP_PBLM pb where pb.obj_type = 3
  1479. <if test="inspPblmCate != null and inspPblmCate != ''">and pb.INSP_PBLM_CATE = #{inspPblmCate}</if>
  1480. <if test="ifCasePblm != null and ifCasePblm != ''">and pb.IF_CASE_PBLM = #{ifCasePblm}</if>
  1481. <if test="hasVedio != null and hasVedio != ''">and pb.HAS_VEDIO = #{hasVedio}</if>
  1482. <if test="startTime != null and startTime != ''">AND pb.COLL_TIME &gt;= TO_DATE(#{startTime},'YYYY-MM-DD')</if>
  1483. <if test="findTime != null and findTime != ''">and pb.COLL_TIME=TO_DATE(#{findTime},'YYYY-MM-DD')</if>
  1484. <if test="endTime != null and endTime != ''">AND pb.COLL_TIME &lt; TO_DATE(#{endTime},'YYYY-MM-DD')+1</if>
  1485. <if test="inspPblmName != null and inspPblmName != ''">and pb.INSP_PBLM_NAME like '%${inspPblmName}%'</if>
  1486. ) p
  1487. join (select * from BIS_INSP_ALL_OBJ o where o.pType=3
  1488. <if test="objId != null and objId != ''">and OBJ_ID = #{objId}</if>
  1489. <include refid="choseSql"/>
  1490. ) j on p.obj_id=j.obj_id
  1491. join BIS_INSP_ALL_RLATION_PERS r on p.rec_pers=r.guid
  1492. left join OBJ_INSP_PBLMS s on p.pblms_type_id=s.guid
  1493. left join BIS_INSP_WTDST t on t.wtdst_id = j.code
  1494. left join att_ad_x_base b on t.loc_ad=b.ad_code
  1495. left join BIS_INSP_ALL l on l.id=j.id
  1496. ) w where w.ptype=3
  1497. <if test="tabType =='2'.toString()">
  1498. and w.entm &lt;to_date(#{nowTime},'yyyy-MM-dd')+1
  1499. </if>
  1500. <if test="tabType =='1'.toString()">
  1501. and w.entm &gt;=to_date(#{nowTime},'yyyy-MM-dd')
  1502. </if>
  1503. and
  1504. REGEXP_LIKE(
  1505. W.OID,'^('||
  1506. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  1507. <include refid="orgIdSql"/>
  1508. )>0 then
  1509. (SELECT LISTAGG(id, '|') as
  1510. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  1511. <include refid="orgIdSql"/> GROUP BY PERSID
  1512. )
  1513. else (select 'non' from dual) end)
  1514. ||')')
  1515. ) a where 1=1
  1516. <if test="persName != null and persName != ''">and PERS_NAME like '%${persName}%'</if>
  1517. <if test="orgNm != null and orgNm != ''">and org_nm like '%${orgNm}%'</if>
  1518. <if test="codes != null and codes != ''">and CODE in (${codes})</if>
  1519. <if test="adCodes != null and adCodes != ''">and AD_CODE in (${adCodes})</if>
  1520. <if test="orgIds != null and orgIds != ''">and org_id in (${orgIds})</if>
  1521. <if test="recPers !=null and recPers !=''">
  1522. and rec_pers=#{recPers}
  1523. </if>
  1524. <if test="inspPblmType != null and inspPblmType != ''">and INSP_PBLM_TYPE = #{inspPblmType}</if>
  1525. <if test="nm != null and nm != ''">and nm like '%${nm}%'</if>
  1526. <if test="adFullName != null and adFullName != ''">and ad_full_name like '%${adFullName}%'</if>
  1527. order by ad_code asc,coll_time desc
  1528. </select>
  1529. <!---->
  1530. <select id="findKeyRegPblmPage" resultType="cn.com.goldenwater.dcproj.dto.PblmRetCount"
  1531. parameterType="cn.com.goldenwater.dcproj.param.CountParam">
  1532. select e.nm as rs_name ,dd.code from ATT_EMPWTPRJ_BASE e,(
  1533. select distinct w.code from (
  1534. select j.id as oid,j.ptype,j.code,p.insp_pblm_cate,r.org_id from BIS_INSP_PBLM p
  1535. join (select * from bis_insp_all_obj o where o.ptype=#{pType}
  1536. <include refid="choseSql"/>
  1537. ) j on p.obj_id=j.obj_id
  1538. join BIS_INSP_ALL_RLATION_PERS r on p.rec_pers=r.guid
  1539. ) w where w.ptype=#{pType}
  1540. <if test="persId != null and persId != ''">
  1541. and
  1542. REGEXP_LIKE(
  1543. W.OID,'^('||
  1544. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  1545. <include refid="orgIdSql"/>
  1546. )>0 then
  1547. (SELECT LISTAGG(id, '|') as
  1548. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  1549. <include refid="orgIdSql"/> GROUP BY PERSID
  1550. )
  1551. else (select 'non' from dual) end)
  1552. ||')')
  1553. </if>
  1554. ) dd where e.id=dd.code
  1555. </select>
  1556. <!--分页查询小水闸-->
  1557. <select id="findWagaPblmPage" resultType="cn.com.goldenwater.dcproj.dto.PblmRetCount"
  1558. parameterType="cn.com.goldenwater.dcproj.param.CountParam">
  1559. select e.gate_name as rs_name ,dd.code,e.eng_scal from att_waga_base e,(
  1560. select distinct w.code from (
  1561. select j.id as oid,j.ptype,j.code,p.insp_pblm_cate,j.org_id from bis_insp_pblm p
  1562. join (
  1563. select * from bis_insp_all_obj o where o.pType=#{pType}
  1564. <include refid="choseSql"/>
  1565. ) j on p.obj_id=j.obj_id
  1566. join BIS_INSP_ALL_RLATION_PERS r on p.rec_pers=r.guid
  1567. ) w where w.ptype=#{pType}
  1568. and
  1569. REGEXP_LIKE(
  1570. W.OID,'^('||
  1571. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  1572. <include refid="orgIdSql"/>
  1573. )>0 then
  1574. (SELECT LISTAGG(id, '|') as
  1575. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  1576. <include refid="orgIdSql"/> GROUP BY PERSID
  1577. )
  1578. else (select 'non' from dual) end)
  1579. ||')') ) dd where e.obj_code=dd.code
  1580. </select>
  1581. <!--分页查询小水库-->
  1582. <select id="findReverPblmPage" resultType="cn.com.goldenwater.dcproj.dto.PblmRetCount"
  1583. parameterType="cn.com.goldenwater.dcproj.param.CountParam">
  1584. select e.rs_name,dd.code,(case to_char(e.eng_scal) when '1' then '大(1)型' when '2' then '大(2)型' when '3' then
  1585. '中型' when '4' then '小(1)型' when '5' then '小(2)型' end ) as eng_scal from att_rs_base e,(
  1586. select distinct w.code from (
  1587. select j.id as oid,j.ptype,j.code,p.insp_pblm_cate,j.org_id from
  1588. bis_insp_pblm p
  1589. join (select * from bis_insp_all_obj o where o.ptype=#{pType}
  1590. <include refid="choseSql"/>
  1591. ) j on p.obj_id=j.obj_id
  1592. join BIS_INSP_ALL_RLATION_PERS r on p.rec_pers=r.guid
  1593. ) w where w.ptype=#{pType}
  1594. and
  1595. REGEXP_LIKE(
  1596. W.OID,'^('||
  1597. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  1598. <include refid="orgIdSql"/>
  1599. )>0 then
  1600. (SELECT LISTAGG(id, '|') as
  1601. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  1602. <include refid="orgIdSql"/> GROUP BY PERSID
  1603. )
  1604. else (select 'non' from dual) end)
  1605. ||')') ) dd where e.rs_code=dd.code
  1606. </select>
  1607. <!--问题总计-->
  1608. <select id="totalCount" resultType="cn.com.goldenwater.dcproj.dto.CateTotal" parameterType="java.lang.String">
  1609. select count(code) as total,(case insp_pblm_cate when '0' then '一般' when '1' then '较重' when '2' then '严重' when
  1610. '3' then '特别严重' end) as cate from (
  1611. select j.id as oid,j.ptype,j.code,p.insp_pblm_cate,j.ORG_ID from BIS_INSP_PBLM p
  1612. join (select * from bis_insp_all_obj o where o.ptype=#{pType}
  1613. <include refid="choseSql"/>
  1614. ) j on p.obj_id=j.obj_id
  1615. join BIS_INSP_ALL_RLATION_PERS r on p.rec_pers=r.guid
  1616. ) w where w.ptype=#{pType}
  1617. <if test="persId !=null and persId !=''">
  1618. and
  1619. REGEXP_LIKE(
  1620. W.OID,'^('||
  1621. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  1622. <include refid="orgIdSql"/>
  1623. )>0 then
  1624. (SELECT LISTAGG(id, '|') as
  1625. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  1626. <include refid="orgIdSql"/> GROUP BY PERSID
  1627. )
  1628. else (select 'non' from dual) end)
  1629. ||')')
  1630. </if>
  1631. and insp_pblm_cate is not null group by insp_pblm_cate order by insp_pblm_cate
  1632. </select>
  1633. <select id="countKeyReg" resultType="cn.com.goldenwater.dcproj.dto.PblmCount" parameterType="java.lang.String">
  1634. select dd.*,b.nm as rs_name from ATT_EMPWTPRJ_BASE b , (
  1635. select a.code,count(a.code) as sub,insp_pblm_cate,count(insp_pblm_cate) as total from (
  1636. select w.* from (
  1637. select j.id as oid,j.ptype,j.code,p.insp_pblm_cate,j.org_id from bis_insp_pblm p
  1638. join (select * from bis_insp_all_obj o where o.pType=#{pType}
  1639. <include refid="choseSql"/>
  1640. ) j on p.obj_id=j.obj_id
  1641. join BIS_INSP_ALL_RLATION_PERS r on p.rec_pers=r.guid
  1642. ) w where w.ptype=#{pType} and w.code in(${codes})
  1643. <if test="persId !=null and persId !=''">
  1644. and
  1645. REGEXP_LIKE(
  1646. W.OID,'^('||
  1647. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  1648. <include refid="orgIdSql"/>
  1649. )>0 then
  1650. (SELECT LISTAGG(id, '|') as
  1651. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  1652. <include refid="orgIdSql"/> GROUP BY PERSID
  1653. )
  1654. else (select 'non' from dual) end)
  1655. ||')')
  1656. </if>
  1657. ) a where a.insp_pblm_cate is not null group by a.code,a.insp_pblm_cate order by a.code ) dd where b.id=dd.code
  1658. </select>
  1659. <!--小水库水闸问题统计-->
  1660. <select id="countWaga" resultType="cn.com.goldenwater.dcproj.dto.PblmCount" parameterType="java.lang.String">
  1661. select dd.*,b.gate_name as rs_name,b.eng_scal from att_waga_base b , (
  1662. select a.code,count(a.code) as sub,insp_pblm_cate,count(insp_pblm_cate) as total from (
  1663. select w.* from (
  1664. select j.id as oid,j.ptype,j.code,p.insp_pblm_cate,p.BELONG_ORG_ID from BIS_INSP_PBLM p
  1665. join (select * from bis_insp_all_obj o where o.pType=6
  1666. <include refid="choseSql"/>
  1667. ) j on p.obj_id=j.obj_id
  1668. join BIS_INSP_ALL_RLATION_PERS r on p.rec_pers=r.guid
  1669. ) w where w.ptype=6 and w.code in(${codes})
  1670. and
  1671. REGEXP_LIKE(
  1672. W.OID,'^('||
  1673. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  1674. <include refid="orgIdSql"/>
  1675. )>0 then
  1676. (SELECT LISTAGG(id, '|') as
  1677. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  1678. <include refid="orgIdSql"/> GROUP BY PERSID
  1679. )
  1680. else (select 'non' from dual) end)
  1681. ||')')
  1682. ) a where a.insp_pblm_cate is not null group by a.code,a.insp_pblm_cate order by a.code ) dd where
  1683. b.obj_code=dd.code
  1684. </select>
  1685. <!--小水库问题统计-->
  1686. <select id="countRever" resultType="cn.com.goldenwater.dcproj.dto.PblmCount" parameterType="java.lang.String">
  1687. select dd.*,b.rs_name,b.eng_scal from att_rs_base b,(
  1688. select a.code,count(a.code) as sub,insp_pblm_cate,count(insp_pblm_cate) as total from (
  1689. select w.* from (
  1690. select j.id as oid,j.ptype,j.code,p.insp_pblm_cate,j.ORG_ID from BIS_INSP_PBLM p
  1691. join (select * from bis_insp_all_obj o where o.ptype=#{pType}
  1692. <include refid="choseSql"/>
  1693. ) j on p.obj_id=j.obj_id
  1694. join BIS_INSP_ALL_RLATION_PERS r on p.rec_pers=r.guid
  1695. ) w where w.ptype=#{pType} and w.code in(${codes})
  1696. and
  1697. REGEXP_LIKE(
  1698. W.OID,'^('||
  1699. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  1700. <include refid="orgIdSql"/>
  1701. )>0 then
  1702. (SELECT LISTAGG(id, '|') as
  1703. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  1704. <include refid="orgIdSql"/> GROUP BY PERSID
  1705. )
  1706. else (select 'non' from dual) end)
  1707. ||')')
  1708. ) a where a.insp_pblm_cate is not null group by a.code,a.insp_pblm_cate order by a.code ) dd where
  1709. b.rs_code=dd.code
  1710. </select>
  1711. <!--人饮统计问题分页-->
  1712. <select id="findVillPblmPage" resultType="cn.com.goldenwater.dcproj.dto.VillCount"
  1713. parameterType="cn.com.goldenwater.dcproj.param.CountParam">
  1714. select dd.*,b.ad_full_name from att_ad_x_base b ,(
  1715. select code,count(pblm_id) as total from (
  1716. select j.code,j.nm,j.id as oid,j.ptype,p.vill_type,b.ad_full_name,p.pblm_id,j.org_id from BIS_INSP_PBLM p
  1717. join (select * from bis_insp_all_obj o where o.ptype=2
  1718. <include refid="choseSql"/>
  1719. ) j on p.obj_id=j.obj_id
  1720. left join att_ad_x_base b on j.code=b.ad_code
  1721. ) w where w.ptype=2
  1722. and
  1723. REGEXP_LIKE(
  1724. W.OID,'^('||
  1725. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  1726. <include refid="orgIdSql"/>
  1727. )>0 then
  1728. (SELECT LISTAGG(id, '|') as
  1729. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  1730. <include refid="orgIdSql"/> GROUP BY PERSID
  1731. )
  1732. else (select 'non' from dual) end)
  1733. ||')') and vill_type is not null group by w.code ) dd where b.ad_code=dd.code order by dd.code
  1734. </select>
  1735. <select id="countVill" resultType="cn.com.goldenwater.dcproj.dto.VillTypeCount" parameterType="java.lang.String">
  1736. select count(code) as total,code,insp_Pblm_Name from (
  1737. select j.code,j.nm,j.id as oid,j.ptype,p.vill_type,j.org_id,(case p.vill_type when '1' then '行政村' when '2' then
  1738. '水源地' when '3' then '饮水工程' else '责任落实' end) insp_Pblm_Name
  1739. from BIS_INSP_PBLM p
  1740. join (select * from bis_insp_all_obj o where o.ptype=2
  1741. <include refid="choseSql"/>
  1742. ) j on p.obj_id=j.obj_id
  1743. left join att_ad_x_base b on j.code=b.ad_code
  1744. ) w where w.ptype=2 and w.code in (${codes})
  1745. and
  1746. REGEXP_LIKE(
  1747. W.OID,'^('||
  1748. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  1749. <include refid="orgIdSql"/>
  1750. )>0 then
  1751. (SELECT LISTAGG(id, '|') as
  1752. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  1753. <include refid="orgIdSql"/>GROUP BY PERSID
  1754. )
  1755. else (select 'non' from dual) end)
  1756. ||')') and w.vill_type is not null group by code,insp_Pblm_Name
  1757. </select>
  1758. <!--人饮问题统计-->
  1759. <select id="totalCountVill" parameterType="java.lang.String"
  1760. resultType="cn.com.goldenwater.dcproj.dto.VillTypeCount">
  1761. select count(code) as total,insp_Pblm_Name from (
  1762. select j.code,j.nm,j.id as oid,j.ptype,p.vill_type,j.org_id,(case p.vill_type when '1' then '行政村' when '2' then
  1763. '水源地' when '3' then '饮水工程' else '责任落实' end) insp_Pblm_Name
  1764. from BIS_INSP_PBLM p
  1765. join (select * from bis_insp_all_obj o where o.ptype=2
  1766. <include refid="choseSql"/>
  1767. ) j on p.obj_id=j.obj_id
  1768. left join att_ad_x_base b on j.code=b.ad_code
  1769. ) w where w.ptype=2
  1770. and
  1771. REGEXP_LIKE(
  1772. W.OID,'^('||
  1773. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  1774. <include refid="orgIdSql"/>
  1775. )>0 then
  1776. (SELECT LISTAGG(id, '|') as
  1777. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  1778. <include refid="orgIdSql"/> GROUP BY PERSID
  1779. )
  1780. else (select 'non' from dual) end)
  1781. ||')') and w.vill_type is not null group by insp_Pblm_Name
  1782. </select>
  1783. <!--获取用户可查询问题范围-->
  1784. <select id="findPblmByPersId" parameterType="java.lang.String" resultType="cn.com.goldenwater.dcproj.dto.PblmRole">
  1785. select distinct name, id,length,case when perType is null then '0' else perType end perType from (
  1786. SELECT length(B.ID) as length,substr(B.id,0,3) as id,e.name as name,o.permission as perType
  1787. FROM (
  1788. select * from BIS_INSP_ALL_RLATION r where
  1789. <choose>
  1790. <when test="province !=null and province !=''">
  1791. r.ad_code =#{province}
  1792. </when>
  1793. <otherwise>
  1794. r.ad_code is null
  1795. </otherwise>
  1796. </choose>
  1797. ) B join BIS_INSP_ALL_RLATION_PERS o on b.persid=o.guid
  1798. join att_insp_type e on substr(B.id,0,3)=e.code
  1799. WHERE B.PERSID =#{persId} ) w order by w.id asc
  1800. </select>
  1801. <!--根据督查组查询统计问题-->
  1802. <select id="getAreaOrgIdsNew" resultType="java.lang.String" parameterType="java.lang.String">
  1803. SELECT LISTAGG(A.id, ',') W as id
  1804. FROM BIS_INSP_ALL A
  1805. join BIS_INSP_ALL_RLATION B ON A.ID = B.ID
  1806. join Bis_insp_all_obj o on A.id=o.id
  1807. WHERE B.PERSID =#{persId} AND A.ID LIKE #{areaId}
  1808. <include refid="choseSql"/> GROUP BY A.id
  1809. </select>
  1810. <!--获取数据-->
  1811. <select id="findKeyRegBYAreaId" parameterType="java.lang.String"
  1812. resultType="cn.com.goldenwater.dcproj.model.KeyRegCount">
  1813. select count(insp_pblm_cate) as total,insp_pblm_cate,ad_full_name from (
  1814. select j.id as oid,j.ptype,j.code,p.insp_pblm_cate,
  1815. (select e.ad_full_name from att_ad_x_base e where e.ad_code=concat(substr(se.ad_code,0,2),'0000000000')) as
  1816. ad_full_name from BIS_INSP_PBLM p
  1817. join (select * from BIS_INSP_ALL_OBJ o where o.ptype=#{pType}
  1818. <include refid="choseSql"/>
  1819. ) j on p.obj_id=j.obj_id
  1820. left join att_empwtprj_base ba on j.code=ba.id
  1821. left join att_ad_x_base se on ba.ad_code=se.ad_code
  1822. ) w where w.ptype=#{pType} group by insp_pblm_cate,ad_full_name
  1823. </select>
  1824. <!--根据督查组查人饮问题县统计-->
  1825. <select id="findVillPblmBYAreaId" parameterType="java.lang.String"
  1826. resultType="cn.com.goldenwater.dcproj.dto.VillCount">
  1827. select count(code) as countyNum,ad_full_name from (
  1828. select distinct code,ad_full_name from (
  1829. select j.code,j.nm,j.id as oid,j.ptype,p.vill_type,
  1830. (select e.ad_full_name from att_ad_x_base e where e.ad_code=concat(substr(b.ad_code,0,2),'0000000000')) as
  1831. ad_full_name,p.pblm_id from BIS_INSP_PBLM p
  1832. join (select * from BIS_INSP_ALL_OBJ o where o.ptype=2
  1833. <include refid="choseSql"/>
  1834. ) j on p.obj_id=j.obj_id
  1835. left join att_ad_x_base b on j.code=b.ad_code
  1836. ) w where w.ptype=2
  1837. <if test="areaId !=null and areaId !='' ">
  1838. and w.oid in (${areaId})
  1839. </if>
  1840. and vill_type is not null ) dd group by ad_full_name
  1841. </select>
  1842. <select id="countVillPblmByArea" parameterType="java.lang.String"
  1843. resultType="cn.com.goldenwater.dcproj.dto.VillTypeCount">
  1844. select count(ad_full_name) as total,ad_full_name,insp_Pblm_Name from (
  1845. select j.nm,j.id as oid,j.ptype,p.vill_type,substr(b.ad_full_name,0,INSTR(b.ad_full_name, '-', 1, 1)-1) as
  1846. ad_full_name,
  1847. (case p.vill_type when '1' then '行政村' when '2' then '水源地' when '3' then '饮水工程' else '责任落实' end) insp_Pblm_Name
  1848. from BIS_INSP_PBLM p
  1849. join (select * from BIS_INSP_ALL_OBJ o where o.ptype=2
  1850. <include refid="choseSql"/>
  1851. ) j on p.obj_id=j.obj_id
  1852. left join att_ad_x_base b on j.code=b.ad_code
  1853. ) w where w.ptype=2
  1854. <if test="areaId !=null and areaId !='' ">
  1855. and w.oid in (${areaId})
  1856. </if>
  1857. and w.vill_type is not null group by ad_full_name,insp_Pblm_Name
  1858. </select>
  1859. <!--根据督查组查询水闸问题-->
  1860. <select id="findWagaPblmBYAreaId" parameterType="java.lang.String"
  1861. resultType="cn.com.goldenwater.dcproj.model.WagaTotal">
  1862. select count(obj_code) as sub,ad_full_name as nm from (
  1863. select w.obj_code,ad_full_name from (
  1864. select t.obj_code,j.code,j.nm,j.id as oid,j.ptype,p.vill_type,p.insp_pblm_name,
  1865. (select e.ad_full_name from att_ad_x_base e where e.ad_code=concat(substr(b.ad_code,0,2),'0000000000')) as
  1866. ad_full_name,p.pblm_id from BIS_INSP_PBLM p
  1867. join (select * from BIS_INSP_ALL_OBJ o where o.ptype=6
  1868. <include refid="choseSql"/>
  1869. ) j on p.obj_id=j.obj_id
  1870. left join att_waga_base t on t.obj_code=j.code
  1871. left join att_ad_x_base b on t.ad_code=b.ad_code
  1872. ) w where w.ptype=6
  1873. <if test="areaId !=null and areaId !='' ">
  1874. and w.oid in (${areaId})
  1875. </if>
  1876. and vill_type is not null and insp_pblm_name is not null ) dd where ad_full_name is not null group by
  1877. ad_full_name
  1878. </select>
  1879. <!--水闸问题根据类型统计-->
  1880. <select id="countWagaPblmByType" parameterType="java.lang.String"
  1881. resultType="cn.com.goldenwater.dcproj.model.WagaType">
  1882. select count(ad_full_name) as total,ad_full_name as nm,eng_scal from (
  1883. select w.ad_full_name,w.eng_scal from (
  1884. select t.obj_code,t.eng_scal,j.code,j.nm,j.id as oid,j.ptype,p.vill_type,p.insp_pblm_name,
  1885. (select e.ad_full_name from att_ad_x_base e where e.ad_code=concat(substr(b.ad_code,0,2),'0000000000')) as
  1886. ad_full_name,
  1887. p.pblm_id from BIS_INSP_PBLM p
  1888. join (select * from BIS_INSP_ALL_OBJ o where o.ptype=6
  1889. <include refid="choseSql"/>
  1890. ) j on p.obj_id=j.obj_id
  1891. left join att_waga_base t on t.obj_code=j.code
  1892. left join att_ad_x_base b on t.ad_code=b.ad_code
  1893. ) w where w.ptype=6
  1894. <if test="areaId !=null and areaId !='' ">
  1895. and w.oid in (${areaId})
  1896. </if>
  1897. and vill_type is not null and insp_pblm_name is not null ) dd group by ad_full_name,eng_scal
  1898. </select>
  1899. <select id="countWagaPblmByCate" parameterType="java.lang.String"
  1900. resultType="cn.com.goldenwater.dcproj.model.WagaType">
  1901. select count(ad_full_name) as total,ad_full_name as nm,insp_pblm_cate as cate from (
  1902. select w.ad_full_name,w.insp_pblm_cate from (
  1903. select t.obj_code,t.eng_scal,j.code,j.nm,j.id as
  1904. oid,j.ptype,p.vill_type,p.insp_pblm_cate,p.insp_pblm_name,p.pblm_id ,
  1905. (select e.ad_full_name from att_ad_x_base e where e.ad_code=concat(substr(b.ad_code,0,2),'0000000000')) as
  1906. ad_full_name
  1907. from BIS_INSP_PBLM p
  1908. join (select * from BIS_INSP_ALL_OBJ o where o.ptype=6
  1909. <include refid="choseSql"/>
  1910. ) j on p.obj_id=j.obj_id
  1911. left join att_waga_base t on t.obj_code=j.code
  1912. left join att_ad_x_base b on t.ad_code=b.ad_code
  1913. ) w where w.ptype=6
  1914. <if test="areaId !=null and areaId !='' ">
  1915. and w.oid in (${areaId})
  1916. </if>
  1917. and vill_type is not null and insp_pblm_name is not null ) dd group by ad_full_name,insp_pblm_cate
  1918. </select>
  1919. <!--根据督查组查询水毁问题-->
  1920. <select id="findTrackPblmBYAreaId" parameterType="java.lang.String"
  1921. resultType="cn.com.goldenwater.dcproj.dto.TrackCount">
  1922. select count(wtdst_id) as project_Nm,ad_full_name as nm from (
  1923. select distinct w.wtdst_id,ad_full_name from (
  1924. select t.wtdst_id,j.code,j.nm,j.id as oid,j.ptype,p.vill_type,p.insp_pblm_name,
  1925. (select e.ad_full_name from att_ad_x_base e where e.ad_code=concat(substr(b.ad_code,0,2),'0000000000')) as
  1926. ad_full_name,p.pblm_id from BIS_INSP_PBLM p
  1927. join (select * from BIS_INSP_ALL_OBJ o where o.ptype=3
  1928. <include refid="choseSql"/>
  1929. ) j on p.obj_id=j.obj_id
  1930. left join bis_insp_wtdst t on t.wtdst_id=j.code
  1931. left join att_ad_x_base b on t.loc_ad=b.ad_code
  1932. ) w where w.ptype=3
  1933. <if test="areaId !=null and areaId !='' ">
  1934. and w.oid in (${areaId})
  1935. </if>
  1936. and vill_type is not null and insp_pblm_name is not null ) dd where ad_full_name is not null group by
  1937. ad_full_name
  1938. </select>
  1939. <select id="countTrackPblmByArea" parameterType="java.lang.String"
  1940. resultType="cn.com.goldenwater.dcproj.dto.TrackTypeCount">
  1941. select insp_pblm_name,ad_full_name as nm,count(insp_pblm_name) as total from (
  1942. select t.wtdst_id,j.code,j.nm,j.id as oid,j.ptype,p.vill_type,p.insp_pblm_name,
  1943. (select e.ad_full_name from att_ad_x_base e where e.ad_code=concat(substr(b.ad_code,0,2),'0000000000')) as
  1944. ad_full_name,p.pblm_id from BIS_INSP_PBLM p
  1945. join (select * from BIS_INSP_ALL_OBJ o where o.ptype=3
  1946. <include refid="choseSql"/>
  1947. ) j on p.obj_id=j.obj_id
  1948. left join bis_insp_wtdst t on t.wtdst_id=j.code
  1949. left join att_ad_x_base b on t.loc_ad=b.ad_code
  1950. ) w where w.ptype=3
  1951. <if test="areaId !=null and areaId !='' ">
  1952. and w.oid in (${areaId})
  1953. </if>
  1954. and vill_type is not null and insp_pblm_name is not null group by ad_full_name,insp_pblm_name
  1955. </select>
  1956. <!--水毁工程和问题总计查询-->
  1957. <select id="findTrackPblmPage" resultType="cn.com.goldenwater.dcproj.dto.TrackCount"
  1958. parameterType="cn.com.goldenwater.dcproj.param.CountParam">
  1959. select dd.*,k.nm from BIS_INSP_ALL_OBJ k,(
  1960. select obj_id,count(insp_pblm_cate) as total from (
  1961. select w.* from (
  1962. select j.nm,j.id as oid,j.obj_id,j.ptype,p.insp_pblm_name,p.insp_pblm_cate from BIS_INSP_PBLM p
  1963. join (select * from BIS_INSP_ALL_OBJ o where o.ptype=3
  1964. <include refid="choseSql"/>
  1965. ) j on p.obj_id=j.obj_id
  1966. ) w where w.ptype=3 and
  1967. REGEXP_LIKE(
  1968. W.OID,'^('||
  1969. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  1970. <include refid="orgIdSql"/>
  1971. )>0 then
  1972. (SELECT LISTAGG(id, '|') as
  1973. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  1974. <include refid="orgIdSql"/> GROUP BY PERSID
  1975. )
  1976. else (select 'non' from dual) end)
  1977. ||')') and w.insp_pblm_name is not null and w.insp_pblm_cate is not null
  1978. ) a group by obj_id ) dd where k.obj_id=dd.obj_id order by total
  1979. </select>
  1980. <!--水毁根据督查问题类型统计-->
  1981. <select id="countTrack" parameterType="java.lang.String" resultType="cn.com.goldenwater.dcproj.dto.TrackTypeCount">
  1982. select obj_id,count(insp_pblm_cate) as total,insp_pblm_name from (
  1983. select w.* from (
  1984. select j.nm,j.id as oid,j.obj_id,j.ptype,p.insp_pblm_name,p.insp_pblm_cate from BIS_INSP_PBLM p
  1985. join (select * from BIS_INSP_ALL_OBJ o where o.ptype=3
  1986. <include refid="choseSql"/>
  1987. ) j on p.obj_id=j.obj_id
  1988. ) w where w.ptype=3 and obj_id in (${objIds}) and
  1989. REGEXP_LIKE(
  1990. W.OID,'^('||
  1991. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  1992. <include refid="orgIdSql"/>
  1993. )>0 then
  1994. (SELECT LISTAGG(id, '|') as
  1995. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  1996. <include refid="orgIdSql"/> GROUP BY PERSID
  1997. )
  1998. else (select 'non' from dual) end)
  1999. ||')') and w.insp_pblm_name is not null and w.insp_pblm_cate is not null
  2000. ) a group by obj_id,insp_pblm_name
  2001. </select>
  2002. <!--水毁问题分类合计-->
  2003. <select id="totalCountTrack" parameterType="java.lang.String"
  2004. resultType="cn.com.goldenwater.dcproj.dto.TrackTypeCount">
  2005. select insp_pblm_name,count(insp_pblm_cate) as total from (
  2006. select j.nm,j.id as oid,j.obj_id,j.ptype,p.insp_pblm_name,p.insp_pblm_cate from BIS_INSP_PBLM p
  2007. join (select * from BIS_INSP_ALL_OBJ o where o.ptype=3
  2008. <include refid="choseSql"/>
  2009. ) j on p.obj_id=j.obj_id
  2010. ) w where w.ptype=3 and
  2011. REGEXP_LIKE(
  2012. W.OID,'^('||
  2013. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  2014. <include refid="orgIdSql"/>
  2015. )>0 then
  2016. (SELECT LISTAGG(id, '|') as
  2017. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  2018. <include refid="orgIdSql"/> GROUP BY PERSID
  2019. )
  2020. else (select 'non' from dual) end)
  2021. ||')') and w.insp_pblm_name is not null and w.insp_pblm_cate is not null group by insp_pblm_name
  2022. </select>
  2023. <select id="countByType" resultType="cn.com.goldenwater.dcproj.dto.CountType" parameterType="java.util.Map">
  2024. select count(w.pblm_id) as count,(case obj_type when '1' then '小水库' when '3' then '水毁' when '5' then '地下水' end )
  2025. as name from (
  2026. select j.code,j.nm,j.id as oid,r.PERS_NAME,p.* from BIS_INSP_PBLM p
  2027. join (select * from BIS_INSP_ALL_OBJ o where 1=1
  2028. <include refid="choseSql"/>
  2029. ) j on p.obj_id=j.obj_id
  2030. join BIS_INSP_ALL_RLATION_PERS r on p.rec_pers=r.guid
  2031. ) w
  2032. where 1=1
  2033. <trim prefix="and" prefixOverrides="and | or ">
  2034. <if test="adCode != null and adCode != '' and adCode != 'null'">and w.CODE like '${adCode}%'</if>
  2035. </trim>
  2036. and REGEXP_LIKE(
  2037. W.oid,'^('||
  2038. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{presId}
  2039. <include refid="orgIdSql"/>
  2040. )>0 then
  2041. (SELECT LISTAGG(id, '|') as
  2042. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{presId}
  2043. <include refid="orgIdSql"/>GROUP BY PERSID
  2044. )
  2045. else (select 'non' from dual) end)
  2046. ||')') and obj_type in (1,3,5) group by obj_type
  2047. union all
  2048. select count(w.pblm_id) as count,'行政村' as name from (
  2049. select j.code,j.nm,j.id as oid,r.PERS_NAME,p.* from BIS_INSP_PBLM p
  2050. join BIS_INSP_ALL_OBJ j on p.obj_id=j.obj_id
  2051. join BIS_INSP_ALL_RLATION_PERS r on p.rec_pers=r.guid
  2052. ) w
  2053. where 1=1
  2054. <trim prefix="and" prefixOverrides="and | or ">
  2055. <if test="adCode != null and adCode != '' and adCode != 'null'">and w.CODE like '${adCode}%'</if>
  2056. </trim>
  2057. and REGEXP_LIKE(
  2058. W.oid,'^('||
  2059. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{presId}
  2060. <include refid="orgIdSql"/>
  2061. )>0 then
  2062. (SELECT LISTAGG(id, '|') as
  2063. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{presId}
  2064. <include refid="orgIdSql"/>GROUP BY PERSID
  2065. )
  2066. else (select 'non' from dual) end)
  2067. ||')') and obj_type=2 and w.village_code is not null
  2068. union all
  2069. select count(w.pblm_id) as count,'饮水工程' as name from (
  2070. select j.code,j.nm,j.id as oid,r.PERS_NAME,p.* from BIS_INSP_PBLM p
  2071. join BIS_INSP_ALL_OBJ j on p.obj_id=j.obj_id
  2072. join BIS_INSP_ALL_RLATION_PERS r on p.rec_pers=r.guid
  2073. ) w
  2074. where 1=1
  2075. <trim prefix="and" prefixOverrides="and | or ">
  2076. <if test="adCode != null and adCode != '' and adCode != 'null'">and w.CODE like '${adCode}%'</if>
  2077. </trim>
  2078. and REGEXP_LIKE(
  2079. W.oid,'^('||
  2080. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{presId}
  2081. <include refid="orgIdSql"/>
  2082. )>0 then
  2083. (SELECT LISTAGG(id, '|') as
  2084. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{presId}
  2085. <include refid="orgIdSql"/> GROUP BY PERSID
  2086. )
  2087. else (select 'non' from dual) end)
  2088. ||')') and obj_type=2 and w.cws_code is not null
  2089. union all
  2090. select count(w.pblm_id) as count,'水源地' as name from (
  2091. select j.code,j.nm,j.id as oid,r.PERS_NAME,p.* from BIS_INSP_PBLM p
  2092. join BIS_INSP_ALL_OBJ j on p.obj_id=j.obj_id
  2093. join BIS_INSP_ALL_RLATION_PERS r on p.rec_pers=r.guid
  2094. ) w
  2095. where 1=1
  2096. <trim prefix="and" prefixOverrides="and | or ">
  2097. <if test="adCode != null and adCode != '' and adCode != 'null'">and w.CODE like '${adCode}%'</if>
  2098. </trim>
  2099. and REGEXP_LIKE(
  2100. W.oid,'^('||
  2101. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{presId}
  2102. <include refid="orgIdSql"/>
  2103. )>0 then
  2104. (SELECT LISTAGG(id, '|') as
  2105. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{presId}
  2106. <include refid="orgIdSql"/> GROUP BY PERSID
  2107. )
  2108. else (select 'non' from dual) end)
  2109. ||')') and obj_type=2 and w.cws_code is null and w.village_code is null
  2110. </select>
  2111. <select id="selectCount" resultType="int">
  2112. select count(m.PBLM_ID) from bis_insp_pblm m,bis_insp_all_obj j
  2113. where m.obj_id=j.obj_id
  2114. <if test="startTime != null and startTime != ''">and m.COLL_TIME &gt; TO_DATE(#{startTime},'YYYY-MM-DD
  2115. HH24:MI:SS')
  2116. </if>
  2117. <if test="endTime != null and endTime != ''">and m.COLL_TIME &lt; TO_DATE(#{endTime},'YYYY-MM-DD HH24:MI:SS')
  2118. </if>
  2119. <if test="findTime != null and findTime != ''">and to_char(m.coll_time,'yyyy-MM-dd')=#{findTime}</if>
  2120. <if test="monthTime != null and monthTime != ''">and to_char(m.coll_time,'yyyy-MM')=#{monthTime}</if>
  2121. <if test="regid != null and regid != ''">and M.REGID = #{regid}</if>
  2122. <if test="objId != null and objId != ''">and M.OBJ_ID = #{objId}</if>
  2123. <if test="orgId != null and orgId != ''">and J.ORG_ID = #{orgId}</if>
  2124. <choose>
  2125. <when test="province != null and province != ''">
  2126. and j.ad_code = '${province}'
  2127. </when>
  2128. <otherwise>
  2129. and j.ad_code is null
  2130. </otherwise>
  2131. </choose>
  2132. </select>
  2133. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspPblm">
  2134. insert into bis_insp_pblm(
  2135. <include refid="table_columns"/>
  2136. )
  2137. values (
  2138. <include refid="entity_properties"/>
  2139. )
  2140. </insert>
  2141. <delete id="delete" parameterType="java.lang.String">
  2142. delete from bis_insp_pblm where PBLM_ID = #{id}
  2143. </delete>
  2144. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspPblm">
  2145. delete from bis_insp_pblm
  2146. <include refid="page_where"/>
  2147. </delete>
  2148. <update id="deleteInFlag" parameterType="java.lang.String">
  2149. update bis_insp_pblm set flag_valid = 0 where PBLM_ID = #{id}
  2150. </update>
  2151. <update id="deletePblmByTypeId" parameterType="cn.com.goldenwater.dcproj.model.BisInspPblm">
  2152. delete from bis_insp_pblm
  2153. where obj_type = #{objType}
  2154. and PBLMS_TYPE_ID in (${pblmsTypeId})
  2155. <if test="objType == '1'">
  2156. and obj_id in (select obj_id from bis_insp_rsvr_rgstr where rgstr_id = #{rgstrId})
  2157. </if>
  2158. </update>
  2159. <update id="updatePblmStatus" parameterType="cn.com.goldenwater.dcproj.model.BisInspPblm">
  2160. update bis_insp_pblm set pblmStat=#{pblmStat} where regid=#{regid}
  2161. </update>
  2162. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspPblm">
  2163. update bis_insp_pblm
  2164. <trim prefix="set" suffixOverrides=",">
  2165. <if test="newVillName != null and newVillName != ''">NEW_VILL_NAME = #{newVillName},</if>
  2166. <if test="pblmNameBz != null and pblmNameBz != ''">PBLM_NAME_BZ = #{pblmNameBz},</if>
  2167. <if test="snNumBz != null and snNumBz != ''">SN_NUM_BZ = #{snNumBz},</if>
  2168. <if test="checkPointBz != null and checkPointBz != ''">CHECK_POINT_BZ = #{checkPointBz},</if>
  2169. <if test="pblmDescBz != null and pblmDescBz != ''">PBLM_DESC_BZ = #{pblmDescBz},</if>
  2170. <if test="regid != null and regid != ''">REGID = #{regid},</if>
  2171. <if test="attachBz != null and attachBz != ''">attach_Bz = #{attachBz},</if>
  2172. <if test="quote != null and quote != ''">QUOTE = #{quote},</if>
  2173. <if test="commonFileIds != null and commonFileIds != ''">COMMON_FILE_IDS = #{commonFileIds},</if>
  2174. <if test="fileNo != null and fileNo != ''">FILE_NO = #{fileNo},</if>
  2175. <if test="fileNoNumber != null and fileNoNumber != ''">FILE_NO_NUMBER = #{fileNoNumber},</if>
  2176. <if test="pblmsId != null and pblmsId != '0'.toString()">PBLMS_ID = #{pblmsId},</if>
  2177. <if test="pblmsTypeId != null and pblmsTypeId != '0'.toString()">PBLMS_TYPE_ID = #{pblmsTypeId},</if>
  2178. <if test="pblmsId == '0'.toString()">PBLMS_ID ='',</if>
  2179. <if test="pblmsTypeId == '0'.toString()">PBLMS_TYPE_ID ='',</if>
  2180. <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
  2181. <if test="objType != null and objType != ''">OBJ_TYPE = #{objType},</if>
  2182. <if test="waterUserId != null and waterUserId != ''">water_User_Id = #{waterUserId},</if>
  2183. <if test="inspGroupId != null and inspGroupId != ''">INSP_GROUP_ID = #{inspGroupId},</if>
  2184. <if test="pguid != null and pguid != ''">PGUID = #{pguid},</if>
  2185. <if test="inspPblmType != null and inspPblmType != ''">INSP_PBLM_TYPE = #{inspPblmType},</if>
  2186. <if test="inspPblmCode != null and inspPblmCode != ''">INSP_PBLM_CODE = #{inspPblmCode},</if>
  2187. <if test="inspPblmName != null and inspPblmName != ''">INSP_PBLM_NAME = #{inspPblmName},</if>
  2188. <if test="inspPblmDesc != null and inspPblmDesc != ''">INSP_PBLM_DESC = #{inspPblmDesc},</if>
  2189. <if test="inspAddDesc != null and inspAddDesc != ''">INSP_ADD_DESC = #{inspAddDesc},</if>
  2190. <if test="pblmLong != null and pblmLong != ''">PBLM_LONG = #{pblmLong},</if>
  2191. <if test="pblmLat != null and pblmLat != ''">PBLM_LAT = #{pblmLat},</if>
  2192. <if test="ifCasePblm != null and ifCasePblm != ''">IF_CASE_PBLM = #{ifCasePblm},</if>
  2193. <if test="inspPblmOrgName != null and inspPblmOrgName != ''">INSP_PBLM_ORG_NAME = #{inspPblmOrgName},</if>
  2194. <if test="pblmPersName != null and pblmPersName != ''">PBLM_PERS_NAME = #{pblmPersName},</if>
  2195. <if test="inspPblmCate != null and inspPblmCate != ''">INSP_PBLM_CATE = #{inspPblmCate},</if>
  2196. <if test="relBasis != null and relBasis != ''">REL_BASIS = #{relBasis},</if>
  2197. <if test="pblmStat != null and pblmStat != ''">PBLM_STAT = #{pblmStat},</if>
  2198. <if test="reviOpin != null and reviOpin != ''">REVI_OPIN = #{reviOpin},</if>
  2199. <if test="reviConc != null and reviConc != ''">REVI_CONC = #{reviConc},</if>
  2200. <if test="villageCode != null and villageCode != ''">village_Code = #{villageCode},</if>
  2201. <if test="cwsCode != null and cwsCode != ''">cws_Code = #{cwsCode},</if>
  2202. <if test="reviOrgGuid != null and reviOrgGuid != ''">REVI_ORG_GUID = #{reviOrgGuid},</if>
  2203. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  2204. <if test="collTime != null">COLL_TIME = #{collTime},</if>
  2205. <if test="recPers != null and recPers != ''">REC_PERS = #{recPers},</if>
  2206. <if test="note != null and note != ''">NOTE = #{note},</if>
  2207. <if test="hasVedio != null and hasVedio != ''">HAS_VEDIO = #{hasVedio},</if>
  2208. <if test="problemType != null and problemType != ''">problem_Type = #{problemType},</if>
  2209. <if test="villType != null and villType != ''">VILL_TYPE = #{villType},</if>
  2210. <if test="defectTypeId != null and defectTypeId != '0'.toString()">DEFECT_TYPE_ID = #{defectTypeId},</if>
  2211. <if test="qualityTypeId != null and qualityTypeId != '0'.toString()">QUALITY_TYPE_ID = #{qualityTypeId},
  2212. </if>
  2213. <if test="defectTypeId == '0'.toString()">DEFECT_TYPE_ID ='',</if>
  2214. <if test="qualityTypeId == '0'.toString()">QUALITY_TYPE_ID ='',</if>
  2215. <if test="gongdiBzId != null and gongdiBzId != '0'.toString()">gongdi_Bz_Id = #{gongdiBzId},</if>
  2216. <if test="gongdiBzId == '0'.toString()">gongdi_Bz_Id ='',</if>
  2217. <if test="fdbkId != null and fdbkId != ''">FDBK_ID = #{fdbkId},</if>
  2218. <if test="itemId != null and itemId != ''">item_Id = #{itemId},</if>
  2219. <if test="uptm != null">UP_TM = #{uptm},</if>
  2220. <if test="pblmReason != null and pblmReason != ''">PBLM_REASON = #{pblmReason},</if>
  2221. <if test="pblmSggtn != null and pblmSggtn != ''">PBLM_SGGTN = #{pblmSggtn},</if>
  2222. <if test="objCode != null and objCode != ''">OBJ_CODE = #{objCode},</if>
  2223. <if test="objName != null and objName != ''">OBJ_NAME = #{objName},</if>
  2224. <if test="objAdCode != null and objAdCode != ''">OBJ_AD_CODE = #{objAdCode},</if>
  2225. <if test="wtdstNote != null and wtdstNote != ''">WTDST_NOTE = #{wtdstNote},</if>
  2226. <if test="state != null and state != ''">STATE = #{state},</if>
  2227. <if test="score != null and score != ''">SCORE = #{score},</if>
  2228. <if test="damRegCode != null and damRegCode != ''">DAM_REG_CODE = #{damRegCode},</if>
  2229. </trim>
  2230. <where>PBLM_ID = #{pblmId}</where>
  2231. </update>
  2232. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspPblm">
  2233. update bis_insp_pblm
  2234. <trim prefix="set" suffixOverrides=",">
  2235. <if test="newVillName != null and newVillName != ''">NEW_VILL_NAME = #{newVillName},</if>
  2236. <if test="pblmNameBz != null and pblmNameBz != ''">PBLM_NAME_BZ = #{pblmNameBz},</if>
  2237. <if test="snNumBz != null and snNumBz != ''">SN_NUM_BZ = #{snNumBz},</if>
  2238. <if test="checkPointBz != null and checkPointBz != ''">CHECK_POINT_BZ = #{checkPointBz},</if>
  2239. <if test="pblmDescBz != null and pblmDescBz != ''">PBLM_DESC_BZ = #{pblmDescBz},</if>
  2240. <if test="regid != null and regid != ''">REGID = #{regid},</if>
  2241. <if test="attachBz != null and attachBz != ''">attach_Bz = #{attachBz},</if>
  2242. <if test="commonFileIds != null and commonFileIds != ''">COMMON_FILE_IDS = #{commonFileIds},</if>
  2243. <if test="fileNo != null and fileNo != ''">FILE_NO = #{fileNo},</if>
  2244. <if test="fileNoNumber != null and fileNoNumber != ''">FILE_NO_NUMBER = #{fileNoNumber},</if>
  2245. <if test="pblmsId != null and pblmsId != ''">PBLMS_ID = #{pblmsId},</if>
  2246. <if test="pblmId != null and pblmId != ''">PBLM_ID = #{pblmId},</if>
  2247. <if test="waterUserId != null and waterUserId != ''">water_User_Id = #{waterUserId},</if>
  2248. <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
  2249. <if test="objType != null and objType != ''">OBJ_TYPE = #{objType},</if>
  2250. <if test="inspGroupId != null and inspGroupId != ''">INSP_GROUP_ID = #{inspGroupId},</if>
  2251. <if test="pguid != null and pguid != ''">PGUID = #{pguid},</if>
  2252. <if test="itemId != null and itemId != ''">item_Id = #{itemId},</if>
  2253. <if test="inspPblmType != null and inspPblmType != ''">INSP_PBLM_TYPE = #{inspPblmType},</if>
  2254. <if test="inspPblmCode != null and inspPblmCode != ''">INSP_PBLM_CODE = #{inspPblmCode},</if>
  2255. <if test="inspPblmName != null and inspPblmName != ''">INSP_PBLM_NAME = #{inspPblmName},</if>
  2256. <if test="inspPblmDesc != null and inspPblmDesc != ''">INSP_PBLM_DESC = #{inspPblmDesc},</if>
  2257. <if test="inspAddDesc != null and inspAddDesc != ''">INSP_ADD_DESC = #{inspAddDesc},</if>
  2258. <if test="pblmLong != null and pblmLong != ''">PBLM_LONG = #{pblmLong},</if>
  2259. <if test="pblmLat != null and pblmLat != ''">PBLM_LAT = #{pblmLat},</if>
  2260. <if test="ifCasePblm != null and ifCasePblm != ''">IF_CASE_PBLM = #{ifCasePblm},</if>
  2261. <if test="inspPblmOrgName != null and inspPblmOrgName != ''">INSP_PBLM_ORG_NAME = #{inspPblmOrgName},</if>
  2262. <if test="pblmPersName != null and pblmPersName != ''">PBLM_PERS_NAME = #{pblmPersName},</if>
  2263. <if test="inspPblmCate != null and inspPblmCate != ''">INSP_PBLM_CATE = #{inspPblmCate},</if>
  2264. <if test="pblmStat != null and pblmStat != ''">PBLM_STAT = #{pblmStat},</if>
  2265. <if test="reviOpin != null and reviOpin != ''">REVI_OPIN = #{reviOpin},</if>
  2266. <if test="reviConc != null and reviConc != ''">REVI_CONC = #{reviConc},</if>
  2267. <if test="reviOrgGuid != null and reviOrgGuid != ''">REVI_ORG_GUID = #{reviOrgGuid},</if>
  2268. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  2269. <if test="fdbkId != null and fdbkId != ''">FDBK_ID = #{fdbkId},</if>
  2270. <if test="collTime != null">COLL_TIME = #{collTime},</if>
  2271. <if test="villageCode != null and villageCode != ''">village_Code = #{villageCode},</if>
  2272. <if test="problemType != null and problemType != ''">problem_Type = #{problemType},</if>
  2273. <if test="cwsCode != null and cwsCode != ''">cws_Code = #{cwsCode},</if>
  2274. <if test="recPers != null and recPers != ''">REC_PERS = #{recPers},</if>
  2275. <if test="note != null and note != ''">NOTE = #{note},</if>
  2276. <if test="villType != null and villType != ''">VILL_TYPE = #{villType},</if>
  2277. <if test="hasVedio != null and hasVedio != ''">HAS_VEDIO = #{hasVedio},</if>
  2278. <if test="defectTypeId != null and defectTypeId != ''">DEFECT_TYPE_ID = #{defectTypeId},</if>
  2279. <if test="qualityTypeId != null and qualityTypeId != ''">QUALITY_TYPE_ID = #{qualityTypeId},</if>
  2280. <if test="gongdiBzId != null and gongdiBzId != '0'.toString()">gongdi_Bz_Id = #{gongdiBzId},</if>
  2281. <if test="gongdiBzId == '0'.toString()">gongdi_Bz_Id ='',</if>
  2282. <if test="uptm != null">UP_TM = #{uptm},</if>
  2283. <if test="pblmReason != null and pblmReason != ''">PBLM_REASON = #{pblmReason},</if>
  2284. <if test="pblmSggtn != null and pblmSggtn != ''">PBLM_SGGTN = #{pblmSggtn},</if>
  2285. <if test="objCode != null and objCode != ''">OBJ_CODE = #{objCode},</if>
  2286. <if test="objName != null and objName != ''">OBJ_NAME = #{objName},</if>
  2287. <if test="objAdCode != null and objAdCode != ''">OBJ_AD_CODE = #{objAdCode},</if>
  2288. <if test="wtdstNote != null and wtdstNote != ''">WTDST_NOTE = #{wtdstNote},</if>
  2289. </trim>
  2290. <include refid="page_where"/>
  2291. </update>
  2292. <!-- 其他自定义SQL -->
  2293. <select id="getBisInspPblmById" resultType="cn.com.goldenwater.dcproj.model.BisInspPblmDelLog">
  2294. select t.pblm_id,t.PBLM_NAME_BZ,t.CHECK_POINT_BZ,t.SN_NUM_BZ,t.PBLM_DESC_BZ,
  2295. t.obj_id,
  2296. t.obj_type,
  2297. t.quote,
  2298. t.insp_group_id,
  2299. t.pguid,
  2300. t.insp_pblm_type,
  2301. t.insp_pblm_code,
  2302. t.insp_pblm_name,
  2303. t.insp_pblm_desc,
  2304. t.insp_add_desc,
  2305. t.pblm_long,
  2306. t.pblm_lat,
  2307. t.if_case_pblm,
  2308. t.insp_pblm_org_name,
  2309. t.pblm_pers_name,
  2310. t.insp_pblm_cate,
  2311. t.pblm_stat,
  2312. t.revi_opin,
  2313. t.revi_conc,
  2314. t.revi_org_guid,
  2315. t.data_stat,
  2316. to_char(t.coll_time,'YYYY-MM-DD HH24:MI:SS') coll_time,
  2317. t.rec_pers,
  2318. t.note,
  2319. t.regid,
  2320. t.common_file_ids,
  2321. t.file_no,
  2322. t.file_no_number,
  2323. t.pblms_id,
  2324. t.pblms_type_id,
  2325. t.vill_type,
  2326. t.cws_code,
  2327. t.WTDST_NOTE,
  2328. t.village_code from BIS_INSP_PBLM t WHERE t.pblm_id = #{pblmId}
  2329. </select>
  2330. <insert id="insertPblmDelLog" parameterType="cn.com.goldenwater.dcproj.model.BisInspPblmDelLog">
  2331. insert into BIS_INSP_PBLM_DEL_LOG(
  2332. <include refid="table_columns_pblmDelLog"/>
  2333. )
  2334. values (
  2335. <include refid="entity_properties_pblmDelLog"/>
  2336. )
  2337. </insert>
  2338. <sql id="choseSql">
  2339. <choose>
  2340. <when test="province != null and province !=''">
  2341. and o.ad_code = '${province}'
  2342. </when>
  2343. </choose>
  2344. </sql>
  2345. <select id="countPblmIncByDay" parameterType="cn.com.goldenwater.dcproj.param.IndexPblmParam"
  2346. resultType="cn.com.goldenwater.dcproj.dto.CountTime">
  2347. select LTRIM(to_char(TO_DATE(f.dat,'yyyy-mm-dd'),'dd'),'0') as name,f.value from (
  2348. select c.dat,nvl(d.value,0) as value from (
  2349. select to_char(to_date(#{seltime},'yyyy-mm-dd')+level-1,'yyyy-mm-dd') as dat
  2350. from dual
  2351. connect by level &lt;=to_date(#{ettm},'yyyy-mm-dd')-to_date(#{seltime},'yyyy-mm-dd')+1
  2352. ) c left join (
  2353. select to_char(w.COLL_TIME,'yyyy-MM-dd') AS NAME,count(1)as value from (
  2354. <trim>
  2355. <include refid="lyzSql"/>
  2356. </trim>
  2357. ) w where 1=1
  2358. <if test="sttm != null and sttm != ''">and w.coll_time&gt;= TO_DATE(#{sttm},'YYYY-MM-DD')</if>
  2359. <if test="ettm != null and ettm != ''">and to_char(w.coll_time,'yyyy-MM-dd') &lt;= #{ettm}</if>
  2360. <if test="orgIds != null and orgIds != ''">
  2361. and substr(w.id,4,3) in (${orgIds})
  2362. </if>
  2363. <if test="adCode != null and adCode != ''">and substr(w.id,4,3) in (${orgIds})and w.AD_CODE like
  2364. CONCAT(#{adCode}, '%')
  2365. </if>
  2366. <if test="type != null and type != ''">and w.obj_type in (${type})</if>
  2367. group by to_char(w.COLL_TIME,'yyyy-MM-dd')
  2368. ) d on c.dat = d.name
  2369. order by c.dat
  2370. ) f
  2371. </select>
  2372. <select id="countPblmTotalByDay" parameterType="cn.com.goldenwater.dcproj.param.IndexPblmParam"
  2373. resultType="cn.com.goldenwater.dcproj.dto.CountTime">
  2374. select LTRIM(to_char(TO_DATE(f.dat,'yyyy-mm-dd'),'dd'),'0') as name,f.value from (
  2375. select x.dat,sum(x.value) over(order by x.dat) as value from (
  2376. select c.dat,nvl(d.value,0) as value from (
  2377. select to_char(to_date(#{sttm},'yyyy-mm-dd')+level-1,'yyyy-mm-dd') as dat
  2378. from dual
  2379. connect by level &lt;=to_date(#{ettm},'yyyy-mm-dd')-to_date(#{sttm},'yyyy-mm-dd')+1
  2380. ) c left join (
  2381. select to_char(w.COLL_TIME,'yyyy-MM-dd') AS NAME,count(1)as value from (
  2382. <trim>
  2383. <include refid="lyzSql"/>
  2384. </trim>
  2385. ) w where 1=1
  2386. <if test="sttm != null and sttm != ''">and w.coll_time&gt;= TO_DATE(#{sttm},'YYYY-MM-DD')</if>
  2387. <if test="ettm != null and ettm != ''">and to_char(w.coll_time,'yyyy-MM-dd') &lt;= #{ettm}</if>
  2388. <if test="orgIds != null and orgIds != ''">
  2389. and substr(w.id,4,3) in (${orgIds})
  2390. </if>
  2391. <if test="adCode != null and adCode != ''">and substr(w.id,4,3) in (${orgIds})and w.AD_CODE like
  2392. CONCAT(#{adCode}, '%')
  2393. </if>
  2394. <if test="type != null and type != ''">and w.obj_type in (${type})</if>
  2395. group by to_char(w.COLL_TIME,'yyyy-MM-dd')
  2396. ) d on c.dat = d.name
  2397. order by c.dat
  2398. )x
  2399. ) f
  2400. </select>
  2401. <select id="countPblmIncByWeek" parameterType="cn.com.goldenwater.dcproj.param.IndexPblmParam"
  2402. resultType="cn.com.goldenwater.dcproj.dto.CountTime">
  2403. select to_char(w.COLL_TIME,'iw') AS NAME,count(1)as value from (
  2404. <trim>
  2405. <include refid="lyzSql"/>
  2406. </trim>
  2407. ) w where 1=1
  2408. <if test="sttm != null and sttm != ''">and w.coll_time&gt;= TO_DATE(#{sttm},'YYYY-MM-DD')</if>
  2409. <if test="stime != null and stime != ''">and w.coll_time&lt;= TO_DATE(#{stime},'YYYY-MM-DD')</if>
  2410. <if test="orgIds != null and orgIds != ''">
  2411. and substr(w.id,4,3) in (${orgIds})
  2412. </if>
  2413. <if test="adCode != null and adCode != ''">and w.AD_CODE like CONCAT(#{adCode}, '%')</if>
  2414. <if test="type != null and type != ''">and w.obj_type in (${type})</if>
  2415. group by to_char(w.COLL_TIME,'iw')
  2416. order by name
  2417. </select>
  2418. <select id="countPblmTotalByWeek" parameterType="cn.com.goldenwater.dcproj.param.IndexPblmParam"
  2419. resultType="cn.com.goldenwater.dcproj.dto.CountTime">
  2420. select c.name,sum(c.value) over(order by c.name) as value from (
  2421. select to_char(w.COLL_TIME,'w') AS NAME,count(1)as value from (
  2422. <trim>
  2423. <include refid="lyzSql"/>
  2424. </trim>
  2425. ) w where 1=1
  2426. <if test="stime != null and stime != ''">and to_char(w.coll_time,'yyyy-MM') =
  2427. to_char(TO_DATE(#{stime},'yyyy-MM-dd'),'yyyy-MM')
  2428. </if>
  2429. <if test="orgIds != null and orgIds != ''">
  2430. and substr(w.id,4,3) in (${orgIds})
  2431. </if>
  2432. <if test="adCode != null and adCode != ''">and w.AD_CODE like CONCAT(#{adCode}, '%')</if>
  2433. <if test="type != null and type != ''">and w.obj_type in (${type})</if>
  2434. group by to_char(w.COLL_TIME,'w')
  2435. order by name
  2436. ) c
  2437. </select>
  2438. <select id="countPblmIncByMonth" parameterType="cn.com.goldenwater.dcproj.param.IndexPblmParam"
  2439. resultType="cn.com.goldenwater.dcproj.dto.CountTime">
  2440. select LTRIM(to_char(to_date(f.name,'yyyy-MM'),'MM'),'0') as name, f.value as value from (
  2441. select to_char(to_date(m.monthlist,'yyyy-MM'),'yyyy-MM') as name,nvl(d.value,0) as value from (
  2442. SELECT TO_CHAR(ADD_MONTHS(to_date(to_char(to_date(#{seltime}, 'yyyy-MM-dd'),'yyyy-MM'),'yyyy-MM'), ROWNUM - 1),
  2443. 'yyyy-MM') as monthlist
  2444. FROM DUAL
  2445. CONNECT BY ROWNUM &lt;=
  2446. months_between(to_date(to_char(to_date(#{ettm}, 'yyyy-MM-dd'),'yyyy-MM'), 'yyyy-MM'),
  2447. to_date(to_char(to_date(#{seltime}, 'yyyy-MM-dd'),'yyyy-MM'),'yyyy-MM')) + 1
  2448. ) m left join (
  2449. select to_char(COLL_TIME,'yyyy-MM') as name,count(*) as value from (
  2450. <trim>
  2451. <include refid="lyzSql"/>
  2452. </trim>
  2453. ) w where 1=1
  2454. <if test="sttm != null and sttm != ''">and w.coll_time &gt;= TO_DATE(#{sttm},'YYYY-MM-DD')</if>
  2455. <if test="ettm != null and ettm != ''">and to_char(w.coll_time,'yyyy-MM') &lt;=
  2456. to_char(TO_DATE(#{ettm},'yyyy-MM-dd'),'yyyy-MM')
  2457. </if>
  2458. <if test="orgIds != null and orgIds != ''">
  2459. and substr(w.id,4,3) in (${orgIds})
  2460. </if>
  2461. <if test="adCode != null and adCode != ''">and w.AD_CODE like CONCAT(#{adCode}, '%')</if>
  2462. <if test="type != null and type != ''">and w.obj_type in (${type})</if>
  2463. group by to_char(COLL_TIME,'yyyy-MM')
  2464. ) d on m.monthlist = d.name
  2465. order by m.monthlist
  2466. ) f
  2467. </select>
  2468. <select id="countPblmTotalByMonth" parameterType="cn.com.goldenwater.dcproj.param.IndexPblmParam"
  2469. resultType="cn.com.goldenwater.dcproj.dto.CountTime">
  2470. select LTRIM(to_char(to_date(f.name,'yyyy-MM'),'MM'),'0') as name, f.value as value from (
  2471. select c.name,sum(c.value) over(order by c.name) as value from (
  2472. select to_char(to_date(m.monthlist,'yyyy-MM'),'yyyy-MM') as name,nvl(d.value,0) as value from (
  2473. SELECT TO_CHAR(ADD_MONTHS(to_date(to_char(to_date(#{sttm}, 'yyyy-MM-dd'),'yyyy-MM'),'yyyy-MM'), ROWNUM - 1),
  2474. 'yyyy-MM') as monthlist
  2475. FROM DUAL
  2476. CONNECT BY ROWNUM &lt;=
  2477. months_between(to_date(to_char(to_date(#{stime}, 'yyyy-MM-dd'),'yyyy-MM'), 'yyyy-MM'),
  2478. to_date(to_char(to_date(#{sttm}, 'yyyy-MM-dd'),'yyyy-MM'),'yyyy-MM')) + 1
  2479. ) m left join (
  2480. select to_char(COLL_TIME,'yyyy-MM') as name,count(*) as value from (
  2481. <trim>
  2482. <include refid="lyzSql"/>
  2483. </trim>
  2484. ) w where 1=1
  2485. <if test="sttm != null and sttm != ''">and w.coll_time&lt;= TO_DATE(#{stime},'YYYY-MM-DD')</if>
  2486. <if test="stime != null and stime != ''">and to_char(w.coll_time,'yyyy-MM') &gt;=
  2487. to_char(TO_DATE(#{sttm},'yyyy-MM-dd'),'yyyy-MM')
  2488. </if>
  2489. <if test="orgIds != null and orgIds != ''">
  2490. and substr(w.id,4,3) in (${orgIds})
  2491. </if>
  2492. <if test="adCode != null and adCode != ''">and w.AD_CODE like CONCAT(#{adCode}, '%')</if>
  2493. <if test="type != null and type != ''">and w.obj_type in (${type})</if>
  2494. group by to_char(COLL_TIME,'yyyy-MM')
  2495. ) d on m.monthlist = d.name
  2496. ) c ) f
  2497. </select>
  2498. <select id="countPblmByTime" parameterType="cn.com.goldenwater.dcproj.param.IndexPblmParam" resultType="Integer">
  2499. select count(*) from (
  2500. <trim>
  2501. <include refid="lyzSql"/>
  2502. </trim>
  2503. ) w where 1=1 and w.id is not null
  2504. <if test="sttm != null and sttm != ''">and w.coll_time&gt;= TO_DATE(#{sttm},'YYYY-MM-DD')</if>
  2505. <if test="ettm != null and ettm != ''">and w.coll_time &lt; TO_DATE(#{ettm},'YYYY-MM-DD')+1</if>
  2506. <if test="orgIds != null and orgIds != ''">
  2507. and substr(w.id,4,3) in (${orgIds})
  2508. </if>
  2509. <if test="adCode != null and adCode != ''">and w.AD_CODE like CONCAT(#{adCode}, '%')</if>
  2510. <if test="type != null and type != ''">and w.obj_type in (${type})</if>
  2511. </select>
  2512. <sql id="provinceSql">
  2513. <choose>
  2514. <when test="province !=null and province !=''">
  2515. and o.ad_code =#{province}
  2516. </when>
  2517. <otherwise>
  2518. and o.ad_code is null
  2519. </otherwise>
  2520. </choose>
  2521. </sql>
  2522. <sql id="lyzSql">
  2523. select OB.ADM_DIV AS AD_CODE,t.coll_time AS COLL_TIME,o.ID AS ID,t.obj_type from BIS_INSP_PBLM t
  2524. left join bis_insp_all_obj o
  2525. on t.obj_id = o.obj_id
  2526. left join ATT_RS_BASE OB ON O.CODE = OB.RS_CODE where t.obj_type = 1
  2527. <if test="quote !=null and quote !=''">
  2528. and t.quote=#{quote}
  2529. </if>
  2530. <include refid="provinceSql"/>
  2531. union all
  2532. select o.code AS AD_CODE,t.coll_time AS COLL_TIME,o.ID AS ID,t.obj_type from BIS_INSP_PBLM t
  2533. left join bis_insp_all_obj o
  2534. on t.obj_id = o.obj_id where t.obj_type = 2
  2535. <if test="quote !=null and quote !=''">
  2536. and t.quote=#{quote}
  2537. </if>
  2538. <include refid="provinceSql"/>
  2539. union all
  2540. select OB.LOC_AD AS AD_CODE,t.coll_time AS COLL_TIME,o.ID AS ID,t.obj_type
  2541. from BIS_INSP_PBLM t
  2542. left join bis_insp_all_obj o
  2543. on t.obj_id = o.obj_id
  2544. left join BIS_INSP_WTDST OB ON O.CODE = OB.WTDST_ID where t.obj_type = 3
  2545. <if test="quote !=null and quote !=''">
  2546. and t.quote=#{quote}
  2547. </if>
  2548. <include refid="provinceSql"/>
  2549. union all
  2550. select OB.AD_CODE AS AD_CODE ,t.coll_time AS COLL_TIME,o.ID AS ID ,t.obj_type
  2551. from BIS_INSP_PBLM t
  2552. left join bis_insp_all_obj o
  2553. on t.obj_id = o.obj_id
  2554. left join ATT_EMPWTPRJ_BASE OB ON O.CODE = OB.ID where t.obj_type = 4
  2555. <if test="quote !=null and quote !=''">
  2556. and t.quote=#{quote}
  2557. </if>
  2558. <include refid="provinceSql"/>
  2559. union all
  2560. select OB.ADCD AS AD_CODE,t.coll_time AS COLL_TIME,o.ID AS ID,t.obj_type
  2561. from BIS_INSP_PBLM t
  2562. left join bis_insp_all_obj o
  2563. on t.obj_id = o.obj_id
  2564. left join ATT_GRW_BASE OB ON O.CODE = OB.STCD where t.obj_type = 5
  2565. <if test="quote !=null and quote !=''">
  2566. and t.quote=#{quote}
  2567. </if>
  2568. <include refid="provinceSql"/>
  2569. union all
  2570. select OB.AD_CODE AS AD_CODE,t.coll_time AS COLL_TIME,o.ID AS ID,t.obj_type
  2571. from BIS_INSP_PBLM t
  2572. left join bis_insp_all_obj o
  2573. on t.obj_id = o.obj_id
  2574. left join ATT_WAGA_BASE OB ON O.CODE = OB.OBJ_CODE where t.obj_type = 6
  2575. <if test="quote !=null and quote !=''">
  2576. and t.quote=#{quote}
  2577. </if>
  2578. <include refid="provinceSql"/>
  2579. union all
  2580. select OB.AD_CODE AS AD_CODE,t.coll_time AS COLL_TIME,o.ID AS ID,t.obj_type
  2581. from BIS_INSP_PBLM t
  2582. left join bis_insp_all_obj o
  2583. on t.obj_id = o.obj_id
  2584. left join ATT_EMPWTPRJ_BASE OB ON O.CODE = OB.ID where t.obj_type = 7
  2585. <if test="quote !=null and quote !=''">
  2586. and t.quote=#{quote}
  2587. </if>
  2588. <include refid="provinceSql"/>
  2589. union all
  2590. select OB.AD_CODE AS AD_CODE,t.intm AS COLL_TIME,o.ID AS ID,t.obj_type
  2591. from tac_pblm_info t
  2592. left join bis_insp_all_obj o
  2593. on t.obj_id = o.obj_id
  2594. left join tac_att_pawp_base OB ON O.CODE = OB.ID where t.obj_type = 8
  2595. union all
  2596. select OB.AD_CODE AS AD_CODE,t.coll_time AS COLL_TIME,o.ID AS ID,t.obj_type
  2597. from BIS_INSP_PBLM t
  2598. left join bis_insp_all_obj o
  2599. on t.obj_id = o.obj_id
  2600. left join att_fsc_base OB ON O.CODE = OB.ID where t.obj_type = 9
  2601. <if test="quote !=null and quote !=''">
  2602. and t.quote=#{quote}
  2603. </if>
  2604. <include refid="provinceSql"/>
  2605. union all
  2606. select OB.AD_CODE AS AD_CODE,t.coll_time AS COLL_TIME,o.ID AS ID,t.obj_type
  2607. from BIS_INSP_PBLM t
  2608. left join bis_insp_all_obj o
  2609. on t.obj_id = o.obj_id
  2610. left join att_other_base OB ON O.CODE = OB.ID where t.obj_type = 10
  2611. <if test="quote !=null and quote !=''">
  2612. and t.quote=#{quote}
  2613. </if>
  2614. <include refid="provinceSql"/>
  2615. union all
  2616. select OB.ADM_DIV AS AD_CODE,t.coll_time AS COLL_TIME,o.ID AS ID,t.obj_type
  2617. from BIS_INSP_PBLM t
  2618. left join bis_insp_all_obj o
  2619. on t.obj_id = o.obj_id
  2620. left join ATT_RS_BASE OB ON o.CODE = OB.RS_CODE where t.obj_type = 22
  2621. <if test="quote !=null and quote !=''">
  2622. and t.quote=#{quote}
  2623. </if>
  2624. <include refid="provinceSql"/>
  2625. </sql>
  2626. <select id="findSdPblmList" parameterType="cn.com.goldenwater.dcproj.param.SdPblmParam"
  2627. resultMap="bisInspPblmResultMap">
  2628. select w.* from (
  2629. select ba.sd_name as rs_name,l.entm,l.sttm,j.code,j.nm,j.id as
  2630. oid,j.ptype,r.PERS_NAME,p.*,s.insp_pblms_name,s.check_point,s.attach,s.sheet,s.sn_num,b.ad_full_name,b.ad_code,l.pnm
  2631. as org_nm,j.id as org_id from (
  2632. select * from BIS_INSP_PBLM pb where pb.obj_type=#{pType}
  2633. <if test="ifCasePblm != null and ifCasePblm != ''">and pb.IF_CASE_PBLM = #{ifCasePblm}</if>
  2634. <if test="hasVedio != null and hasVedio != ''">and pb.HAS_VEDIO = #{hasVedio}</if>
  2635. <if test="startTime != null and startTime != ''">
  2636. AND pb.COLL_TIME &gt;= TO_DATE(#{startTime},'YYYY-MM-DD')
  2637. </if>
  2638. <if test="quote !=null and quote !=''">
  2639. and pb.quote=#{quote}
  2640. </if>
  2641. <if test="findTime != null and findTime != ''">and pb.COLL_TIME=TO_DATE(#{findTime},'YYYY-MM-DD')</if>
  2642. <if test="reviConc != null and reviConc != ''">and pb.revi_conc = #{reviConc}</if>
  2643. <if test="inspPblmCate != null and inspPblmCate != ''">and pb.INSP_PBLM_CATE = #{inspPblmCate}</if>
  2644. <if test="endTime != null and endTime != ''">
  2645. AND pb.COLL_TIME &lt; TO_DATE(#{endTime},'YYYY-MM-DD')+1
  2646. </if>
  2647. <if test="inspPblmName != null and inspPblmName != ''">and pb.INSP_PBLM_NAME like '%${inspPblmName}%'</if>
  2648. <if test="objId != null and objId != ''">and pb.obj_Id = #{objId}</if>
  2649. ) p left join (select * from bis_insp_all_obj bj where bj.ptype = #{pType}) j on p.obj_id = j.obj_id
  2650. join BIS_INSP_ALL_RLATION_PERS r on p.rec_pers=r.guid
  2651. left join bis_insp_rect_fdbk k on p.pblm_id=k.pblm_id and k.guid=p.FDBK_ID
  2652. left join BIS_INSP_SD_RGSTR ba on ba.obj_id=j.obj_id
  2653. left join att_ad_x_base b on ba.ad_code=b.ad_code
  2654. left join OBJ_INSP_PBLMS s on p.pblms_type_id=s.guid
  2655. left join BIS_INSP_ALL l on l.id=j.id
  2656. ) w where w.ptype=#{pType}
  2657. <if test="tabType =='2'.toString()">
  2658. and w.entm &lt;to_date(#{nowTime},'yyyy-MM-dd')+1
  2659. </if>
  2660. <if test="tabType =='1'.toString()">
  2661. and w.entm &gt;=to_date(#{nowTime},'yyyy-MM-dd')
  2662. </if>
  2663. and
  2664. REGEXP_LIKE(
  2665. W.OID,'^('||
  2666. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  2667. <include refid="orgIdSql"/>
  2668. )>0 then
  2669. (SELECT LISTAGG(id, '|') as
  2670. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  2671. <include refid="orgIdSql"/> GROUP BY PERSID
  2672. )
  2673. else (select 'non' from dual) end)
  2674. ||')')
  2675. <if test="nm != null and nm != ''">and w.nm like '%${nm}%'</if>
  2676. <if test="orgNm != null and orgNm != ''">and w.org_nm like '%${orgNm}%'</if>
  2677. <if test="sdName != null and sdName != ''">and w.rs_name like '%${sdName}%'</if>
  2678. <if test="adFullName != null and adFullName != ''">and w.ad_full_name like '%${adFullName}%'</if>
  2679. <if test="persName != null and persName != ''">and w.PERS_NAME like '%${persName}%'</if>
  2680. <if test="codes != null and codes != ''">and w.CODE in (${codes})</if>
  2681. <if test="recPers !=null and recPers !=''">
  2682. and w.rec_pers=#{recPers}
  2683. </if>
  2684. <if test="adCodes != null and adCodes != ''">and w.AD_CODE in (${adCodes})</if>
  2685. <if test="orgIds != null and orgIds != ''">and w.org_id in (${orgIds})</if>
  2686. <if test="inspPblmType != null and inspPblmType != ''">and w.INSP_PBLM_TYPE = #{inspPblmType}</if>
  2687. order by w.ad_code asc,w.coll_time desc
  2688. </select>
  2689. <select id="findSdPblmPage" resultType="cn.com.goldenwater.dcproj.dto.PblmRetCount"
  2690. parameterType="cn.com.goldenwater.dcproj.param.CountParam">
  2691. select e.sd_name as rsName,dd.code,e.SD_TYPE as eng_scal from att_sd_base e,(
  2692. select distinct w.code from (
  2693. select j.id as oid,j.ptype,j.code,p.insp_pblm_cate from BIS_INSP_PBLM p
  2694. join (select * from BIS_INSP_ALL_OBJ o where 1=1
  2695. <include refid="choseSql"/>
  2696. ) j on p.obj_id=j.obj_id
  2697. join BIS_INSP_ALL_RLATION_PERS r on p.rec_pers=r.guid
  2698. ) w where w.ptype=#{pType} and
  2699. REGEXP_LIKE(
  2700. W.OID,'^('||
  2701. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  2702. <include refid="orgIdSql"/>
  2703. )>0 then
  2704. (SELECT LISTAGG(id, '|') as
  2705. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  2706. <include refid="orgIdSql"/> GROUP BY PERSID
  2707. )
  2708. else (select 'non' from dual) end)
  2709. ||')') ) dd where e.sd_code=dd.code
  2710. </select>
  2711. <select id="findSwhsPblmPage" resultType="cn.com.goldenwater.dcproj.dto.PblmRetCount"
  2712. parameterType="cn.com.goldenwater.dcproj.param.CountParam">
  2713. select e.swhs_name as rsName,dd.code,e.WAIN_WASO_TYPE as eng_scal from att_swhs_base e,(
  2714. select distinct w.code from (
  2715. select j.id as oid,j.ptype,j.code,p.insp_pblm_cate from BIS_INSP_PBLM p
  2716. join (select * from BIS_INSP_ALL_OBJ o where o.ptype=#{pType}
  2717. <include refid="choseSql"/>
  2718. ) j on p.obj_id=j.obj_id
  2719. join BIS_INSP_ALL_RLATION_PERS r on p.rec_pers=r.guid
  2720. ) w where w.ptype=#{pType} and
  2721. REGEXP_LIKE(
  2722. W.OID,'^('||
  2723. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  2724. <include refid="orgIdSql"/>
  2725. )>0 then
  2726. (SELECT LISTAGG(id, '|') WGROUP BY PERSID as
  2727. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  2728. <include refid="orgIdSql"/> GROUP BY PERSID
  2729. )
  2730. else (select 'non' from dual) end)
  2731. ||')') ) dd where e.swhs_code=dd.code
  2732. </select>
  2733. <select id="findJswaPblmPage" resultType="cn.com.goldenwater.dcproj.dto.PblmRetCount"
  2734. parameterType="cn.com.goldenwater.dcproj.param.CountParam">
  2735. select e.name as rsName,dd.code,'' as eng_scal from ATT_JSKEJIAN_WATER_BASE e,(
  2736. select distinct w.code from (
  2737. select j.id as oid,j.ptype,j.code,p.insp_pblm_cate from BIS_INSP_PBLM p
  2738. join (select * from BIS_INSP_ALL_OBJ o where o.ptype=#{pType}
  2739. <include refid="choseSql"/>
  2740. ) j on p.obj_id=j.obj_id
  2741. join BIS_INSP_ALL_RLATION_PERS r on p.rec_pers=r.guid
  2742. ) w where w.ptype=#{pType} and
  2743. REGEXP_LIKE(
  2744. W.OID,'^('||
  2745. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  2746. <include refid="orgIdSql"/>
  2747. )>0 then
  2748. (SELECT LISTAGG(id, '|') as
  2749. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  2750. <include refid="orgIdSql"/> GROUP BY PERSID
  2751. )
  2752. else (select 'non' from dual) end)
  2753. ||')') ) dd where e.id=dd.code
  2754. </select>
  2755. <select id="findJsflPblmPage" resultType="cn.com.goldenwater.dcproj.dto.PblmRetCount"
  2756. parameterType="cn.com.goldenwater.dcproj.param.CountParam">
  2757. select e.name as rsName,dd.code,'' as eng_scal from ATT_JSKEJIAN_FLKDIS_BASE e,(
  2758. select distinct w.code from (
  2759. select j.id as oid,j.ptype,j.code,p.insp_pblm_cate from BIS_INSP_PBLM p
  2760. join (select * from BIS_INSP_ALL_OBJ o where o.ptype=#{pType}
  2761. <include refid="choseSql"/>
  2762. ) j on p.obj_id=j.obj_id
  2763. join BIS_INSP_ALL_RLATION_PERS r on p.rec_pers=r.guid
  2764. ) w where w.ptype=#{pType} and
  2765. REGEXP_LIKE(
  2766. W.OID,'^('||
  2767. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  2768. <include refid="orgIdSql"/>
  2769. )>0 then
  2770. (SELECT LISTAGG(id, '|') as
  2771. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  2772. <include refid="orgIdSql"/> GROUP BY PERSID
  2773. )
  2774. else (select 'non' from dual) end)
  2775. ||')') ) dd where e.id=dd.code
  2776. </select>
  2777. <select id="findPrdPblmPage" resultType="cn.com.goldenwater.dcproj.dto.PblmRetCount"
  2778. parameterType="cn.com.goldenwater.dcproj.param.CountParam">
  2779. select e.name as rsName,dd.code,'' as eng_scal from ATT_PRD_CSTR_PROJ_BASE e,(
  2780. select distinct w.code from (
  2781. select j.id as oid,j.ptype,j.code,p.insp_pblm_cate from BIS_INSP_PBLM p
  2782. join (select * from BIS_INSP_ALL_OBJ o where o.ptype=#{pType}
  2783. <include refid="choseSql"/>
  2784. ) j on p.obj_id=j.obj_id
  2785. join BIS_INSP_ALL_RLATION_PERS r on p.rec_pers=r.guid
  2786. ) w where w.ptype=#{pType} and
  2787. REGEXP_LIKE(
  2788. W.OID,'^('||
  2789. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  2790. <include refid="orgIdSql"/>
  2791. )>0 then
  2792. (SELECT LISTAGG(id, '|') as
  2793. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  2794. <include refid="orgIdSql"/> GROUP BY PERSID
  2795. )
  2796. else (select 'non' from dual) end)
  2797. ||')') ) dd where e.id=dd.code
  2798. </select>
  2799. <select id="findWiuPblmPage" resultType="cn.com.goldenwater.dcproj.dto.PblmRetCount"
  2800. parameterType="cn.com.goldenwater.dcproj.param.CountParam">
  2801. select e.wiu_name as rsName,dd.code,'' as eng_scal from att_wiu_base e,(
  2802. select distinct w.code from (
  2803. select j.id as oid,j.ptype,j.code,p.insp_pblm_cate from BIS_INSP_PBLM p
  2804. join (select * from BIS_INSP_ALL_OBJ o where o.ptype=#{pType}
  2805. <include refid="choseSql"/>
  2806. ) j on p.obj_id=j.obj_id
  2807. join BIS_INSP_ALL_RLATION_PERS r on p.rec_pers=r.guid
  2808. ) w where w.ptype=#{pType} and
  2809. REGEXP_LIKE(
  2810. W.OID,'^('||
  2811. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  2812. <include refid="orgIdSql"/>
  2813. )>0 then
  2814. (SELECT LISTAGG(id, '|') as
  2815. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  2816. <include refid="orgIdSql"/> GROUP BY PERSID
  2817. )
  2818. else (select 'non' from dual) end)
  2819. ||')') ) dd where e.id=dd.code
  2820. </select>
  2821. <select id="countSd" resultType="cn.com.goldenwater.dcproj.dto.PblmCount" parameterType="java.lang.String">
  2822. select dd.*,b.SD_NAME as rs_name from ATT_SD_BASE b , (
  2823. select a.code,count(a.code) as sub,insp_pblm_cate,count(insp_pblm_cate) as total from (
  2824. select w.* from (
  2825. select j.id as oid,j.ptype,j.code,p.insp_pblm_cate from BIS_INSP_PBLM p
  2826. join (select * from BIS_INSP_ALL_OBJ o where o.ptype=#{pType}
  2827. <include refid="choseSql"/>
  2828. ) j on p.obj_id=j.obj_id
  2829. join BIS_INSP_ALL_RLATION_PERS r on p.rec_pers=r.guid
  2830. ) w where w.ptype=#{pType} and w.code in(${codes})
  2831. <if test="persId !=null and persId !=''">
  2832. and
  2833. REGEXP_LIKE(
  2834. W.OID,'^('||
  2835. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  2836. <include refid="orgIdSql"/>
  2837. )>0 then
  2838. (SELECT LISTAGG(id, '|') as
  2839. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  2840. <include refid="orgIdSql"/> GROUP BY PERSID
  2841. )
  2842. else (select 'non' from dual) end)
  2843. ||')')
  2844. </if>
  2845. ) a where a.insp_pblm_cate is not null group by a.code,a.insp_pblm_cate order by a.code ) dd where
  2846. b.SD_CODE=dd.code
  2847. </select>
  2848. <select id="findPblmList" resultType="cn.com.goldenwater.dcproj.model.BisInspPblm"
  2849. parameterType="cn.com.goldenwater.dcproj.param.PblmParam">
  2850. SELECT DISTINCT W.* FROM (
  2851. SELECT
  2852. J.ID AS OID, J.ID AS ORG_ID,J.CODE, J.NM, J.NM AS RS_NAME, J.PTYPE,
  2853. R.PERS_NAME,
  2854. P.*, NVL(P.INSP_PBLM_NAME,P.PBLM_NAME_BZ) AS INSP_PBLMS_NAME,P.CHECK_POINT_BZ AS CHECK_POINT,
  2855. P.PBLM_DESC_BZ AS PBLM_DESC,
  2856. S.ATTACH,S.SHEET,S.SN_NUM,
  2857. B.AD_FULL_NAME AS LOC,B.AD_FULL_NAME,B.AD_CODE,
  2858. <if test='pType == "78"'>BAU.SEC_ID, BAU.ID AS UNIT_ID, BAU.NM AS UNIT_NM ,</if>
  2859. L.PNM AS ORG_NM
  2860. from (
  2861. select * from BIS_INSP_PBLM pb
  2862. <where>
  2863. <if test="ifCasePblm != null and ifCasePblm != ''">and pb.IF_CASE_PBLM = #{ifCasePblm}</if>
  2864. <if test="hasVedio != null and hasVedio != ''">and pb.HAS_VEDIO = #{hasVedio}</if>
  2865. <if test="startTime != null and startTime != ''">AND pb.COLL_TIME &gt;= TO_DATE(#{startTime},'YYYY-MM-DD')</if>
  2866. <if test="quote !=null and quote !=''">and pb.quote=#{quote}</if>
  2867. <if test="findTime != null and findTime != ''">and pb.COLL_TIME=TO_DATE(#{findTime},'YYYY-MM-DD')</if>
  2868. <if test="reviConc != null and reviConc != ''">and pb.revi_conc = #{reviConc}</if>
  2869. <if test="inspPblmCate != null and inspPblmCate != ''">and pb.INSP_PBLM_CATE = #{inspPblmCate}</if>
  2870. <if test="endTime != null and endTime != ''">AND pb.COLL_TIME &lt; TO_DATE(#{endTime},'YYYY-MM-DD')+1</if>
  2871. <if test="inspPblmName != null and inspPblmName != ''">and pb.INSP_PBLM_NAME like '%${inspPblmName}%'</if>
  2872. <if test="objId != null and objId != ''">and pb.OBJ_ID = #{objId}</if>
  2873. <if test="regid != null and regid != ''">and pb.regid = #{regid}</if>
  2874. <if test="cwsCode != null and cwsCode != ''">and pb.CWS_CODE = #{cwsCode}</if>
  2875. </where>
  2876. ) p
  2877. JOIN (SELECT * FROM BIS_INSP_ALL_OBJ O WHERE O.PTYPE=#{pType}<include refid="choseSql"/>) J ON P.OBJ_ID =
  2878. J.OBJ_ID
  2879. LEFT JOIN BIS_INSP_ALL_RLATION_PERS R ON P.REC_PERS = R.GUID
  2880. <choose>
  2881. <when test='pType == "3"'>
  2882. left join BIS_INSP_WTDST_TRACK ba on ba.obj_id=j.obj_id
  2883. </when>
  2884. <when test='pType == "4"'>
  2885. left join BIS_INSP_KEY_REGISTER ba on ba.obj_id=j.obj_id
  2886. </when>
  2887. <when test='pType == "7"'>
  2888. left join BIS_INSP_KEY_REGISTER ba on ba.obj_id=j.obj_id
  2889. </when>
  2890. <when test='pType == "11"'>
  2891. left join BIS_INSP_SD_RGSTR ba on ba.obj_id=j.obj_id
  2892. </when>
  2893. <when test='pType == "12"'>
  2894. left join bis_insp_wiu_rgstr ba on ba.obj_id=j.obj_id
  2895. </when>
  2896. <when test='pType == "13"'>
  2897. left join bis_insp_swhs_rgstr ba on ba.obj_id=j.obj_id
  2898. </when>
  2899. <when test='pType == "14"'>
  2900. LEFT JOIN BIS_INSP_WINT_RGSTR ba on ba.obj_id = j.obj_id
  2901. </when>
  2902. <when test='pType == "15"'>
  2903. LEFT JOIN BIS_INSP_SVWT_AREA_RGSTR ba on ba.obj_id = j.obj_id
  2904. </when>
  2905. <when test='pType == "16"'>
  2906. LEFT JOIN BIS_INSP_SVWT_WUNT_RGSTR ba on ba.obj_id = j.obj_id
  2907. </when>
  2908. <when test='pType == "17"'>
  2909. LEFT JOIN BIS_INSP_OPRD_CSTR_PROJ_RGSTR ba on ba.obj_id = j.obj_id
  2910. </when>
  2911. <when test='pType == "18"'>
  2912. LEFT JOIN ATT_JSKEJIAN_FLKDIS_RGSTR ba on ba.obj_id = j.obj_id
  2913. </when>
  2914. <when test='pType == "19"'>
  2915. LEFT JOIN ATT_JSKEJIAN_WATER_RGSTR ba on ba.obj_id = j.obj_id
  2916. </when>
  2917. <when test='pType == "20"'>
  2918. LEFT JOIN ATT_JSKEJIAN_ECOFRD_RGSTR ba on ba.obj_id = j.obj_id
  2919. </when>
  2920. <when test='pType == "22"'>
  2921. LEFT JOIN BIS_INSP_RSML_RGSTR ba on ba.obj_id = j.obj_id
  2922. </when>
  2923. <when test='pType == "24"'>
  2924. LEFT JOIN bis_insp_stnd_rgstr ba on ba.obj_id = j.obj_id
  2925. </when>
  2926. <when test='pType == "41"'>
  2927. LEFT JOIN bis_zhejiang_vill_rgstr ba on ba.obj_id = j.obj_id
  2928. </when>
  2929. <when test='pType == "42"'>
  2930. LEFT JOIN BIS_ZHEJIANG_JG_RGSTR ba on ba.obj_id = j.obj_id
  2931. </when>
  2932. <when test='pType == "26"'>
  2933. LEFT JOIN BIS_INSP_RSFCO_RGSTR ba on ba.obj_id = j.obj_id
  2934. </when>
  2935. <when test='pType == "25"'>
  2936. LEFT JOIN BIS_NEW_VILL_RGSTR ba on ba.obj_id = j.obj_id
  2937. </when>
  2938. <when test='pType == "27"'>
  2939. LEFT JOIN BIS_INSP_MFDP_RGSTR ba on ba.obj_id = j.obj_id
  2940. </when>
  2941. <when test='pType == "28"'>
  2942. LEFT JOIN BIS_INSP_IRR_RGSTR ba on ba.obj_id = j.obj_id
  2943. </when>
  2944. <when test='pType == "29"'>
  2945. LEFT JOIN BIS_INSP_WAGA_SAP_RGSTR ba on ba.obj_id = j.obj_id
  2946. </when>
  2947. <when test='pType == "30"'>
  2948. LEFT JOIN (select t.*,'' as ad_code from BIS_INSP_EFP_RGSTR t) ba on ba.obj_id = j.obj_id
  2949. </when>
  2950. <when test='pType == "31"'>
  2951. LEFT JOIN BIS_INSP_WINTU_RGSTR ba on ba.obj_id = j.obj_id
  2952. </when>
  2953. <when test='pType == "32"'>
  2954. LEFT JOIN BIS_INSP_WRM_RGSTR ba on ba.obj_id = j.obj_id
  2955. </when>
  2956. <when test='pType == "33"'>
  2957. LEFT JOIN BIS_INSP_WTUNT_RGSTR ba on ba.obj_id = j.obj_id
  2958. </when>
  2959. <when test='pType == "34"'>
  2960. LEFT JOIN BIS_INSP_rssfdr_RGSTR ba on ba.obj_id = j.obj_id
  2961. </when>
  2962. <when test='pType == "35"'>
  2963. LEFT JOIN BIS_INSP_samrmp_RGSTR ba on ba.obj_id = j.obj_id
  2964. </when>
  2965. <when test='pType == "37"'>
  2966. LEFT JOIN BIS_RDWSP_RGSTR ba on ba.obj_id = j.obj_id
  2967. </when>
  2968. <when test='pType == "53"'>
  2969. LEFT JOIN BIS_INSP_WRWS_RGSTR BA ON BA.OBJ_ID = J.OBJ_ID
  2970. </when>
  2971. <when test='pType == "54"'>
  2972. LEFT JOIN BIS_INSP_WTCRR_RGSTR BA ON BA.OBJ_ID = J.OBJ_ID
  2973. </when>
  2974. <when test='pType == "55"'>
  2975. LEFT JOIN BIS_INSP_WTGT_RGSTR BA ON BA.OBJ_ID = J.OBJ_ID
  2976. </when>
  2977. <when test='pType == "56"'>
  2978. LEFT JOIN BIS_INSP_WRWX_RGSTR BA ON BA.OBJ_ID = J.OBJ_ID
  2979. </when>
  2980. <when test='pType == "57"'>
  2981. LEFT JOIN BIS_INSP_WTGTH_RGSTR BA ON BA.OBJ_ID = J.OBJ_ID
  2982. </when>
  2983. <when test='pType == "62"'>
  2984. LEFT JOIN BIS_INSP_CDEP_RGSTR BA ON BA.OBJ_ID = J.OBJ_ID
  2985. </when>
  2986. <when test='pType == "67"'>
  2987. LEFT JOIN BIS_INSP_BID_RGSTR BA ON BA.OBJ_ID = J.OBJ_ID
  2988. </when>
  2989. <when test='pType == "68"'>
  2990. LEFT JOIN BIS_INSP_RLRW_RGSTR BA ON BA.OBJ_ID = J.OBJ_ID
  2991. </when>
  2992. <when test='pType == "69"'>
  2993. LEFT JOIN BIS_INSP_DRDMP_RGSTR BA ON BA.OBJ_ID = J.OBJ_ID
  2994. </when>
  2995. <when test='pType == "70"'>
  2996. LEFT JOIN BIS_INSP_GROW_RGSTR BA ON BA.OBJ_ID = J.OBJ_ID
  2997. </when>
  2998. <when test='pType == "71"'>
  2999. LEFT JOIN BIS_INSP_VILLQH_RGSTR BA ON BA.OBJ_ID = J.OBJ_ID
  3000. </when>
  3001. <when test='pType == "72"'>LEFT JOIN BIS_INSP_WIUQH_RGSTR BA ON BA.OBJ_ID = J.OBJ_ID</when>
  3002. <when test='pType == "73"'>LEFT JOIN BIS_INSP_HYST_RGSTR BA ON BA.OBJ_ID = J.OBJ_ID</when>
  3003. <when test='pType == "74"'>LEFT JOIN BIS_INSP_SAFETY_RGSTR BA ON BA.OBJ_ID = J.OBJ_ID</when>
  3004. <when test='pType == "75"'>LEFT JOIN BIS_INSP_YNDRDMP_RGSTR BA ON BA.OBJ_ID = J.OBJ_ID</when>
  3005. <when test='pType == "76"'>LEFT JOIN BIS_INSP_DPGM_RGSTR BA ON BA.OBJ_ID = J.OBJ_ID</when>
  3006. <when test='pType == "77"'>LEFT JOIN BIS_INSP_RVGM_RGSTR BA ON BA.OBJ_ID = J.OBJ_ID</when>
  3007. <when test='pType == "78"'>
  3008. LEFT JOIN BIS_INSP_WTPRJ_REGISTER BA ON BA.OBJ_ID = J.OBJ_ID
  3009. LEFT JOIN BIS_INSP_WTPRJ_UNIT BAU ON P.regid = BAU.ID
  3010. </when>
  3011. <when test='pType == "79"'>LEFT JOIN BIS_INSP_VILLGD BA ON BA.OBJ_ID = J.OBJ_ID</when>
  3012. <when test='pType == "80"'>LEFT JOIN BIS_INSP_RSLKBK_RGSTR BA ON BA.OBJ_ID = J.OBJ_ID</when>
  3013. <when test='pType == "81"'>LEFT JOIN BIS_INSP_WAGAJS_BDG BA ON BA.OBJ_ID = J.OBJ_ID</when>
  3014. <when test='pType == "82"'>LEFT JOIN BIS_INSP_WTGOV_RGSTR BA ON BA.OBJ_ID = J.OBJ_ID</when>
  3015. <when test='pType == "83"'>LEFT JOIN BIS_INSP_CHMCLS_RGSTR BA ON BA.OBJ_ID = J.OBJ_ID</when>
  3016. <when test='pType == "84"'>LEFT JOIN BIS_INSP_RSSFGD_RGSTR BA ON BA.OBJ_ID = J.OBJ_ID</when>
  3017. <when test='pType == "89"'>LEFT JOIN BIS_INSP_UNWT_RGSTR BA ON BA.OBJ_ID = J.OBJ_ID</when>
  3018. <when test='pType == "91"'>LEFT JOIN BIS_INSP_PRDQH_RGSTR BA ON BA.OBJ_ID = J.OBJ_ID</when>
  3019. <when test='pType == "93"'>LEFT JOIN BIS_INSP_FLOODQH BA ON BA.OBJ_ID = J.OBJ_ID</when>
  3020. <when test='pType == "94"'>LEFT JOIN BIS_INSP_MFDPQH_RGSTR BA ON BA.OBJ_ID = J.OBJ_ID</when>
  3021. <when test='pType == "95"'>LEFT JOIN BIS_INSP_DSTFLDQH BA ON BA.OBJ_ID = J.OBJ_ID</when>
  3022. <when test='pType == "96"'>LEFT JOIN BIS_INSP_RSFCOQH_RGSTR BA ON BA.OBJ_ID = J.OBJ_ID</when>
  3023. <when test='pType == "97"'>LEFT JOIN BIS_INSP_VILL2021_RGSTR BA ON BA.OBJ_ID = J.OBJ_ID</when>
  3024. <when test='pType == "98"'>LEFT JOIN BIS_INSP_FUND_RGSTR BA ON BA.OBJ_ID = J.OBJ_ID</when>
  3025. <when test='pType == "99"'>LEFT JOIN BIS_INSP_KEYSAFQH_REGISTER BA ON BA.OBJ_ID = J.OBJ_ID</when>
  3026. <when test='pType == "100"'>LEFT JOIN BIS_INSP_KEYCHKQH_REGISTER BA ON BA.OBJ_ID = J.OBJ_ID</when>
  3027. <when test='pType == "101"'>LEFT JOIN BIS_INSP_SVWTQH BA ON BA.OBJ_ID = J.OBJ_ID</when>
  3028. <when test='pType == "104"'>LEFT JOIN BIS_INSP_STSTN BA ON BA.OBJ_ID = J.OBJ_ID</when>
  3029. <when test='pType == "105"'>LEFT JOIN BIS_INSP_QYMTEN BA ON BA.OBJ_ID = J.OBJ_ID</when>
  3030. <when test='pType == "106"'>LEFT JOIN BIS_INSP_RSVRYN_RGSTR BA ON BA.OBJ_ID = J.OBJ_ID</when>
  3031. <when test='pType == "108"'>LEFT JOIN BIS_INSP_XJVILL BA ON BA.OBJ_ID = J.OBJ_ID</when>
  3032. <when test='pType == "110"'>LEFT JOIN BIS_INSP_FJWTENF BA ON BA.OBJ_ID = J.OBJ_ID</when>
  3033. <when test='pType == "112"'>LEFT JOIN BIS_INSP_WIUJS_RGSTR BA ON BA.OBJ_ID = J.OBJ_ID</when>
  3034. <when test='pType == "113"'>LEFT JOIN BIS_INSP_SWHSJS BA ON BA.OBJ_ID = J.OBJ_ID</when>
  3035. <when test='pType == "115"'>LEFT JOIN BIS_INSP_RSVR_SD BA ON BA.OBJ_ID = J.OBJ_ID</when>
  3036. <when test='pType == "116"'>LEFT JOIN BIS_INSP_HYSTP BA ON BA.OBJ_ID = J.OBJ_ID</when>
  3037. <when test='pType == "117"'>LEFT JOIN BIS_INSP_RDWPGD_RGSTR BA ON BA.OBJ_ID = J.OBJ_ID</when>
  3038. <when test='pType == "119"'>LEFT JOIN BIS_INSP_FJQA BA ON BA.OBJ_ID = J.OBJ_ID</when>
  3039. <when test='pType == "120"'>LEFT JOIN BIS_INSP_JSPWIU BA ON BA.OBJ_ID = J.OBJ_ID</when>
  3040. <when test='pType == "126"'>LEFT JOIN BIS_INSP_JSPWIU2024 BA ON BA.OBJ_ID = J.OBJ_ID</when>
  3041. <otherwise>LEFT JOIN BIS_INSP_GNRL_RGSTR BA ON BA.OBJ_ID = J.OBJ_ID</otherwise>
  3042. </choose>
  3043. LEFT JOIN ATT_AD_X_BASE B ON BA.AD_CODE = B.AD_CODE
  3044. LEFT JOIN OBJ_INSP_PBLMS S ON P.PBLMS_TYPE_ID = S.GUID
  3045. LEFT JOIN BIS_INSP_ALL L ON L.ID = J.ID
  3046. where 1=1
  3047. <if test="tabType =='2'.toString()">
  3048. AND L.ENTM &lt; TO_DATE(#{nowTime},'yyyy-MM-dd')+1
  3049. </if>
  3050. <if test="tabType =='1'.toString()">
  3051. AND L.ENTM &gt;= TO_DATE(#{nowTime},'yyyy-MM-dd')
  3052. </if>
  3053. ) w
  3054. WHERE REGEXP_LIKE(
  3055. W.OID,'^('||
  3056. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID = #{persId}
  3057. <include refid="orgIdSql"/>
  3058. <choose>
  3059. <when test="pType.length() == 1">
  3060. and id like concat('00','${pType}%')
  3061. </when>
  3062. <when test="pType.length() == 2">
  3063. and id like concat('0','${pType}%')
  3064. </when>
  3065. <otherwise>
  3066. and id like '${pType}%'
  3067. </otherwise>
  3068. </choose>
  3069. )>0 then
  3070. (SELECT LISTAGG(id, '|') as id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  3071. <include refid="orgIdSql"/>
  3072. <choose>
  3073. <when test="pType.length() == 1">
  3074. and id like concat('00','${pType}%')
  3075. </when>
  3076. <when test="pType.length() == 2">
  3077. and id like concat('0','${pType}%')
  3078. </when>
  3079. <otherwise>
  3080. and id like '${pType}%'
  3081. </otherwise>
  3082. </choose> GROUP BY PERSID
  3083. )
  3084. else (select 'non' from dual) end) ||')')
  3085. <if test="nm != null and nm != ''">and w.nm like '%${nm}%'</if>
  3086. <if test="newVillName != null and newVillName != ''">and w.NEW_VILL_NAME like '%${newVillName}%'</if>
  3087. <if test="orgNm != null and orgNm != ''">and w.org_nm like '%${orgNm}%'</if>
  3088. <if test="adFullName != null and adFullName != ''">and w.ad_full_name like '%${adFullName}%'</if>
  3089. <if test="persName != null and persName != ''">and w.PERS_NAME like '%${persName}%'</if>
  3090. <if test="codes != null and codes != ''">and w.CODE in (${codes})</if>
  3091. <if test="recPers !=null and recPers !=''">and w.rec_pers=#{recPers}</if>
  3092. <if test="adCodes != null and adCodes != ''">and w.AD_CODE in (${adCodes})</if>
  3093. <!-- 福建省 综合展示 lxf -->
  3094. <if test="adCode != null and adCode != ''">and w.AD_CODE like '${adCode}%'</if>
  3095. <if test="orgIds != null and orgIds != ''">and w.org_id in (${orgIds})</if>
  3096. <if test="inspPblmType != null and inspPblmType != ''">and w.INSP_PBLM_TYPE = #{inspPblmType}</if>
  3097. <if test="bplmsTypeId != null and bplmsTypeId != ''">and w.PBLMS_TYPE_ID = #{bplmsTypeId}</if>
  3098. <if test="secId != null and secId != ''">and w.SEC_ID = #{secId}</if>
  3099. <if test="inspPblmsName != null and inspPblmsName != ''">and w.INSP_PBLMS_NAME Like '%${inspPblmsName}%'</if>
  3100. <if test="checkPoint != null and checkPoint != ''">and w.CHECK_POINT_BZ Like '%${checkPoint}%'</if>
  3101. <if test="state != null and state != ''">and w.STATE = #{state}</if>
  3102. order by w.ad_code asc, w.code asc, w.coll_time desc
  3103. </select>
  3104. <select id="countSwhs" resultType="cn.com.goldenwater.dcproj.dto.PblmCount" parameterType="java.lang.String">
  3105. select dd.*,b.SWHS_NAME as rs_name from ATT_SWHS_BASE b , (
  3106. select a.code,count(a.code) as sub,insp_pblm_cate,count(insp_pblm_cate) as total from (
  3107. select w.* from (
  3108. select j.id as oid,j.ptype,j.code,p.insp_pblm_cate from BIS_INSP_PBLM p
  3109. join (select * from BIS_INSP_ALL_OBJ o where o.ptype=#{pType}
  3110. <include refid="choseSql"/>
  3111. ) j on p.obj_id=j.obj_id
  3112. join BIS_INSP_ALL_RLATION_PERS r on p.rec_pers=r.guid
  3113. ) w where w.ptype=#{pType} and w.code in(${codes})
  3114. <if test="persId !=null and persId !=''">
  3115. and
  3116. REGEXP_LIKE(
  3117. W.OID,'^('||
  3118. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  3119. <include refid="orgIdSql"/>
  3120. )>0 then
  3121. (SELECT LISTAGG(id, '|') as
  3122. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  3123. <include refid="orgIdSql"/> GROUP BY PERSID
  3124. )
  3125. else (select 'non' from dual) end)
  3126. ||')')
  3127. </if>
  3128. ) a where a.insp_pblm_cate is not null group by a.code,a.insp_pblm_cate order by a.code ) dd where b.ID=dd.code
  3129. </select>
  3130. <select id="countJsfl" resultType="cn.com.goldenwater.dcproj.dto.PblmCount" parameterType="java.lang.String">
  3131. select dd.*,b.name as rs_name from ATT_JSKEJIAN_FLKDIS_BASE b , (
  3132. select a.code,count(a.code) as sub,insp_pblm_cate,count(insp_pblm_cate) as total from (
  3133. select w.* from (
  3134. select j.id as oid,j.ptype,j.code,p.insp_pblm_cate from BIS_INSP_PBLM p
  3135. join (select * from BIS_INSP_ALL_OBJ o where o.ptype=#{pType}
  3136. <include refid="choseSql"/>
  3137. ) j on p.obj_id=j.obj_id
  3138. join BIS_INSP_ALL_RLATION_PERS r on p.rec_pers=r.guid
  3139. ) w where w.ptype=#{pType} and w.code in(${codes})
  3140. <if test="persId !=null and persId !=''">
  3141. and
  3142. REGEXP_LIKE(
  3143. W.OID,'^('||
  3144. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  3145. <include refid="orgIdSql"/>
  3146. )>0 then
  3147. (SELECT LISTAGG(id, '|') as
  3148. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  3149. <include refid="orgIdSql"/> GROUP BY PERSID
  3150. )
  3151. else (select 'non' from dual) end)
  3152. ||')')
  3153. </if>
  3154. ) a where a.insp_pblm_cate is not null group by a.code,a.insp_pblm_cate order by a.code ) dd where b.ID=dd.code
  3155. </select>
  3156. <select id="countJswa" resultType="cn.com.goldenwater.dcproj.dto.PblmCount" parameterType="java.lang.String">
  3157. select dd.*,b.name as rs_name from ATT_JSKEJIAN_WATER_BASE b , (
  3158. select a.code,count(a.code) as sub,insp_pblm_cate,count(insp_pblm_cate) as total from (
  3159. select w.* from (
  3160. select j.id as oid,j.ptype,j.code,p.insp_pblm_cate from BIS_INSP_PBLM p
  3161. join (select * from BIS_INSP_ALL_OBJ o where o.ptype=#{pType}
  3162. <include refid="choseSql"/>
  3163. ) j on p.obj_id=j.obj_id
  3164. join BIS_INSP_ALL_RLATION_PERS r on p.rec_pers=r.guid
  3165. ) w where w.ptype=#{pType} and w.code in(${codes})
  3166. <if test="persId !=null and persId !=''">
  3167. and
  3168. REGEXP_LIKE(
  3169. W.OID,'^('||
  3170. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  3171. <include refid="orgIdSql"/>
  3172. )>0 then
  3173. (SELECT LISTAGG(id, '|') as
  3174. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  3175. <include refid="orgIdSql"/> GROUP BY PERSID
  3176. )
  3177. else (select 'non' from dual) end)
  3178. ||')')
  3179. </if>
  3180. ) a where a.insp_pblm_cate is not null group by a.code,a.insp_pblm_cate order by a.code ) dd where b.ID=dd.code
  3181. </select>
  3182. <select id="countPrd" resultType="cn.com.goldenwater.dcproj.dto.PblmCount" parameterType="java.lang.String">
  3183. select dd.*,b.name as rs_name from ATT_PRD_CSTR_PROJ_BASE b , (
  3184. select a.code,count(a.code) as sub,insp_pblm_cate,count(insp_pblm_cate) as total from (
  3185. select w.* from (
  3186. select j.id as oid,j.ptype,j.code,p.insp_pblm_cate from BIS_INSP_PBLM p
  3187. join (select * from BIS_INSP_ALL_OBJ o where o.ptype=#{pType}
  3188. <include refid="choseSql"/>
  3189. ) j on p.obj_id=j.obj_id
  3190. join BIS_INSP_ALL_RLATION_PERS r on p.rec_pers=r.guid
  3191. ) w where w.ptype=#{pType} and w.code in(${codes})
  3192. <if test="persId !=null and persId !=''">
  3193. and
  3194. REGEXP_LIKE(
  3195. W.OID,'^('||
  3196. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  3197. <include refid="orgIdSql"/>
  3198. )>0 then
  3199. (SELECT LISTAGG(id, '|') as
  3200. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  3201. <include refid="orgIdSql"/>GROUP BY PERSID
  3202. )
  3203. else (select 'non' from dual) end)
  3204. ||')')
  3205. </if>
  3206. ) a where a.insp_pblm_cate is not null group by a.code,a.insp_pblm_cate order by a.code ) dd where b.ID=dd.code
  3207. </select>
  3208. <select id="countWiu" resultType="cn.com.goldenwater.dcproj.dto.PblmCount" parameterType="java.lang.String">
  3209. select dd.*,b.WIU_NAME as rs_name from ATT_WIU_BASE b , (
  3210. select a.code,count(a.code) as sub,insp_pblm_cate,count(insp_pblm_cate) as total from (
  3211. select w.* from (
  3212. select j.id as oid,j.ptype,j.code,p.insp_pblm_cate from BIS_INSP_PBLM p
  3213. join (select * from BIS_INSP_ALL_OBJ o where o.ptype=#{pType}
  3214. <include refid="choseSql"/>
  3215. ) j on p.obj_id=j.obj_id
  3216. join BIS_INSP_ALL_RLATION_PERS r on p.rec_pers=r.guid
  3217. ) w where w.ptype=#{pType} and w.code in(${codes})
  3218. <if test="persId !=null and persId !=''">
  3219. and
  3220. REGEXP_LIKE(
  3221. W.OID,'^('||
  3222. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  3223. <include refid="orgIdSql"/>
  3224. )>0 then
  3225. (SELECT LISTAGG(id, '|') as
  3226. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  3227. <include refid="orgIdSql"/> GROUP BY PERSID
  3228. )
  3229. else (select 'non' from dual) end)
  3230. ||')')
  3231. </if>
  3232. ) a where a.insp_pblm_cate is not null group by a.code,a.insp_pblm_cate order by a.code ) dd where b.ID=dd.code
  3233. </select>
  3234. <select id="getObjPblmList" parameterType="cn.com.goldenwater.dcproj.param.BisInspPblmParam"
  3235. resultType="cn.com.goldenwater.dcproj.model.BisInspPblm">
  3236. select
  3237. p.*,s.check_point,s.pblm_desc
  3238. from bis_insp_pblm p
  3239. left join OBJ_INSP_PBLMS s on p.pblms_type_id=s.guid
  3240. where obj_type = #{objType}
  3241. <!-- and PBLMS_TYPE_ID in (${pblmsTypeId}) -->
  3242. <if test="objId != null and objId != ''">
  3243. and obj_id = #{objId}
  3244. </if>
  3245. <choose>
  3246. <when test="orgId !=null and orgId !=''">
  3247. AND ORG_ID=#{orgId}
  3248. </when>
  3249. <otherwise>
  3250. AND ORG_ID is null
  3251. </otherwise>
  3252. </choose>
  3253. </select>
  3254. <select id="getPblmList" resultMap="bisInspPblmResultMap"
  3255. parameterType="cn.com.goldenwater.dcproj.model.BisInspPblm">
  3256. select t.*,x.ad_full_name,r.rsvr_nm as rsName,r.RGSTR_ID,p.check_point,p.pblm_desc from BIS_INSP_PBLM t left
  3257. join obj_insp_pblms p on t.pblms_type_id = p.guid
  3258. <if test='objType == "1"'>
  3259. left join Bis_Insp_Rsvr_Rgstr
  3260. </if>
  3261. r on t.regid = r.rgstr_id
  3262. left join att_ad_x_base x on r.ad_code = x.ad_code
  3263. where p.guid is not null and t.obj_type = #{objType}
  3264. and t.regid in (${rgstrId})
  3265. </select>
  3266. <select id="getPblmListByRegId" parameterType="cn.com.goldenwater.dcproj.param.BisInspPblmParam"
  3267. resultType="cn.com.goldenwater.dcproj.model.BisInspPblm">
  3268. select t.*,x.ad_full_name,r.rsvr_nm as rsName,r.RGSTR_ID,p.check_point,p.pblm_desc from BIS_INSP_PBLM t left
  3269. join obj_insp_pblms p on t.pblms_type_id = p.guid
  3270. <if test='objType == "1"'>
  3271. left join Bis_Insp_Rsvr_Rgstr
  3272. </if>
  3273. r on t.regid = r.rgstr_id
  3274. left join att_ad_x_base x on r.ad_code = x.ad_code
  3275. where t.obj_type = #{objType}
  3276. ${regid}
  3277. </select>
  3278. <update id="updatePblmStateByObjId" parameterType="cn.com.goldenwater.dcproj.param.BisInspPblmParam">
  3279. UPDATE BIS_INSP_PBLM t
  3280. set t.state = #{state}
  3281. where t.obj_id = #{objId}
  3282. <if test="objType != null and objType != ''">
  3283. and t.obj_type = #{objType}
  3284. </if>
  3285. </update>
  3286. <update id="updatePblmState" parameterType="cn.com.goldenwater.dcproj.param.BisInspPblmParam">
  3287. UPDATE BIS_INSP_PBLM t set t.state = #{state} where t.obj_id = #{objId} and t.obj_type = #{objType}
  3288. </update>
  3289. <select id="getPblmListByTm" resultType="cn.com.goldenwater.dcproj.dto.BisInspTaskTotal">
  3290. select count(a.pblm_id)pblmSize from bis_insp_pblm A JOIN BIS_INSP_ALL_OBJ B ON A.OBJ_ID=B.OBJ_ID where
  3291. a.obj_type=#{objType} and a.coll_time&gt;=#{stTm} and a.coll_time&lt;#{enTm} and substr(b.code,1,6)=#{adCode}
  3292. </select>
  3293. <select id="getPblmPath" resultType="String">
  3294. select FILE_PATH
  3295. from GW_COM_FILE WHERE BIZ_ID = #{pblmId}
  3296. </select>
  3297. <!-- 批量导入口径查询 -->
  3298. <select id="getPblmListFromImport" parameterType="cn.com.goldenwater.dcproj.param.PblmParam" resultMap="bisInspPblmResultMap">
  3299. SELECT
  3300. t2.ad_full_name,
  3301. t1.PBLM_ID,
  3302. t1.obj_code,
  3303. t1.obj_name,
  3304. t1.check_point_bz,
  3305. t1.INSP_PBLM_TYPE,
  3306. t1.insp_pblm_name,
  3307. t1.INSP_PBLM_DESC,
  3308. t1.PBLM_DESC_BZ,
  3309. t1.INSP_PBLM_CATE,
  3310. t1.IF_CASE_PBLM,
  3311. t3.pers_name,
  3312. t1.coll_time,
  3313. t1.has_vedio
  3314. FROM bis_insp_pblm t1
  3315. LEFT JOIN ATT_AD_X_BASE t2 on t1.obj_ad_code = t2.ad_code
  3316. LEFT JOIN BIS_INSP_ALL_RLATION_PERS t3 ON t1.rec_pers = t3.guid
  3317. LEFT JOIN bis_insp_all_obj t4 ON t1.obj_id = t4.obj_id
  3318. WHERE t1.obj_type = '999'
  3319. <if test="province != null and province != ''">
  3320. <choose>
  3321. <when test="province !=null and province !=''">
  3322. and t1.obj_ad_code like '${province}%'
  3323. </when>
  3324. <otherwise>
  3325. and t1.obj_ad_code is null
  3326. </otherwise>
  3327. </choose>
  3328. </if>
  3329. <if test="adFullName != null and adFullName != '' ">
  3330. AND t2.ad_full_name like '%${adFullName}%'
  3331. </if>
  3332. <if test="objName != null and objName != '' ">
  3333. AND t1.obj_name like '%${objName}%'
  3334. </if>
  3335. <if test="inspPblmName != null and inspPblmName != '' ">
  3336. AND t1.insp_pblm_name like '%${inspPblmName}%'
  3337. </if>
  3338. <if test="recPers != null and recPers != '' ">
  3339. AND t1.rec_pers like '%{recPers}%'
  3340. </if>
  3341. <if test="persName != null and persName != '' ">
  3342. AND t3.pers_name like '%${persName}%'
  3343. </if>
  3344. <if test="startTime != null and startTime != '' ">
  3345. AND t1.coll_time &gt; TO_DATE(#{startTime},'YYYY-MM-DD')
  3346. </if>
  3347. <if test="endTime != null and endTime != '' ">
  3348. AND t1.coll_time &lt; TO_DATE(#{endTime},'YYYY-MM-DD')
  3349. </if>
  3350. </select>
  3351. <!-- 批量导入 -->
  3352. <insert id="insertByList" parameterType="java.util.ArrayList">
  3353. INSERT ALL
  3354. <foreach collection="list" item="item">
  3355. INTO bis_insp_pblm
  3356. (PBLM_ID, OBJ_ID,OBJ_TYPE, OBJ_AD_CODE, INSP_PBLM_NAME, PBLM_NAME_BZ, INSP_PBLM_DESC,
  3357. IF_CASE_PBLM, DATA_STAT, COLL_TIME, REC_PERS, obj_name, CHECK_POINT_BZ,
  3358. PBLM_DESC_BZ, INSP_PBLM_CATE, has_vedio, state )
  3359. VALUES
  3360. (
  3361. #{item.pblmId},#{item.objId},#{item.objType},#{item.objAdCode},#{item.inspPblmName},#{item.pblmNameBz},#{item.inspPblmDesc},
  3362. #{item.ifCasePblm}, 0, #{item.collTime},#{item.recPers},#{item.objName},#{item.checkPointBz},
  3363. #{item.pblmDescBz}, #{item.inspPblmCate},#{item.hasVedio},#{item.state}
  3364. )
  3365. </foreach>
  3366. select * from DUAL
  3367. </insert>
  3368. <delete id="batchDelete" parameterType="java.util.ArrayList">
  3369. delete from bis_insp_pblm where PBLM_ID in
  3370. <foreach collection="list" item="item" open="(" close=")" separator=",">
  3371. #{item.pblmId}
  3372. </foreach>
  3373. </delete>
  3374. <select id="indexTopList" resultMap="bisInspPblmResultMap"
  3375. parameterType="cn.com.goldenwater.dcproj.param.BisInspPblmParam">
  3376. SELECT * FROM (SELECT
  3377. P.*, O.NM, O.OBJ_AD_CODE AS AD_CODE,
  3378. AAB.AD_NAME, AAB.AD_FULL_NAME, A.PNM, T.NAME AS OBJ_TYPE_NAME
  3379. FROM BIS_INSP_PBLM P
  3380. JOIN BIS_INSP_ALL_OBJ O on P.OBJ_ID = O.OBJ_ID
  3381. JOIN (select * FROM ATT_INSP_TYPE where code IN (select INSP_TYPE FROM REL_ORG_INSP_TYPE
  3382. <where>
  3383. <if test="orgId != null and orgId != '' ">
  3384. AND ORG_ID = #{orgId}
  3385. </if>
  3386. </where>
  3387. )) T on P.OBJ_TYPE = T.PTYPE
  3388. LEFT JOIN ATT_AD_BASE AAB on O.OBJ_AD_CODE = AAB.AD_CODE
  3389. LEFT JOIN BIS_INSP_ALL A on A.ID = O.ID
  3390. <where>
  3391. <if test="orgId != null and orgId != '' ">O.ID LIKE '___${orgId}%'</if>
  3392. <if test="objType != null and objType != ''">and P.OBJ_TYPE = #{objType}</if>
  3393. <if test="inspPblmCate != null and inspPblmCate != ''">and P.INSP_PBLM_CATE = #{inspPblmCate}</if>
  3394. <if test="sttm != null and sttm != '' and entm != null and entm != '' ">
  3395. AND P.COLL_TIME &gt;= TO_DATE(#{sttm}, 'YYYY-MM-DD')
  3396. AND P.COLL_TIME &lt; TO_DATE(#{entm}, 'YYYY-MM-DD') + 1
  3397. </if>
  3398. <if test="adCode != null and adCode != ''">and O.OBJ_AD_CODE like '${adCode}%'</if>
  3399. <!-- 福建省 福州市排除 平潭县 把平潭县 归属到 平潭综合实验区-->
  3400. <if test='adCode != null and adCode == "3501" '>AND SUBSTR(O.OBJ_AD_CODE, 0, 6) !='350128'</if>
  3401. <if test='adCode != null and adCode == "3510" '>AND SUBSTR(O.OBJ_AD_CODE, 0, 6) ='350128'</if>
  3402. </where>
  3403. ORDER BY P.COLL_TIME desc
  3404. ) w where ROWNUM &lt;= ${pageSize}
  3405. </select>
  3406. </mapper>