BriefReportDao.xml 130 KB

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