BisInspPblmDao.xml 182 KB

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