05a87adf3ab91ef22c1058f38ce8608f9755bed5.svn-base 178 KB

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