| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="cn.com.goldenwater.dcproj.dao.BriefReportDao">
- <resultMap type="cn.com.goldenwater.dcproj.model.BriefReport" id="brief">
- <result property="adCode" column="AD_CODE"/>
- <result property="adName" column="AD_NAME"/>
- <result property="code" column="CODE"/>
- <result property="pnm" column="PNM"/>
- <result property="num" column="NUM"/>
- </resultMap>
- <select id="getGroupCountByType" resultType="int" parameterType="String">
- select count(*)
- from BIS_INSP_ALL t
- where length(id) = 12 and id like '${type}${orgId}%'
- </select>
- <select id="getGroupCountListByType" resultMap="brief" parameterType="java.util.Map">
- select a.code, b.pnm, a.num
- from (select substr(t.id, 1, 6) as code, count(t.id) as num
- from BIS_INSP_ALL t,bis_insp_all_rlation o
- where t.id=o.id and length(t.id) = 12
- <include refid="ochoseSql"/>
- <if test="type != null and type != ''">
- and t.id like CONCAT(#{type},CONCAT(#{orgId},'%'))
- </if>
- <if test="sttm != null and sttm != '' and entm != null and entm != ''">
- AND ((STTM >= STR_TO_DATE(#{sttm},'%Y-%m-%d') AND ENTM < DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d'), INTERVAL 1 DAY ))
- or( STTM >= STR_TO_DATE(#{sttm},'%Y-%m-%d') and STTM < DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d'),INTERVAL 1 DAY) )
- or( ENTM >= STR_TO_DATE(#{sttm},'%Y-%m-%d') and ENTM < DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d'), INTERVAL 1 DAY) )
- or( STTM <= STR_TO_DATE(#{sttm},'%Y-%m-%d') and ENTM >= STR_TO_DATE(#{entm},'%Y-%m-%d')))
- </if>
- group by substr(t.id, 1, 6)) a
- left join BIS_INSP_ALL b
- on a.code = b.id
- where 1=1
- <if test="orgName != null and orgName != ''">
- and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
- </if>
- <if test="orgId !=null and orgId !=''">
- and b.id like '___${orgId}%'
- </if>
- order by a.code
- </select>
- <select id="getPersCountByType" resultType="int" parameterType="String">
- select count(distinct persid)
- from bis_insp_all_rlation t
- where length(id) = 12 and id like '${type}${orgId}%'
- <include refid="choseSql"/>
- </select>
- <sql id="choseSql">
- <choose>
- <when test="province !=null and province !=''">
- and t.ad_code =#{province}
- </when>
- <otherwise>
- and t.ad_code is null
- </otherwise>
- </choose>
- </sql>
- <select id="getPersCountListByType" resultMap="brief" parameterType="java.util.Map">
- select a.code, b.pnm, a.num
- from (select substr(id, 1, 6) as code, count(distinct persid) as num
- from bis_insp_all_rlation t
- where length(id) = 12
- <include refid="choseSql"/>
- <if test="type != null and type != ''">
- and id like CONCAT(#{type}, '%')
- </if>
- group by substr(id, 1, 6)) a
- left join BIS_INSP_ALL b
- on a.code = b.id
- where 1=1
- <if test="orgName != null and orgName != ''">
- and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
- </if>
- order by a.code
- </select>
- <select id="getProCount" resultType="int" parameterType="String">
- select count(distinct ad_code) as num
- from (select distinct substr(ad_code, 1, 2) as ad_code
- from bis_insp_sel_area
- where length(id) > 3
- union all
- select distinct substr(code, 1, 2) as ad_code
- from bis_insp_all_obj t
- where t.ptype = '2'
- union all
- select distinct substr(b.loc_ad, 1, 2) as ad_code
- from bis_insp_all_obj a
- left join BIS_INSP_WTDST b
- on a.code = b.wtdst_id
- where a.ptype = '3'
- ) t
- where ad_code != '00'
- <include refid="choseSql"/>
- </select>
- <select id="getRectProCount" resultType="int" parameterType="String">
- select count(distinct substr(b.loc_ad, 1, 2)) as num
- from bis_insp_all_obj t
- left join BIS_INSP_WTDST b
- on t.code = b.wtdst_id
- where t.ptype = '3'
- <include refid="choseSql"/>
- </select>
- <select id="getRectProCountList" resultMap="brief">
- select a.code, b.pnm, a.num
- from (select q.id as code, count(distinct q.code) as num
- from (select substr(o.id, 1, 6) as id,
- substr(b.loc_ad, 1, 2) as code,o.ad_code
- from BIS_INSP_WTDST_TRACK t
- left join bis_insp_all_obj o
- on t.obj_id = o.obj_id
- left join BIS_INSP_WTDST b
- on o.code = b.wtdst_id
- where length(o.id) > 3
- <if test="state != null and state != ''">
- AND case when t.state is null then '0' else t.state end = #{state}
- </if>
- ) q where 1=1 <include refid="qchose"/>
- group by q.id) a
- left join BIS_INSP_ALL b
- on a.code = b.id
- where 1=1
- <if test="orgName != null and orgName != ''">
- and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
- </if>
- order by a.code
- </select>
- <select id="getWagaProCountList" resultMap="brief">
- select a.code, b.pnm, a.num
- from (select q.id as code, count(distinct q.code) as num
- from (select substr(o.id, 1, 6) as id,
- substr(b.AD_CODE, 1, 2) as code
- from ATT_WAGA_RGSTR t
- left join bis_insp_all_obj o
- on t.obj_id = o.obj_id
- left join ATT_WAGA_BASE b
- on o.code = b.OBJ_CODE
- where length(o.id) > 3
- <include refid="ochoseSql"/>
- <if test="state != null and state != ''">
- AND case when t.state is null then '0' else t.state end = #{state}
- </if>
- ) q
- group by q.id) a
- left join BIS_INSP_ALL b
- on a.code = b.id
- where 1=1
- <if test="orgName != null and orgName != ''">
- and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
- </if>
- order by a.code
- </select>
- <select id="getEmpwtProCountList" resultMap="brief">
- select a.code, b.pnm, a.num
- from (select q.id as code, count(distinct q.code) as num
- from (select substr(o.id, 1, 6) as id,
- substr(b.AD_CODE, 1, 2) as code
- from BIS_INSP_KEY_REGISTER t
- left join bis_insp_all_obj o
- on t.obj_id = o.obj_id
- left join ATT_EMPWTPRJ_BASE b
- on o.code = b.ID
- where length(o.id) > 3 and b.eng_sta = #{engSta}
- <include refid="ochoseSql"/>
- <if test="state != null and state != ''">
- AND case when t.state is null then '0' else t.state end = #{state}
- </if>
- ) q
- group by q.id) a
- left join BIS_INSP_ALL b
- on a.code = b.id
- where 1=1
- <if test="orgName != null and orgName != ''">
- and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
- </if>
- order by a.code
- </select>
- <select id="getRectCtCountList" resultMap="brief" parameterType="String">
- select a.code, b.pnm, a.num
- from (select q.id as code, count(distinct q.code) as num
- from (select substr(o.id, 1, 6) as id,
- substr(b.loc_ad, 1, 6) as code,o.ad_code
- from BIS_INSP_WTDST_TRACK t
- left join bis_insp_all_obj o
- on t.obj_id = o.obj_id
- left join BIS_INSP_WTDST b
- on o.code = b.wtdst_id
- where length(o.id) > 3
- <if test="state != null and state != ''">
- AND case when t.state is null then '0' else t.state end = #{state}
- </if>
- ) q where 1=1 <include refid="qchose"/>
- group by q.id) a
- left join BIS_INSP_ALL b
- on a.code = b.id
- where 1=1
- <if test="orgName != null and orgName != ''">
- and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
- </if>
- order by a.code
- </select>
- <select id="getRectCountList" resultMap="brief" parameterType="String">
- select a.code, b.pnm, a.num
- from (select q.id as code, count(q.code) as num
- from (select substr(o.id, 1, 6) as id,
- substr(b.loc_ad, 1, 6) as code,o.ad_code
- from BIS_INSP_WTDST_TRACK t
- left join bis_insp_all_obj o
- on t.obj_id = o.obj_id
- left join BIS_INSP_WTDST b
- on o.code = b.wtdst_id
- where length(o.id) > 3
- <if test="sttm != null and sttm != '' and entm != null and entm != ''">
- AND t.INTM >= str_to_date(#{sttm},'%Y-%m-%d') AND t.INTM < DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d') , INTERVAL 1 DAY)
- </if>
- <if test="state != null and state != ''">
- AND case when t.state is null then '0' else t.state end = #{state}
- </if>
- ) q where 1=1 <include refid="qchose"/>
- group by q.id) a
- left join BIS_INSP_ALL b
- on a.code = b.id
- where 1=1
- <if test="orgName != null and orgName != ''">
- and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
- </if>
- order by a.code
- </select>
- <select id="getRsvrProCount" resultType="int" parameterType="String">
- select count(distinct substr(ad_code, 1, 2)) as num
- from bis_insp_sel_area
- where length(id) > 3
- <choose>
- <when test="province !=null and province !=''">
- and ad_code like '${province}%'
- </when>
- </choose>
- </select>
- <select id="getRsvrProCountList" resultMap="brief" parameterType="String">
- select a.code, b.pnm, a.num
- from (select t.id as code, count(distinct t.code) as num
- from (select substr(o.id, 1, 6) as id,
- substr(t.ad_code, 1, 2) as code,o.ad_code
- from BIS_INSP_RSVR_RGSTR t
- left join bis_insp_all_obj o
- on t.obj_id = o.obj_id
- where
- o.id not like '001016%'
- and o.id not like '001017%'
- <include refid="ochoseSql"/>
- and length(o.id) > 3
- <if test="state != null and state != ''">
- AND case when t.state is null then '0' else t.state end = #{state}
- </if>
- ) t
- group by t.id) a
- left join BIS_INSP_ALL b
- on a.code = b.id
- where 1=1
- <if test="orgName != null and orgName != ''">
- and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
- </if>
- order by a.code
- </select>
- <select id="getRsvrCtCountList" resultMap="brief" parameterType="String">
- select a.code, b.pnm, a.num
- from (select t.id as code, count(distinct t.code) as num
- from (select substr(o.id, 1, 6) as id,
- substr(t.ad_code, 1, 6) as code,o.ad_code
- from BIS_INSP_RSVR_RGSTR t
- left join bis_insp_all_obj o
- on t.obj_id = o.obj_id
- where
- o.id not like '001016%'
- and o.id not like '001017%'
- and length(o.id) > 3
- <include refid="ochoseSql"/>
- <if test="state != null and state != ''">
- AND case when t.state is null then '0' else t.state end = #{state}
- </if>
- ) t
- group by t.id) a
- left join BIS_INSP_ALL b
- on a.code = b.id
- where 1=1
- <if test="orgName != null and orgName != ''">
- and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
- </if>
- order by a.code
- </select>
- <select id="getWagaCtCountList" resultMap="brief" parameterType="String">
- select a.code, b.pnm, a.num
- from (select q.id as code, count(distinct q.code) as num
- from (select substr(o.id, 1, 6) as id,
- substr(t.ad_code, 1, 6) as code
- from ATT_WAGA_RGSTR t
- left join bis_insp_all_obj o
- on t.obj_id = o.obj_id
- where length(o.id) > 3
- <include refid="ochoseSql"/>
- <if test="state != null and state != ''">
- AND case when t.state is null then '0' else t.state end = #{state}
- </if>
- ) q
- group by q.id) a
- left join BIS_INSP_ALL b
- on a.code = b.id
- where 1=1
- <if test="orgName != null and orgName != ''">
- and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
- </if>
- order by a.code
- </select>
- <select id="getEmpwtCtCountList" resultMap="brief" parameterType="String">
- select a.code, b.pnm, a.num
- from (select q.id as code, count(distinct q.code) as num
- from (select substr(o.id, 1, 6) as id,
- substr(t.ad_code, 1, 6) as code
- from BIS_INSP_KEY_REGISTER t
- left join bis_insp_all_obj o
- on t.obj_id = o.obj_id
- where length(o.id) > 3 and t.eng_sta = #{engSta}
- <include refid="ochoseSql"/>
- <if test="state != null and state != ''">
- AND case when t.state is null then '0' else t.state end = #{state}
- </if>
- ) q
- group by q.id) a
- left join BIS_INSP_ALL b
- on a.code = b.id
- where 1=1
- <if test="orgName != null and orgName != ''">
- and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
- </if>
- order by a.code
- </select>
- <select id="getRsvrCountByType" resultType="int" parameterType="String">
- select count(*)
- from bis_insp_all_obj t
- left join att_rs_base b
- on t.code = b.rs_code
- where t.id not like '001016%'
- and t.id not like '001017%'
- and length(t.id) > 3
- and t.ptype = '1'
- <if test="eng_scal != null and eng_scal != ''">
- and b.eng_scal = #{eng_scal}
- </if>
- <include refid="choseSql"/>
- </select>
- <select id="getRsvrCountListByType" resultMap="brief" parameterType="String">
- select a.code, b.pnm, a.num
- from (select q.id as code, count(q.code) as num
- from (select substr(o.id, 1, 6) as id,
- substr(t.ad_code, 1, 6) as code,o.ad_code
- from BIS_INSP_RSVR_RGSTR t
- left join bis_insp_all_obj o
- on t.obj_id = o.obj_id
- where
- length(o.id) > 3
- <include refid="choseSql"/>
- <if test="state != null and state != ''">
- AND case when t.state is null then '0' else t.state end = #{state}
- </if>
- <if test="eng_scal != null and eng_scal != ''">
- and t.eng_scal = #{eng_scal}
- </if>
- <if test="sttm != null and sttm != '' and entm != null and entm != ''">
- AND t.INTM >= str_to_date(#{sttm},'%Y-%m-%d') AND t.INTM < DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d') , INTERVAL 1 DAY)
- </if>
- ) q
- where 1=1 <include refid="qchose"/>
- group by q.id) a
- left join BIS_INSP_ALL b
- on a.code = b.id
- where 1=1
- <if test="orgName != null and orgName != ''">
- and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
- </if>
- order by a.code
- </select>
- <sql id="qchose">
- <choose>
- <when test="province !=null and province !=''">
- and q.ad_code =#{province}
- </when>
- <otherwise>
- and q.ad_code is null
- </otherwise>
- </choose>
- </sql>
- <select id="getWagaCountListByType" resultMap="brief" parameterType="String">
- select a.code, b.pnm, a.num
- from (select q.id as code, count(q.code) as num
- from (select substr(o.id, 1, 6) as id,
- substr(t.ad_code, 1, 6) as code
- from ATT_WAGA_RGSTR t
- left join bis_insp_all_obj o
- on t.obj_id = o.obj_id
- where length(o.id) > 3
- <include refid="ochoseSql"/>
- <if test="engScal != null and engScal != ''">
- and t.eng_scal = #{engScal}
- </if>
- <if test='engScal == null'>
- and t.eng_scal IS NULL
- </if>
- <if test="sttm != null and sttm != '' and entm != null and entm != ''">
- AND t.INTM >= str_to_date(#{sttm},'%Y-%m-%d') AND t.INTM < DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d') , INTERVAL 1 DAY)
- </if>
- <if test="state != null and state != ''">
- AND case when t.state is null then '0' else t.state end = #{state}
- </if>
- ) q
- group by q.id) a
- left join BIS_INSP_ALL b
- on a.code = b.id
- where 1=1
- <if test="orgName != null and orgName != ''">
- and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
- </if>
- order by a.code
- </select>
- <select id="getEmpwtCountListByType" resultMap="brief" parameterType="String">
- select a.code, b.pnm, a.num
- from (select q.id as code, count(q.code) as num
- from (select substr(o.id, 1, 6) as id,
- substr(t.ad_code, 1, 6) as code
- from BIS_INSP_KEY_REGISTER t
- left join bis_insp_all_obj o
- on t.obj_id = o.obj_id
- where length(o.id) > 3
- and t.eng_sta = #{engSta}
- <include refid="ochoseSql"/>
- <if test="sttm != null and sttm != '' and entm != null and entm != ''">
- AND t.INTM >= str_to_date(#{sttm},'%Y-%m-%d') AND t.INTM < DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d') , INTERVAL 1 DAY)
- </if>
- <if test="state != null and state != ''">
- AND case when t.state is null then '0' else t.state end = #{state}
- </if>
- ) q
- group by q.id) a
- left join BIS_INSP_ALL b
- on a.code = b.id
- where 1=1
- <if test="orgName != null and orgName != ''">
- and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
- </if>
- order by a.code
- </select>
- <select id="getVillProCount" resultType="int" parameterType="String">
- select count(distinct substr(code, 1, 2)) as num
- from bis_insp_all_obj t
- where t.ptype = '2'
- <include refid="choseSql"/>
- </select>
- <select id="getVillProCountList" resultMap="brief" parameterType="String">
- select b.code, c.pnm, b.num
- from (select a.id as code, count(distinct a.code) as num
- from (select substr(id, 1, 6) as id, substr(code, 1, 2) as code
- from bis_insp_all_obj t
- where t.ptype = '2'
- <include refid="choseSql"/>
- and t.id not like '002%') a
- group by a.id) b
- left join BIS_INSP_ALL c
- on b.code = c.id
- where 1=1
- <if test="orgName != null and orgName != ''">
- and c.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
- </if>
- order by b.code
- </select>
- <select id="getVillCtCount" resultType="int" parameterType="String">
- select count(distinct substr(code, 1, 6)) as num
- from bis_insp_all_obj t
- where t.ptype = '2'
- <include refid="choseSql"/>
- </select>
- <select id="getVillCtCountList" resultMap="brief" parameterType="String">
- select b.code, c.pnm, b.num
- from (select a.id as code, count(distinct a.code) as num
- from (select substr(id, 1, 6) as id, substr(code, 1, 6) as code
- from bis_insp_all_obj t
- where t.ptype = '2'
- <include refid="choseSql"/>
- and t.id not like '002011%') a
- group by a.id) b
- left join BIS_INSP_ALL c
- on b.code = c.id
- where 1=1
- <if test="orgName != null and orgName != ''">
- and c.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
- </if>
- order by b.code
- </select>
- <select id="getVillVillCount" resultType="int" parameterType="String">
- select count(distinct t.village_code) as num
- from BIS_INSP_SECSURVEY_VLG t
- where 1=1
- <choose>
- <when test="province !=null and province !=''">
- and t.village_code like '${province}%'
- </when>
- </choose>
- </select>
- <select id="getVillVillCountList" resultMap="brief" parameterType="String">
- select q.code, w.pnm, q.num
- from (select substr(t.id, 1, 6) as code,
- count( t.village_code) as num
- from (select t.village_code, o.id, o.nm, o.code,o.ad_code
- from BIS_INSP_SECSURVEY_VLG t
- join BIS_INSP_VILL_RGSTR r
- on t.eng_id = r.eng_id
- join bis_insp_all_obj o
- on r.obj_id = o.obj_id
- WHERE 1 = 1
- <include refid="ochoseSql"/>
- <if test="sttm != null and sttm != '' and entm != null and entm != ''">
- AND t.CREATE_TIME >= str_to_date(#{sttm},'%Y-%m-%d') AND t.CREATE_TIME < DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d') , INTERVAL 1 DAY)
- </if>
- <if test="state != null and state != ''">
- AND case when r.state is null then '0' ELSE r.state end = #{state}
- </if>
- ) t where 1=1
- group by substr(t.id, 1, 6)) q
- left join BIS_INSP_ALL w
- on q.code = w.id
- where 1=1
- <if test="orgName != null and orgName != ''">
- and w.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
- </if>
- order by q.code
- </select>
- <select id="getVillPersCount" resultType="int" parameterType="String">
- select count(*)
- from BIS_INSP_WATERUSER_INFO a
- where 1=1
- <choose>
- <when test="province !=null and province !=''">
- and a.village_code like '${province}%'
- </when>
- </choose>
- </select>
- <select id="getVillPersCountList" resultMap="brief" parameterType="String">
- select q.code, w.pnm, q.num
- from (select substr(t.id, 1, 6) as code,
- count(t.village_code) as num
- from (select t.village_code, o.id, o.nm, o.code,o.ad_code
- from BIS_INSP_WATERUSER_INFO t
- join BIS_INSP_VILL_RGSTR r
- on t.eng_id = r.eng_id
- join bis_insp_all_obj o
- on r.obj_id = o.obj_id
- WHERE 1 = 1
- <include refid="ochoseSql"/>
- <if test="sttm != null and sttm != '' and entm != null and entm != ''">
- AND t.CREATE_TIME >= str_to_date(#{sttm},'%Y-%m-%d') AND t.CREATE_TIME < DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d') , INTERVAL 1 DAY)
- </if>
- <if test="state != null and state != ''">
- AND case when r.state is null then '0' ELSE r.state end = #{state}
- </if>
- ) t where 1=1
- group by substr(t.id, 1, 6)) q
- left join BIS_INSP_ALL w
- on q.code = w.id
- where 1=1
- <if test="orgName != null and orgName != ''">
- and w.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
- </if>
- order by q.code
- </select>
- <select id="getVillCwsCountList" resultMap="brief" parameterType="String">
- select q.code, w.pnm, q.num
- from (select substr(t.id, 1, 6) as code,
- count(t.CWS_CODE) as num
- from (select t.CWS_CODE, o.id, o.nm, o.code,o.ad_code
- from BIS_INSP_VLGDRINK_PROJ_MANAGE t
- join BIS_INSP_VILL_RGSTR r
- on t.eng_id = r.eng_id
- join bis_insp_all_obj o
- on r.obj_id = o.obj_id
- WHERE 1 = 1
- <include refid="ochoseSql"/>
- <if test="sttm != null and sttm != '' and entm != null and entm != ''">
- AND t.CREATE_TIME >= str_to_date(#{sttm},'%Y-%m-%d') AND t.CREATE_TIME < DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d') , INTERVAL 1 DAY)
- </if>
- <if test="state != null and state != ''">
- AND case when r.state is null then '0' ELSE r.state end = #{state}
- </if>
- ) t where 1=1
- group by substr(t.id, 1, 6)) q
- left join BIS_INSP_ALL w
- on q.code = w.id
- where 1=1
- <if test="orgName != null and orgName != ''">
- and w.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
- </if>
- order by q.code
- </select>
- <select id="getVillWaterCountList" resultMap="brief">
- select q.code, w.pnm, q.num
- from (select substr(t.id, 1, 6) as code,
- count(t.WATER_SOURCE_NM) as num
- from (select t.WATER_SOURCE_NM, o.id, o.nm, o.code,o.ad_code
- from BIS_INSP_PRO_SOURCE_PROTECT t
- join BIS_INSP_VILL_RGSTR r
- on t.eng_id = r.eng_id
- join bis_insp_all_obj o
- on r.obj_id = o.obj_id
- WHERE 1 = 1
- <include refid="ochoseSql"/>
- <if test="sttm != null and sttm != '' and entm != null and entm != ''">
- AND t.CREATE_TIME >= str_to_date(#{sttm},'%Y-%m-%d') AND t.CREATE_TIME < DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d') , INTERVAL 1 DAY)
- </if>
- <if test="state != null and state != ''">
- AND case when r.state is null then '0' ELSE r.state end = #{state}
- </if>
- ) t where 1=1
- group by substr(t.id, 1, 6)) q
- left join BIS_INSP_ALL w
- on q.code = w.id
- where 1=1
- <if test="orgName != null and orgName != ''">
- and w.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
- </if>
- order by q.code
- </select>
- <select id="getPblmCountList" resultMap="brief" parameterType="java.util.Map">
- select a.code, b.pnm, a.num
- from (select t.code, count(t.pblm_id) as num
- from (select substr(o.id, 1, 6) as code, t.pblm_id,o.ad_code
- from BIS_INSP_PBLM t
- join bis_insp_all_obj o
- on t.obj_id = o.obj_id
- left join
- <if test='objType == "1" or objType=="36"'>
- BIS_INSP_RSVR_RGSTR
- </if>
- <if test='objType == "2"'>
- BIS_INSP_VILL_RGSTR
- </if>
- <if test='objType == "3"'>
- BIS_INSP_WTDST_TRACK
- </if>
- <if test='objType == "4"'>
- BIS_INSP_KEY_REGISTER
- </if>
- <if test='objType == "6"'>
- ATT_WAGA_RGSTR
- </if>
- <if test='objType == "7"'>
- BIS_INSP_KEY_REGISTER
- </if>
- B ON t.OBJ_ID = B.OBJ_ID
- where 1=1
- <include refid="ochoseSql"/>
- <if test="sttm != null and sttm != ''">
- and t.coll_time >= str_to_date(#{sttm}, '%Y-%m-%d')
- </if>
- <if test="entm != null and entm != ''">
- and t.coll_time < DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d') , INTERVAL 1 DAY)
- </if>
- <if test="cate != null and cate != ''">
- and t.insp_pblm_cate = #{cate}
- </if>
- <if test="objType != null and objType != ''">
- and t.obj_type = #{objType}
- </if>
- <if test="stat != null and stat != ''">
- and t.PBLM_STAT = #{stat}
- </if>
- <if test="state != null and state != ''">
- AND case when B.state is null then '0' else B.state end = #{state}
- </if>
- ) t
- group by t.code) a
- left join BIS_INSP_ALL b
- on a.code = b.id
- where a.code is not null
- <if test="orgName != null and orgName != ''">
- and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
- </if>
- order by a.code
- </select>
- <select id="getPblmCount" resultType="int" parameterType="java.util.Map">
- select count(*)
- from BIS_INSP_PBLM t,BIS_INSP_ALL_OBJ o
- where t.OBJ_ID=o.OBJ_ID
- <if test="sttm != null and sttm != ''">
- and t.coll_time >= str_to_date(#{sttm}, '%Y-%m-%d')
- </if>
- <if test="entm != null and entm != ''">
- and t.coll_time < DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d') , INTERVAL 1 DAY)
- </if>
- <if test="cate != null and cate != ''">
- and t.insp_pblm_cate = #{cate}
- </if>
- <if test="objType != null and objType != ''">
- and t.obj_type = #{objType}
- </if>
- <if test="stat != null and stat != ''">
- and t.PBLM_STAT = #{stat}
- </if>
- <include refid="ochoseSql"/>
- </select>
- <sql id="ochoseSql">
- <choose>
- <when test="province !=null and province !=''">
- and o.ad_code =#{province}
- </when>
- <otherwise>
- and o.ad_code is null
- </otherwise>
- </choose>
- </sql>
- <select id="getPblmList" resultType="java.util.Map" parameterType="java.util.Map">
- select c.ad_full_name, t.pblm_id,t.obj_id,t.obj_type,t.insp_pblm_code,t.insp_pblm_name,t.insp_pblm_desc,t.if_case_pblm,t.insp_pblm_cate,t.pblm_stat,t.data_stat,DATE_FORMAT(t.coll_time,'%Y-%m-%d %H') as coll_time,t.rec_pers,t.note,t.regid,t.pblms_id,t.pblms_type_id,t.vill_type,t.cws_code,t.village_code,cast(d.file_path as char) as file_path
- from BIS_INSP_PBLM t
- join BIS_INSP_ALL_OBJ o
- on t.OBJ_ID=o.OBJ_ID
- left join att_ad_x_base c
- on t.village_code = c.ad_code
- LEFT JOIN (SELECT BIZ_ID, GROUP_CONCAT(FILE_PATH) AS file_path
- FROM gw_com_file
- GROUP BY BIZ_ID) d
- on t.pblm_id = d.biz_id
- where 1=1
- <if test="sttm != null and sttm != ''">
- and t.coll_time >= str_to_date(#{sttm}, '%Y-%m-%d')
- </if>
- <if test="entm != null and entm != ''">
- and t.coll_time < DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d') , INTERVAL 1 DAY)
- </if>
- <if test="cate != null and cate != ''">
- and t.insp_pblm_cate = #{cate}
- </if>
- <if test="objType != null and objType != ''">
- and t.obj_type = #{objType}
- </if>
- <if test="stat != null and stat != ''">
- and t.PBLM_STAT = #{stat}
- </if>
- <if test="ifCase != null and ifCase != ''">
- and t.IF_CASE_PBLM = #{ifCase}
- </if>
- <if test="villType != null and villType != ''">
- and t.vill_type = #{villType}
- </if>
- <include refid="ochoseSql"/>
- </select>
- <!--省加单位-组-->
- <select id="getOrgProGroupList" resultMap="brief" parameterType="String">
- SELECT CONCAT(H.AD_CODE, '${zero}') AS AD_CODE,
- G.AD_NAME,
- H.ID AS CODE,
- E.PNM,
- H.NUM
- FROM (SELECT SUBSTR(F.AD_CODE, 1, ${length}) AS AD_CODE,
- SUBSTR(F.ID, 1, 6) AS ID,
- COUNT(DISTINCT F.ID) AS NUM
- FROM (SELECT J.ID,J.PNM,
- A.PTYPE,A.AD_CODE as province,
- <if test='type == "001" or type=="036"'>
- OB.ADM_DIV AS AD_CODE
- FROM BIS_INSP_ALL J
- LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
- left join ATT_RS_BASE OB ON A.CODE = OB.RS_CODE
- </if>
- <if test='type == "002"'>
- A.CODE AS AD_CODE
- FROM BIS_INSP_ALL J
- LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
- </if>
- <if test='type == "003"'>
- OB.LOC_AD AS AD_CODE
- FROM BIS_INSP_ALL J
- LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
- left join BIS_INSP_WTDST OB ON A.CODE = OB.WTDST_ID
- </if>
- <if test='type == "004"'>
- OB.AD_CODE AS AD_CODE
- FROM BIS_INSP_ALL J
- LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
- left join ATT_EMPWTPRJ_BASE OB ON A.CODE = OB.ID
- </if>
- <if test='type == "005"'>
- OB.ADCD AS AD_CODE
- FROM BIS_INSP_ALL J
- LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
- left join ATT_GRW_BASE OB ON A.CODE = OB.STCD
- </if>
- <if test='type == "006"'>
- OB.AD_CODE AS AD_CODE
- FROM BIS_INSP_ALL J
- LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
- left join ATT_WAGA_BASE OB ON A.CODE = OB.OBJ_CODE
- </if>
- <if test='type == "007"'>
- OB.AD_CODE AS AD_CODE
- FROM BIS_INSP_ALL J
- LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
- left join ATT_EMPWTPRJ_BASE OB ON A.CODE = OB.ID
- </if>
- <if test='type == "009"'>
- r.AD_CODE AS AD_CODE
- FROM BIS_INSP_ALL J
- LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
- LEFT JOIN BIS_INSP_FSC_RGSTR r ON r.OBJ_ID = A.OBJ_ID
- </if>
- <if test='type == "010"'>
- r.AD_CODE AS AD_CODE
- FROM BIS_INSP_ALL J
- LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
- LEFT JOIN BIS_INSP_OTHER_RGSTR r ON r.OBJ_ID = A.OBJ_ID
- </if>
- <if test='type == "011"'>
- r.AD_CODE AS AD_CODE
- FROM BIS_INSP_ALL J
- LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
- LEFT JOIN BIS_INSP_SD_RGSTR r ON r.OBJ_ID = A.OBJ_ID
- </if>
- <if test='type == "012"'>
- r.AD_CODE AS AD_CODE
- FROM BIS_INSP_ALL J
- LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
- LEFT JOIN BIS_INSP_WIU_RGSTR r ON r.OBJ_ID = A.OBJ_ID
- </if>
- <if test='type == "013"'>
- r.AD_CODE AS AD_CODE
- FROM BIS_INSP_ALL J
- LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
- LEFT JOIN BIS_INSP_SWHS_RGSTR r ON r.OBJ_ID = A.OBJ_ID
- </if>
- <if test='type == "014"'>
- r.AD_CODE AS AD_CODE
- FROM BIS_INSP_ALL J
- LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
- LEFT JOIN BIS_INSP_WINT_RGSTR r ON r.OBJ_ID = A.OBJ_ID
- </if>
- <if test='type == "015"'>
- r.AD_CODE AS AD_CODE
- FROM BIS_INSP_ALL J
- LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
- LEFT JOIN BIS_INSP_SVWT_AREA_RGSTR r ON r.OBJ_ID = A.OBJ_ID
- </if>
- <if test='type == "016"'>
- r.AD_CODE AS AD_CODE
- FROM BIS_INSP_ALL J
- LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
- LEFT JOIN BIS_INSP_SVWT_WUNT_RGSTR r ON r.OBJ_ID = A.OBJ_ID
- </if>
- WHERE LENGTH(J.ID) = 12
- <if test="type != null and type != ''">
- AND J.ID LIKE CONCAT(#{type}, '%')
- </if>
- <if test="sttm != null and sttm != '' and entm != null and entm != ''">
- AND J.STTM >= str_to_date(#{sttm},'%Y-%m-%d') AND J.ENTM < DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d') , INTERVAL 1 DAY)
- </if>
- ) F where 1=1
- <include refid="fchose"/>
- GROUP BY SUBSTR(F.AD_CODE, 1, ${length}), SUBSTR(F.ID, 1, 6)) H
- LEFT JOIN BIS_INSP_ALL E
- ON H.ID = E.ID
- LEFT JOIN ATT_AD_X_BASE G
- ON CONCAT(H.AD_CODE, '${zero}') = G.AD_CODE
- where 1=1
- <if test="orgName != null and orgName != ''">
- and E.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
- </if>
- <if test="adName != null and adName != ''">
- and G.ad_name like CONCAT('%',CONCAT(#{adName}, '%'))
- </if>
- ORDER BY H.AD_CODE, H.ID
- </select>
- <!--省加单位-人-->
- <select id="getOrgProPersList" resultMap="brief" parameterType="String">
- SELECT CONCAT(H.AD_CODE, '${zero}') AS AD_CODE,
- G.AD_NAME,
- H.ID AS CODE,
- E.PNM,
- H.NUM
- FROM (SELECT SUBSTR(F.AD_CODE, 1, ${length}) AS AD_CODE,
- SUBSTR(F.ID, 1, 6) AS ID,
- COUNT(DISTINCT F.PERSID) AS NUM
- FROM (SELECT J.ID,
- A.PTYPE,J.PERSID,A.AD_CODE as province,
- <if test='type == "001" or type="036"'>
- OB.ADM_DIV AS AD_CODE
- FROM BIS_INSP_ALL_RLATION J
- LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
- left join ATT_RS_BASE OB ON A.CODE = OB.RS_CODE
- </if>
- <if test='type == "002"'>
- A.CODE AS AD_CODE
- FROM BIS_INSP_ALL_RLATION J
- LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
- </if>
- <if test='type == "003"'>
- OB.LOC_AD AS AD_CODE
- FROM BIS_INSP_ALL_RLATION J
- LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
- left join BIS_INSP_WTDST OB ON A.CODE = OB.WTDST_ID
- </if>
- <if test='type == "004"'>
- OB.AD_CODE AS AD_CODE
- FROM BIS_INSP_ALL_RLATION J
- LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
- left join ATT_EMPWTPRJ_BASE OB ON A.CODE = OB.ID
- </if>
- <if test='type == "005"'>
- OB.ADCD AS AD_CODE
- FROM BIS_INSP_ALL_RLATION J
- LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
- left join ATT_GRW_BASE OB ON A.CODE = OB.STCD
- </if>
- <if test='type == "006"'>
- OB.AD_CODE AS AD_CODE
- FROM BIS_INSP_ALL_RLATION J
- LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
- left join ATT_WAGA_BASE OB ON A.CODE = OB.OBJ_CODE
- </if>
- <if test='type == "007"'>
- OB.AD_CODE AS AD_CODE
- FROM BIS_INSP_ALL_RLATION J
- LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
- left join ATT_EMPWTPRJ_BASE OB ON A.CODE = OB.ID
- </if>
- <if test='type == "009"'>
- r.AD_CODE AS AD_CODE
- FROM BIS_INSP_ALL_RLATION J
- LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
- LEFT JOIN BIS_INSP_FSC_RGSTR r ON r.OBJ_ID = A.OBJ_ID
- </if>
- <if test='type == "010"'>
- r.AD_CODE AS AD_CODE
- FROM BIS_INSP_ALL_RLATION J
- LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
- LEFT JOIN BIS_INSP_OTHER_RGSTR r ON r.OBJ_ID = A.OBJ_ID
- </if>
- <if test='type == "011"'>
- r.AD_CODE AS AD_CODE
- FROM BIS_INSP_ALL_RLATION J
- LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
- LEFT JOIN BIS_INSP_SD_RGSTR r ON r.OBJ_ID = A.OBJ_ID
- </if>
- <if test='type == "012"'>
- r.AD_CODE AS AD_CODE
- FROM BIS_INSP_ALL_RLATION J
- LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
- LEFT JOIN BIS_INSP_WIU_RGSTR r ON r.OBJ_ID = A.OBJ_ID
- </if>
- <if test='type == "013"'>
- r.AD_CODE AS AD_CODE
- FROM BIS_INSP_ALL_RLATION J
- LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
- LEFT JOIN BIS_INSP_SWHS_RGSTR r ON r.OBJ_ID = A.OBJ_ID
- </if>
- <if test='type == "014"'>
- r.AD_CODE AS AD_CODE
- FROM BIS_INSP_ALL_RLATION J
- LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
- LEFT JOIN BIS_INSP_WINT_RGSTR r ON r.OBJ_ID = A.OBJ_ID
- </if>
- <if test='type == "015"'>
- r.AD_CODE AS AD_CODE
- FROM BIS_INSP_ALL_RLATION J
- LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
- LEFT JOIN BIS_INSP_SVWT_AREA_RGSTR r ON r.OBJ_ID = A.OBJ_ID
- </if>
- <if test='type == "016"'>
- r.AD_CODE AS AD_CODE
- FROM BIS_INSP_ALL_RLATION J
- LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
- LEFT JOIN BIS_INSP_SVWT_WUNT_RGSTR r ON r.OBJ_ID = A.OBJ_ID
- </if>
- WHERE LENGTH(J.ID) = 12
- <if test="type != null and type != ''">
- AND J.ID LIKE CONCAT(#{type}, '%')
- </if>
- ) F where 1=1
- <include refid="repeatSql"/>
- GROUP BY SUBSTR(F.AD_CODE, 1, ${length}), SUBSTR(F.ID, 1, 6)) H
- LEFT JOIN BIS_INSP_ALL E
- ON H.ID = E.ID
- LEFT JOIN ATT_AD_X_BASE G
- ON CONCAT(H.AD_CODE, '${zero}') = G.AD_CODE
- where 1=1
- <if test="orgName != null and orgName != ''">
- and e.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
- </if>
- <if test="adName != null and adName != ''">
- and G.ad_name like CONCAT('%',CONCAT(#{adName}, '%'))
- </if>
- order by G.ad_code,e.id
- </select>
- <sql id="repeatSql">
- <choose>
- <when test="province !=null and province !=''">
- and F.province =#{province}
- </when>
- <otherwise>
- and F.province is null
- </otherwise>
- </choose>
- </sql>
- <!--省加单位-小水库-县-->
- <select id="getOrgProCountryList" resultMap="brief" parameterType="String">
- select ad.ad_code,ad.ad_name,a.code, b.pnm, a.num
- from (select q.id as code,q.code as ad_code, count(distinct q.xian) as num
- from (select substr(o.id, 1, 6) as id,
- substr(t.ad_code, 1, ${length}) as code,substr(t.ad_code, 1, 6) as xian,o.ad_code
- from BIS_INSP_RSVR_RGSTR t
- left join bis_insp_all_obj o
- on t.obj_id = o.obj_id
- where length(o.id) > 3
- <if test="state != null and state != ''">
- AND case when t.state is null then '0' else t.state end = #{state}
- </if>
- ) q where 1=1
- <include refid="qchose"/>
- group by q.id,q.code) a
- left join BIS_INSP_ALL b
- on a.code = b.id
- left join att_ad_base ad on concat(a.ad_code,'${zero}') = ad.ad_code
- where 1=1
- <if test="orgName != null and orgName != ''">
- and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
- </if>
- <if test="adName != null and adName != ''">
- and ad.ad_name like CONCAT('%',CONCAT(#{adName}, '%'))
- </if>
- order by ad.ad_code,a.code
- </select>
- <!--省加单位-小水库-水库-->
- <select id="getOrgProRsvrList" resultMap="brief" parameterType="String">
- select ad.ad_code, ad.ad_name, a.code, b.pnm, a.num
- from (select q.id as code,
- q.code as ad_code,
- count( q.rs_code) as num
- from (select substr(o.id, 1, 6) as id,
- substr(t.ad_code, 1, ${length}) as code,
- t.rs_code,o.ad_code
- from BIS_INSP_RSVR_RGSTR t
- left join bis_insp_all_obj o
- on t.obj_id = o.obj_id
- where length(o.id) > 3
- <if test="state != null and state != ''">
- AND case when t.state is null then '0' else t.state end = #{state}
- </if>
- <if test="eng_scal != null and eng_scal != ''">
- and t.eng_scal = #{eng_scal}
- </if>
- <if test="sttm != null and sttm != '' and entm != null and entm != ''">
- AND t.INTM >= str_to_date(#{sttm},'%Y-%m-%d') AND t.INTM < DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d') , INTERVAL 1 DAY)
- </if>
- ) q where 1=1 <include refid="qchose"/>
- group by q.id, q.code) a
- left join BIS_INSP_ALL b
- on a.code = b.id
- left join att_ad_base ad
- on concat(a.ad_code, '${zero}') = ad.ad_code
- where 1=1
- <if test="orgName != null and orgName != ''">
- and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
- </if>
- <if test="adName != null and adName != ''">
- and ad.ad_name like CONCAT('%',CONCAT(#{adName}, '%'))
- </if>
- order by ad.ad_code,a.code
- </select>
- <!--省加单位-水闸数量-->
- <select id="getOrgProWagaList" resultMap="brief" parameterType="String">
- select ad.ad_code, ad.ad_name, a.code, b.pnm, a.num
- from (select q.id as code,
- q.code as ad_code,
- count( q.OBJ_code) as num
- from (select substr(o.id, 1, 6) as id,
- substr(t.ad_code, 1, 2) as code,
- t.OBJ_code
- from ATT_WAGA_RGSTR t
- left join bis_insp_all_obj o
- on t.obj_id = o.obj_id
- where length(o.id) > 3
- <include refid="ochoseSql"/>
- <if test="state != null and state != ''">
- AND case when t.state is null then '0' ELSE t.state end = #{state}
- </if>
- <if test="sttm != null and sttm != '' and entm != null and entm != ''">
- AND t.INTM >= str_to_date(#{sttm},'%Y-%m-%d') AND t.INTM < DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d') , INTERVAL 1 DAY)
- </if>
- <if test="engScal != null and engScal != ''">
- and t.eng_scal = #{engScal}
- </if>
- <if test='engScal == null'>
- AND t.eng_scal IS NULL
- </if>
- ) q
- group by q.id, q.code) a
- left join BIS_INSP_ALL b
- on a.code = b.id
- left join att_ad_base ad
- on concat(a.ad_code, '0000000000') = ad.ad_code
- where 1=1
- <if test="orgName != null and orgName != ''">
- and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
- </if>
- <if test="adName != null and adName != ''">
- and ad.ad_name like CONCAT('%',CONCAT(#{adName}, '%'))
- </if>
- order by ad.ad_code,a.code
- </select>
- <!--省加单位-问题列表-->
- <select id="getOrgProPblmList" resultMap="brief" parameterType="String">
- select AD.AD_CODE,AD.AD_NAME,a.code, b.pnm, a.num
- from (select SUBSTR(Q.AD_CODE,1,${length}) AS AD_CODE,q.code, count(q.pblm_id) as num
- from (select substr(o.id, 1, 6) as code,o.ad_code as province,t.pblm_id,
- <if test='objType == "1" or objType=="36"'>
- OB.ADM_DIV AS AD_CODE
- from BIS_INSP_PBLM t
- left join bis_insp_all_obj o
- on t.obj_id = o.obj_id
- left join ATT_RS_BASE OB ON O.CODE = OB.RS_CODE
- LEFT JOIN BIS_INSP_RSVR_RGSTR B ON t.OBJ_ID = B.OBJ_ID
- </if>
- <if test='objType == "2"'>
- o.CODE AS AD_CODE
- from BIS_INSP_PBLM t
- left join bis_insp_all_obj o
- on t.obj_id = o.obj_id
- LEFT JOIN BIS_INSP_VILL_RGSTR B ON t.OBJ_ID = B.OBJ_ID
- </if>
- <if test='objType == "3"'>
- OB.LOC_AD AS AD_CODE
- from BIS_INSP_PBLM t
- left join bis_insp_all_obj o
- on t.obj_id = o.obj_id
- left join BIS_INSP_WTDST OB ON O.CODE = OB.WTDST_ID
- LEFT JOIN BIS_INSP_WTDST_TRACK B ON t.OBJ_ID = B.OBJ_ID
- </if>
- <if test='objType == "4"'>
- OB.AD_CODE AS AD_CODE
- from BIS_INSP_PBLM t
- left join bis_insp_all_obj o
- on t.obj_id = o.obj_id
- left join ATT_EMPWTPRJ_BASE OB ON O.CODE = OB.ID
- LEFT JOIN BIS_INSP_KEY_REGISTER B ON t.OBJ_ID = B.OBJ_ID
- </if>
- <if test='objType == "5"'>
- OB.ADCD AS AD_CODE
- from BIS_INSP_PBLM t
- left join bis_insp_all_obj o
- on t.obj_id = o.obj_id
- left join ATT_GRW_BASE OB ON O.CODE = OB.STCD
- left join BIS_INSP_GRW B on t.obj_id = B.obj_id
- </if>
- <if test='objType == "6"'>
- OB.AD_CODE AS AD_CODE
- from BIS_INSP_PBLM t
- left join bis_insp_all_obj o
- on t.obj_id = o.obj_id
- left join ATT_WAGA_BASE OB ON O.CODE = OB.OBJ_CODE
- LEFT JOIN ATT_WAGA_RGSTR B ON t.OBJ_ID = B.OBJ_ID
- </if>
- <if test='objType == "7"'>
- OB.AD_CODE AS AD_CODE
- from BIS_INSP_PBLM t
- left join bis_insp_all_obj o
- on t.obj_id = o.obj_id
- left join ATT_EMPWTPRJ_BASE OB ON O.CODE = OB.ID
- LEFT JOIN BIS_INSP_KEY_REGISTER B ON t.OBJ_ID = B.OBJ_ID
- </if>
- where 1=1
- <if test="objType != null and objType != ''">
- and T.OBJ_TYPE = #{objType}
- </if>
- <if test="sttm != null and sttm != ''">
- and t.coll_time >= str_to_date(#{sttm}, '%Y-%m-%d')
- </if>
- <if test="entm != null and entm != ''">
- and t.coll_time < DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d') , INTERVAL 1 DAY)
- </if>
- <if test="cate != null and cate != ''">
- and t.insp_pblm_cate = #{cate}
- </if>
- <if test="state != null and state != ''">
- AND case when B.state is null then '0' ELSE B.state end = #{state}
- </if>
- ) q
- where 1=1
- <include refid="qchose"/>
- and length(q.code)=6
- group by SUBSTR(Q.AD_CODE,1,${length}),q.code) a
- left join BIS_INSP_ALL b
- on a.code = b.id
- LEFT JOIN ATT_AD_X_BASE AD ON CONCAT(A.AD_CODE,'${zero}') = AD.AD_CODE
- where a.code is not null
- <if test="orgName != null and orgName != ''">
- and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
- </if>
- <if test="adName != null and adName != ''">
- and ad.ad_name like CONCAT('%',CONCAT(#{adName}, '%'))
- </if>
- order by a.AD_CODE,a.code
- </select>
- <!--省加单位-水毁县数-->
- <select id="getOrgProRectCountryList" resultMap="brief" parameterType="String">
- select AD.AD_CODE,AD.AD_NAME,a.code, b.pnm, a.num
- from (select SUBSTR(q.loc_ad,1,2) as ad_code,q.id as code, count(distinct q.code) as num
- from (select b.loc_ad,substr(o.id, 1, 6) as id,
- substr(b.loc_ad, 1, 6) as code
- from BIS_INSP_WTDST_TRACK t
- left join bis_insp_all_obj o
- on t.obj_id = o.obj_id
- left join BIS_INSP_WTDST b
- on o.code = b.wtdst_id
- where length(o.id) > 3
- <include refid="ochoseSql"/>
- <if test="state != null and state != ''">
- AND case when t.state is null then '0' else t.state end = #{state}
- </if>
- ) q
- group by SUBSTR(q.loc_ad,1,2),q.id) a
- left join BIS_INSP_ALL b
- on a.code = b.id
- left join ATT_AD_X_BASE AD ON CONCAT(A.AD_CODE,'0000000000') = AD.AD_CODE
- where 1=1
- <if test="adName != null and adName != ''">
- and AD.ad_name like CONCAT('%',CONCAT(#{adName}, '%'))
- </if>
- <if test="orgName != null and orgName != ''">
- and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
- </if>
- order by ad.ad_code,a.code
- </select>
- <!--172重点工程县-->
- <select id="getOrgProEmpwtCountryList" resultMap="brief" parameterType="String">
- select AD.AD_CODE,AD.AD_NAME,a.code, b.pnm, a.num
- from (select SUBSTR(q.AD_CODE,1,2) as ad_code,q.id as code, count(distinct q.code) as num
- from (select b.AD_CODE,substr(o.id, 1, 6) as id,
- substr(b.AD_CODE, 1, 6) as code
- from BIS_INSP_KEY_REGISTER t
- left join bis_insp_all_obj o
- on t.obj_id = o.obj_id
- left join ATT_EMPWTPRJ_BASE b
- on o.code = b.ID
- where length(o.id) > 3 AND b.ENG_STA = #{engSta}
- <include refid="ochoseSql"/>
- <if test="state != null and state != ''">
- AND case when t.state is null then '0' else t.state end = #{state}
- </if>
- ) q
- group by SUBSTR(q.AD_CODE,1,2),q.id) a
- left join BIS_INSP_ALL b
- on a.code = b.id
- left join ATT_AD_X_BASE AD ON CONCAT(A.AD_CODE,'0000000000') = AD.AD_CODE
- where 1=1
- <if test="adName != null and adName != ''">
- and AD.ad_name like CONCAT('%',CONCAT(#{adName}, '%'))
- </if>
- <if test="orgName != null and orgName != ''">
- and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
- </if>
- order by ad.ad_code,a.code
- </select>
- <!--水闸--县-->
- <select id="getOrgProWagaCountryList" resultMap="brief" parameterType="String">
- select AD.AD_CODE,AD.AD_NAME,a.code, b.pnm, a.num
- from (select SUBSTR(q.AD_CODE,1,2) as ad_code,q.id as code, count(distinct q.code) as num
- from (select b.AD_CODE,substr(o.id, 1, 6) as id,
- substr(b.AD_CODE, 1, 6) as code
- from ATT_WAGA_RGSTR t
- left join bis_insp_all_obj o
- on t.obj_id = o.obj_id
- left join ATT_WAGA_BASE b
- on o.code = b.OBJ_CODE
- where length(o.id) > 3
- <include refid="ochoseSql"/>
- <if test="state != null and state != ''">
- AND case when t.state is null then '0' ELSE t.state end = #{state}
- </if>
- ) q
- group by SUBSTR(q.AD_CODE,1,2),q.id) a
- left join BIS_INSP_ALL b
- on a.code = b.id
- left join ATT_AD_X_BASE AD ON CONCAT(A.AD_CODE,'0000000000') = AD.AD_CODE
- where 1=1
- <if test="adName != null and adName != ''">
- and AD.ad_name like CONCAT('%',CONCAT(#{adName}, '%'))
- </if>
- <if test="orgName != null and orgName != ''">
- and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
- </if>
- order by ad.ad_code,a.code
- </select>
- <!--省加单位-水毁项目数-->
- <select id="getOrgProRectList" resultMap="brief" parameterType="String">
- select AD.AD_CODE,AD.AD_NAME,a.code, b.pnm, a.num
- from (select SUBSTR(q.loc_ad,1,2) as ad_code,q.id as code, count(*) as num
- from (select b.loc_ad,substr(o.id, 1, 6) as id,
- substr(b.loc_ad, 1, 6) as code
- from BIS_INSP_WTDST_TRACK t
- left join bis_insp_all_obj o
- on t.obj_id = o.obj_id
- left join BIS_INSP_WTDST b
- on o.code = b.wtdst_id
- where length(o.id) > 3
- <include refid="ochoseSql"/>
- <if test="state != null and state != ''">
- AND case when t.state is null then '0' else t.state end = #{state}
- </if>
- ) q
- group by SUBSTR(q.loc_ad,1,2),q.id) a
- left join BIS_INSP_ALL b
- on a.code = b.id
- left join ATT_AD_X_BASE AD ON CONCAT(A.AD_CODE,'0000000000') = AD.AD_CODE
- where 1=1
- <if test="adName != null and adName != ''">
- and AD.ad_name like CONCAT('%',CONCAT(#{adName}, '%'))
- </if>
- <if test="orgName != null and orgName != ''">
- and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
- </if>
- order by ad.ad_code,a.code
- </select>
- <!--省加单位-172项目数-->
- <select id="getOrgProEmpwtList" resultMap="brief" parameterType="String">
- select AD.AD_CODE,AD.AD_NAME,a.code, b.pnm, a.num
- from (select SUBSTR(q.AD_CODE,1,2) as ad_code,q.id as code, count(*) as num
- from (select b.AD_CODE,substr(o.id, 1, 6) as id,
- substr(b.AD_CODE, 1, 6) as code
- from BIS_INSP_KEY_REGISTER t
- left join bis_insp_all_obj o
- on t.obj_id = o.obj_id
- left join ATT_EMPWTPRJ_BASE b
- on o.code = b.ID
- where length(o.id) > 3 AND b.ENG_STA = #{engSta}
- <include refid="ochoseSql"/>
- <if test="state != null and state != ''">
- AND case when t.state is null then '0' else t.state end = #{state}
- </if>
- ) q
- group by SUBSTR(q.AD_CODE,1,2),q.id) a
- left join BIS_INSP_ALL b
- on a.code = b.id
- left join ATT_AD_X_BASE AD ON CONCAT(A.AD_CODE,'0000000000') = AD.AD_CODE
- where 1=1
- <if test="adName != null and adName != ''">
- and AD.ad_name like CONCAT('%',CONCAT(#{adName}, '%'))
- </if>
- <if test="orgName != null and orgName != ''">
- and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
- </if>
- order by ad.ad_code,a.code
- </select>
- <select id="getOrgProVillCountryList" resultMap="brief" parameterType="String">
- select AD.AD_CODE,AD.AD_NAME,b.code, c.pnm, b.num
- from (select substr(a.code,1,2) as ad_code,a.id as code, count(distinct a.code) as num
- from (select substr(id, 1, 6) as id, substr(code, 1, 6) as code
- from bis_insp_all_obj t
- LEFT JOIN BIS_INSP_VILL_RGSTR VR ON t.OBJ_ID = VR.OBJ_ID
- WHERE 1 = 1
- <include refid="choseSql"/>
- <if test="sttm != null and sttm != '' and entm != null and entm != ''">
- AND VR.INTM >= str_to_date(#{sttm},'%Y-%m-%d') AND VR.INTM < DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d') , INTERVAL 1 DAY)
- </if>
- <if test="state != null and state != ''">
- AND case when VR.state is null then '0' ELSE VR.state end = #{state}
- </if>
- AND t.ptype = '2') a
- group by substr(a.code,1,2),a.id) b
- left join BIS_INSP_ALL c
- on b.code = c.id
- left join ATT_AD_X_BASE AD ON CONCAT(B.AD_CODE,'0000000000') = AD.AD_CODE
- where 1=1
- <if test="adName != null and adName != ''">
- and AD.ad_name like CONCAT('%',CONCAT(#{adName}, '%'))
- </if>
- <if test="orgName != null and orgName != ''">
- and c.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
- </if>
- order by ad.ad_code,b.code
- </select>
- <select id="getOrgProVillVillList" resultMap="brief" parameterType="String">
- select AD.AD_CODE,AD.AD_NAME,q.code, w.pnm, q.num
- from (select substr(t.village_code, 1, 2) as AD_CODE,substr(t.id, 1, 6) as code,
- count( t.village_code) as num
- from (select t.village_code, o.id, o.nm, o.code,o.ad_code
- from BIS_INSP_SECSURVEY_VLG t
- left join BIS_INSP_VILL_RGSTR r
- on t.eng_id = r.eng_id
- left join bis_insp_all_obj o
- on r.obj_id = o.obj_id
- where 1=1
- <include refid="ochoseSql"/>
- <if test="sttm != null and sttm != '' and entm != null and entm != ''">
- AND t.CREATE_TIME >= str_to_date(#{sttm},'%Y-%m-%d') AND t.CREATE_TIME < DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d') , INTERVAL 1 DAY)
- </if>
- <if test="state != null and state != ''">
- AND case when r.state is null then '0' ELSE r.state end = #{state}
- </if>
- ) t
- group by substr(t.village_code, 1, 2),substr(t.id, 1, 6)) q
- left join BIS_INSP_ALL w
- on q.code = w.id
- left join ATT_AD_X_BASE AD ON CONCAT(Q.AD_CODE,'0000000000') = AD.AD_CODE
- where 1=1
- <if test="adName != null and adName != ''">
- and AD.ad_name like CONCAT('%',CONCAT(#{adName}, '%'))
- </if>
- <if test="orgName != null and orgName != ''">
- and w.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
- </if>
- order by ad.ad_code,q.code
- </select>
- <select id="getOrgProVillPersList" resultMap="brief" parameterType="String">
- select AD.AD_CODE,AD.AD_NAME,q.code, w.pnm, q.num
- from (select substr(a.village_code, 1, 2) as AD_CODE,substr(a.id, 1, 6) as code,
- count(a.village_code) as num
- from (select t.village_code, o.id, o.nm, o.code,o.ad_code
- from BIS_INSP_WATERUSER_INFO t
- left join BIS_INSP_VILL_RGSTR r
- on t.eng_id = r.eng_id
- left join bis_insp_all_obj o
- on r.obj_id = o.obj_id
- where 1=1
- <include refid="ochoseSql"/>
- <if test="sttm != null and sttm != '' and entm != null and entm != ''">
- AND t.CREATE_TIME >= str_to_date(#{sttm},'%Y-%m-%d') AND t.CREATE_TIME < DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d') , INTERVAL 1 DAY)
- </if>
- <if test="state != null and state != ''">
- AND case when r.state is null then '0' ELSE r.state end = #{state}
- </if>
- ) a
- group by substr(a.village_code, 1, 2),substr(a.id, 1, 6)) q
- left join BIS_INSP_ALL w
- on q.code = w.id
- left join ATT_AD_X_BASE AD ON CONCAT(Q.AD_CODE,'0000000000') = AD.AD_CODE
- where 1=1
- <if test="adName != null and adName != ''">
- and AD.ad_name like CONCAT('%',CONCAT(#{adName}, '%'))
- </if>
- <if test="orgName != null and orgName != ''">
- and w.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
- </if>
- order by ad.ad_code,q.code
- </select>
- <select id="getOrgProVillCwsList" resultMap="brief" parameterType="String">
- select AD.AD_CODE,AD.AD_NAME,q.code, w.pnm, q.num
- from (select substr(a.code, 1, 2) as AD_CODE,substr(a.id, 1, 6) as code,
- count(a.CWS_CODE) as num
- from (select t.CWS_CODE, o.id, o.nm, o.code
- from BIS_INSP_VLGDRINK_PROJ_MANAGE t
- left join BIS_INSP_VILL_RGSTR r
- on t.eng_id = r.eng_id
- left join bis_insp_all_obj o
- on r.obj_id = o.obj_id
- where 1=1
- <include refid="ochoseSql"/>
- <if test="sttm != null and sttm != '' and entm != null and entm != ''">
- AND t.CREATE_TIME >= str_to_date(#{sttm},'%Y-%m-%d') AND t.CREATE_TIME < DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d') , INTERVAL 1 DAY)
- </if>
- <if test="state != null and state != ''">
- AND case when r.state is null then '0' ELSE r.state end = #{state}
- </if>
- ) a
- group by substr(a.code, 1, 2),substr(a.id, 1, 6)) q
- left join BIS_INSP_ALL w
- on q.code = w.id
- left join ATT_AD_X_BASE AD ON CONCAT(Q.AD_CODE,'0000000000') = AD.AD_CODE
- where 1=1
- <if test="adName != null and adName != ''">
- and AD.ad_name like CONCAT('%',CONCAT(#{adName}, '%'))
- </if>
- <if test="orgName != null and orgName != ''">
- and w.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
- </if>
- order by ad.ad_code,q.code
- </select>
- <select id="getOrgProVillWaterList" resultMap="brief">
- select AD.AD_CODE,AD.AD_NAME,q.code, w.pnm, q.num
- from (select substr(a.code, 1, 2) as ad_code,substr(a.id, 1, 6) as code,
- count(a.WATER_SOURCE_NM) as num
- from (select t.WATER_SOURCE_NM, o.id, o.nm, o.code
- from BIS_INSP_PRO_SOURCE_PROTECT t
- left join BIS_INSP_VILL_RGSTR r
- on t.eng_id = r.eng_id
- left join bis_insp_all_obj o
- on r.obj_id = o.obj_id
- where 1=1
- <include refid="ochoseSql"/>
- <if test="sttm != null and sttm != '' and entm != null and entm != ''">
- AND t.CREATE_TIME >= str_to_date(#{sttm},'%Y-%m-%d') AND t.CREATE_TIME < DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d') , INTERVAL 1 DAY)
- </if>
- <if test="state != null and state != ''">
- AND case when r.state is null then '0' ELSE r.state end = #{state}
- </if>
- ) a
- group by substr(a.code, 1, 2),substr(a.id, 1, 6)) q
- left join BIS_INSP_ALL w
- on q.code = w.id
- left join ATT_AD_X_BASE AD ON CONCAT(Q.AD_CODE,'0000000000') = AD.AD_CODE
- where 1=1
- <if test="adName != null and adName != ''">
- and AD.ad_name like CONCAT('%',CONCAT(#{adName}, '%'))
- </if>
- <if test="orgName != null and orgName != ''">
- and w.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
- </if>
- order by ad.ad_code,q.code
- </select>
- <!--流域督查统计(农饮)-获取组id和组名称-->
- <select id="getRiverSupervisionCwsCount" parameterType="cn.com.goldenwater.dcproj.param.BriefReportParam" resultType="cn.com.goldenwater.dcproj.dto.RiverSupervisionCwsCount">
- select A.ID basinId,A.PNM basinName,C.ID groupId,C.PNM groupName from BIS_INSP_ALL A LEFT JOIN BIS_INSP_ALL B ON A.ID = B.PID
- LEFT JOIN BIS_INSP_ALL C ON B.ID = C.PID WHERE 1 = 1
- <if test="basinId != null and basinId != ''">
- AND A.ID = #{basinId}
- </if>
- <if test="sttm != null and sttm != '' and entm != null and entm != ''">
- AND C.STTM >= str_to_date(#{sttm},'%Y-%m-%d') AND C.ENTM < DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d') , INTERVAL 1 DAY)
- </if>
- AND A.ID LIKE '002${orgId}'
- ORDER BY A.ID
- </select>
- <select id="getRiverSupervisionWtdCount" parameterType="cn.com.goldenwater.dcproj.param.BriefReportParam" resultType="cn.com.goldenwater.dcproj.dto.RiverSupervisionWtdCount">
- select A.ID basinId,A.PNM basinName,C.ID groupId,C.PNM groupName from BIS_INSP_ALL A LEFT JOIN BIS_INSP_ALL B ON A.ID = B.PID
- LEFT JOIN BIS_INSP_ALL C ON B.ID = C.PID WHERE 1 = 1
- <if test="basinId != null and basinId != ''">
- AND A.ID = #{basinId}
- </if>
- <if test="sttm != null and sttm != '' and entm != null and entm != ''">
- AND C.STTM >= str_to_date(#{sttm},'%Y-%m-%d') AND C.ENTM < DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d') , INTERVAL 1 DAY)
- </if>
- AND A.ID LIKE '003${orgId}'
- ORDER BY A.ID
- </select>
- <select id="getRsCountByGroupId" resultType="cn.com.goldenwater.dcproj.dto.PersCountDto">
- SELECT A.ENG_SCAL as TYPE ,b.id,COUNT(A.RGSTR_ID) as count FROM BIS_INSP_RSVR_RGSTR A LEFT JOIN BIS_INSP_ALL_OBJ B ON A.OBJ_ID = B.OBJ_ID
- WHERE B.ID in (${groupId}) AND B.PTYPE = '1'
- <if test="state != null and state != ''">
- AND case when A.state is null then '0' else A.state end = #{state}
- </if>
- group by a.eng_scal,b.id
- </select>
- <select id="getRiverSupervisionRivCount" parameterType="cn.com.goldenwater.dcproj.param.BriefReportParam" resultType="cn.com.goldenwater.dcproj.dto.RiverSupervisionRivCount">
- select A.ID basinId,A.PNM basinName,C.ID groupId,C.PNM groupName from BIS_INSP_ALL A LEFT JOIN BIS_INSP_ALL B ON A.ID = B.PID
- LEFT JOIN BIS_INSP_ALL C ON B.ID = C.PID WHERE 1 = 1
- <if test="basinId != null and basinId != ''">
- AND A.ID = #{basinId}
- </if>
- <if test="sttm != null and sttm != '' and entm != null and entm != ''">
- AND C.STTM >= str_to_date(#{sttm},'%Y-%m-%d') AND C.ENTM < DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d') , INTERVAL 1 DAY)
- </if>
- AND A.ID LIKE '001${orgId}'
- ORDER BY A.ID
- </select>
- <select id="getRivCountyCountById" resultType="cn.com.goldenwater.dcproj.dto.PersCountDto">
- SELECT t1.id,COUNT(AD.AD_NAME) as count FROM
- (SELECT distinct b.id,SUBSTR(A.ADM_DIV,1,6) subAd FROM ATT_RS_BASE A LEFT JOIN BIS_INSP_ALL_OBJ B ON A.RS_CODE = B.CODE
- WHERE B.PTYPE = '1' AND B.ID in (${groupId})) T1 LEFT JOIN ATT_AD_X_BASE AD ON
- CONCAT(T1.subAd,'000000') = AD.AD_CODE
- group by t1.id
- </select>
- <!--获取水库行政区划名称-->
- <select id="getRivAdNameDtoListByGroupIds" resultType="cn.com.goldenwater.dcproj.dto.AdNameDto">
- SELECT t1.id, AD.AD_NAME FROM
- (SELECT distinct b.id,SUBSTR(A.AD_CODE,1,2) subAd FROM BIS_INSP_RSVR_RGSTR A LEFT JOIN BIS_INSP_ALL_OBJ B ON A.OBJ_ID =
- B.OBJ_ID
- WHERE B.PTYPE = '1' AND B.ID in (${groupId})) T1 LEFT JOIN ATT_AD_X_BASE AD ON
- CONCAT(T1.subAd,'0000000000') = AD.AD_CODE
- where length(t1.id) = 12
- </select>
- <select id="getRiverSupervisionEmpwtConCount" parameterType="cn.com.goldenwater.dcproj.param.BriefReportParam" resultType="cn.com.goldenwater.dcproj.dto.RiverSupervisionEmpwtCount">
- select A.ID basinId,A.PNM basinName,C.ID groupId,C.PNM groupName from BIS_INSP_ALL A LEFT JOIN BIS_INSP_ALL B ON A.ID = B.PID
- LEFT JOIN BIS_INSP_ALL C ON B.ID = C.PID WHERE 1 = 1
- <if test="basinId != null and basinId != ''">
- AND A.ID = #{basinId}
- </if>
- <if test="sttm != null and sttm != '' and entm != null and entm != ''">
- AND C.STTM >= str_to_date(#{sttm},'%Y-%m-%d') AND C.ENTM < DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d') , INTERVAL 1 DAY)
- </if>
- AND A.ID LIKE '004${orgId}'
- ORDER BY A.ID
- </select>
- <select id="getRiverSupervisionEmpwtRunCount" parameterType="cn.com.goldenwater.dcproj.param.BriefReportParam" resultType="cn.com.goldenwater.dcproj.dto.RiverSupervisionEmpwtCount">
- select A.ID basinId,A.PNM basinName,C.ID groupId,C.PNM groupName from BIS_INSP_ALL A LEFT JOIN BIS_INSP_ALL B ON A.ID = B.PID
- LEFT JOIN BIS_INSP_ALL C ON B.ID = C.PID WHERE 1 = 1
- <if test="basinId != null and basinId != ''">
- AND A.ID = #{basinId}
- </if>
- <if test="sttm != null and sttm != '' and entm != null and entm != ''">
- AND C.STTM >= str_to_date(#{sttm},'%Y-%m-%d') AND C.ENTM < DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d') , INTERVAL 1 DAY)
- </if>
- AND A.ID LIKE '007___'
- ORDER BY A.ID
- </select>
- <select id="getRiverSupervisionWagaCount" parameterType="cn.com.goldenwater.dcproj.param.BriefReportParam" resultType="cn.com.goldenwater.dcproj.dto.RiverSupervisionWagaCount">
- select A.ID basinId,A.PNM basinName,C.ID groupId,C.PNM groupName from BIS_INSP_ALL A LEFT JOIN BIS_INSP_ALL B ON A.ID = B.PID
- LEFT JOIN BIS_INSP_ALL C ON B.ID = C.PID WHERE 1 = 1
- <if test="basinId != null and basinId != ''">
- AND A.ID = #{basinId}
- </if>
- <if test="sttm != null and sttm != '' and entm != null and entm != ''">
- AND C.STTM >= str_to_date(#{sttm},'%Y-%m-%d') AND C.ENTM < DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d') , INTERVAL 1 DAY)
- </if>
- AND A.ID LIKE '006___'
- ORDER BY A.ID
- </select>
- <!--获取农饮行政区划名称-->
- <select id="getCwsAdNameDtoList" resultType="cn.com.goldenwater.dcproj.dto.AdNameDto">
- SELECT AD.AD_NAME FROM
- (SELECT SUBSTR(A.AD_CODE,1,2) subAd FROM ATT_AD_X_BASE A LEFT JOIN BIS_INSP_ALL_OBJ t ON A.AD_CODE = t.CODE
- WHERE t.PTYPE = '2'
- <include refid="choseSql"/>
- AND t.ID = #{groupId} GROUP BY SUBSTR(A.AD_CODE,1,2)) T1 LEFT JOIN ATT_AD_X_BASE AD ON CONCAT(T1.subAd,'0000000000') = AD.AD_CODE
- </select>
- <!--获取水库行政区划名称-->
- <select id="getRivAdNameDtoList" resultType="cn.com.goldenwater.dcproj.dto.AdNameDto">
- SELECT AD.AD_NAME FROM
- (SELECT SUBSTR(A.AD_CODE,1,2) subAd FROM BIS_INSP_RSVR_RGSTR A LEFT JOIN BIS_INSP_ALL_OBJ t ON A.OBJ_ID = t.OBJ_ID
- WHERE t.PTYPE = '1' AND t.ID = #{groupId}
- <include refid="choseSql"/>
- GROUP BY SUBSTR(A.AD_CODE,1,2)) T1 LEFT JOIN ATT_AD_X_BASE AD ON CONCAT(T1.subAd,'0000000000') = AD.AD_CODE
- </select>
- <!--获取水闸行政区划名称-->
- <select id="getWagaAdNameDtoList" resultType="cn.com.goldenwater.dcproj.dto.AdNameDto">
- SELECT AD.AD_NAME FROM
- (SELECT SUBSTR(A.AD_CODE,1,2) subAd FROM ATT_WAGA_BASE A LEFT JOIN BIS_INSP_ALL_OBJ B ON A.OBJ_CODE = B.CODE
- WHERE B.PTYPE = '6' AND B.ID = #{groupId} GROUP BY SUBSTR(A.AD_CODE,1,2)) T1 LEFT JOIN ATT_AD_X_BASE AD ON CONCAT(T1.subAd,'0000000000') = AD.AD_CODE
- </select>
- <!--获取172重点工程行政区划名称-->
- <select id="getEmpwtAdNameDtoList" resultType="cn.com.goldenwater.dcproj.dto.AdNameDto">
- SELECT AD.AD_NAME FROM
- (SELECT SUBSTR(A.AD_CODE,1,2) subAd FROM ATT_EMPWTPRJ_BASE A LEFT JOIN BIS_INSP_ALL_OBJ t ON A.ID = t.CODE
- WHERE t.PTYPE = #{type} AND B.ID = #{groupId}
- <include refid="choseSql"/>
- GROUP BY SUBSTR(A.AD_CODE,1,2)) T1
- LEFT JOIN ATT_AD_X_BASE AD ON CONCAT(T1.subAd,'0000000000') = AD.AD_CODE
- </select>
- <!--获取水毁行政区划名称-->
- <select id="getWtdAdNameDtoList" resultType="cn.com.goldenwater.dcproj.dto.AdNameDto">
- SELECT AD.AD_NAME FROM
- (SELECT SUBSTR(A.LOC_AD,1,2) subAd FROM BIS_INSP_WTDST A LEFT JOIN BIS_INSP_ALL_OBJ t ON A.WTDST_ID = t.CODE
- WHERE t.PTYPE = '3'
- <include refid="choseSql"/>
- AND t.ID = #{groupId} GROUP BY SUBSTR(A.LOC_AD,1,2)) T1 LEFT JOIN ATT_AD_X_BASE AD ON CONCAT(T1.subAd,'0000000000') = AD.AD_CODE
- </select>
- <select id="getPersCount" resultType="Integer">
- SELECT COUNT(PERSID) FROM BIS_INSP_ALL_RLATION t WHERE ID = #{groupId}
- <include refid="choseSql"/>
- </select>
- <select id="getCwsCountyCount" resultType="Integer">
- SELECT COUNT(AD.AD_NAME) FROM
- (SELECT SUBSTR(A.AD_CODE,1,6) subAd FROM ATT_AD_X_BASE A LEFT JOIN BIS_INSP_ALL_OBJ t ON A.AD_CODE = t.CODE
- WHERE t.PTYPE = '2'
- <include refid="choseSql"/>
- AND t.ID = #{groupId} GROUP BY SUBSTR(A.AD_CODE,1,6)) T1 LEFT JOIN ATT_AD_X_BASE AD ON CONCAT(T1.subAd,'000000') = AD.AD_CODE
- </select>
- <select id="getRivCountyCount" resultType="Integer">
- SELECT COUNT(AD.AD_NAME) FROM
- (SELECT SUBSTR(A.ADM_DIV,1,6) subAd FROM ATT_RS_BASE A LEFT JOIN BIS_INSP_ALL_OBJ t ON A.RS_CODE = t.CODE
- WHERE t.PTYPE = '1'
- <include refid="choseSql"/>
- AND t.ID = #{groupId} GROUP BY SUBSTR(A.ADM_DIV,1,6)) T1 LEFT JOIN ATT_AD_X_BASE AD ON CONCAT(T1.subAd,'000000') = AD.AD_CODE
- </select>
- <select id="getWtdCountyCount" resultType="Integer">
- SELECT COUNT(AD.AD_NAME) FROM
- (SELECT SUBSTR(A.LOC_AD,1,6) subAd FROM BIS_INSP_WTDST A LEFT JOIN BIS_INSP_ALL_OBJ o ON A.WTDST_ID = o.CODE
- LEFT JOIN BIS_INSP_WTDST_TRACK T ON o.OBJ_ID = T.OBJ_ID
- WHERE o.PTYPE = '3' AND o.ID = #{groupId}
- <include refid="ochoseSql"/>
- <if test="state != null and state != ''">
- AND case when t.state is null then '0' else t.state end = #{state}
- </if>
- GROUP BY SUBSTR(A.LOC_AD,1,6)) T1 LEFT JOIN ATT_AD_X_BASE AD ON CONCAT(T1.subAd,'000000') = AD.AD_CODE
- </select>
- <select id="getVillageCount" resultType="Integer">
- SELECT COUNT(A.ENG_ID)
- FROM
- <if test='type == "1"'>
- BIS_INSP_SECSURVEY_VLG
- </if>
- <if test='type == "2"'>
- BIS_INSP_WATERUSER_INFO
- </if>
- <if test='type == "3"'>
- BIS_INSP_VLGDRINK_PROJ_MANAGE
- </if>
- <if test='type == "4"'>
- BIS_INSP_PRO_SOURCE_PROTECT
- </if>
- A LEFT JOIN BIS_INSP_VILL_RGSTR B ON A.ENG_ID = B.ENG_ID
- LEFT JOIN BIS_INSP_ALL_OBJ t ON B.OBJ_ID = t.OBJ_ID
- WHERE t.PTYPE = '2' AND t.ID = #{groupId}
- <include refid="choseSql"/>
- <if test="sttm != null and sttm != '' and entm != null and entm != ''">
- AND A.CREATE_TIME >= str_to_date(#{sttm},'%Y-%m-%d') AND A.CREATE_TIME < DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d') , INTERVAL 1 DAY)
- </if>
- <if test="state != null and state != ''">
- AND case when B.state is null then '0' else B.state end = #{state}
- </if>
- </select>
- <select id="getAllProCount" resultType="Integer">
- select COUNT(PBLM_ID) cateCount from BIS_INSP_PBLM A LEFT JOIN BIS_INSP_ALL_OBJ t ON A.OBJ_ID = t.OBJ_ID
- <if test='type == "1"'>
- LEFT JOIN BIS_INSP_RSVR_RGSTR C ON A.OBJ_ID = C.OBJ_ID
- </if>
- <if test='type == "2"'>
- LEFT JOIN BIS_INSP_VILL_RGSTR C ON A.OBJ_ID = C.OBJ_ID
- </if>
- <if test='type == "3"'>
- LEFT JOIN BIS_INSP_WTDST_TRACK C ON A.OBJ_ID = C.OBJ_ID
- </if>
- <if test='type == "4"'>
- LEFT JOIN BIS_INSP_KEY_REGISTER C ON A.OBJ_ID = C.OBJ_ID
- </if>
- <if test='type == "6"'>
- LEFT JOIN ATT_WAGA_RGSTR C ON A.OBJ_ID = C.OBJ_ID
- </if>
- <if test='type == "7"'>
- LEFT JOIN BIS_INSP_KEY_REGISTER C ON A.OBJ_ID = C.OBJ_ID
- </if>
- WHERE t.PTYPE = #{type} AND t.ID = #{groupId} AND A.OBJ_TYPE = #{type}
- <include refid="choseSql"/>
- AND INSP_PBLM_CATE = #{pblmType}
- <if test="sttm != null and sttm != '' and entm != null and entm != ''">
- AND A.COLL_TIME >= str_to_date(#{sttm},'%Y-%m-%d') AND A.COLL_TIME < DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d') , INTERVAL 1 DAY)
- </if>
- <if test="state != null and state != '' and type != null and type != ''">
- AND case when C.state is null then '0' ELSE C.state end = #{state}
- </if>
- </select>
- <select id="getRsCount" resultType="Integer">
- SELECT COUNT(A.RGSTR_ID) FROM BIS_INSP_RSVR_RGSTR A LEFT JOIN BIS_INSP_ALL_OBJ t ON A.OBJ_ID = t.OBJ_ID
- WHERE t.ID = #{groupId} AND t.PTYPE = '1' AND A.ENG_SCAL = #{engScal}
- <include refid="choseSql"/>
- <if test="state != null and state != ''">
- AND case when A.state is null then '0' else A.state end = #{state}
- </if>
- </select>
- <select id="getWagaCount" resultType="Integer">
- SELECT COUNT(A.OBJ_CODE) FROM ATT_WAGA_RGSTR A LEFT JOIN BIS_INSP_ALL_OBJ t ON A.OBJ_ID = t.OBJ_ID
- WHERE t.ID = #{groupId} AND t.PTYPE = '6'
- <include refid="choseSql"/>
- <if test="engScal != null and engScal != ''">
- AND A.ENG_SCAL = #{engScal}
- </if>
- <if test='engScal == null'>
- AND A.ENG_SCAL IS NULL
- </if>
- <if test="state != null and state != ''">
- AND case when A.state is null then '0' else A.state end = #{state}
- </if>
- </select>
- <select id="getWtdCount" resultType="Integer">
- SELECT COUNT(A.WTDST_ID) FROM BIS_INSP_WTDST A LEFT JOIN BIS_INSP_ALL_OBJ O ON A.WTDST_ID = O.CODE
- LEFT JOIN BIS_INSP_KEY_REGISTER T ON O.OBJ_ID = T.OBJ_ID
- WHERE O.ID = #{groupId} AND O.PTYPE = '3'
- <include refid="ochoseSql"/>
- <if test="state != null and state != ''">
- AND case when t.state is null then '0' else t.state end = #{state}
- </if>
- </select>
- <select id="getRiverNode" resultType="cn.com.goldenwater.dcproj.model.RiverNode">
- SELECT ID ,PNM FROM BIS_INSP_ALL WHERE 1 = 1
- <if test='type == "1" '>
- AND PID = '001'
- <if test="province !=null and province !=''">
- AND ID like '001${orgId}%'
- </if>
- </if>
- <if test='type == "36" '>
- AND PID = '036'
- <if test="province !=null and province !=''">
- AND ID like '036${orgId}%'
- </if>
- </if>
- <if test='type == "2"'>
- AND PID = '002'
- <if test="province !=null and province !=''">
- AND ID like '002${orgId}%'
- </if>
- </if>
- <if test='type == "3"'>
- AND PID = '003'
- <if test="province !=null and province !=''">
- AND ID like '003${orgId}%'
- </if>
- </if>
- <if test='type == "4"'>
- AND PID = '004'
- <if test="province !=null and province !=''">
- AND ID like '004${orgId}%'
- </if>
- </if>
- <if test='type == "5"'>
- AND PID = '005'
- <if test="province !=null and province !=''">
- AND ID like '005${orgId}%'
- </if>
- </if>
- <if test='type == "6"'>
- AND PID = '006'
- <if test="province !=null and province !=''">
- AND ID like '006${orgId}%'
- </if>
- </if>
- <if test='type == "7"'>
- AND PID = '007'
- <if test="province !=null and province !=''">
- AND ID like '007${orgId}%'
- </if>
- </if>
- <if test='type == "8"'>
- AND PID = '008'
- </if>
- <if test='type == "9"'>
- AND PID = '009'
- </if>
- <if test='type == "10"'>
- AND PID = '010'
- </if>
- ORDER BY ID
- </select>
- <select id="getNmByPersid" parameterType="String" resultType="cn.com.goldenwater.dcproj.dto.ObjectNameDto">
- SELECT A.id,A.PNM name FROM BIS_INSP_ALL A LEFT JOIN BIS_INSP_ALL_RLATION B ON A.ID = B.ID
- WHERE B.PERSID = #{persid} AND A.ID LIKE '001%'
- <choose>
- <when test="province !=null and province !=''">
- AND B.ad_code like '${province}%'
- </when>
- <otherwise>
- AND B.ad_code is null
- </otherwise>
- </choose>
- </select>
- <select id="getbigNmByPersid" parameterType="String" resultType="cn.com.goldenwater.dcproj.dto.ObjectNameDto">
- SELECT A.id,A.PNM name FROM BIS_INSP_ALL A LEFT JOIN BIS_INSP_ALL_RLATION B ON A.ID = B.ID
- WHERE B.PERSID = #{persid} AND A.ID LIKE '036%'
- <choose>
- <when test="province !=null and province !=''">
- AND B.ad_code like '${province}%'
- </when>
- <otherwise>
- AND B.ad_code is null
- </otherwise>
- </choose>
- </select>
- <select id="getOrgName" parameterType="String" resultType="cn.com.goldenwater.dcproj.dto.ObjectNameDto">
- SELECT ID,PNM name FROM BIS_INSP_ALL WHERE ID = #{substring}
- </select>
- <select id="getEmpwtCount" resultType="Integer">
- SELECT COUNT(o.OBJ_ID) FROM BIS_INSP_ALL_OBJ o
- LEFT JOIN BIS_INSP_KEY_REGISTER r on o.obj_id = r.obj_id
- WHERE o.ID = #{groupId}
- <include refid="ochoseSql"/>
- <if test="state != null and state != ''">
- AND case when r.state is null then '0' else r.state end = #{state}
- </if>
- </select>
- <select id="getAdCodeByType" resultType="cn.com.goldenwater.dcproj.model.BriefReport">
- SELECT CONCAT(H.AD_CODE, '${zero}') AS AD_CODE,
- G.AD_NAME,
- H.ID AS CODE,
- E.PNM
- FROM (SELECT SUBSTR(F.AD_CODE, 1, ${length}) AS AD_CODE,
- SUBSTR(F.ID, 1, 6) AS ID,
- COUNT(DISTINCT F.ID) AS NUM
- FROM (SELECT J.ID,J.PNM,
- A.PTYPE,A.AD_CODE as province,
- <if test='type == "001" or type=="036"'>
- OB.AD_CODE AS AD_CODE
- FROM BIS_INSP_ALL J
- LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
- left join BIS_INSP_RSVR_RGSTR OB ON A.OBJ_ID = OB.OBJ_ID
- </if>
- <if test='type == "002"'>
- A.CODE AS AD_CODE
- FROM BIS_INSP_ALL J
- LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
- </if>
- <if test='type == "003"'>
- OB.LOC_AD AS AD_CODE
- FROM BIS_INSP_ALL J
- LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
- left join BIS_INSP_WTDST OB ON A.CODE = OB.WTDST_ID
- </if>
- <if test='type == "004"'>
- OB.AD_CODE AS AD_CODE
- FROM BIS_INSP_ALL J
- LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
- left join ATT_EMPWTPRJ_BASE OB ON A.CODE = OB.ID
- </if>
- <if test='type == "005"'>
- OB.ADCD AS AD_CODE
- FROM BIS_INSP_ALL J
- LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
- left join ATT_GRW_BASE OB ON A.CODE = OB.STCD
- </if>
- <if test='type == "006"'>
- OB.AD_CODE AS AD_CODE
- FROM BIS_INSP_ALL J
- LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
- left join ATT_WAGA_RGSTR OB ON A.OBJ_ID = OB.OBJ_ID
- </if>
- <if test='type == "007"'>
- OB.AD_CODE AS AD_CODE
- FROM BIS_INSP_ALL J
- LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
- left join ATT_EMPWTPRJ_BASE OB ON A.CODE = OB.ID
- </if>
- <if test='type == "009"'>
- r.AD_CODE AS AD_CODE
- FROM BIS_INSP_ALL J
- LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
- LEFT JOIN BIS_INSP_FSC_RGSTR r ON r.OBJ_ID = A.OBJ_ID
- </if>
- <if test='type == "010"'>
- r.AD_CODE AS AD_CODE
- FROM BIS_INSP_ALL J
- LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
- LEFT JOIN BIS_INSP_OTHER_RGSTR r ON r.OBJ_ID = A.OBJ_ID
- </if>
- <if test='type == "011"'>
- r.AD_CODE AS AD_CODE
- FROM BIS_INSP_ALL J
- LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
- LEFT JOIN BIS_INSP_SD_RGSTR r ON r.OBJ_ID = A.OBJ_ID
- </if>
- <if test='type == "012"'>
- r.AD_CODE AS AD_CODE
- FROM BIS_INSP_ALL J
- LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
- LEFT JOIN BIS_INSP_WIU_RGSTR r ON r.OBJ_ID = A.OBJ_ID
- </if>
- <if test='type == "013"'>
- r.AD_CODE AS AD_CODE
- FROM BIS_INSP_ALL J
- LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
- LEFT JOIN BIS_INSP_SWHS_RGSTR r ON r.OBJ_ID = A.OBJ_ID
- </if>
- <if test='type == "014"'>
- r.AD_CODE AS AD_CODE
- FROM BIS_INSP_ALL J
- LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
- LEFT JOIN BIS_INSP_WINT_RGSTR r ON r.OBJ_ID = A.OBJ_ID
- </if>
- <if test='type == "015"'>
- r.AD_CODE AS AD_CODE
- FROM BIS_INSP_ALL J
- LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
- LEFT JOIN BIS_INSP_SVWT_AREA_RGSTR r ON r.OBJ_ID = A.OBJ_ID
- </if>
- <if test='type == "016"'>
- r.AD_CODE AS AD_CODE
- FROM BIS_INSP_ALL J
- LEFT JOIN BIS_INSP_ALL_OBJ A ON J.ID=A.ID
- LEFT JOIN BIS_INSP_SVWT_WUNT_RGSTR r ON r.OBJ_ID = A.OBJ_ID
- </if>
- WHERE LENGTH(J.ID) = 12
- <if test="type != null and type != ''">
- AND J.ID LIKE CONCAT(#{type}, '%')
- </if>
- ) F where 1=1
- <include refid="fchose"/>
- GROUP BY SUBSTR(F.AD_CODE, 1, ${length}), SUBSTR(F.ID, 1, 6)) H
- LEFT JOIN BIS_INSP_ALL E
- ON H.ID = E.ID
- LEFT JOIN ATT_AD_X_BASE G
- ON CONCAT(H.AD_CODE, '${zero}') = G.AD_CODE
- where 1=1
- <if test="orgName != null and orgName != ''">
- and E.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
- </if>
- <if test="adName != null and adName != ''">
- and G.ad_name like CONCAT('%',CONCAT(#{adName}, '%'))
- </if>
- ORDER BY H.AD_CODE, H.ID
- </select>
- <sql id="fchose">
- <choose>
- <when test="province !=null and province !=''">
- AND F.province=#{province}
- </when>
- <otherwise>
- AND F.province is null
- </otherwise>
- </choose>
- </sql>
- <sql id="qchosepro">
- <choose>
- <when test="province !=null and province !=''">
- AND q.province=#{province}
- </when>
- <otherwise>
- AND q.province is null
- </otherwise>
- </choose>
- </sql>
- <select id="getRiverPersSupervisionInfo" parameterType="cn.com.goldenwater.dcproj.param.BriefReportParam" resultType="cn.com.goldenwater.dcproj.dto.RiverSupervisionRivCount">
- SELECT B.GUID persId,B.PERS_NAME persName,B.ORG_ID basinId,B.ORG_NM basinName FROM
- (SELECT DISTINCT PERSID FROM BIS_INSP_ALL_RLATION t
- WHERE ID LIKE '001%'
- <include refid="choseSql"/>
- ) A LEFT JOIN BIS_INSP_ALL_RLATION_PERS B
- ON A.PERSID = B.GUID
- WHERE B.GUID IS NOT NULL
- <if test="basinId != null and basinId != ''">
- AND CONCAT(#{type},B.ORG_ID) = #{basinId}
- </if>
- <if test="persName != null and persName != ''">
- AND B.PERS_NAME LIKE '%${persName}%'
- </if>
- </select>
- <select id="getPersAdFullNameDtoList" parameterType="String" resultType="cn.com.goldenwater.dcproj.dto.AdNameDto">
- SELECT AD.AD_FULL_NAME adName
- FROM (select DISTINCT A.AD_CODE AD_CODE
- from BIS_INSP_SEL_AREA A
- LEFT JOIN BIS_INSP_ALL_RLATION B
- ON A.ID = B.ID
- WHERE B.PERSID = #{persId} AND A.AD_CODE LIKE '${province}%') T
- LEFT JOIN ATT_AD_X_BASE AD
- ON T.AD_CODE = AD.AD_CODE
- WHERE AD.AD_CODE IS NOT NULL
- </select>
- <select id="getPersRsCount" resultType="Integer">
- SELECT count(C.RGSTR_ID) FROM BIS_INSP_RSVR_RGSTR C,BIS_INSP_ALL_OBJ t
- WHERE C.OBJ_ID=T.OBJ_ID and C.REC_PERS_ID = #{persId} AND C.ENG_SCAL = #{engScal}
- <include refid="choseSql"/>
- <if test="sttm != null and sttm != '' and entm != null and entm != ''">
- AND C.INTM >= str_to_date(#{sttm},'%Y-%m-%d') AND C.INTM < DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d') , INTERVAL 1 DAY)
- </if>
- <if test="state != null and state != ''">
- AND case when C.state is null then '0' else C.state end = #{state}
- </if>
- </select>
- <select id="getPersAllProCount" resultType="Integer">
- SELECT count(A.PBLM_ID) FROM BIS_INSP_PBLM A join BIS_INSP_ALL_OBJ t
- on A.OBJ_ID=t.OBJ_ID
- <if test='type == "1" or type=="36"'>
- LEFT JOIN BIS_INSP_RSVR_RGSTR B ON A.OBJ_ID = B.OBJ_ID
- </if>
- <if test='type == "2"'>
- LEFT JOIN BIS_INSP_VILL_RGSTR B ON A.OBJ_ID = B.OBJ_ID
- </if>
- <if test='type == "3"'>
- LEFT JOIN BIS_INSP_WTDST_TRACK B ON A.OBJ_ID = B.OBJ_ID
- </if>
- <if test='type == "4"'>
- LEFT JOIN BIS_INSP_KEY_REGISTER B ON A.OBJ_ID = B.OBJ_ID
- </if>
- <if test='type == "6"'>
- LEFT JOIN ATT_WAGA_RGSTR B ON A.OBJ_ID = B.OBJ_ID
- </if>
- <if test='type == "7"'>
- LEFT JOIN BIS_INSP_KEY_REGISTER B ON A.OBJ_ID = B.OBJ_ID
- </if>
- WHERE A.OBJ_TYPE = #{type} AND A.INSP_PBLM_CATE = #{s} AND A.REC_PERS = #{persId}
- <include refid="choseSql"/>
- <if test="sttm != null and sttm != '' and entm != null and entm != ''">
- AND A.COLL_TIME >= str_to_date(#{sttm},'%Y-%m-%d') AND A.COLL_TIME < DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d') , INTERVAL 1 DAY)
- </if>
- <if test="state != null and state != '' and type != null and type != ''">
- AND case when B.state is null then '0' ELSE B.state end = #{state}
- </if>
- </select>
- <select id="getRiverPersSupervisionCwsInfo" parameterType="cn.com.goldenwater.dcproj.param.BriefReportParam" resultType="cn.com.goldenwater.dcproj.dto.RiverSupervisionCwsCount">
- SELECT B.GUID persId,B.PERS_NAME persName,B.ORG_ID basinId,B.ORG_NM basinName FROM
- (SELECT DISTINCT PERSID FROM BIS_INSP_ALL_RLATION
- WHERE ID LIKE '002%') A LEFT JOIN BIS_INSP_ALL_RLATION_PERS B
- ON A.PERSID = B.GUID
- WHERE B.GUID IS NOT NULL
- <if test="basinId != null and basinId != ''">
- AND CONCAT(#{type},B.ORG_ID) = #{basinId}
- </if>
- <if test="persName != null and persName != ''">
- AND B.PERS_NAME LIKE '%${persName}%'
- </if>
- </select>
- <select id="getPersVillageCount" resultType="Integer">
- SELECT COUNT(*) FROM
- <if test='type == "1" or type =="36"'>
- BIS_INSP_SECSURVEY_VLG A
- </if>
- <if test='type == "2"'>
- BIS_INSP_WATERUSER_INFO A
- </if>
- <if test='type == "3"'>
- BIS_INSP_VLGDRINK_PROJ_MANAGE A
- </if>
- <if test='type == "4"'>
- BIS_INSP_PRO_SOURCE_PROTECT A
- </if>
- LEFT JOIN BIS_INSP_VILL_RGSTR B ON A.ENG_ID = B.ENG_ID
- WHERE A.REC_PERS_ID = #{persId}
- <if test="sttm != null and sttm != '' and entm != null and entm != ''">
- AND A.CREATE_TIME >= str_to_date(#{sttm},'%Y-%m-%d') AND A.CREATE_TIME < DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d') , INTERVAL 1 DAY)
- </if>
- <if test="state != null and state != ''">
- AND case when B.state is null then '0' else B.state end = #{state}
- </if>
- </select>
- <select id="getPersRiverSupervisionWtdInfo" parameterType="cn.com.goldenwater.dcproj.param.BriefReportParam" resultType="cn.com.goldenwater.dcproj.dto.RiverSupervisionWtdCount">
- SELECT B.GUID persId,B.PERS_NAME persName,B.ORG_ID basinId,B.ORG_NM basinName FROM
- (SELECT DISTINCT PERSID FROM BIS_INSP_ALL_RLATION
- WHERE ID LIKE '003%') A LEFT JOIN BIS_INSP_ALL_RLATION_PERS B
- ON A.PERSID = B.GUID
- WHERE B.GUID IS NOT NULL
- <if test="basinId != null and basinId != ''">
- AND CONCAT(#{type},B.ORG_ID) = #{basinId}
- </if>
- <if test="persName != null and persName != ''">
- AND B.PERS_NAME LIKE '%${persName}%'
- </if>
- </select>
- <select id="getPersWtdCount" parameterType="String" resultType="Integer">
- SELECT count(TRACK_ID) FROM BIS_INSP_WTDST_TRACK
- WHERE REC_PERS_ID = #{persId}
- <if test="sttm != null and sttm != '' and entm != null and entm != ''">
- AND INTM >= str_to_date(#{sttm},'%Y-%m-%d') AND INTM < DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d') , INTERVAL 1 DAY)
- </if>
- <if test="state != null and state != ''">
- AND case when state is null then '0' else state end = #{state}
- </if>
- </select>
- <select id="getPersRiverSupervisionEmpwtConCount" parameterType="cn.com.goldenwater.dcproj.param.BriefReportParam" resultType="cn.com.goldenwater.dcproj.dto.RiverSupervisionEmpwtCount">
- SELECT B.GUID persId,B.PERS_NAME persName,B.ORG_ID basinId,B.ORG_NM basinName FROM
- (SELECT DISTINCT PERSID FROM BIS_INSP_ALL_RLATION
- WHERE ID LIKE '004%') A LEFT JOIN BIS_INSP_ALL_RLATION_PERS B
- ON A.PERSID = B.GUID
- WHERE B.GUID IS NOT NULL
- <if test="basinId != null and basinId != ''">
- AND CONCAT(#{type},B.ORG_ID) = #{basinId}
- </if>
- <if test="persName != null and persName != ''">
- AND B.PERS_NAME LIKE '%${persName}%'
- </if>
- </select>
- <select id="getPersEmpwtCount" resultType="Integer">
- SELECT COUNT(ID) FROM BIS_INSP_KEY_REGISTER r ,BIS_INSP_ALL_OBJ t
- WHERE r.obj_id=t.obj_id and r.REC_PERS_ID = #{persId}
- <include refid="choseSql"/>
- AND ENG_STA = #{engSta}
- <if test="sttm != null and sttm != '' and entm != null and entm != ''">
- AND r.INTM >= str_to_date(#{sttm},'%Y-%m-%d') AND r.INTM < DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d') , INTERVAL 1 DAY)
- </if>
- <if test="state != null and state != ''">
- AND case when r.state is null then '0' else r.state end = #{state}
- </if>
- </select>
- <select id="getPersRiverSupervisionEmpwtRunCount" parameterType="cn.com.goldenwater.dcproj.param.BriefReportParam" resultType="cn.com.goldenwater.dcproj.dto.RiverSupervisionEmpwtCount">
- SELECT B.GUID persId,B.PERS_NAME persName,B.ORG_ID basinId,B.ORG_NM basinName FROM
- (SELECT DISTINCT PERSID FROM BIS_INSP_ALL_RLATION
- WHERE ID LIKE '007%') A LEFT JOIN BIS_INSP_ALL_RLATION_PERS B
- ON A.PERSID = B.GUID
- WHERE B.GUID IS NOT NULL
- <if test="basinId != null and basinId != ''">
- AND CONCAT(#{type},B.ORG_ID) = #{basinId}
- </if>
- <if test="persName != null and persName != ''">
- AND B.PERS_NAME LIKE '%${persName}%'
- </if>
- </select>
- <select id="getPersRiverSupervisionWagaCount" parameterType="cn.com.goldenwater.dcproj.param.BriefReportParam" resultType="cn.com.goldenwater.dcproj.dto.RiverSupervisionWagaCount">
- SELECT B.GUID persId,B.PERS_NAME persName,B.ORG_ID basinId,B.ORG_NM basinName FROM
- (SELECT DISTINCT PERSID FROM BIS_INSP_ALL_RLATION
- WHERE ID LIKE '006%') A LEFT JOIN BIS_INSP_ALL_RLATION_PERS B
- ON A.PERSID = B.GUID
- WHERE B.GUID IS NOT NULL
- <if test="basinId != null and basinId != ''">
- AND CONCAT(#{type},B.ORG_ID) = #{basinId}
- </if>
- <if test="persName != null and persName != ''">
- AND B.PERS_NAME LIKE '%${persName}%'
- </if>
- </select>
- <select id="getPersWagaCount" resultType="Integer">
- SELECT COUNT(ID) FROM ATT_WAGA_RGSTR r,BIS_INSP_ALL_OBJ t
- WHERE r.obj_id=t.obj_id and r.PERS_ID = #{persId}
- <include refid="choseSql"/>
- <if test="engScal != null and engScal != ''">
- AND r.ENG_SCAL = #{engScal}
- </if>
- <if test='engScal == null'>
- AND r.ENG_SCAL IS NULL
- </if>
- <if test="sttm != null and sttm != '' and entm != null and entm != ''">
- AND r.INTM >= str_to_date(#{sttm},'%Y-%m-%d') AND r.INTM < DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d') , INTERVAL 1 DAY)
- </if>
- <if test="state != null and state != ''">
- AND case when r.state is null then '0' else r.state end = #{state}
- </if>
- </select>
- <select id="getPersCountById" resultType="cn.com.goldenwater.dcproj.dto.PersCountDto">
- SELECT id,COUNT(PERSID) as count FROM BIS_INSP_ALL_RLATION WHERE ID in (${groupId}) group By Id
- </select>
- <select id="getCwsAdNameDtoListByGroupIds" resultType="cn.com.goldenwater.dcproj.dto.AdNameDto">
- SELECT t1.id, AD.AD_NAME FROM
- (SELECT distinct b.id,SUBSTR(A.AD_CODE,1,2) subAd FROM ATT_AD_X_BASE A LEFT JOIN BIS_INSP_ALL_OBJ B ON A.AD_CODE = B.CODE
- WHERE B.PTYPE = '2' AND B.ID in (${groupId})) T1 LEFT JOIN ATT_AD_X_BASE AD ON
- CONCAT(T1.subAd,'0000000000') = AD.AD_CODE
- where length(t1.id) = 12
- </select>
- <select id="getCwsCountyCountById" resultType="cn.com.goldenwater.dcproj.dto.PersCountDto">
- SELECT t1.id,COUNT(AD.AD_NAME) as count FROM
- (SELECT distinct b.id,SUBSTR(A.AD_CODE,1,6) subAd FROM ATT_AD_X_BASE A LEFT JOIN BIS_INSP_ALL_OBJ B ON A.AD_CODE = B.CODE
- WHERE B.PTYPE = '2' AND B.ID in (${groupId}) ) T1 LEFT JOIN ATT_AD_X_BASE AD ON
- CONCAT(T1.subAd,'000000') = AD.AD_CODE
- group by t1.id
- </select>
- <select id="getVillageCountByGroupId" resultType="cn.com.goldenwater.dcproj.dto.PersCountDto">
- select A.type,C.id,count(*) as count from (
- select '1' as type,A.ENG_ID from BIS_INSP_SECSURVEY_VLG A
- union all
- select '2' as type,A.ENG_ID from BIS_INSP_WATERUSER_INFO A
- union all
- select '3' as type,A.ENG_ID from BIS_INSP_VLGDRINK_PROJ_MANAGE A
- union all
- select '4' as type,A.ENG_ID from BIS_INSP_PRO_SOURCE_PROTECT A
- ) A LEFT JOIN BIS_INSP_VILL_RGSTR B ON A.ENG_ID = B.ENG_ID
- LEFT JOIN BIS_INSP_ALL_OBJ C ON B.OBJ_ID = C.OBJ_ID
- where c.ptype = '2' and c.id in (${groupId})
- <if test="sttm != null and sttm != '' and entm != null and entm != ''">
- AND B.intm >= str_to_date(#{sttm},'%Y-%m-%d') AND t.uptm < DATE_ADD(str_to_date(#{entm},'%Y-%m-%d') , INTERVAL 1 DAY)
- </if>
- <if test="state != null and state != ''">
- AND case when B.state is null then '0' else B.state end = #{state}
- </if>
- group by A.type,C.id
- </select>
- <select id="getAllProCountByGroupId" resultType="cn.com.goldenwater.dcproj.dto.PersCountDto">
- select a.INSP_PBLM_CATE as type,b.id,COUNT(PBLM_ID) count from BIS_INSP_PBLM A LEFT JOIN BIS_INSP_ALL_OBJ B ON A.OBJ_ID = B.OBJ_ID
- <if test='type == "1" and type=="36"'>
- LEFT JOIN BIS_INSP_RSVR_RGSTR C ON A.OBJ_ID = C.OBJ_ID
- </if>
- <if test='type == "2"'>
- LEFT JOIN BIS_INSP_VILL_RGSTR C ON A.OBJ_ID = C.OBJ_ID
- </if>
- <if test='type == "3"'>
- LEFT JOIN BIS_INSP_WTDST_TRACK C ON A.OBJ_ID = C.OBJ_ID
- </if>
- <if test='type == "4"'>
- LEFT JOIN BIS_INSP_KEY_REGISTER C ON A.OBJ_ID = C.OBJ_ID
- </if>
- <if test='type == "6"'>
- LEFT JOIN ATT_WAGA_RGSTR C ON A.OBJ_ID = C.OBJ_ID
- </if>
- <if test='type == "7"'>
- LEFT JOIN BIS_INSP_KEY_REGISTER C ON A.OBJ_ID = C.OBJ_ID
- </if>
- <if test='type == "11"'>
- LEFT JOIN BIS_INSP_SD_RGSTR C ON A.OBJ_ID = C.OBJ_ID
- </if>
- <if test='type == "12"'>
- LEFT JOIN BIS_INSP_WIU_RGSTR C ON A.OBJ_ID = C.OBJ_ID
- </if>
- <if test='type == "13"'>
- LEFT JOIN BIS_INSP_SWHS_RGSTR C ON A.OBJ_ID = C.OBJ_ID
- </if>
- <if test='type == "14"'>
- LEFT JOIN BIS_INSP_WINT_RGSTR C ON A.OBJ_ID = C.OBJ_ID
- </if>
- <if test='type == "15"'>
- LEFT JOIN BIS_INSP_SVWT_AREA_RGSTR C ON A.OBJ_ID = C.OBJ_ID
- </if>
- <if test='type == "16"'>
- LEFT JOIN BIS_INSP_SVWT_WUNT_RGSTR C ON A.OBJ_ID = C.OBJ_ID
- </if>
- WHERE B.PTYPE = #{type} AND B.ID in (${groupId}) AND A.OBJ_TYPE = #{type}
- <if test="sttm != null and sttm != '' and entm != null and entm != ''">
- AND A.COLL_TIME >= str_to_date(#{sttm},'%Y-%m-%d') AND A.COLL_TIME < DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d') , INTERVAL 1 DAY)
- </if>
- <if test="state != null and state != '' and type != null and type != ''">
- AND case when C.state is null then '0' ELSE C.state end = #{state}
- </if>
- group by a.INSP_PBLM_CATE,b.id
- </select>
- <select id="getPersRsCountByPersIds" resultType="cn.com.goldenwater.dcproj.dto.PersCountDto">
- SELECT c.REC_PERS_ID as id,c.eng_scal as type,count(C.RGSTR_ID) as count FROM BIS_INSP_RSVR_RGSTR C
- where c.REC_PERS_ID is not null and c.REC_PERS_ID in (${persId})
- <if test="sttm != null and sttm != '' and entm != null and entm != ''">
- AND C.INTM >= str_to_date(#{sttm},'%Y-%m-%d') AND C.INTM < DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d') , INTERVAL 1 DAY)
- </if>
- <if test="state != null and state != ''">
- AND case when C.state is null then '0' else C.state end = #{state}
- </if>
- group by c.REC_PERS_ID,c.eng_scal
- </select>
- <select id="getPersAdFullNameDtoListByPersIds" parameterType="String" resultType="cn.com.goldenwater.dcproj.dto.AdNameDto">
- SELECT t.id,AD.AD_FULL_NAME adName
- FROM (select DISTINCT b.persId ID,A.AD_CODE AD_CODE
- from BIS_INSP_SEL_AREA A
- LEFT JOIN BIS_INSP_ALL_RLATION B
- ON A.ID = B.ID
- WHERE b.persid in (${persId}) and A.AD_CODE LIKE '__0000000000') T
- LEFT JOIN ATT_AD_X_BASE AD
- ON T.AD_CODE = AD.AD_CODE
- WHERE AD.AD_CODE IS NOT NULL
- </select>
- <select id="getPersAllProCountByPersIds" resultType="cn.com.goldenwater.dcproj.dto.PersCountDto">
- SELECT a.REC_PERS as id,a.insp_pblm_cate as type,count(A.PBLM_ID) as count FROM BIS_INSP_PBLM A
- <if test='type == "1"'>
- LEFT JOIN BIS_INSP_RSVR_RGSTR B ON A.OBJ_ID = B.OBJ_ID
- </if>
- <if test='type == "2"'>
- LEFT JOIN BIS_INSP_VILL_RGSTR B ON A.OBJ_ID = B.OBJ_ID
- </if>
- <if test='type == "3"'>
- LEFT JOIN BIS_INSP_WTDST_TRACK B ON A.OBJ_ID = B.OBJ_ID
- </if>
- <if test='type == "4"'>
- LEFT JOIN BIS_INSP_KEY_REGISTER B ON A.OBJ_ID = B.OBJ_ID
- </if>
- <if test='type == "6"'>
- LEFT JOIN ATT_WAGA_RGSTR B ON A.OBJ_ID = B.OBJ_ID
- </if>
- <if test='type == "7"'>
- LEFT JOIN BIS_INSP_KEY_REGISTER B ON A.OBJ_ID = B.OBJ_ID
- </if>
- <if test='type == "11"'>
- LEFT JOIN BIS_INSP_SD_RGSTR B ON A.OBJ_ID = B.OBJ_ID
- </if>
- <if test='type == "12"'>
- LEFT JOIN BIS_INSP_WIU_RGSTR B ON A.OBJ_ID = B.OBJ_ID
- </if>
- <if test='type == "13"'>
- LEFT JOIN BIS_INSP_SWHS_RGSTR B ON A.OBJ_ID = B.OBJ_ID
- </if>
- <if test='type == "14"'>
- LEFT JOIN BIS_INSP_WINT_RGSTR B ON A.OBJ_ID = B.OBJ_ID
- </if>
- <if test='type == "15"'>
- LEFT JOIN BIS_INSP_SVWT_AREA_RGSTR B ON A.OBJ_ID = B.OBJ_ID
- </if>
- <if test='type == "16"'>
- LEFT JOIN BIS_INSP_SVWT_WUNT_RGSTR B ON A.OBJ_ID = B.OBJ_ID
- </if>
- WHERE a.REC_PERS is not null and A.OBJ_TYPE = #{type} AND A.REC_PERS in (${persId})
- <if test="sttm != null and sttm != '' and entm != null and entm != ''">
- AND A.COLL_TIME >= str_to_date(#{sttm},'%Y-%m-%d') AND A.COLL_TIME < DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d') , INTERVAL 1 DAY)
- </if>
- <if test="state != null and state != '' and type != null and type != ''">
- AND case when B.state is null then '0' ELSE B.state end = #{state}
- </if>
- group by a.REC_PERS,a.insp_pblm_cate
- </select>
- <select id="getPersEmpwtCountByPersIds" resultType="cn.com.goldenwater.dcproj.dto.PersCountDto">
- SELECT REC_PERS_ID as id,ENG_STA as type,COUNT(ID) as COUNT FROM BIS_INSP_KEY_REGISTER
- WHERE REC_PERS_ID in (${persId}) and ENG_STA = #{engSta}
- <if test="sttm != null and sttm != '' and entm != null and entm != ''">
- AND INTM >= str_to_date(#{sttm},'%Y-%m-%d') AND INTM < DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d') , INTERVAL 1 DAY)
- </if>
- <if test="state != null and state != ''">
- AND case when state is null then '0' else state end = #{state}
- </if>
- group by REC_PERS_ID, ENG_STA
- </select>
- <select id="getOrgProList" parameterType="cn.com.goldenwater.dcproj.param.BriefReportParam" resultType="cn.com.goldenwater.dcproj.model.BriefReport">
- select ad.ad_code, ad.ad_name, a.code, b.pnm, a.num, a.type from (
- select A.id as code,A.code as ad_code,A.type,count(A.rgstrId) as num from (
- select substr(o.id, 1, 6) as id,
- substr(t.ad_code, 1, 2) as code,t.rgstrId,t.type from (
- select o.id, o.obj_id from bis_insp_all_obj o where o.ptype = #{objType}
- ) o left join
- <if test='objType == "9"'>
- (
- select t.id as rgstrId,t.obj_id,'' as type, t.ad_code,(case when t.state is null then '0' else t.state end)
- state,t.in_tm,t.up_tm from
- BIS_INSP_FSC_RGSTR t
- )
- </if>
- <if test='objType == "10"'>
- (select t.id as rgstrId,t.obj_id,'' as type, t.ad_code,(case when t.state is null then '0' else t.state end) state,t.in_tm,t.up_tm from
- BIS_INSP_OTHER_RGSTR t)
- </if>
- <if test='objType == "11"'>
- (select t.id as rgstrId,t.obj_id,'' as type, t.ad_code,(case when t.state is null then '0' else t.state end) state,t.in_tm,t.up_tm from
- BIS_INSP_SD_RGSTR t)
- </if>
- <if test='objType == "12"'>
- (select t.id as rgstrId,t.obj_id,'' as type, t.ad_code,(case when t.state is null then '0' else t.state end) state,t.in_tm,t.up_tm from
- BIS_INSP_WIU_RGSTR t)
- </if>
- <if test='objType == "13"'>
- (select t.id as rgstrId,t.obj_id,'' as type, t.ad_code,(case when t.state is null then '0' else t.state end) state,t.in_tm,t.up_tm from
- BIS_INSP_SWHS_RGSTR t)
- </if>
- <if test='objType == "14"'>
- (select t.id as rgstrId,t.obj_id,'' as type, t.ad_code,(case when t.state is null then '0' else t.state end) state,t.in_tm,t.up_tm from
- BIS_INSP_WINT_RGSTR t)
- </if>
- <if test='objType == "15"'>
- (select t.id as rgstrId,t.obj_id,'' as type, t.ad_code,(case when t.state is null then '0' else t.state end) state,t.in_tm,t.up_tm from
- BIS_INSP_SVWT_AREA_RGSTR t)
- </if>
- <if test='objType == "16"'>
- (select t.id as rgstrId,t.obj_id,'' as type, t.ad_code,(case when t.state is null then '0' else t.state end) state,t.in_tm,t.up_tm from
- BIS_INSP_SVWT_WUNT_RGSTR t)
- </if>
- t on o.obj_id = t.obj_id
- where t.obj_id is not null and length(o.id) > 3
- <if test="state != null and state != ''">
- AND t.state = #{state}
- </if>
- <if test="sttm != null and sttm != '' and entm != null and entm != ''">
- AND t.INTM >= str_to_date(#{sttm},'%Y-%m-%d') AND t.INTM < DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d') , INTERVAL 1 DAY)
- </if>
- )A group by A.id,A.code,A.type
- ) a left join BIS_INSP_ALL b
- on a.code = b.id
- left join att_ad_base ad
- on concat(a.ad_code, '0000000000') = ad.ad_code
- where 1=1
- <if test="orgName != null and orgName != ''">
- and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
- </if>
- <if test="adName != null and adName != ''">
- and ad.ad_name like CONCAT('%',CONCAT(#{adName}, '%'))
- </if>
- order by ad.ad_code,a.code
- </select>
- <select id="getOrgPblmList" parameterType="cn.com.goldenwater.dcproj.param.BriefReportParam" resultType="cn.com.goldenwater.dcproj.model.BriefReport">
- select AD.AD_CODE,AD.AD_NAME,a.code, b.pnm, a.num, a.type
- from (select SUBSTR(Q.AD_CODE,1,2) AS AD_CODE,q.code, count(q.pblm_id) as num, q.type FROM
- <if test='objType == "9"'>
- (
- select t.id as pblm_id,t.rect_conc as type,substr(o.id, 1, 6) as code,r.ad_code,t.in_tm,(case when r.state is null then '0' else r.state end) state from BIS_INSP_FSC_PBLM t left join Bis_Insp_Fsc_Rgstr r on t.rgstr_id = r.id left join bis_insp_all_obj o on r.obj_id = o.obj_id
- where r.obj_id is not null
- )
- </if>
- <if test='objType == "10"'>
- (select t.id as pblm_id,(case when t.rect_conc is null then '0' else t.rect_conc end) as type,substr(o.id, 1, 6) as code,r.ad_code,t.in_tm,(case when r.state is null then '0' else r.state end) state from BIS_INSP_OTHER_PBLM t left join Bis_Insp_OTHER_Rgstr r on t.rgstr_id = r.id left join bis_insp_all_obj o on r.obj_id = o.obj_id
- where r.obj_id is not null)
- </if>
- <if test='objType == "11"'>
- (select t.pblm_id,(case when t.INSP_PBLM_CATE is null then '0' else INSP_PBLM_CATE end) as type,substr(o.id, 1, 6) as code,r.ad_code,t.COLL_TIME as in_tm,(case when r.state is null then '0' else r.state end) state from Bis_Insp_Pblm t left join bis_insp_all_obj o on t.obj_id = o.obj_id left join BIS_INSP_SD_RGSTR r on o.obj_id = r.obj_id
- where t.obj_type = #{objType} and r.obj_id is not null)
- </if>
- <if test='objType == "12"'>
- (select t.pblm_id,(case when t.INSP_PBLM_CATE is null then '0' else INSP_PBLM_CATE end) as type,substr(o.id, 1, 6) as code,r.ad_code,t.COLL_TIME as in_tm,(case when r.state is null then '0' else r.state end) state from Bis_Insp_Pblm t left join bis_insp_all_obj o on t.obj_id = o.obj_id left join BIS_INSP_WIU_RGSTR r on o.obj_id = r.obj_id
- where t.obj_type = #{objType} and r.obj_id is not null)
- </if>
- <if test='objType == "13"'>
- (select t.pblm_id,(case when t.INSP_PBLM_CATE is null then '0' else INSP_PBLM_CATE end) as type,substr(o.id, 1, 6) as code,r.ad_code,t.COLL_TIME as in_tm,(case when r.state is null then '0' else r.state end) state from Bis_Insp_Pblm t left join bis_insp_all_obj o on t.obj_id = o.obj_id left join BIS_INSP_SWHS_RGSTR r on o.obj_id = r.obj_id
- where t.obj_type = #{objType} and r.obj_id is not null)
- </if>
- <if test='objType == "14"'>
- (select t.pblm_id,(case when t.INSP_PBLM_CATE is null then '0' else INSP_PBLM_CATE end) as type,substr(o.id, 1, 6) as code,r.ad_code,t.COLL_TIME as in_tm,(case when r.state is null then '0' else r.state end) state from Bis_Insp_Pblm t left join bis_insp_all_obj o on t.obj_id = o.obj_id left join BIS_INSP_WINT_RGSTR r on o.obj_id = r.obj_id
- where t.obj_type = #{objType} and r.obj_id is not null)
- </if>
- <if test='objType == "15"'>
- (select t.pblm_id,(case when t.INSP_PBLM_CATE is null then '0' else INSP_PBLM_CATE end) as type,substr(o.id, 1, 6) as code,r.ad_code,t.COLL_TIME as in_tm,(case when r.state is null then '0' else r.state end) state from Bis_Insp_Pblm t left join bis_insp_all_obj o on t.obj_id = o.obj_id left join BIS_INSP_SVWT_AREA_RGSTR r on o.obj_id = r.obj_id
- where t.obj_type = #{objType} and r.obj_id is not null)
- </if>
- <if test='objType == "16"'>
- (select t.pblm_id,(case when t.INSP_PBLM_CATE is null then '0' else INSP_PBLM_CATE end) as type,substr(o.id, 1, 6) as code,r.ad_code,t.COLL_TIME as in_tm,(case when r.state is null then '0' else r.state end) state from Bis_Insp_Pblm t left join bis_insp_all_obj o on t.obj_id = o.obj_id left join BIS_INSP_SVWT_WUNT_RGSTR r on o.obj_id = r.obj_id
- where t.obj_type = #{objType} and r.obj_id is not null)
- </if>
- q where q.ad_code is not null and length(q.code)=6
- <if test="sttm != null and sttm != ''">
- and q.in_tm >= str_to_date(#{sttm}, '%Y-%m-%d')
- </if>
- <if test="entm != null and entm != ''">
- and q.in_tm < DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d') , INTERVAL 1 DAY)
- </if>
- <if test="state != null and state != ''">
- AND q.state = #{state}
- </if>
- group by SUBSTR(Q.AD_CODE,1,2),q.code, q.TYPE ) a
- left join BIS_INSP_ALL b
- on a.code = b.id
- LEFT JOIN ATT_AD_X_BASE AD ON CONCAT(A.AD_CODE,'0000000000') = AD.AD_CODE
- where a.code is not null
- <if test="orgName != null and orgName != ''">
- and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
- </if>
- <if test="adName != null and adName != ''">
- and ad.ad_name like CONCAT('%',CONCAT(#{adName}, '%'))
- </if>
- order by a.AD_CODE,a.code
- </select>
- <select id="getOrgWorkProCountList" parameterType="cn.com.goldenwater.dcproj.param.BriefReportParam" resultType="cn.com.goldenwater.dcproj.model.BriefReport">
- select a.code, b.pnm, a.num
- from (select q.id as code, count(distinct q.code) as num
- from (select substr(o.id, 1, 6) as id,
- substr(t.ad_code, 1, 2) as code
- from
- <if test='objType == "9"'>
- BIS_INSP_FSC_RGSTR
- </if>
- <if test='objType == "10"'>
- BIS_INSP_OTHER_RGSTR
- </if>
- <if test='objType == "11"'>
- BIS_INSP_SD_RGSTR
- </if>
- <if test='objType == "12"'>
- BIS_INSP_WIU_RGSTR
- </if>
- <if test='objType == "13"'>
- BIS_INSP_SWHS_RGSTR
- </if>
- <if test='objType == "14"'>
- BIS_INSP_WINT_RGSTR
- </if>
- <if test='objType == "15"'>
- BIS_INSP_SVWT_AREA_RGSTR
- </if>
- <if test='objType == "16"'>
- BIS_INSP_SVWT_WUNT_RGSTR
- </if>
- t left join bis_insp_all_obj o
- on t.obj_id = o.obj_id
- where o.id not like '001016%'
- and o.id not like '001017%'
- and length(o.id) > 3
- <if test="state != null and state != ''">
- AND case when t.state is null then '0' else t.state end = #{state}
- </if>
- ) q
- group by q.id) a
- left join BIS_INSP_ALL b
- on a.code = b.id
- where 1=1
- <if test="orgName != null and orgName != ''">
- and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
- </if>
- order by a.code
- </select>
- <select id="getOrgWorkCtCountList" parameterType="cn.com.goldenwater.dcproj.param.BriefReportParam" resultType="cn.com.goldenwater.dcproj.model.BriefReport">
- select a.code, b.pnm, a.num
- from (select q.id as code, count(distinct q.code) as num
- from (select substr(o.id, 1, 6) as id,
- substr(t.ad_code, 1, 6) as code
- from
- <if test='objType == "9"'>
- BIS_INSP_FSC_RGSTR
- </if>
- <if test='objType == "10"'>
- BIS_INSP_OTHER_RGSTR
- </if>
- <if test='objType == "11"'>
- BIS_INSP_SD_RGSTR
- </if>
- <if test='objType == "12"'>
- BIS_INSP_WIU_RGSTR
- </if>
- <if test='objType == "13"'>
- BIS_INSP_SWHS_RGSTR
- </if>
- <if test='objType == "14"'>
- BIS_INSP_WINT_RGSTR
- </if>
- <if test='objType == "15"'>
- BIS_INSP_SVWT_AREA_RGSTR
- </if>
- <if test='objType == "16"'>
- BIS_INSP_SVWT_WUNT_RGSTR
- </if>
- t left join bis_insp_all_obj o
- on t.obj_id = o.obj_id
- where o.id not like '001016%'
- and o.id not like '001017%'
- and length(o.id) > 3
- <if test="state != null and state != ''">
- AND case when t.state is null then '0' else t.state end = #{state}
- </if>
- ) q
- group by q.id) a
- left join BIS_INSP_ALL b
- on a.code = b.id
- where 1=1
- <if test="orgName != null and orgName != ''">
- and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
- </if>
- order by a.code
- </select>
- <select id="getOrgWorkObjCountListByType" parameterType="cn.com.goldenwater.dcproj.param.BriefReportParam" resultType="cn.com.goldenwater.dcproj.model.BriefReport">
- select a.code, b.pnm, a.num,a.type
- from (select q.id as code,q.type, count(q.code) as num
- from (select substr(o.id, 1, 6) as id,
- substr(t.ad_code, 1, 6) as code,t.type
- from
- <if test='objType == "9"'>
- (SELECT t.ad_Code,'' as type, t.obj_id, (case when t.state is null then '0' else t.state end) state from BIS_INSP_FSC_RGSTR t)
- </if>
- <if test='objType == "10"'>
- (SELECT t.ad_Code,'' as type, t.obj_id, (case when t.state is null then '0' else t.state end) state from BIS_INSP_OTHER_RGSTR t)
- </if>
- <if test='objType == "11"'>
- (SELECT t.ad_Code,'' as type, t.obj_id, (case when t.state is null then '0' else t.state end) state from BIS_INSP_SD_RGSTR t)
- </if>
- <if test='objType == "12"'>
- (SELECT t.ad_Code,'' as type, t.obj_id, (case when t.state is null then '0' else t.state end) state from BIS_INSP_WIU_RGSTR t)
- </if>
- <if test='objType == "13"'>
- (SELECT t.ad_Code,'' as type, t.obj_id, (case when t.state is null then '0' else t.state end) state from BIS_INSP_SWHS_RGSTR t)
- </if>
- <if test='objType == "14"'>
- (SELECT t.ad_Code,'' as type, t.obj_id, (case when t.state is null then '0' else t.state end) state from BIS_INSP_WINT_RGSTR t)
- </if>
- <if test='objType == "15"'>
- (SELECT t.ad_Code,'' as type, t.obj_id, (case when t.state is null then '0' else t.state end) state from BIS_INSP_SVWT_AREA_RGSTR t)
- </if>
- <if test='objType == "16"'>
- (SELECT t.ad_Code,'' as type, t.obj_id, (case when t.state is null then '0' else t.state end) state from BIS_INSP_SVWT_WUNT_RGSTR t)
- </if>
- t left join bis_insp_all_obj o
- on t.obj_id = o.obj_id
- where o.id not like '001016%'
- and o.id not like '001017%'
- and length(o.id) > 3
- <if test="state != null and state != ''">
- AND t.state = #{state}
- </if>
- <if test="sttm != null and sttm != '' and entm != null and entm != ''">
- AND t.INTM >= str_to_date(#{sttm},'%Y-%m-%d') AND t.INTM < DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d') , INTERVAL 1 DAY)
- </if>
- ) q
- group by q.id, q.type) a
- left join BIS_INSP_ALL b
- on a.code = b.id
- where 1=1
- <if test="orgName != null and orgName != ''">
- and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
- </if>
- order by a.code
- </select>
- <select id="getPblmCountListByType" parameterType="cn.com.goldenwater.dcproj.param.BriefReportParam" resultType="cn.com.goldenwater.dcproj.model.BriefReport">
- select a.code, b.pnm, a.num, a.type
- from (select q.code,q.type, count(q.pblm_id) as num
- from (
- select t.*
- from
- <if test='objType == "9"'>
- (
- select t.id as pblm_id,t.rect_conc as type,substr(o.id, 1, 6) as code,r.ad_code,t.in_tm,(case when r.state is null then '0' else r.state end) state from BIS_INSP_FSC_PBLM t left join Bis_Insp_Fsc_Rgstr r on t.rgstr_id = r.id left join bis_insp_all_obj o on r.obj_id = o.obj_id
- where r.obj_id is not null
- )
- </if>
- <if test='objType == "10"'>
- (select t.id as pblm_id,(case when t.rect_conc is null then '0' else t.rect_conc end) as type,substr(o.id, 1, 6) as code,r.ad_code,t.in_tm,(case when r.state is null then '0' else r.state end) state from BIS_INSP_OTHER_PBLM t left join Bis_Insp_OTHER_Rgstr r on t.rgstr_id = r.id left join bis_insp_all_obj o on r.obj_id = o.obj_id
- where r.obj_id is not null)
- </if>
- <if test='objType == "11"'>
- (select t.pblm_id,(case when t.INSP_PBLM_CATE is null then '0' else INSP_PBLM_CATE end) as type,substr(o.id, 1, 6) as code,r.ad_code,t.COLL_TIME as in_tm,(case when r.state is null then '0' else r.state end) state from Bis_Insp_Pblm t left join bis_insp_all_obj o on t.obj_id = o.obj_id left join BIS_INSP_SD_RGSTR r on o.obj_id = r.obj_id
- where t.obj_type = #{objType} and r.obj_id is not null)
- </if>
- <if test='objType == "12"'>
- (select t.pblm_id,(case when t.INSP_PBLM_CATE is null then '0' else INSP_PBLM_CATE end) as type,substr(o.id, 1, 6) as code,r.ad_code,t.COLL_TIME as in_tm,(case when r.state is null then '0' else r.state end) state from Bis_Insp_Pblm t left join bis_insp_all_obj o on t.obj_id = o.obj_id left join BIS_INSP_WIU_RGSTR r on o.obj_id = r.obj_id
- where t.obj_type = #{objType} and r.obj_id is not null)
- </if>
- <if test='objType == "13"'>
- (select t.pblm_id,(case when t.INSP_PBLM_CATE is null then '0' else INSP_PBLM_CATE end) as type,substr(o.id, 1, 6) as code,r.ad_code,t.COLL_TIME as in_tm,(case when r.state is null then '0' else r.state end) state from Bis_Insp_Pblm t left join bis_insp_all_obj o on t.obj_id = o.obj_id left join BIS_INSP_SWHS_RGSTR r on o.obj_id = r.obj_id
- where t.obj_type = #{objType} and r.obj_id is not null)
- </if>
- <if test='objType == "14"'>
- (select t.pblm_id,(case when t.INSP_PBLM_CATE is null then '0' else INSP_PBLM_CATE end) as type,substr(o.id, 1, 6) as code,r.ad_code,t.COLL_TIME as in_tm,(case when r.state is null then '0' else r.state end) state from Bis_Insp_Pblm t left join bis_insp_all_obj o on t.obj_id = o.obj_id left join BIS_INSP_WINT_RGSTR r on o.obj_id = r.obj_id
- where t.obj_type = #{objType} and r.obj_id is not null)
- </if>
- <if test='objType == "15"'>
- (select t.pblm_id,(case when t.INSP_PBLM_CATE is null then '0' else INSP_PBLM_CATE end) as type,substr(o.id, 1, 6) as code,r.ad_code,t.COLL_TIME as in_tm,(case when r.state is null then '0' else r.state end) state from Bis_Insp_Pblm t left join bis_insp_all_obj o on t.obj_id = o.obj_id left join BIS_INSP_SVWT_AREA_RGSTR r on o.obj_id = r.obj_id
- where t.obj_type = #{objType} and r.obj_id is not null)
- </if>
- <if test='objType == "16"'>
- (select t.pblm_id,(case when t.INSP_PBLM_CATE is null then '0' else INSP_PBLM_CATE end) as type,substr(o.id, 1, 6) as code,r.ad_code,t.COLL_TIME as in_tm,(case when r.state is null then '0' else r.state end) state from Bis_Insp_Pblm t left join bis_insp_all_obj o on t.obj_id = o.obj_id left join BIS_INSP_SVWT_WUNT_RGSTR r on o.obj_id = r.obj_id
- where t.obj_type = #{objType} and r.obj_id is not null)
- </if>
- t
- where 1=1
- <!--t.rec_pers not in
- (select guid from bis_insp_all_rlation_pers where org_id = '1209')-->
- <if test="sttm != null and sttm != ''">
- and t.in_tm >= str_to_date(#{sttm}, '%Y-%m-%d')
- </if>
- <if test="entm != null and entm != ''">
- and t.in_tm < DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d') , INTERVAL 1 DAY)
- </if>
- <if test="state != null and state != ''">
- AND t.state = #{state}
- </if>
- ) q
- group by q.code, q.type) a
- left join BIS_INSP_ALL b
- on a.code = b.id
- where a.code is not null
- <if test="orgName != null and orgName != ''">
- and b.pnm like CONCAT('%',CONCAT(#{orgName}, '%'))
- </if>
- order by a.code
- </select>
- <select id="getRiverSupervisionCount" parameterType="cn.com.goldenwater.dcproj.param.BriefReportParam" resultType="cn.com.goldenwater.dcproj.dto.RiverSupervisionRivCount">
- select A.ID basinId,A.PNM basinName,C.ID groupId,C.PNM groupName from BIS_INSP_ALL A LEFT JOIN BIS_INSP_ALL B ON
- A.ID = B.PID
- LEFT JOIN BIS_INSP_ALL C ON B.ID = C.PID WHERE 1 = 1
- <if test="basinId != null and basinId != ''">
- AND A.ID = #{basinId}
- </if>
- <if test="sttm != null and sttm != '' and entm != null and entm != ''">
- AND ((C.STTM <= str_to_date(#{sttm},'%Y-%m-%d') AND C.ENTM > DATE_ADD(str_to_date(#{sttm},'%Y-%m-%d') , INTERVAL 1 DAY) ) OR
- (C.STTM <= str_to_date(#{entm},'%Y-%m-%d') AND C.ENTM > DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d') , INTERVAL 1 DAY) ))
- </if>
- AND A.ID LIKE '${objType}___'
- ORDER BY A.ID
- </select>
- <select id="getAdNameDtoListByGroupIds" resultType="cn.com.goldenwater.dcproj.dto.AdNameDto" parameterType="java.util.Map">
- SELECT t1.id, AD.AD_NAME FROM
- (SELECT distinct b.id,SUBSTR(A.AD_CODE,1,2) subAd FROM
- <if test='objType == "9"'>
- BIS_INSP_FSC_RGSTR
- </if>
- <if test='objType == "10"'>
- BIS_INSP_OTHER_RGSTR
- </if>
- <if test='objType == "11"'>
- BIS_INSP_SD_RGSTR
- </if>
- <if test='objType == "12"'>
- BIS_INSP_WIU_RGSTR
- </if>
- <if test='objType == "13"'>
- BIS_INSP_SWHS_RGSTR
- </if>
- <if test='objType == "14"'>
- BIS_INSP_WINT_RGSTR
- </if>
- <if test='objType == "15"'>
- BIS_INSP_SVWT_AREA_RGSTR
- </if>
- <if test='objType == "16"'>
- BIS_INSP_SVWT_WUNT_RGSTR
- </if>
- A LEFT JOIN BIS_INSP_ALL_OBJ B ON A.OBJ_ID =
- B.OBJ_ID
- WHERE B.PTYPE = #{objType} AND B.ID in (${groupId})) T1 LEFT JOIN ATT_AD_X_BASE AD ON
- CONCAT(T1.subAd,'0000000000') = AD.AD_CODE
- where length(t1.id) = 12
- </select>
- <select id="getGroupCountyCountById" resultType="cn.com.goldenwater.dcproj.dto.PersCountDto" parameterType="java.util.Map">
- SELECT t1.id,COUNT(AD.AD_NAME) as count FROM
- (SELECT distinct b.id,SUBSTR(A.AD_CODE,1,6) subAd FROM
- <if test='objType == "9"'>
- BIS_INSP_FSC_RGSTR
- </if>
- <if test='objType == "10"'>
- BIS_INSP_OTHER_RGSTR
- </if>
- <if test='objType == "11"'>
- BIS_INSP_SD_RGSTR
- </if>
- <if test='objType == "12"'>
- BIS_INSP_WIU_RGSTR
- </if>
- <if test='objType == "13"'>
- BIS_INSP_SWHS_RGSTR
- </if>
- <if test='objType == "14"'>
- BIS_INSP_WINT_RGSTR
- </if>
- <if test='objType == "15"'>
- BIS_INSP_SVWT_AREA_RGSTR
- </if>
- <if test='objType == "16"'>
- BIS_INSP_SVWT_WUNT_RGSTR
- </if>
- A LEFT JOIN BIS_INSP_ALL_OBJ B ON A.OBJ_ID = B.OBJ_ID
- WHERE B.PTYPE = #{objType} AND B.ID in (${groupId})) T1 LEFT JOIN ATT_AD_X_BASE AD ON
- CONCAT(T1.subAd,'000000') = AD.AD_CODE
- group by t1.id
- </select>
- <select id="getGroupCountByGroupId" resultType="cn.com.goldenwater.dcproj.dto.PersCountDto" parameterType="java.util.Map">
- SELECT t.TYPE ,b.id,COUNT(t.RGSTR_ID) as count FROM
- (
- <if test='objType == "9"'>
- SELECT t.id as RGSTR_ID,'' as type, t.obj_id, (case when t.state is null then '0' else t.state end) state from BIS_INSP_FSC_RGSTR t
- </if>
- <if test='objType == "10"'>
- SELECT t.id as RGSTR_ID,'' as type, t.obj_id, (case when t.state is null then '0' else t.state end) state from BIS_INSP_OTHER_RGSTR t
- </if>
- <if test='objType == "11"'>
- SELECT t.id as RGSTR_ID,'' as type, t.obj_id, (case when t.state is null then '0' else t.state end) state from BIS_INSP_SD_RGSTR t
- </if>
- <if test='objType == "12"'>
- SELECT t.id as RGSTR_ID,'' as type, t.obj_id, (case when t.state is null then '0' else t.state end) state from BIS_INSP_WIU_RGSTR t
- </if>
- <if test='objType == "13"'>
- SELECT t.id as RGSTR_ID,'' as type, t.obj_id, (case when t.state is null then '0' else t.state end) state from BIS_INSP_SWHS_RGSTR t
- </if>
- <if test='objType == "14"'>
- SELECT t.id as RGSTR_ID,'' as type, t.obj_id, (case when t.state is null then '0' else t.state end) state from BIS_INSP_WINT_RGSTR t
- </if>
- <if test='objType == "15"'>
- SELECT t.id as RGSTR_ID,'' as type, t.obj_id, (case when t.state is null then '0' else t.state end) state from BIS_INSP_SVWT_AREA_RGSTR t
- </if>
- <if test='objType == "16"'>
- SELECT t.id as RGSTR_ID,'' as type, t.obj_id, (case when t.state is null then '0' else t.state end) state from BIS_INSP_SVWT_WUNT_RGSTR t
- </if>
- )t LEFT JOIN BIS_INSP_ALL_OBJ B ON t.OBJ_ID = B.OBJ_ID
- WHERE B.ID in (${groupId}) AND B.PTYPE = ${objType}
- <if test="state != null and state != ''">
- AND t.state end = #{state}
- </if>
- group by t.type,b.id
- </select>
- <select id="getFscOrOthProCountByGroupId" resultType="cn.com.goldenwater.dcproj.dto.PersCountDto" parameterType="cn.com.goldenwater.dcproj.param.BriefReportParam">
- select t.type,t.id,COUNT(t.PBLM_ID) count from
- <if test='objType == "009"'>
- (
- select t.id as pblm_id,t.rect_conc as type,o.id,r.ad_code,t.in_tm,(case when r.state is null then '0' else r.state end) state from BIS_INSP_FSC_PBLM t left join Bis_Insp_Fsc_Rgstr r on t.rgstr_id = r.id left join bis_insp_all_obj o on r.obj_id = o.obj_id
- where r.obj_id is not null
- )
- </if>
- <if test='objType == "010"'>
- (select t.id as pblm_id,(case when t.rect_conc is null then '0' else t.rect_conc end) as type,o.id,r.ad_code,t.in_tm,(case when r.state is null then '0' else r.state end) state from BIS_INSP_OTHER_PBLM t left join Bis_Insp_OTHER_Rgstr r on t.rgstr_id = r.id left join bis_insp_all_obj o on r.obj_id = o.obj_id
- where r.obj_id is not null)
- </if>
- t
- WHERE t.ID in (${groupId})
- <if test="sttm != null and sttm != '' and entm != null and entm != ''">
- AND t.IN_TM >= str_to_date(#{sttm},'%Y-%m-%d') AND t.IN_TM < DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d') , INTERVAL 1 DAY)
- </if>
- <if test="state != null and state != '' and type != null and type != ''">
- AND t.state = #{state}
- </if>
- group by t.type,t.id
- </select>
- <select id="getPersWorkSupervisionInfo" parameterType="cn.com.goldenwater.dcproj.param.BriefReportParam"
- resultType="cn.com.goldenwater.dcproj.dto.RiverSupervisionRivCount">
- SELECT B.GUID persId,B.PERS_NAME persName,B.ORG_ID basinId,B.ORG_NM basinName FROM
- (SELECT DISTINCT PERSID FROM BIS_INSP_ALL_RLATION
- WHERE ID LIKE '${objType}%') A LEFT JOIN BIS_INSP_ALL_RLATION_PERS B
- ON A.PERSID = B.GUID
- WHERE B.GUID IS NOT NULL
- <if test="basinId != null and basinId != ''">
- AND CONCAT(#{type},B.ORG_ID) = #{basinId}
- </if>
- <if test="persName != null and persName != ''">
- AND B.PERS_NAME LIKE '%${persName}%'
- </if>
- </select>
- <select id="getPersCountByPersIds" resultType="cn.com.goldenwater.dcproj.dto.PersCountDto" parameterType="cn.com.goldenwater.dcproj.param.BriefReportParam">
- SELECT c.pers_id as id,c.type,count(*) as count FROM
- (
- <if test='objType == "009"'>
- select t.pers_id,'' as type,t.IN_TM,(case when t.state is null then '0' else t.state end) state from BIS_INSP_FSC_RGSTR t
- </if>
- <if test='objType == "010"'>
- select t.pers_id,'' as type,t.IN_TM,(case when t.state is null then '0' else t.state end) state from BIS_INSP_OTHER_RGSTR t
- </if>
- <if test='objType == "011"'>
- select t.pers_id,'' as type,t.IN_TM,(case when t.state is null then '0' else t.state end) state from BIS_INSP_SD_RGSTR t
- </if>
- <if test='objType == "012"'>
- select t.pers_id,'' as type,t.IN_TM,(case when t.state is null then '0' else t.state end) state from BIS_INSP_WIU_RGSTR t
- </if>
- <if test='objType == "013"'>
- select t.pers_id,'' as type,t.IN_TM,(case when t.state is null then '0' else t.state end) state from BIS_INSP_SWHS_RGSTR t
- </if>
- <if test='objType == "014"'>
- select t.pers_id,'' as type,t.IN_TM,(case when t.state is null then '0' else t.state end) state from BIS_INSP_WINT_RGSTR t
- </if>
- <if test='objType == "015"'>
- select t.pers_id,'' as type,t.IN_TM,(case when t.state is null then '0' else t.state end) state from BIS_INSP_SVWT_AREA_RGSTR t
- </if>
- <if test='objType == "016"'>
- select t.pers_id,'' as type,t.IN_TM,(case when t.state is null then '0' else t.state end) state from BIS_INSP_SVWT_WUNT_RGSTR t
- </if>
- ) c
- where c.pers_id is not null and c.pers_id in (${persIds})
- <if test="sttm != null and sttm != '' and entm != null and entm != ''">
- AND C.INTM >= str_to_date(#{sttm},'%Y-%m-%d') AND C.INTM < DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d') , INTERVAL 1 DAY)
- </if>
- <if test="state != null and state != ''">
- AND c.state = #{state}
- </if>
- group by c.pers_id,c.type
- </select>
- <select id="getPersFscOrOthProCountByPersIds" resultType="cn.com.goldenwater.dcproj.dto.PersCountDto" parameterType="cn.com.goldenwater.dcproj.param.BriefReportParam">
- SELECT a.pers_id as id,a.type,count(A.id) as count FROM (
- <if test='objType == "009"'>
- SELECT p.id,p.pers_id,p.RECT_CONC as type,p.IN_TM,(case when r.state is null then '0' else r.state end) state from bis_insp_fsc_pblm p left join BIS_INSP_FSC_RGSTR r on p.rgstr_id = r.id
- where r.id is not null
- </if>
- <if test='objType == "010"'>
- SELECT p.id,p.pers_id,p.RECT_CONC as type,p.IN_TM,(case when r.state is null then '0' else r.state end) state from bis_insp_OTHER_pblm p left join BIS_INSP_OTHER_RGSTR r on p.rgstr_id = r.id
- where r.id is not null
- </if>
- ) a
- WHERE a.pers_id is not null AND A.pers_id in (${persIds})
- <if test="sttm != null and sttm != '' and entm != null and entm != ''">
- AND A.IN_TM >= str_to_date(#{sttm},'%Y-%m-%d') AND A.IN_TM < DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d') , INTERVAL 1 DAY)
- </if>
- <if test="state != null and state != '' and type != null and type != ''">
- AND a.state = #{state}
- </if>
- group by a.pers_id,a.type
- </select>
- </mapper>
|