| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250 |
- <?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.BisInspAllObjDao">
- <resultMap type="cn.com.goldenwater.dcproj.model.BisInspAllObj" id="bisInspAllObjResultMap">
- <result property="code" column="CODE"/>
- <result property="id" column="ID"/>
- <result property="nm" column="NM"/>
- <result property="provincial" column="PROVINCIAL"/>
- <result property="ptype" column="PTYPE"/>
- <result property="lgtd" column="LGTD"/>
- <result property="lttd" column="LTTD"/>
- <result property="objId" column="OBJ_ID"/>
- <result property="lgtdpc" column="LGTDPC"/>
- <result property="lttdpc" column="LTTDPC"/>
- <result property="orgId" column="ORG_ID"/>
- <result property="adCode" column="AD_CODE"/>
- <result property="objAdCode" column="OBJ_AD_CODE"/>
- </resultMap>
- <sql id="table_columns">
- CODE,
- ID,
- NM,
- PROVINCIAL,
- PTYPE,
- LGTD,
- LTTD,
- LGTDPC,
- LTTDPC,
- OBJ_ID,ORG_ID,AD_CODE,OBJ_AD_CODE
- </sql>
- <sql id="entity_properties">
- #{code},
- #{id},
- #{nm},
- #{provincial},
- #{ptype},
- #{lgtd},
- #{lttd},
- #{lgtdpc},
- #{lttdpc},
- #{objId},#{orgId},#{adCode},#{objAdCode}
- </sql>
- <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
- <sql id="page_where">
- <trim prefix="where" prefixOverrides="and | or ">
- <if test="id != null and id != ''">and ID = #{id}</if>
- <if test="nm != null and nm != ''">and NM = #{nm}</if>
- <if test="provincial != null and provincial != ''">and PROVINCIAL = #{provincial}</if>
- <if test="adCode != null and adCode != ''">and AD_CODE = #{adCode}</if>
- <if test="orgId != null and orgId != ''">and ORG_ID = #{orgId}</if>
- <if test="ptype != null and ptype != ''">and PTYPE = #{ptype}</if>
- <if test="lgtd != null and lgtd != ''">and LGTD = #{lgtd}</if>
- <if test="lttd != null and lttd != ''">and LTTD = #{lttd}</if>
- <if test="objId != null and objId != ''">and OBJ_ID = #{objId}</if>
- <if test="code != null and code != ''">and CODE = #{code}</if>
- <if test="lgtdpc != null and lgtdpc != ''">and LGTDPC = #{lgtdpc}</if>
- <if test="lttdpc != null and lttdpc != ''">and LTTDPC = #{lttdpc}</if>
- <if test="objAdCode != null and objAdCode != ''">and OBJ_AD_CODE = #{objAdCode}</if>
- </trim>
- </sql>
- <select id="get" resultMap="bisInspAllObjResultMap" parameterType="String" >
- select <include refid="table_columns" /> from BIS_INSP_ALL_OBJ where obj_id = #{id}
- </select>
- <select id="getBy" resultMap="bisInspAllObjResultMap">
- select <include refid="table_columns" /> from BIS_INSP_ALL_OBJ <include refid="page_where" />
- </select>
- <select id="findAll" resultMap="bisInspAllObjResultMap">
- select <include refid="table_columns" /> from BIS_INSP_ALL_OBJ
- </select>
- <select id="findList" resultMap="bisInspAllObjResultMap">
- select <include refid="table_columns" /> from BIS_INSP_ALL_OBJ <include refid="page_where" />
- </select>
- <select id="selectCount" resultType="int" >
- select count(ID) from BIS_INSP_ALL_OBJ <include refid="page_where" />
- </select>
- <!--督查办-->
- <sql id="commonSql">
- <include refid="selSql"/>
- </sql>
- <sql id="commonChose" >
- <include refid="commonSql"/>
- </sql>
- <!--督查问题-->
- <select id="findPblmByAdCode" resultType="cn.com.goldenwater.dcproj.model.BisInspPblm" parameterType="cn.com.goldenwater.dcproj.param.IndexParamPage">
- select w.nm,m.* from bis_insp_pblm m, (
- <include refid="commonChose"/>
- ) W where w.obj_id=m.obj_id and w.ad_code=#{adCode}
- <if test="startTime != null and startTime != ''">and w.obj_intm>= str_to_date(#{startTime},'%Y-%m-%d')</if>
- <if test="endTime != null and endTime != ''">and w.obj_intm < date_add(str_to_date(#{endTime},'%Y-%m-%d'), INTERVAL 1 DAY)</if>
- <if test="pTypes != null and pTypes != ''">
- and w.pType in (${pTypes})
- </if>
- <if test="orgIds != null and orgIds != ''">
- and substr(w.id,4,3) in (${orgIds})
- </if>
- </select>
- <sql id="selAdCode">
- <include refid="selSql"/>
- </sql>
- <!--查找督查对象-->
- <select id="findObjByAdCode" resultType="cn.com.goldenwater.dcproj.model.DuchaObj" parameterType="cn.com.goldenwater.dcproj.param.IndexParamPage">
- select * from (
- <include refid="selAdCode"/>
- ) W where w.ad_code=#{adCode}
- <if test="startTime != null and startTime != ''">and w.obj_intm>= str_to_date(#{startTime},'%Y-%m-%d')</if>
- <if test="endTime != null and endTime != ''">and w.obj_intm < date_add(str_to_date(#{endTime},'%Y-%m-%d'), INTERVAL 1 DAY)</if>
- <if test="pTypes != null and pTypes != ''">
- and w.pType in (${pTypes})
- </if>
- <if test="orgIds != null and orgIds != ''">
- and substr(w.id,4,3) in (${orgIds})
- </if>
- </select>
- <select id="findPerByAdCode" resultType="cn.com.goldenwater.dcproj.model.ObjPerson" parameterType="cn.com.goldenwater.dcproj.param.IndexParamPage">
- select D.ptype,e.name as name,D.id,p.pers_name,p.org_nm,p.org_id,p.dpnm,p.mobilenumb,p.dppost,p.guid,p.email,a.pnm from bis_insp_all_rlation l ,bis_insp_all_rlation_pers p,bis_insp_all a,(
- select distinct * from (
- select ptype, ID from (
- <include refid="commonChose"/>
- ) W where w.ad_code=#{adCode}
- <if test="startTime != null and startTime != ''">and w.obj_intm>= STR_TO_DATE(#{startTime},'%Y-%m-%d')</if>
- <if test="endTime != null and endTime != ''">and w.obj_intm < DATE_ADD(STR_TO_DATE(#{endTime},'%Y-%m-%d'),INTERVAL 1 DAY)</if>
- <if test="pTypes != null and pTypes != ''">
- and w.pType in (${pTypes})
- </if>
- <if test="orgIds != null and orgIds != ''">
- and substr(w.id,4,3) in (${orgIds})
- </if>
- ) S ) D,att_insp_type e where l.id=d.id and l.persid=p.guid and a.id=d.id and e.ptype=D.ptype
- </select>
- <select id="countGroupByAdCode" resultType="cn.com.goldenwater.dcproj.dto.ObjGroup" parameterType="cn.com.goldenwater.dcproj.param.IndexParamPage">
- select D.ptype,e.name as name,l.* from bis_insp_all l ,(
- select distinct * from (
- select ptype, ID from (
- <include refid="commonChose"/>
- ) W where w.ad_code=#{adCode}
- <if test="startTime != null and startTime != ''">and w.obj_intm>= STR_TO_DATE(#{startTime},'%Y-%m-%d')</if>
- <if test="endTime != null and endTime != ''">and w.obj_intm < DATE_ADD(STR_TO_DATE(#{endTime},'%Y-%m-%d'),INTERVAL 1 DAY)</if>
- <if test="pTypes != null and pTypes != ''">
- and w.pType in (${pTypes})
- </if>
- <if test="orgIds != null and orgIds != ''">
- and substr(w.id,4,3) in (${orgIds})
- </if>
- ) S ) D,att_insp_type e where l.id=d.id and e.ptype=D.ptype
- </select>
- <!--根据对象类型统计分组数量-->
- <select id="countGroup" resultType="cn.com.goldenwater.dcproj.dto.DcTypeDto" parameterType="cn.com.goldenwater.dcproj.param.IndexParam">
- select ss.total,f.name as name,ss.obj_type from (
- select count(w.obj_type) as total,w.obj_type from (
- select f.obj_type,f.pnm from (
- select ( case when t.sttm is null AND t.insp_year IS NOT NULL then STR_TO_DATE(CONCAT(t.insp_year, '-', t.insp_mnth, '-01'),'%Y-%m-%d') else
- t.sttm end ) as sttm,
- ( case when t.entm is null AND t.insp_year IS NOT NULL then STR_TO_DATE(CONCAT(t.insp_year, '-', t.insp_mnth, '-01'),'%Y-%m-%d') else t.entm end )
- as entm,
- e.ptype as obj_type,t.pnm from bis_insp_all t,att_insp_type e
- where substr(t.id,1,3)=e.code and length(t.id) = 12
- <if test="orgIds != null and orgIds != ''">
- and substr(t.id,4,3) in (${orgIds})
- </if>
- <choose>
- <when test="province != null and province !=''">
- and t.PROVINCE = #{province}
- </when>
- <otherwise>
- and t.PROVINCE is null
- </otherwise>
- </choose>
- ) f where 1=1
- <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
- and ((f.sttm >= str_to_date(#{startTime},'%Y-%m-%d') and f.sttm <= str_to_date(#{endTime},'%Y-%m-%d'))
- or ( f.entm >= str_to_date(#{startTime},'%Y-%m-%d') and f.entm <= str_to_date(#{endTime},'%Y-%m-%d'))
- or( f.sttm >= str_to_date(#{startTime},'%Y-%m-%d') and f.entm <= str_to_date(#{endTime}, '%Y-%m-%d'))
- or( f.sttm <= str_to_date(#{startTime},'%Y-%m-%d') and f.entm >= str_to_date(#{endTime}, '%Y-%m-%d')))
- </if>
- <if test="startTime != null and endTime == null">
- and f.sttm <= str_to_date(#{startTime},'%Y-%m-%d')
- and f.entm >= str_to_date(#{startTime},'%Y-%m-%d')
- or f.sttm >= str_to_date(#{startTime},'%Y-%m-%d')
- </if>
- <if test="endTime != null and startTime == null">
- and f.sttm >= str_to_date(#{endTime},'%Y-%m-%d')
- and f.entm <= str_to_date(#{endTime},'%Y-%m-%d')
- or f.entm <= str_to_date(#{endTime},'%Y-%m-%d')
- </if>
- ) w where w.obj_type != '8'
- <if test="pTypes != null and pTypes != ''">
- and w.obj_type in (${pTypes})
- </if>
- group by w.obj_type)
- ss LEFT JOIN (
- select t.ptype as code,t.name from ATT_INSP_TYPE t
- ) f on ss.obj_type = f.code order by ss.obj_type
- </select>
- <!--根据对象类型统计督查人员-->
- <select id="countPerson" resultType="cn.com.goldenwater.dcproj.dto.DcTypeDto" parameterType="cn.com.goldenwater.dcproj.param.IndexParam">
- select ss.total,e.name as name,ss.obj_type from (
- select count(w.pType) as total,w.pType as obj_type from (
- select a.id, e.ptype as ptype from bis_insp_all_rlation a,att_insp_type e
- where substring(a.id,1,3)=e.code and length(a.id)=12
- <choose>
- <when test="province != null and province !=''">
- and a.ad_code = #{province}
- </when>
- <otherwise>
- and a.ad_code is null
- </otherwise>
- </choose>
- and a.id in (
- select j.id from bis_insp_all_obj j where
- j.pType != '8'
- <if test="startTime != null and startTime != ''">and j.obj_intm >= STR_TO_DATE(#{startTime},'%Y-%m-%d')</if>
- <if test="endTime != null and endTime != ''">and j.obj_intm < DATE_ADD(STR_TO_DATE(#{endTime},'%Y-%m-%d'),INTERVAL 1 DAY)</if>
- <if test="pTypes != null and pTypes != ''">
- and j.pType in (${pTypes})
- </if>
- <if test="orgIds != null and orgIds != ''">
- and substr(j.id,4,3) in (${orgIds})
- </if>
- <choose>
- <when test="province != null and province !=''">
- and j.ad_code = #{province}
- </when>
- <otherwise>
- and j.ad_code is null
- </otherwise>
- </choose>
- )
- ) w group by w.pType ) ss,att_insp_type e where ss.obj_type=e.ptype and obj_type is not null order by ss.obj_type
- </select>
- <!--按省份统计督查人员-->
- <select id="countPersonByPro" resultType="cn.com.goldenwater.dcproj.dto.DcTypeDto" parameterType="cn.com.goldenwater.dcproj.param.IndexParam">
- select * from (
- select count(aa.ad_name) as total,aa.ad_name as name,aa.ad_code from (
- select distinct id,persid,ba.ad_name,ss.ad_code from (
- select a.persid,a.id,w.ad_code from bis_insp_all_rlation a left join (
- <include refid="commonChose"/>
- ) w on a.id=w.id where length(w.ad_code)=12
- <choose>
- <when test="province !=null and province !=''">
- and a.ad_code=#{province}
- </when>
- <otherwise>
- and a.ad_code is null
- </otherwise>
- </choose>
- <if test="startTime != null and startTime != ''">and w.obj_intm>= STR_TO_DATE(#{startTime},'%Y-%m-%d')</if>
- <if test="endTime != null and endTime != ''">and w.obj_intm < DATE_ADD(STR_TO_DATE(#{endTime},'%Y-%m-%d'),INTERVAL 1 DAY)</if>
- <if test="pTypes != null and pTypes != ''">
- and w.pType in (${pTypes})
- </if>
- <if test="orgIds != null and orgIds != ''">
- and substr(w.id,4,3) in (${orgIds})
- </if>
- ) ss,att_ad_x_base ba where ss.ad_code=ba.ad_code
- and ss.ad_code is not null) aa group by aa.ad_name,aa.ad_code ) p order by p.ad_code
- </select>
- <!--根据省份统计分组-->
- <select id="countGroupByPro" resultType="cn.com.goldenwater.dcproj.dto.DcTypeDto" parameterType="cn.com.goldenwater.dcproj.param.IndexParam">
- select ss.ad_Code,ba.ad_name as name,ss.total from (
- select CONCAT(c.adCode, '00000000') as ad_Code,c.total from (
- select count(w.adCode) as total,w.adCode from (
- select f.adCode,f.id from (
- select ( case when t.sttm is null then STR_TO_DATE(CONCAT(t.insp_year, '-', t.insp_mnth, '-01'),'%Y-%m-%d') else
- t.sttm end ) as sttm,
- ( case when t.entm is null then STR_TO_DATE(CONCAT(t.insp_year, '-', t.insp_mnth, '-01'),'%Y-%m-%d') else t.entm end )
- as entm,t.id,substr(a.ad_code,1,4) as adCode from bis_insp_all t left join att_insp_type e on
- substr(t.id,1,3)=e.code
- left join BIS_INSP_SEL_AREA a on t.id = a.id where length (t.id) = 12 and a.ad_code is not null
- <if test="orgIds != null and orgIds != ''">
- and substr(t.id,4,3) in (${orgIds})
- </if>
- <if test="pTypes != null and pTypes != ''">
- and e.ptype in (${pTypes})
- </if>
- <choose>
- <when test="province != null and province !=''">
- and t.PROVINCE = #{province}
- </when>
- <otherwise>
- and t.PROVINCE is null
- </otherwise>
- </choose>
- ) f where 1=1
- <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
- and ((f.sttm >= STR_TO_DATE(#{startTime},'%Y-%m-%d') and f.sttm <= STR_TO_DATE(#{endTime},'%Y-%m-%d'))
- or ( f.entm >= STR_TO_DATE(#{startTime},'%Y-%m-%d') and f.entm <= STR_TO_DATE(#{endTime},'%Y-%m-%d'))
- or( f.sttm >= STR_TO_DATE(#{startTime},'%Y-%m-%d') and f.entm <= STR_TO_DATE(#{endTime}, '%Y-%m-%d'))
- or( f.sttm <= STR_TO_DATE(#{startTime},'%Y-%m-%d') and f.entm >= STR_TO_DATE(#{endTime}, '%Y-%m-%d')))
- </if>
- <if test="startTime != null and endTime == null">
- and f.sttm <= STR_TO_DATE(#{startTime},'%Y-%m-%d')
- and f.entm >= STR_TO_DATE(#{startTime},'%Y-%m-%d')
- or f.sttm >= STR_TO_DATE(#{startTime},'%Y-%m-%d')
- </if>
- <if test="endTime != null and startTime == null">
- and f.sttm >= STR_TO_DATE(#{endTime},'%Y-%m-%d')
- and f.entm <= STR_TO_DATE(#{endTime},'%Y-%m-%d')
- or f.entm <= STR_TO_DATE(#{endTime},'%Y-%m-%d')
- </if>
- ) w group by w.adCode) c
- ) ss left join att_ad_x_base ba on ss.ad_Code=ba.ad_code and ba.ad_grad = '3'
- </select>
- <!--根据省统计问题分类-->
- <select id="countPblmbyPro" resultType="cn.com.goldenwater.dcproj.dto.DcPblmDto" parameterType="cn.com.goldenwater.dcproj.param.IndexParam">
- select ss.*,ba.ad_name as name
- from
- (
- select
- count(m.insp_pblm_cate) as total,m.insp_pblm_cate,w.ad_code
- from
- (
- select *
- from bis_insp_pblm p
- where 1=1
- <if test="pTypes != null and pTypes != ''">
- and p.obj_type in (${pTypes})
- </if>
- ) m
- left join (
- <include refid="commonChose"/>
- ) w on m.obj_id=w.obj_id and length(w.ad_code)=12
- <if test="startTime != null and startTime != ''">and m.coll_time>= STR_TO_DATE(#{startTime},'%Y-%m-%d')</if>
- <if test="endTime != null and endTime != ''">and m.coll_time < DATE_ADD(STR_TO_DATE(#{endTime},'%Y-%m-%d'),INTERVAL 1 DAY)</if>
- <if test="orgIds != null and orgIds != ''">
- and substr(w.id,4,3) in (${orgIds})
- </if>
- group by m.insp_pblm_cate,w.ad_code
- ) ss ,att_ad_x_base ba
- where ss.ad_code=ba.ad_code
- order by ss.ad_code
- </select>
- <sql id="selPlan">
- SELECT CONCAT(substr(e.adm_div,1,${length}), '${otherLength}') as ad_code,o.ptype,o.id,o.obj_id,r.uptm as obj_intm,o.nm,r.hyst_site as ad_name
- from bis_insp_all_obj o inner join bis_insp_rsvr_rgstr r on o.obj_id=r.obj_id left join att_rs_base e on o.code=e.rs_code where o.ptype in (1,36) and r.state='2'
- <include refid="choseSql"/>
- union all
- SELECT CONCAT(substr(o.code,1,${length}), '${otherLength}') as ad_code,o.ptype,o.id,o.obj_id,r.uptm as obj_intm,o.nm,b.ad_full_name as ad_name from bis_insp_all_obj o
- ,BIS_INSP_VILL_RGSTR r,att_ad_x_base b where r.obj_id = o.obj_id and o.code=b.ad_code and r.state = '2' and o.ptype=2
- <include refid="choseSql"/>
- union all
- SELECT CONCAT(SUBSTRING(ob.loc_ad,1,${length}), '${otherLength}') as ad_code,o.ptype,o.id,o.obj_id,t.uptm as obj_intm,o.nm,t.loac as ad_name from bis_insp_all_obj o
- inner join bis_insp_wtdst_track t on o.obj_id=t.obj_id left join BIS_INSP_WTDST OB ON o.CODE = OB.WTDST_ID where o.ptype=3 and t.state='2'
- <include refid="choseSql"/>
- union all
- SELECT CONCAT(SUBSTRING(ke.ad_code,1,${length}), '${otherLength}') as ad_code,o.ptype,o.id,o.obj_id,t.uptm as obj_intm,o.nm,t.nm as ad_name
- from bis_insp_all_obj o inner join bis_insp_key_register t on o.obj_id=t.obj_id left join ATT_EMPWTPRJ_BASE ke ON o.code = ke.id
- where o.ptype in (4,7) and t.state='2'
- <include refid="choseSql"/>
- union all
- SELECT CONCAT(SUBSTRING(ob.adcd,1,${length}), '${otherLength}') as ad_code,o.ptype,o.id,o.obj_id,w.uptm as obj_intm,o.nm,ob.stlc as ad_name from bis_insp_all_obj o
- inner join BIS_INSP_GRW w on o.obj_id=w.obj_id left join ATT_GRW_BASE OB ON o.CODE = OB.stcd where o.ptype=5 and w.insp_state='2'
- <include refid="choseSql"/>
- union all
- SELECT CONCAT(SUBSTRING(ob.ad_code,1,${length}), '${otherLength}') as ad_code,o.ptype,o.id,o.obj_id,g.uptm as obj_intm,o.nm,ob.location_xiang as ad_name from bis_insp_all_obj o
- inner join att_waga_rgstr g on o.obj_id=g.obj_id left join ATT_WAGA_BASE OB ON o.CODE = OB.obj_code where o.ptype=6 and g.state='2'
- <include refid="choseSql"/>
- union all
- SELECT CONCAT(SUBSTRING(ob.ad_code,1,${length}), '${otherLength}') as ad_code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,ob.location as ad_name from bis_insp_all_obj o
- inner join bis_insp_fsc_rgstr g on o.obj_id=g.obj_id left join att_fsc_base OB ON o.CODE = OB.id where o.ptype=9 and g.state='2'
- <include refid="choseSql"/>
- union all
- SELECT CONCAT(SUBSTRING(ob.ad_code,1,${length}), '${otherLength}') as ad_code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,ob.location as ad_name from bis_insp_all_obj o
- inner join bis_insp_other_rgstr g on o.obj_id=g.obj_id left join att_other_base OB ON o.CODE = OB.id where o.ptype=10 and g.state='2'
- <include refid="choseSql"/>
- union all
- SELECT CONCAT(SUBSTRING(ob.ad_code,1,${length}), '${otherLength}') as ad_code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.note as ad_name from bis_insp_all_obj o
- inner join bis_insp_sd_rgstr g on o.obj_id=g.obj_id left join att_sd_base OB ON o.CODE = OB.SD_CODE where o.ptype=11 and g.state='2'
- <include refid="choseSql"/>
- union all
- SELECT CONCAT(SUBSTRING(ob.ad_code,1,${length}), '${otherLength}') as ad_code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.WINT_POS as ad_name from bis_insp_all_obj o
- inner join bis_insp_wiu_rgstr g on o.obj_id=g.obj_id left join att_wain_base OB ON o.CODE = OB.OBJ_CODE where o.ptype=12 and g.state='2'
- <include refid="choseSql"/>
- union all
- SELECT CONCAT(SUBSTRING(ob.ad_code,1,${length}), '${otherLength}') as ad_code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.SWHS_LOC as ad_name from bis_insp_all_obj o
- inner join BIS_INSP_SWHS_RGSTR g on o.obj_id=g.obj_id left join ATT_SWHS_BASE OB ON o.CODE = OB.id where o.ptype=13 and g.state='2'
- <include refid="choseSql"/>
- union all
- SELECT CONCAT(SUBSTRING(ob.ad_code,1,${length}), '${otherLength}') as ad_code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.AD_FULL_NAME as ad_name from bis_insp_all_obj o
- inner join bis_insp_wint_rgstr g on o.obj_id=g.obj_id left join ATT_AD_X_BASE OB ON o.CODE = OB.AD_CODE where o.ptype=14 and g.state='2'
- <include refid="choseSql"/>
- union all
- SELECT CONCAT(SUBSTRING(ob.ad_code,1,${length}), '${otherLength}') as ad_code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.AD_FULL_NAME as ad_name from bis_insp_all_obj o
- inner join bis_insp_svwt_area_rgstr g on o.obj_id=g.obj_id left join ATT_AD_X_BASE OB ON o.CODE = OB.AD_CODE where o.ptype=15 and g.state='2'
- <include refid="choseSql"/>
- union all
- SELECT CONCAT(SUBSTRING(ob.ad_code,1,${length}), '${otherLength}') as ad_code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.ad_name from bis_insp_all_obj o
- inner join bis_insp_svwt_wunt_rgstr g on o.obj_id=g.obj_id left join att_wunt_base OB ON o.CODE = OB.ID where o.ptype=16 and g.state='2'
- <include refid="choseSql"/>
- union all
- SELECT CONCAT(SUBSTRING(ob.ad_code,1,${length}), '${otherLength}') as ad_code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.ad_name from bis_insp_all_obj o
- inner join BIS_INSP_OPRD_CSTR_PROJ_RGSTR g on o.obj_id=g.obj_id left join ATT_PRD_CSTR_PROJ_BASE OB ON o.CODE = OB.ID where o.ptype=17 and g.state='2'
- <include refid="choseSql"/>
- union all
- SELECT CONCAT(SUBSTRING(ob.ad_code,1,${length}), '${otherLength}') as ad_code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.ad_name from bis_insp_all_obj o
- inner join ATT_JSKEJIAN_FLKDIS_RGSTR g on o.obj_id=g.obj_id left join ATT_JSKEJIAN_FLKDIS_BASE OB ON o.CODE = OB.ID where o.ptype=18 and g.state='2'
- <include refid="choseSql"/>
- union all
- SELECT CONCAT(SUBSTRING(ob.ad_code,1,${length}), '${otherLength}') as ad_code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.ad_name from bis_insp_all_obj o
- inner join ATT_JSKEJIAN_WATER_RGSTR g on o.obj_id=g.obj_id left join ATT_JSKEJIAN_WATER_BASE OB ON o.CODE = OB.ID where o.ptype=19 and g.state='2'
- <include refid="choseSql"/>
- union all
- SELECT CONCAT(SUBSTRING(ob.ad_code,1,${length}), '${otherLength}') as ad_code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.ad_name from bis_insp_all_obj o
- inner join ATT_JSKEJIAN_ECOFRD_RGSTR g on o.obj_id=g.obj_id left join ATT_JSKEJIAN_ECOFRD_BASE OB ON o.CODE = OB.ID where o.ptype=20 and g.state='2'
- <include refid="choseSql"/>
- union all
- SELECT CONCAT(SUBSTRING(e.adm_div,1,${length}), '${otherLength}') as ad_code,o.ptype,o.id,o.obj_id,r.uptm as obj_intm,o.nm,r.hyst_site as ad_name
- from bis_insp_all_obj o inner join bis_insp_RSML_rgstr r on o.obj_id=r.obj_id left join att_rs_base e on o.code=e.rs_code where o.ptype = 22 and r.state='2'
- <include refid="choseSql"/>
- </sql>
- <!--根据省统计督查对象个数-->
- <select id="countPlanByPro" resultType="cn.com.goldenwater.dcproj.dto.DcTypeDto" parameterType="cn.com.goldenwater.dcproj.param.IndexParam">
- select c.total,c.ad_name as name,c.ad_code from (
- select count(ba.ad_name) as total,ba.ad_name,ba.ad_code from (
- <include refid="selPlan"/>
- ) w,att_ad_x_base ba where w.ad_code=ba.ad_code and length(w.ad_code)=12
- <if test="startTime != null and startTime != ''">and w.obj_intm>= STR_TO_DATE(#{startTime},'%Y-%m-%d')</if>
- <if test="endTime != null and endTime != ''">and w.obj_intm < DATE_ADD(STR_TO_DATE(#{endTime},'%Y-%m-%d'),INTERVAL 1 DAY)</if>
- <if test="pTypes != null and pTypes != ''">
- and w.pType in (${pTypes})
- </if>
- <if test="orgIds != null and orgIds != ''">
- and substr(w.id,4,3) in (${orgIds})
- </if>
- group by ba.ad_name,ba.ad_code ) c order by c.ad_code
- </select>
- <!--根据对象类型按按照分类统计-->
- <select id="countPblmByObjType" resultType="cn.com.goldenwater.dcproj.dto.DcPblmDto" parameterType="cn.com.goldenwater.dcproj.param.IndexParam">
- select w.total,(case when w.insp_pblm_cate ='0' then '一般' when w.insp_pblm_cate ='1' then '较重'
- when w.insp_pblm_cate ='2' then '严重' when w.insp_pblm_cate ='3' then '特别严重' else '' end ) as name, w.insp_pblm_cate from (
- select count(m.insp_pblm_cate) as total,m.insp_pblm_cate from bis_insp_pblm m
- left join bis_insp_all_obj j on m.obj_id=j.obj_id
- left join (select * from bis_insp_org where 1=1
- <if test="orgIds != null and orgIds != ''">
- and id in (${orgIds})
- </if>
- ) g on substr(j.id,4,3)=g.org_id
- <if test="pTypes != null and pTypes != ''">
- and m.obj_type=#{pTypes}
- </if>
- <choose>
- <when test="province != null and province !=''">
- and j.ad_code = '${province}'
- </when>
- <otherwise>
- and j.ad_code is null
- </otherwise>
- </choose>
- <if test="startTime != null and startTime != ''">and m.coll_time >= STR_TO_DATE(#{startTime},'%Y-%m-%d')</if>
- <if test="endTime != null and endTime != ''">and m.coll_time < DATE_ADD(STR_TO_DATE(#{endTime},'%Y-%m-%d'),INTERVAL 1 DAY)</if>
- group by m.insp_pblm_cate
- ) w order by w.insp_pblm_cate
- </select>
- <!--根据时间,机构,类型统计问题个数-->
- <select id="countPblmbyParam" resultType="cn.com.goldenwater.dcproj.dto.DcTypeDto" parameterType="cn.com.goldenwater.dcproj.param.IndexParam">
- select ss.total,e.name as name,ss.obj_type from (
- select count(m.obj_type) as total ,m.obj_type as obj_type from bis_insp_pblm m
- left join bis_insp_all_obj j on m.obj_id=j.obj_id
- left join (select * from bis_insp_org where 1=1
- <if test="orgIds != null and orgIds != ''">
- and id in (${orgIds})
- </if>
- ) g on substr(j.id,4,3)=g.org_id
- <if test="pTypes != null and pTypes != ''">
- and m.obj_type in (${pTypes})
- </if>
- <choose>
- <when test="province != null and province !=''">
- and j.ad_code = '${province}'
- </when>
- <otherwise>
- and j.ad_code is null
- </otherwise>
- </choose>
- <if test="startTime != null and startTime != ''">and m.coll_time >= STR_TO_DATE(#{startTime},'%Y-%m-%d')</if>
- <if test="endTime != null and endTime != ''">and m.coll_time < DATE_ADD(STR_TO_DATE(#{endTime},'%Y-%m-%d'),INTERVAL 1 DAY)</if>
- group by m.obj_type
- ) ss,att_insp_type e where ss.obj_type=e.ptype order by ss.obj_type
- </select>
- <!--根据时间,机构,类型统计督查对象个数-->
- <select id="countObjbyParam" resultType="cn.com.goldenwater.dcproj.dto.DcTypeDto" parameterType="cn.com.goldenwater.dcproj.param.IndexParam">
- select ss.total,e.name as name,ss.obj_type from (
- select count(j.ptype) as total ,j.ptype as obj_type from bis_insp_all_obj j,bis_insp_org g where substr(j.id,4,3)=g.org_id
- <if test="orgIds != null and orgIds != ''">
- and g.org_id in (${orgIds})
- </if>
- <if test="pTypes != null and pTypes != ''">
- and j.ptype in (${pTypes})
- </if>
- <choose>
- <when test="province != null and province !=''">
- and j.ad_code = '${province}'
- </when>
- <otherwise>
- and j.ad_code is null
- </otherwise>
- </choose>
- <if test="startTime != null and startTime != ''">and j.obj_intm>= STR_TO_DATE(#{startTime},'%Y-%m-%d')</if>
- <if test="endTime != null and endTime != ''">and j.obj_intm < DATE_ADD(STR_TO_DATE(#{endTime},'%Y-%m-%d'),INTERVAL 1 DAY)</if>
- group by j.ptype
- ) ss,att_insp_type e where ss.obj_type=e.ptype order by ss.obj_type
- </select>
- <!--根据类型统计督查个数-->
- <select id="countObjByType" resultType="cn.com.goldenwater.dcproj.dto.DcTypeDto" parameterType="cn.com.goldenwater.dcproj.param.IndexParam">
- select ss.total,e.name as name,ss.obj_type from (
- select count(j.ptype) as total,j.ptype as obj_type from bis_insp_all_obj j
- where 1=1
- <if test="orgIds != null and orgIds != ''">
- and substr(j.id,4,3) in (${orgIds})
- </if>
- <choose>
- <when test="province != null and province !=''">
- and j.ad_code = '${province}'
- </when>
- <otherwise>
- and j.ad_code is null
- </otherwise>
- </choose>
- group by j.ptype
- ) ss,att_insp_type e where ss.obj_type=e.ptype order by ss.obj_type
- </select>
- <!--根据机构统计督查个数-->
- <select id="countObjByOrg" resultType="cn.com.goldenwater.dcproj.dto.DcTypeDto" parameterType="cn.com.goldenwater.dcproj.param.IndexParam">
- select count(w.org_nm) as total,w.org_nm as name from (
- select o.org_nm,b.ptype,o.org_id from bis_insp_org o,bis_insp_all_obj b where o.org_id=substr(b.id,4,3)
- <if test="orgIds != null and orgIds != ''">
- and o.id in (${orgIds})
- </if>
- <if test="pTypes != null and pTypes != ''">
- and b.ptype in (${pTypes})
- </if>
- <choose>
- <when test="province != null and province !=''">
- and b.ad_code = '${province}'
- </when>
- <otherwise>
- and b.ad_code is null
- </otherwise>
- </choose>
- order by o.org_id
- ) w group by w.org_nm
- </select>
- <!--根据类型获取督查问题统计-->
- <select id="countPblmByType" resultType="cn.com.goldenwater.dcproj.dto.DcTypeDto" parameterType="cn.com.goldenwater.dcproj.param.IndexParam">
- select ss.total,e.name as name,ss.obj_type from (
- select count(p.obj_type) as total,p.obj_type from bis_insp_all_obj o ,bis_insp_pblm p where o.obj_id=p.obj_id
- <if test="startTime != null and startTime != ''">and p.coll_time >= STR_TO_DATE(#{startTime},'%Y-%m-%d')</if>
- <if test="endTime != null and endTime != ''">and p.coll_time < DATE_ADD(STR_TO_DATE(#{endTime},'%Y-%m-%d'),INTERVAL 1 DAY)</if>
- <if test="orgIds != null and orgIds != ''">
- and substr(o.id,4,3) in (${orgIds})
- </if>
- <if test="pTypes != null and pTypes != ''">
- and o.ptype in (${pTypes})
- </if>
- <include refid="choseSql"/>
- group by p.obj_type
- ) ss,att_insp_type e where ss.obj_type=e.ptype order by ss.obj_type
- </select>
- <sql id="choseSql">
- <choose>
- <when test="province != null and province !=''">
- and o.ad_code = '${province}'
- </when>
- <otherwise>
- and o.ad_code is null
- </otherwise>
- </choose>
- </sql>
- <!--督查对象(已督查)统计-->
- <select id="countDcByType" resultType="cn.com.goldenwater.dcproj.dto.DcTypeDto" parameterType="cn.com.goldenwater.dcproj.param.IndexParam">
- select e.ptype as objType,e.name as name,count(o.id) as total from bis_insp_all_obj o,
- bis_insp_rsvr_rgstr r,att_insp_type e
- where o.obj_id=r.obj_id and o.ptype=e.ptype and o.ptype in (1,36) and r.state='2'
- <if test="startTime != null and startTime != ''">and r.intm >= str_to_date(#{startTime},'%Y-%m-%d')</if>
- <if test="endTime != null and endTime != ''">and r.intm < DATE_ADD(STR_TO_DATE(#{endTime},'%Y-%m-%d') , INTERVAL 1 DAY)</if>
- <if test="orgIds != null and orgIds != ''">
- and substr(o.id,4,3) in (${orgIds})
- </if>
- <if test="pTypes != null and pTypes != ''">
- and o.ptype in (${pTypes})
- </if>
- <include refid="choseSql"/>
- group by e.name,e.ptype
- union all
- select e.ptype as objType,e.name as name,count(o.id) as total from bis_insp_all_obj o,
- BIS_INSP_VILL_RGSTR v,att_insp_type e
- where o.obj_id=v.obj_id and o.ptype=e.ptype and v.state='2'
- <if test="startTime != null and startTime != ''">and v.uptm >= str_to_date(#{startTime},'%Y-%m-%d')</if>
- <if test="endTime != null and endTime != ''">and v.uptm < DATE_ADD(STR_TO_DATE(#{endTime},'%Y-%m-%d') , INTERVAL 1 DAY)</if>
- <if test="orgIds != null and orgIds != ''">
- and substr(o.id,4,3) in (${orgIds})
- </if>
- <if test="pTypes != null and pTypes != ''">
- and o.ptype in (${pTypes})
- </if>
- <include refid="choseSql"/>
- group by e.name,e.ptype
- union all
- select e.ptype as objType,e.name as name,count(o.id) as total from bis_insp_all_obj o,bis_insp_wtdst_track t,att_insp_type e
- where o.obj_id=t.obj_id and o.ptype=e.ptype and t.state='2'
- <if test="startTime != null and startTime != ''">and t.uptm >= str_to_date(#{startTime},'%Y-%m-%d')</if>
- <if test="endTime != null and endTime != ''">and t.uptm < DATE_ADD(STR_TO_DATE(#{endTime},'%Y-%m-%d') , INTERVAL 1 DAY)</if>
- <if test="orgIds != null and orgIds != ''">
- and substr(o.id,4,3) in (${orgIds})
- </if>
- <if test="pTypes != null and pTypes != ''">
- and o.ptype in (${pTypes})
- </if>
- <include refid="choseSql"/>
- group by e.name,e.ptype
- union all
- select e.ptype as objType,e.name as name,count(o.id) as total from bis_insp_all_obj o,bis_insp_key_register t ,att_insp_type e
- where o.obj_id=t.obj_id and o.ptype=e.ptype and t.state='2' and o.ptype in (4,7)
- <if test="startTime != null and startTime != ''">and t.uptm >= str_to_date(#{startTime},'%Y-%m-%d')</if>
- <if test="endTime != null and endTime != ''">and t.uptm < DATE_ADD(STR_TO_DATE(#{endTime},'%Y-%m-%d') , INTERVAL 1 DAY)</if>
- <if test="orgIds != null and orgIds != ''">
- and substr(o.id,4,3) in (${orgIds})
- </if>
- <if test="pTypes != null and pTypes != ''">
- and o.ptype in (${pTypes})
- </if>
- <include refid="choseSql"/>
- group by e.name,e.ptype
- union all
- select e.ptype as objType,e.name as name,count(o.id) as total from bis_insp_all_obj o,BIS_INSP_GRW w,att_insp_type e
- where o.obj_id=w.obj_id and o.ptype=e.ptype and w.insp_state='2'
- <if test="startTime != null and startTime != ''">and w.uptm >= str_to_date(#{startTime},'%Y-%m-%d')</if>
- <if test="endTime != null and endTime != ''">and w.uptm < DATE_ADD(STR_TO_DATE(#{endTime},'%Y-%m-%d') , INTERVAL 1 DAY)</if>
- <if test="orgIds != null and orgIds != ''">
- and substr(o.id,4,3) in (${orgIds})
- </if>
- <if test="pTypes != null and pTypes != ''">
- and o.ptype in (${pTypes})
- </if>
- <include refid="choseSql"/>
- group by e.name,e.ptype
- union all
- select e.ptype as objType,e.name as name,count(o.id) as total from bis_insp_all_obj o,att_waga_rgstr g,att_insp_type e
- where o.obj_id=g.obj_id and o.ptype=e.ptype and g.state='2'
- <if test="startTime != null and startTime != ''">and g.uptm >= str_to_date(#{startTime},'%Y-%m-%d')</if>
- <if test="endTime != null and endTime != ''">and g.uptm < DATE_ADD(STR_TO_DATE(#{endTime},'%Y-%m-%d') , INTERVAL 1 DAY)</if>
- <if test="orgIds != null and orgIds != ''">
- and substr(o.id,4,3) in (${orgIds})
- </if>
- <if test="pTypes != null and pTypes != ''">
- and o.ptype in (${pTypes})
- </if>
- <include refid="choseSql"/>
- group by e.name,e.ptype
- union all
- select e.ptype as objType,e.name as name,count(o.id) as total from bis_insp_all_obj o,bis_insp_fsc_rgstr g,att_insp_type e
- where o.obj_id=g.obj_id and o.ptype=e.ptype and g.state='2'
- <if test="startTime != null and startTime != ''">and g.up_tm >= str_to_date(#{startTime},'%Y-%m-%d')</if>
- <if test="endTime != null and endTime != ''">and g.up_tm < DATE_ADD(STR_TO_DATE(#{endTime},'%Y-%m-%d') , INTERVAL 1 DAY)</if>
- <if test="orgIds != null and orgIds != ''">
- and substr(o.id,4,3) in (${orgIds})
- </if>
- <if test="pTypes != null and pTypes != ''">
- and o.ptype in (${pTypes})
- </if>
- <include refid="choseSql"/>
- group by e.name,e.ptype
- union all
- select e.ptype as objType,e.name as name,count(o.id) as total from bis_insp_all_obj o,bis_insp_other_rgstr g ,att_insp_type e
- where o.obj_id=g.obj_id and o.ptype=e.ptype and g.state='2'
- <if test="startTime != null and startTime != ''">and g.up_tm >= str_to_date(#{startTime},'%Y-%m-%d')</if>
- <if test="endTime != null and endTime != ''">and g.up_tm < DATE_ADD(STR_TO_DATE(#{endTime},'%Y-%m-%d') , INTERVAL 1 DAY)</if>
- <if test="orgIds != null and orgIds != ''">
- and substr(o.id,4,3) in (${orgIds})
- </if>
- <if test="pTypes != null and pTypes != ''">
- and o.ptype in (${pTypes})
- </if>
- <include refid="choseSql"/>
- group by e.name,e.ptype
- union all
- select e.ptype as objType,e.name as name,count(o.id) as total from bis_insp_all_obj o,bis_insp_sd_rgstr g ,att_insp_type e
- where o.obj_id=g.obj_id and o.ptype=e.ptype and g.state='2'
- <if test="startTime != null and startTime != ''">and g.up_tm >= str_to_date(#{startTime},'%Y-%m-%d')</if>
- <if test="endTime != null and endTime != ''">and g.up_tm < DATE_ADD(STR_TO_DATE(#{endTime},'%Y-%m-%d') , INTERVAL 1 DAY)</if>
- <if test="orgIds != null and orgIds != ''">
- and substr(o.id,4,3) in (${orgIds})
- </if>
- <if test="pTypes != null and pTypes != ''">
- and o.ptype in (${pTypes})
- </if>
- <include refid="choseSql"/>
- group by e.name,e.ptype
- union all
- select e.ptype as objType,e.name as name,count(o.id) as total from bis_insp_all_obj o,bis_insp_wiu_rgstr g ,att_insp_type e
- where o.obj_id=g.obj_id and o.ptype=e.ptype and g.state='2'
- <if test="startTime != null and startTime != ''">and g.up_tm >= str_to_date(#{startTime},'%Y-%m-%d')</if>
- <if test="endTime != null and endTime != ''">and g.up_tm < DATE_ADD(STR_TO_DATE(#{endTime},'%Y-%m-%d') , INTERVAL 1 DAY)</if>
- <if test="orgIds != null and orgIds != ''">
- and substr(o.id,4,3) in (${orgIds})
- </if>
- <if test="pTypes != null and pTypes != ''">
- and o.ptype in (${pTypes})
- </if>
- <include refid="choseSql"/>
- group by e.name,e.ptype
- union all
- select e.ptype as objType,e.name as name,count(o.id) as total from bis_insp_all_obj o,bis_insp_swhs_rgstr g ,att_insp_type e
- where o.obj_id=g.obj_id and o.ptype=e.ptype and g.state='2'
- <if test="startTime != null and startTime != ''">and g.up_tm >= str_to_date(#{startTime},'%Y-%m-%d')</if>
- <if test="endTime != null and endTime != ''">and g.up_tm < DATE_ADD(STR_TO_DATE(#{endTime},'%Y-%m-%d') , INTERVAL 1 DAY)</if>
- <if test="orgIds != null and orgIds != ''">
- and substr(o.id,4,3) in (${orgIds})
- </if>
- <if test="pTypes != null and pTypes != ''">
- and o.ptype in (${pTypes})
- </if>
- <include refid="choseSql"/>
- group by e.name,e.ptype
- union all
- select e.ptype as objType,e.name as name,count(o.id) as total from bis_insp_all_obj o,bis_insp_wint_rgstr g ,att_insp_type e
- where o.obj_id=g.obj_id and o.ptype=e.ptype and g.state='2'
- <if test="startTime != null and startTime != ''">and g.up_tm >= str_to_date(#{startTime},'%Y-%m-%d')</if>
- <if test="endTime != null and endTime != ''">and g.up_tm < DATE_ADD(STR_TO_DATE(#{endTime},'%Y-%m-%d') , INTERVAL 1 DAY)</if>
- <if test="orgIds != null and orgIds != ''">
- and substr(o.id,4,3) in (${orgIds})
- </if>
- <if test="pTypes != null and pTypes != ''">
- and o.ptype in (${pTypes})
- </if>
- <include refid="choseSql"/>
- group by e.name,e.ptype
- union all
- select e.ptype as objType,e.name as name,count(o.id) as total from bis_insp_all_obj o,bis_insp_svwt_area_rgstr g ,att_insp_type e
- where o.obj_id=g.obj_id and o.ptype=e.ptype and g.state='2'
- <if test="startTime != null and startTime != ''">and g.up_tm >= str_to_date(#{startTime},'%Y-%m-%d')</if>
- <if test="endTime != null and endTime != ''">and g.up_tm < DATE_ADD(STR_TO_DATE(#{endTime},'%Y-%m-%d') , INTERVAL 1 DAY)</if>
- <if test="orgIds != null and orgIds != ''">
- and substr(o.id,4,3) in (${orgIds})
- </if>
- <if test="pTypes != null and pTypes != ''">
- and o.ptype in (${pTypes})
- </if>
- <include refid="choseSql"/>
- group by e.name,e.ptype
- union all
- select e.ptype as objType,e.name as name,count(o.id) as total from bis_insp_all_obj o,bis_insp_svwt_wunt_rgstr g,att_insp_type e
- where o.obj_id=g.obj_id and o.ptype=e.ptype and g.state='2'
- <if test="startTime != null and startTime != ''">and g.up_tm >= str_to_date(#{startTime},'%Y-%m-%d')</if>
- <if test="endTime != null and endTime != ''">and g.up_tm < DATE_ADD(STR_TO_DATE(#{endTime},'%Y-%m-%d') , INTERVAL 1 DAY)</if>
- <if test="orgIds != null and orgIds != ''">
- and substr(o.id,4,3) in (${orgIds})
- </if>
- <if test="pTypes != null and pTypes != ''">
- and o.ptype in (${pTypes})
- </if>
- <include refid="choseSql"/>
- group by e.name,e.ptype
- union all
- select e.ptype as objType,e.name as name,count(o.id) as total from bis_insp_all_obj o,BIS_INSP_OPRD_CSTR_PROJ_RGSTR g,att_insp_type e
- where o.obj_id=g.obj_id and o.ptype=e.ptype and g.state='2'
- <if test="startTime != null and startTime != ''">and g.up_tm >= str_to_date(#{startTime},'%Y-%m-%d')</if>
- <if test="endTime != null and endTime != ''">and g.up_tm < DATE_ADD(STR_TO_DATE(#{endTime},'%Y-%m-%d') , INTERVAL 1 DAY)</if>
- <if test="orgIds != null and orgIds != ''">
- and substr(o.id,4,3) in (${orgIds})
- </if>
- <if test="pTypes != null and pTypes != ''">
- and o.ptype in (${pTypes})
- </if>
- <include refid="choseSql"/>
- group by e.name,e.ptype
- union all
- select e.ptype as objType,e.name as name,count(o.id) as total from bis_insp_all_obj o,ATT_JSKEJIAN_FLKDIS_RGSTR g ,att_insp_type e
- where o.obj_id=g.obj_id and o.ptype=e.ptype and g.state='2'
- <if test="startTime != null and startTime != ''">and g.uptm >= str_to_date(#{startTime},'%Y-%m-%d')</if>
- <if test="endTime != null and endTime != ''">and g.uptm < DATE_ADD(STR_TO_DATE(#{endTime},'%Y-%m-%d') , INTERVAL 1 DAY)</if>
- <if test="orgIds != null and orgIds != ''">
- and substr(o.id,4,3) in (${orgIds})
- </if>
- <if test="pTypes != null and pTypes != ''">
- and o.ptype in (${pTypes})
- </if>
- <include refid="choseSql"/>
- group by e.name,e.ptype
- union all
- select e.ptype as objType,e.name as name,count(o.id) as total from bis_insp_all_obj o,ATT_JSKEJIAN_WATER_RGSTR g ,att_insp_type e
- where o.obj_id=g.obj_id and o.ptype=e.ptype and g.state='2'
- <if test="startTime != null and startTime != ''">and g.uptm >= str_to_date(#{startTime},'%Y-%m-%d')</if>
- <if test="endTime != null and endTime != ''">and g.uptm < DATE_ADD(STR_TO_DATE(#{endTime},'%Y-%m-%d') , INTERVAL 1 DAY)</if>
- <if test="orgIds != null and orgIds != ''">
- and substr(o.id,4,3) in (${orgIds})
- </if>
- <if test="pTypes != null and pTypes != ''">
- and o.ptype in (${pTypes})
- </if>
- <include refid="choseSql"/>
- group by e.name,e.ptype
- union all
- select e.ptype as objType,e.name as name,count(o.id) as total from bis_insp_all_obj o,ATT_JSKEJIAN_ECOFRD_RGSTR g ,att_insp_type e
- where o.obj_id=g.obj_id and o.ptype=e.ptype and g.state='2'
- <if test="startTime != null and startTime != ''">and g.uptm >= str_to_date(#{startTime},'%Y-%m-%d')</if>
- <if test="endTime != null and endTime != ''">and g.uptm < DATE_ADD(STR_TO_DATE(#{endTime},'%Y-%m-%d') , INTERVAL 1 DAY)</if>
- <if test="orgIds != null and orgIds != ''">
- and substr(o.id,4,3) in (${orgIds})
- </if>
- <if test="pTypes != null and pTypes != ''">
- and o.ptype in (${pTypes})
- </if>
- <include refid="choseSql"/>
- group by e.name,e.ptype
- union ALL
- select e.ptype as objType,e.name as name,count(o.id) as total from bis_insp_all_obj o,BIS_INSP_RSML_RGSTR g ,att_insp_type e
- where o.obj_id=g.obj_id and o.ptype=e.ptype and g.state='2'
- <if test="startTime != null and startTime != ''">and g.uptm >= str_to_date(#{startTime},'%Y-%m-%d')</if>
- <if test="endTime != null and endTime != ''">and g.uptm < DATE_ADD(STR_TO_DATE(#{endTime},'%Y-%m-%d') , INTERVAL 1 DAY)</if>
- <if test="orgIds != null and orgIds != ''">
- and substr(o.id,4,3) in (${orgIds})
- </if>
- <if test="pTypes != null and pTypes != ''">
- and o.ptype in (${pTypes})
- </if>
- <include refid="choseSql"/>
- group by e.name,e.ptype
- </select>
- <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspAllObj">
- insert into BIS_INSP_ALL_OBJ( <include refid="table_columns" /> )
- values ( <include refid="entity_properties" /> )
- </insert>
- <insert id="insertObj" parameterType="cn.com.goldenwater.dcproj.dto.BisInspAllObjDto">
- insert into BIS_INSP_ALL_OBJ( <include refid="table_columns" /> )
- values ( <include refid="entity_properties" /> )
- </insert>
- <delete id="delete" parameterType="java.lang.String">
- delete from BIS_INSP_ALL_OBJ where ID = #{id}
- </delete>
- <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspAllObj">
- delete from BIS_INSP_ALL_OBJ <include refid="page_where" />
- </delete>
- <update id="deleteInFlag" parameterType="java.lang.String">
- update BIS_INSP_ALL_OBJ set flag_valid = 0 where ID = #{id}
- </update>
- <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspAllObj">
- update BIS_INSP_ALL_OBJ
- <trim prefix="set" suffixOverrides=",">
- <if test="id != null and id != ''">ID = #{id},</if>
- <if test="nm != null and nm != ''">NM = #{nm},</if>
- <if test="ptype != null and ptype != ''">PTYPE = #{ptype},</if>
- <if test="lgtd != null and lgtd != ''">LGTD = #{lgtd},</if>
- <if test="lttd != null and lttd != ''">LTTD = #{lttd},</if>
- <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
- <if test="lgtdpc != null and lgtdpc != ''">LGTDPC = #{lgtdpc},</if>
- <if test="lttdpc != null and lttdpc != ''"> LTTDPC = #{lttdpc},</if>
- <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
- <if test="orgId != null and orgId != ''">ORG_ID = #{orgId},</if>
- <if test="objAdCode != null and objAdCode != ''">OBJ_AD_CODE = #{objAdCode},</if>
- </trim>
- <where>obj_id = #{objId}</where>
- </update>
- <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspAllObj">
- update BIS_INSP_ALL_OBJ
- <trim prefix="set" suffixOverrides=",">
- <if test="id != null and id != ''">ID = #{id},</if>
- <if test="nm != null and nm != ''">NM = #{nm},</if>
- <if test="ptype != null and ptype != ''">PTYPE = #{ptype},</if>
- <if test="lgtd != null and lgtd != ''">LGTD = #{lgtd},</if>
- <if test="lttd != null and lttd != ''">LTTD = #{lttd},</if>
- <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
- <if test="lgtdpc != null and lgtdpc != ''">LGTDPC = #{lgtdpc},</if>
- <if test="lttdpc != null and lttdpc != ''">LTTDPC = #{lttdpc},</if>
- <if test="objAdCode != null and objAdCode != ''">OBJ_AD_CODE = #{objAdCode},</if>
- </trim>
- <include refid="page_where" />
- </update>
- <!-- 其他自定义SQL -->
- <select id="getIdByUserId" resultType="cn.com.goldenwater.dcproj.model.BisInspAllRlation">
- SELECT * FROM BIS_INSP_ALL_RLATION T where persid=#{userid} and id like concat( #{ptype},'%')
- <choose>
- <when test="adCode != null and adCode !=''">
- and t.ad_code = #{adCode}
- </when>
- <otherwise>
- and t.ad_code is null
- </otherwise>
- </choose>
- </select>
- <select id="getObj" parameterType="cn.com.goldenwater.dcproj.model.BisInspAllObj" resultType="cn.com.goldenwater.dcproj.dto.BisInspAllObjDto">
- SELECT * FROM BIS_INSP_ALL_OBJ WHERE ID = #{id} AND CODE = #{code} AND ptype = #{ptype}
- <choose>
- <when test="province !=null and province !=''">
- and ad_code=#{province}
- </when>
- <otherwise>
- and ad_code is null
- </otherwise>
- </choose>
- </select>
- <select id="getGroup" parameterType="String" resultType="cn.com.goldenwater.dcproj.dto.ObjectNameDto">
- SELECT ID,PNM name FROM BIS_INSP_ALL WHERE ID = #{id}
- </select>
- <!--查询督查范围内的稽察对象-->
- <select id="getListByInspGroupIdObjType" resultType="cn.com.goldenwater.dcproj.model.TacAttPawpBase">
- select t.*,C.id AS GROUPID,C.PNM,o.OBJ_ID
- from TAC_ATT_PAWP_BASE t
- left join BIS_INSP_ALL_OBJ o
- on o.CODE = t.id
- LEFT JOIN BIS_INSP_ALL C ON o.ID = C.ID
- and o.ptype = #{objType}
- where 1 = 1
- <if test='isAll == "0"'>and o.ID = #{inspGroupId}</if>
- <if test='isAll == "1"'>and o.ID LIKE '${inspGroupId}%'</if>
- <if test="wtdstNm != null and wtdstNm != ''">and t.NAME LIKE '%${wtdstNm}%'</if>
- <if test="wtdstType != null and wtdstType != ''">and t.TYPE LIKE '%${wtdstType}%'</if>
- <if test="adCode != null and adCode != ''">and t.AD_CODE LIKE '${adCode}%'</if>
- <include refid="choseProvinceSql"/>
- </select>
- <sql id="choseProvinceSql">
- <choose>
- <when test="province !=null and province !=''">
- AND o.ad_code=#{province}
- </when>
- <otherwise>
- AND o.ad_code is null
- </otherwise>
- </choose>
- </sql>
- <select id="findGroupCountByAdCode" resultType="cn.com.goldenwater.dcproj.dto.DcTypeDto">
- select t.ptype as OBJTYPE,t.name,ifnull(d.total,0) AS TOTAL from ATT_INSP_TYPE t left join (
- select f.ptype,count(1) AS TOTAL from (
- select D.ptype,l.* from bis_insp_all l ,(
- select distinct * from (
- select ptype, ID from (
- <include refid="commonChose"/>
- ) W where w.ad_code=#{adCode}
- <if test="startTime != null and startTime != ''">and w.obj_intm>= STR_TO_DATE(#{startTime},'%Y-%m-%d')</if>
- <if test="endTime != null and endTime != ''">and w.obj_intm < DATE_ADD(STR_TO_DATE(#{endTime},'%Y-%m-%d'),INTERVAL 1 DAY)</if>
- <if test="pTypes != null and pTypes != ''">
- and w.pType in (${pTypes})
- </if>
- <if test="orgIds != null and orgIds != ''">
- and substr(w.id,4,3) in (${orgIds})
- </if>
- ) S ) D where l.id=d.id
- ) F GROUP BY F.ptype
- ) D on t.ptype = d.ptype
- order by t.code
- </select>
- <select id="findPerCountByAdCode" resultType="cn.com.goldenwater.dcproj.dto.DcTypeDto" parameterType="cn.com.goldenwater.dcproj.param.IndexParamPage">
- select t.ptype as OBJTYPE,t.name,ifnull(d.total,0) AS TOTAL from ATT_INSP_TYPE t left join (
- select f.ptype,count(1) AS TOTAL from (
- select D.ptype,D.id,p.pers_name,p.org_nm,p.org_id,p.dpnm,p.mobilenumb,p.dppost,p.guid,p.email,a.pnm from bis_insp_all_rlation l ,bis_insp_all_rlation_pers p,bis_insp_all a,(
- select distinct * from (
- select ptype, ID from (
- <include refid="commonChose"/>
- ) W where w.ad_code=#{adCode}
- <if test="startTime != null and startTime != ''">and w.obj_intm>= STR_TO_DATE(#{startTime},'%Y-%m-%d')</if>
- <if test="endTime != null and endTime != ''">and w.obj_intm < DATE_ADD(STR_TO_DATE(#{endTime},'%Y-%m-%d'),INTERVAL 1 DAY)</if>
- <if test="pTypes != null and pTypes != ''">
- and w.pType in (${pTypes})
- </if>
- <if test="orgIds != null and orgIds != ''">
- and substr(w.id,4,3) in (${orgIds})
- </if>
- ) S ) D where l.id=d.id and l.persid=p.guid and a.id=d.id
- ) F GROUP BY F.ptype
- ) D on t.ptype = d.ptype
- order by t.code
- </select>
- <sql id="selSql">
- SELECT CONCAT(SUBSTRING(e.adm_div,1,${length}), '${otherLength}') as ad_code,o.code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,e.location as ad_name
- from bis_insp_all_obj o left join att_rs_base e on o.code=e.rs_code where o.ptype in (1,36,22)
- <include refid="choseSql"/>
- union all
- SELECT CONCAT(SUBSTRING(o.code,1,${length}), '${otherLength}') as ad_code,o.code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,s.ad_full_name as ad_name from bis_insp_all_obj o,att_ad_x_base s where o.code=s.ad_code and o.ptype=2
- <include refid="choseSql"/>
- union all
- SELECT CONCAT(SUBSTRING(ob.loc_ad,1,${length}), '${otherLength}') as ad_code,o.code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,ob.loc_nm as ad_name from bis_insp_all_obj o left join BIS_INSP_WTDST OB ON o.CODE = OB.WTDST_ID where o.ptype=3
- <include refid="choseSql"/>
- union all
- SELECT CONCAT(SUBSTRING(ke.ad_code,1,${length}), '${otherLength}') as ad_code,o.code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,ba.ad_full_name as ad_name from bis_insp_all_obj o
- left join ATT_EMPWTPRJ_BASE ke ON o.code = ke.id
- left join att_ad_x_base ba on ke.ad_code=ba.ad_code
- where o.ptype in (4,7)
- <include refid="choseSql"/>
- union all
- SELECT CONCAT(SUBSTRING(ob.adcd,1,${length}), '${otherLength}') as ad_code,o.code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,ob.adnm as ad_name from bis_insp_all_obj o left join ATT_GRW_BASE OB ON o.CODE = OB.stcd where o.ptype=5
- <include refid="choseSql"/>
- union all
- SELECT CONCAT(SUBSTRING(ob.ad_code,1,${length}), '${otherLength}') as ad_code,o.code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,ob.location_xiang as ad_name from bis_insp_all_obj o left join ATT_WAGA_BASE OB ON o.CODE = OB.obj_code where o.ptype=6
- <include refid="choseSql"/>
- union all
- SELECT CONCAT(SUBSTRING(ob.ad_code,1,${length}), '${otherLength}') as ad_code,o.code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,ob.location as ad_name from bis_insp_all_obj o
- left join att_fsc_base OB ON o.CODE = OB.id where o.ptype=9
- <include refid="choseSql"/>
- union all
- SELECT CONCAT(SUBSTRING(ob.ad_code,1,${length}), '${otherLength}') as ad_code,o.code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,ob.location as ad_name from bis_insp_all_obj o
- left join att_other_base OB ON o.CODE = OB.id where o.ptype=10
- <include refid="choseSql"/>
- union all
- SELECT CONCAT(SUBSTRING(ob.ad_code,1,${length}), '${otherLength}') as ad_code,o.code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.note as ad_name from bis_insp_all_obj o
- left join att_sd_base OB ON o.CODE = OB.SD_CODE where o.ptype=11
- <include refid="choseSql"/>
- union all
- SELECT CONCAT(SUBSTRING(ob.ad_code,1,${length}), '${otherLength}') as ad_code,o.code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.WINT_POS as ad_name from bis_insp_all_obj o
- left join att_wain_base OB ON o.CODE = OB.OBJ_CODE where o.ptype=12
- <include refid="choseSql"/>
- union all
- SELECT CONCAT(SUBSTRING(ob.ad_code,1,${length}), '${otherLength}') as ad_code,o.code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.SWHS_LOC as ad_name from bis_insp_all_obj o
- left join ATT_SWHS_BASE OB ON o.CODE = OB.id where o.ptype=13
- <include refid="choseSql"/>
- union all
- SELECT CONCAT(SUBSTRING(ob.ad_code,1,${length}), '${otherLength}') as ad_code,o.code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.AD_FULL_NAME as ad_name from bis_insp_all_obj o
- left join ATT_AD_X_BASE OB ON o.CODE = OB.AD_CODE where o.ptype=14
- <include refid="choseSql"/>
- union all
- SELECT CONCAT(SUBSTRING(ob.ad_code,1,${length}), '${otherLength}') as ad_code,o.code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.AD_FULL_NAME as ad_name from bis_insp_all_obj o
- left join ATT_AD_X_BASE OB ON o.CODE = OB.AD_CODE where o.ptype=15
- <include refid="choseSql"/>
- union all
- SELECT CONCAT(SUBSTRING(ob.ad_code,1,${length}), '${otherLength}') as ad_code,o.code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.ad_name from bis_insp_all_obj o
- left join att_wunt_base OB ON o.CODE = OB.ID where o.ptype=16
- <include refid="choseSql"/>
- union all
- SELECT CONCAT(SUBSTRING(ob.ad_code,1,${length}), '${otherLength}') as ad_code,o.code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.ad_name from bis_insp_all_obj o
- left join ATT_PRD_CSTR_PROJ_BASE OB ON o.CODE = OB.ID where o.ptype=17
- <include refid="choseSql"/>
- union all
- SELECT CONCAT(SUBSTRING(ob.ad_code,1,${length}), '${otherLength}') as ad_code,o.code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.ad_name from bis_insp_all_obj o
- left join ATT_JSKEJIAN_FLKDIS_BASE OB ON o.CODE = OB.ID where o.ptype=18
- <include refid="choseSql"/>
- union all
- SELECT CONCAT(SUBSTRING(ob.ad_code,1,${length}), '${otherLength}') as ad_code,o.code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.ad_name from bis_insp_all_obj o
- left join ATT_JSKEJIAN_WATER_BASE OB ON o.CODE = OB.ID where o.ptype=19
- <include refid="choseSql"/>
- union all
- SELECT CONCAT(SUBSTRING(ob.ad_code,1,${length}), '${otherLength}') as ad_code,o.code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.ad_name from bis_insp_all_obj o
- left join ATT_JSKEJIAN_Ecofrd_BASE OB ON o.CODE = OB.ID where o.ptype=20
- <include refid="choseSql"/>
- </sql>
- <select id="findObjCountByAdCode" resultType="cn.com.goldenwater.dcproj.dto.DcTypeDto" parameterType="cn.com.goldenwater.dcproj.param.IndexParamPage">
- select t.ptype as OBJTYPE,t.name,ifnull(d.total,0) AS TOTAL from ATT_INSP_TYPE t left join (
- select f.ptype,count(1) AS TOTAL from (
- select W.* from (
- <include refid="selSql"/>
- ) W where w.ad_code=#{adCode}
- <if test="startTime != null and startTime != ''">and w.obj_intm>= STR_TO_DATE(#{startTime},'%Y-%m-%d')</if>
- <if test="endTime != null and endTime != ''">and w.obj_intm < DATE_ADD(STR_TO_DATE(#{endTime},'%Y-%m-%d'),INTERVAL 1 DAY)</if>
- <if test="pTypes != null and pTypes != ''">
- and w.pType in (${pTypes})
- </if>
- <if test="orgIds != null and orgIds != ''">
- and substr(w.id,4,3) in (${orgIds})
- </if>
- ) F GROUP BY F.ptype
- ) D ON t.ptype = d.ptype
- order by t.code
- </select>
- <!--督查问题-->
- <select id="findPblmCountByAdCode" resultType="cn.com.goldenwater.dcproj.dto.DcTypeDto" parameterType="cn.com.goldenwater.dcproj.param.IndexParamPage">
- select t.ptype as OBJTYPE,t.name,ifnull(d.total,0) AS TOTAL from ATT_INSP_TYPE t left join (
- select f.PTYPE,count(1) AS TOTAL from (
- select w.ptype,w.nm,m.* from bis_insp_pblm m, (
- <include refid="commonChose"/>
- ) W where w.obj_id=m.obj_id and w.ad_code=#{adCode}
- <if test="startTime != null and startTime != ''">and w.obj_intm>= STR_TO_DATE(#{startTime},'%Y-%m-%d')</if>
- <if test="endTime != null and endTime != ''">and w.obj_intm < DATE_ADD(STR_TO_DATE(#{endTime},'%Y-%m-%d'),INTERVAL 1 DAY)</if>
- <if test="pTypes != null and pTypes != ''">
- and w.pType in (${pTypes})
- </if>
- <if test="orgIds != null and orgIds != ''">
- and substr(w.id,4,3) in (${orgIds})
- </if>
- ) F GROUP BY F.ptype
- ) D on t.ptype = d.ptype
- order by t.code
- </select>
- <select id="listByMap" resultType="cn.com.goldenwater.dcproj.dto.BisInspAllObjDto">
- SELECT O.*, A.NAME AS OBJ_TYPE_NAME, AB.AD_FULL_NAME, AL.PNM
- FROM BIS_INSP_ALL_OBJ O
- JOIN (select * FROM ATT_INSP_TYPE where code IN (select INSP_TYPE FROM REL_ORG_INSP_TYPE
- <where>
- <if test="orgId != null and orgId != '' ">
- AND ORG_ID = #{orgId}
- </if>
- </where>
- )) A ON O.PTYPE = A.PTYPE
- JOIN BIS_INSP_ALL AL ON O.ID = AL.ID
- LEFT JOIN ATT_AD_BASE AB ON O.OBJ_AD_CODE = AB.AD_CODE
- <where>
- <if test="depm != null and depm.size() > 0 ">
- AND A.CODE IN (SELECT PTYPE FROM ATT_INSP_TYPE_DUTY where DUTY_DEP IN
- <foreach item="item" index="index" collection="depm" open="(" separator="," close=")">
- '${item}'
- </foreach>
- )
- </if>
- <if test="id != null and id != ''">and O.ID like '%${id}%'</if>
- <if test="orgId != null and orgId != '' ">AND O.ID LIKE '___${orgId}%'</if>
- <if test="objType != null and objType != ''">and O.PTYPE = #{objType}</if>
- <if test="objTypeName != null and objTypeName != ''">and A.NAME LIKE '%${objTypeName}%'</if>
- <if test="nm != null and nm != ''">and O.nm like '%${nm}%'</if>
- <if test="adCode != null and adCode != ''">and O.OBJ_AD_CODE like '${adCode}%'</if>
- <if test="pnm != null and pnm != ''">and AL.PNM like '%${pnm}%'</if>
- <if test="adFullName != null and adFullName != ''">and AB.AD_FULL_NAME like '%${adFullName}%'</if>
- <if test="sttm != null and sttm != '' and entm != null and entm != '' ">
- AND O.OBJ_INTM >= str_to_date(#{sttm}, '%Y-%m-%d')
- AND O.OBJ_INTM < date_add( STR_TO_DATE(#{entm},'%Y-%m-%d'), INTERVAL 1 day )
- </if>
- <if test='null !=isRepeat and "" != isRepeat and "1" == isRepeat.toString() '>
- AND O.code in ( select biaoin.code from BIS_INSP_ALL_OBJ biaoin
- <where>
- <if test="orgId != null and orgId != '' ">
- AND biaoin.ORG_ID = #{orgId}
- </if>
- <if test='adCode != null and adCode != "" '>AND biaoin.OBJ_AD_CODE like '${adCode}%'</if>
- </where>
- group by biaoin.code having count(biaoin.code) > 1
- )
- </if>
- <if test='null !=isRepeat and "" != isRepeat and "1" != isRepeat.toString() '>
- AND O.code in ( select biaoin.code from BIS_INSP_ALL_OBJ biaoin
- <where>
- <if test="orgId != null and orgId != '' ">
- AND biaoin.ORG_ID = #{orgId}
- </if>
- <if test='adCode != null and adCode != "" '> AND biaoin.OBJ_AD_CODE like '${adCode}%'</if>
- </where>
- group by biaoin.code having count(biaoin.code) = 1
- )
- </if>
- </where>
- order by O.PTYPE, O.OBJ_AD_CODE, O.OBJ_ID
- </select>
- <select id="getTableName" resultType="String">
- SELECT RGSTR_TABLE_NAME
- FROM ATT_INSP_TYPE where PTYPE = #{ptype}
- </select>
- <select id="getRgstrIdAndState" resultType="cn.com.goldenwater.dcproj.dto.BisInspAllObjDto">
- SELECT ${idName},STATE
- FROM ${tableName} where OBJ_ID = #{objId}
- </select>
- <select id="listOfRgstr" resultType="java.util.Map">
- select
- O.ID AS "groupId", SUBSTR(O.ID, 4, 3) AS "orgId",
- O.CODE AS "code", O.NM AS "nm", O.OBJ_AD_CODE AS "adCode",
- R.OBJ_ID AS "objId", R.${stateName} AS "state"
- FROM ${tableName} R
- JOIN BIS_INSP_ALL_OBJ O ON O.OBJ_ID = R.OBJ_ID
- JOIN BIS_INSP_ALL G ON G.ID = O.ID
- <where>
- <if test="adCode != null and adCode != ''">
- O.OBJ_AD_CODE LIKE CONCAT(#{adCode}, '%')
- </if>
- <if test="groupIds != null and groupIds != ''">
- O.ID IN (${groupIds})
- </if>
- <if test="objId != null and objId != ''">
- AND O.OBJ_ID = #{objId}
- </if>
- <if test="objType != null and objType != ''">
- AND O.PTYPE = #{objType}
- </if>
- <if test="orgIds != null and orgIds != ''">
- AND O.ORG_ID IN (${orgIds})
- </if>
- <if test="orgId != null and orgId != ''">
- AND O.ORG_ID = #{orgId}
- </if>
- <if test="state != null and state != ''">
- AND R.${stateName} = #{state}
- </if>
- <if test="nm != null and nm != ''">
- AND O.NM like '%${nm}%'
- </if>
- <if test="chkType != null and chkType != ''">
- AND G.CHK_TYPE = #{chkType}
- </if>
- </where>
- </select>
- <update id="updateRgstrState">
- update ${tableName} SET ${stateName} = ${state}
- WHERE
- <choose>
- <when test="objIdList != null and objIdList.size() > 0">
- OBJ_ID IN
- <foreach item="objIds" index="index" collection="objIdList" open="(" separator=") OR OBJ_ID IN ("
- close=")">
- ${objIds}
- </foreach>
- </when>
- <otherwise>
- OBJ_ID = #{objId}
- </otherwise>
- </choose>
- </update>
- </mapper>
|