| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
- <mapper namespace="cn.com.goldenwater.dcproj.dao.GeneralDownloadDao">
- <select id="getCodeByEngId" resultType="string">
- select code from BIS_INSP_ALL_OBJ o left join BIS_INSP_VILL_RGSTR r on o.obj_id = r.obj_id
- where r.eng_id = #{engId} and rownum = 1
- </select>
- <select id="getCodeById" resultType="map">
- select * from BIS_INSP_ALL_OBJ where id = #{id}
- </select>
- <select id="getRyNode" resultType="cn.com.goldenwater.dcproj.model.BisInspAll">
- select distinct rgstr.eng_id id, obj.id pid, obj.nm pnm
- from BIS_INSP_ALL_OBJ obj left join BIS_INSP_VILL_RGSTR rgstr
- on obj.obj_id = rgstr.obj_id
- WHERE ENG_ID IS NOT NULL
- AND ID LIKE '002%' ORDER BY ID
- </select>
- <select id="getNodeProvincialExceptGroup" resultType="cn.com.goldenwater.dcproj.model.BisInspAll">
- SELECT * FROM (
- SELECT
- ID,PID,PNM,STTM,ENTM
- FROM BIS_INSP_ALL T
- WHERE LENGTH(ID) < 12
- AND REGEXP_LIKE(
- Id,'^('||
- ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{userid} and id like '${orgType}%')>0 then
- (SELECT LISTAGG(id, '|') as
- id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{userid} and id like '${orgType}%' GROUP BY PERSID)
- else (select 'non' from dual) end)
- ||')')
- <if test="province != null and province != ''">
- AND T.PROVINCE LIKE '${province}%'
- </if>
- <if test="year != null and year != ''">
- AND ( TO_CHAR(T.STTM, 'yyyy') = #{year} OR LENGTH(ID) = 6 )
- </if>
- AND ID LIKE '${orgType}%'
- <if test="level == '3'.toString()">
- UNION
- select DISTINCT b.ad_code id,substr(t.id,0,9) pid,b.ad_name pnm,null sttm,null entm from BIS_INSP_SEL_AREA t
- left join ATT_AD_BASE b on substr(t.ad_code,0,4)||'00000000' = b.ad_code
- where t.id like '${orgType}%'
- and REGEXP_LIKE(
- t.id,'^('||
- ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{userid} and id like '${orgType}%')>0
- then
- (SELECT LISTAGG(id, '|') as
- id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{userid} and id like '${orgType}%' GROUP BY PERSID)
- else (select 'non' from dual) end)
- ||')')
- <if test="province != null and province != ''">
- And t.ad_code like '${province}%'
- </if>
- </if>
- <if test="level == '4'.toString()">
- UNION
- select DISTINCT b.ad_code || substr(id,0,9) id,substr(t.id,0,9) pid,b.ad_name pnm,null sttm,null entm from
- BIS_INSP_SEL_AREA t
- left join ATT_AD_BASE b on substr(t.ad_code,0,4)||'00000000' = b.ad_code
- where t.id like '${orgType}%'
- and REGEXP_LIKE(
- t.id,'^('||
- ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{userid} and id like '${orgType}%')>0
- then
- (SELECT LISTAGG(id, '|') as
- id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{userid} and id like '${orgType}%' GROUP BY PERSID)
- else (select 'non' from dual) end)
- ||')')
- <if test="province != null and province != ''">
- And t.ad_code like '${province}%'
- </if>
- UNION
- select DISTINCT b.ad_code id,b.ad_fcode || substr(t.id,0,9) pid,b.ad_name pnm,null sttm,null entm from
- BIS_INSP_SEL_AREA t
- left join ATT_AD_BASE b on substr(t.ad_code,0,6)||'000000' = b.ad_code
- where t.id like '${orgType}%' and length(rtrim(t.ad_code,'00')) >= 5
- and REGEXP_LIKE(
- t.id,'^('||
- ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{userid} and id like '${orgType}%')>0
- then
- (SELECT LISTAGG(id, '|') as
- id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{userid} and id like '${orgType}%' GROUP BY PERSID)
- else (select 'non' from dual) end)
- ||')')
- <if test="province != null and province != ''">
- And t.ad_code like '${province}%'
- </if>
- </if>
- ) order by id
- </select>
- <select id="getRyNodeProvincial" resultType="cn.com.goldenwater.dcproj.model.BisInspAll">
- select * from (
- select id,pid,pnm,sttm,entm from
- BIS_INSP_ALL t where
- REGEXP_LIKE(
- Id,'^('||
- ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{userid} and id like '${orgType}%')>0 then
- (SELECT LISTAGG(id, '|') as
- id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{userid} and id like '${orgType}%' GROUP BY PERSID)
- else (select 'non' from dual) end)
- ||')')
- <if test="level == '1'.toString()">
- AND LENGTH(id) <=6
- </if>
- <if test="province != null and province != ''">
- And t.province like '${province}%'
- </if>
- AND ID LIKE '${orgType}%'
- <if test="orgType != '001' and orgType != '006' and orgType !='036' and orgType !='022'and orgType !='023'">
- UNION
- select b.ad_code id,substr(id,0,6) pid,b.ad_name pnm,null as sttm,null as entm
- from BIS_INSP_ALL_OBJ o left join ATT_AD_X_BASE b on substr(o.code,0,2)||'0000000000' = b.ad_code
- where
- REGEXP_LIKE(
- o.id,'^('||
- ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{userid} and id like '${orgType}%')>0
- then
- (SELECT LISTAGG(id, '|') as
- id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{userid} and id like '${orgType}%' GROUP BY PERSID)
- else (select 'non' from dual) end)
- ||')')
- AND o.id like '${orgType}%'
- </if>
- <if test="level == '3'.toString()">
- UNION
- select distinct b.ad_code id,o.id as pid,b.ad_name pnm,null as sttm,null as entm
- from BIS_INSP_ALL_OBJ o left join ATT_AD_X_BASE b on substr(o.code,0,4)||'00000000' = b.ad_code
- left join (select distinct substr(ad_code,0,4) as ad_code,id from BIS_INSP_SEL_AREA where id like
- '${orgType}%') c on c.id = o.id
- where
- REGEXP_LIKE(
- o.id,'^('||
- ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{userid} and id like '${orgType}%')>0
- then
- (SELECT LISTAGG(id, '|') as
- id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{userid} and id like '${orgType}%' GROUP BY PERSID)
- else (select 'non' from dual) end)
- ||')')
- AND o.id like '${orgType}%'
- AND o.id IS NOT NULL
- and substr(o.code,0,4) = c.ad_code
- <if test="province != null and province != ''">
- And c.ad_code like '${province}%'
- </if>
- </if>
- <if test="level == '4'.toString()">
- UNION
- select distinct b.ad_code||o.id as id,o.id pid,b.ad_name pnm,null as sttm,null as entm
- from BIS_INSP_ALL_OBJ o left join ATT_AD_X_BASE b on substr(o.code,0,4)||'00000000' = b.ad_code
- left join (select distinct substr(ad_code,0,4) as ad_code,id from BIS_INSP_SEL_AREA where id like
- '${orgType}%') c on c.id = o.id
- where
- REGEXP_LIKE(
- o.id,'^('||
- ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{userid} and id like '${orgType}%')>0
- then
- (SELECT LISTAGG(id, '|') as
- id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{userid} and id like '${orgType}%' GROUP BY PERSID)
- else (select 'non' from dual) end)
- ||')')
- AND o.id like '${orgType}%'
- AND o.id IS NOT NULL
- and substr(o.code,0,4) = c.ad_code
- <if test="province != null and province != ''">
- And c.ad_code like '${province}%'
- </if>
- UNION
- select distinct b.ad_code id,b.ad_fcode || o.id as pid,b.ad_name pnm,null as sttm,null as entm
- from BIS_INSP_ALL_OBJ o left join ATT_AD_X_BASE b on substr(o.code,0,6)||'000000' = b.ad_code
- left join (select distinct substr(ad_code,0,4) as ad_code,id from BIS_INSP_SEL_AREA where id like
- '${orgType}%') c on c.id = o.id
- where
- REGEXP_LIKE(
- o.id,'^('||
- ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{userid} and id like '${orgType}%')>0
- then
- (SELECT LISTAGG(id, '|') as
- id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{userid} and id like '${orgType}%' GROUP BY PERSID)
- else (select 'non' from dual) end)
- ||')')
- AND o.id like '${orgType}%'
- AND o.id IS NOT NULL
- and substr(o.code,0,4) = c.ad_code
- <if test="province != null and province != ''">
- And c.ad_code like '${province}%'
- </if>
- </if>
- ) order by id
- </select>
- <select id="getRsraqgNodeProvincial" resultType="cn.com.goldenwater.dcproj.model.BisInspAll">
- select * from (
- select id,pid,pnm,sttm,entm from
- BIS_INSP_ALL t where
- REGEXP_LIKE(
- Id,'^('||
- ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{userid} and id like '023%')>0 then
- (SELECT LISTAGG(id, '|') as
- id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{userid} and id like '023%' GROUP BY PERSID)
- else (select 'non' from dual) end)
- ||')')
- <if test="level == '1'.toString()">
- AND LENGTH(id) <=6
- </if>
- <if test="province != null and province != ''">
- And t.province like '${province}%'
- </if>
- AND ID LIKE '023%'
- <if test="level == '3'.toString()">
- UNION
- select distinct o.code id,o.id as pid,o.nm pnm,null as sttm,null as entm
- from BIS_INSP_ALL_OBJ o
- where
- REGEXP_LIKE(
- o.id,'^('||
- ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{userid} and id like '023%')>0 then
- (SELECT LISTAGG(id, '|') as
- id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{userid} and id like '023%' GROUP BY PERSID)
- else (select 'non' from dual) end)
- ||')')
- AND o.id like '023%'
- AND o.id IS NOT NULL
- <if test="province != null and province != ''">
- And o.code like '${province}%'
- </if>
- </if>
- <if test="level == '4'.toString()">
- UNION
- select distinct o.code||o.id id,o.id as pid,o.nm pnm,null as sttm,null as entm
- from BIS_INSP_ALL_OBJ o
- where
- REGEXP_LIKE(
- o.id,'^('||
- ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{userid} and id like '023%')>0 then
- (SELECT LISTAGG(id, '|') as
- id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{userid} and id like '023%' GROUP BY PERSID)
- else (select 'non' from dual) end)
- ||')')
- AND o.id like '023%'
- AND o.id IS NOT NULL
- <if test="province != null and province != ''">
- And o.code like '${province}%'
- </if>
- UNION
- select distinct c.Ad_code id,t.ad_code || o.id as pid,c.ad_name pnm,null as sttm,null as entm
- from BIS_INSP_ALL_OBJ o left join BIS_INSP_RSRAQG_RGSTR t on o.obj_id = t.obj_id left join
- BIS_INSP_RSRAQG_RGSTR_COUNTY c on c.rgstr_id = t.id
- where
- REGEXP_LIKE(
- o.id,'^('||
- ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{userid} and id like '023%')>0 then
- (SELECT LISTAGG(id, '|') as
- id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{userid} and id like '023%' GROUP BY PERSID)
- else (select 'non' from dual) end)
- ||')')
- AND o.id like '023%'
- AND o.id IS NOT NULL
- <if test="province != null and province != ''">
- And o.code like '${province}%'
- </if>
- </if>
- ) order by id
- </select>
- <select id="getSzyNodeProvincial" resultType="cn.com.goldenwater.dcproj.model.BisInspAll">
- select * from (
- SELECT ID,PID,PNM,STTM,ENTM FROM
- (select distinct substr(id,4,3) id, '001'as pid, pnm, sttm, entm,
- row_number() over(partition by substr(id,4,3) order by pnm) as rn
- from BIS_INSP_ALL t
- where REGEXP_LIKE(Id,
- '^(' || (case
- when (SELECT count(id)
- from BIS_INSP_ALL_RLATION
- WHERE PERSID = #{userid}) > 0 then
- (SELECT LISTAGG(id, '|') as id
- FROM BIS_INSP_ALL_RLATION
- WHERE PERSID = #{userid} GROUP BY PERSID)
- else
- (select 'non' from dual)
- end) || ')')
- AND LENGTH(id) = 6
- AND (ID LIKE '012%' or ID LIKE '013%' or ID LIKE '014%' or ID LIKE '015%' OR ID LIKE '016%')
- )
- WHERE RN = 1
- UNION
- SELECT '001' AS ID,'0' AS PID,'水资源督查' as pnm,null as sttm,null as entm from dual
- UNION
- select distinct b.ad_code id,
- substr(id, 4, 3) pid,
- b.ad_name pnm,
- null as sttm,
- null as entm
- from BIS_INSP_ALL_OBJ o
- left join ATT_AD_X_BASE b
- on substr(o.code, 0, 2) || '0000000000' = b.ad_code
- where REGEXP_LIKE(o.id,
- '^(' || (case
- when (SELECT count(id)
- from BIS_INSP_ALL_RLATION
- WHERE PERSID = #{userid}) > 0 then
- (SELECT LISTAGG(id, '|') as id
- FROM BIS_INSP_ALL_RLATION
- WHERE PERSID = #{userid} GROUP BY PERSID)
- else
- (select 'non' from dual)
- end) || ')')
- AND (o.id like '012%' or o.id LIKE '013%' or o.id LIKE '014%' or o.id LIKE '015%' OR o.id LIKE '016%')
- AND b.ad_name is not null
- ) order by id
- </select>
- <select id="getLyNode" resultType="cn.com.goldenwater.dcproj.model.BisInspAll">
- select id,pid,pnm,sttm,entm from BIS_INSP_ALL where id in (
- select substr(id,0,6) id from
- BIS_INSP_ALL t where
- REGEXP_LIKE(
- Id,'^('||
- ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID = #{userid}
- <include refid="orgIdSql"/>
- )>0 then
- (SELECT LISTAGG(id, '|') as
- id FROM BIS_INSP_ALL_RLATION WHERE PERSID = #{userid}
- <include refid="orgIdSql"/> GROUP BY PERSID
- )
- else (select 'non' from dual) end)
- ||')')
- AND ID like '${orgType}%'
- ) order by id
- </select>
- <select id="getGcNode" resultType="cn.com.goldenwater.dcproj.model.BisInspKeyRegister"
- parameterType="cn.com.goldenwater.dcproj.param.TypeParam">
- SELECT * FROM (
- select A.CODE,A.ID nodeId,
- A.NM,
- '4' PTYPE,
- B.PTYPE ETYPE,
- B.STWKTM ,
- B.PLANTM ,
- B.ESTAPP,
- B.ENG_STA,
- B.BUID_TIME_YEAR,
- B.lgtd,
- B.lttd,
- B.lgtd_pc,
- B.lttd_pc,
- A.OBJ_ID,B.ID ID,
- (case when b.State is null then '0' else b.state end)STATE,
- (case when b.State is null then '0' else b.state end)wtdstState,
- d.nm oneUnitNm,d.id oneUnitId
- ,B.INTM
- from BIS_INSP_ALL_OBJ
- A LEFT JOIN BIS_INSP_KEY_REGISTER B ON A.OBJ_ID=B.OBJ_ID
- LEFT JOIN ATT_EMPWTPRJ_BASE C ON A.CODE=C.ID
- LEFT JOIN (SELECT * FROM ATT_MAMPU_INFO WHERE LEV='1') D ON D.REG_ID=B.ID
- where A.ptype=#{pType}
- and REGEXP_LIKE(
- A.Id,'^('||
- ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{presId}
- <include refid="orgIdSql"/>
- )>0 then
- (SELECT LISTAGG(id, '|') as
- id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{presId}
- <include refid="orgIdSql"/> GROUP BY PERSID
- )
- else (select 'non' from dual) end)
- ||')')
- ) A WHERE a.PTYPE=#{pType}
- order by nodeId asc
- </select>
- <sql id="orgIdSql">
- <choose>
- <when test="orgId !=null and orgId !=''">
- and ORG_ID=#{orgId}
- </when>
- <otherwise>
- and ORG_ID is null
- </otherwise>
- </choose>
- </sql>
- </mapper>
|