| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433 |
- <?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.BisInspSwhsRgstrDao">
- <resultMap type="cn.com.goldenwater.dcproj.model.BisInspSwhsRgstr" id="bisInspSwhsRgstrResultMap">
- <result property="id" column="ID"/>
- <result property="objId" column="OBJ_ID"/>
- <result property="swhsId" column="SWHS_ID"/>
- <result property="swhsCode" column="SWHS_CODE"/>
- <result property="swhsName" column="SWHS_NAME"/>
- <result property="insName" column="INS_NAME"/>
- <result property="insPers" column="INS_PERS"/>
- <result property="insWaterPers" column="INS_WATER_PERS"/>
- <result property="adCode" column="AD_CODE"/>
- <result property="swhsLoc" column="SWHS_LOC"/>
- <result property="centerX" column="CENTER_X"/>
- <result property="centerY" column="CENTER_Y"/>
- <result property="gdX" column="GD_X"/>
- <result property="gdY" column="GD_Y"/>
- <result property="wainWasoType" column="WAIN_WASO_TYPE"/>
- <result property="watArea" column="WAT_AREA"/>
- <result property="wainNum" column="WAIN_NUM"/>
- <result property="wainUse" column="WAIN_USE"/>
- <result property="wasuObjType" column="WASU_OBJ_TYPE"/>
- <result property="desAnnWain" column="DES_ANN_WAIN"/>
- <result property="desAnnWasuPop" column="DES_ANN_WASU_POP"/>
- <result property="waquGoal" column="WAQU_GOAL"/>
- <result property="ifMonWqua" column="IF_MON_WQUA"/>
- <result property="wquaCat" column="WQUA_CAT"/>
- <result property="ifWquaUptoSta" column="IF_WQUA_UPTO_STA"/>
- <result property="note" column="NOTE"/>
- <result property="state" column="STATE"/>
- <result property="dataStat" column="DATA_STAT"/>
- <result property="persId" column="PERS_ID"/>
- <result property="groupId" column="GROUP_ID"/>
- <result property="inTm" column="IN_TM"/>
- <result property="upTm" column="UP_TM"/>
- <result property="safetyStat" column="SAFETY_STAT"/>
- <result property="measuresStat" column="MEASURES_STAT"/>
- <result property="waterStat" column="WATER_STAT"/>
- <result property="insTel" column="INS_TEL"/>
- <result property="insWaterUnit" column="INS_WATER_UNIT"/>
- <result property="insWaterTel" column="INS_WATER_TEL"/>
- <result property="province" column="PROVINCE"/>
- </resultMap>
-
- <sql id="table_columns">
- ID,PROVINCE,
- OBJ_ID,
- SWHS_ID,
- SWHS_CODE,
- SWHS_NAME,
- INS_NAME,
- INS_PERS,
- INS_WATER_PERS,
- AD_CODE,
- SWHS_LOC,
- CENTER_X,
- CENTER_Y,
- GD_X,
- GD_Y,
- WAIN_WASO_TYPE,
- WAT_AREA,
- WAIN_NUM,
- WAIN_USE,
- WASU_OBJ_TYPE,
- DES_ANN_WAIN,
- DES_ANN_WASU_POP,
- WAQU_GOAL,
- IF_MON_WQUA,
- WQUA_CAT,
- IF_WQUA_UPTO_STA,
- NOTE,
- STATE,
- DATA_STAT,
- PERS_ID,
- GROUP_ID,
- IN_TM,
- UP_TM,
- SAFETY_STAT,
- MEASURES_STAT,
- WATER_STAT,
- INS_TEL,
- INS_WATER_UNIT,
- INS_WATER_TEL
- </sql>
- <sql id="entity_properties">
- #{id},#{province},
- #{objId},
- #{swhsId},
- #{swhsCode},
- #{swhsName},
- #{insName},
- #{insPers},
- #{insWaterPers},
- #{adCode},
- #{swhsLoc},
- #{centerX},
- #{centerY},
- #{gdX},
- #{gdY},
- #{wainWasoType},
- #{watArea},
- #{wainNum},
- #{wainUse},
- #{wasuObjType},
- #{desAnnWain},
- #{desAnnWasuPop},
- #{waquGoal},
- #{ifMonWqua},
- #{wquaCat},
- #{ifWquaUptoSta},
- #{note},
- #{state},
- #{dataStat},
- #{persId},
- #{groupId},
- #{inTm},
- #{upTm},
- #{safetyStat},
- #{measuresStat},
- #{waterStat},
- #{insTel},
- #{insWaterUnit},
- #{insWaterTel}
- </sql>
- <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
- <sql id="page_where">
- <trim prefix="where" prefixOverrides="and | or ">
- <if test="objId != null and objId != ''">and OBJ_ID = #{objId}</if>
- <if test="swhsId != null and swhsId != ''">and SWHS_ID = #{swhsId}</if>
- <if test="swhsCode != null and swhsCode != ''">and SWHS_CODE = #{swhsCode}</if>
- <if test="swhsName != null and swhsName != ''">and SWHS_NAME = #{swhsName}</if>
- <if test="insName != null and insName != ''">and INS_NAME = #{insName}</if>
- <if test="insPers != null and insPers != ''">and INS_PERS = #{insPers}</if>
- <if test="insWaterPers != null and insWaterPers != ''">and INS_WATER_PERS = #{insWaterPers}</if>
- <if test="adCode != null and adCode != ''">and AD_CODE = #{adCode}</if>
- <if test="swhsLoc != null and swhsLoc != ''">and SWHS_LOC = #{swhsLoc}</if>
- <if test="centerX != null and centerX != ''">and CENTER_X = #{centerX}</if>
- <if test="centerY != null and centerY != ''">and CENTER_Y = #{centerY}</if>
- <if test="gdX != null and gdX != ''">and GD_X = #{gdX}</if>
- <if test="gdY != null and gdY != ''">and GD_Y = #{gdY}</if>
- <if test="wainWasoType != null and wainWasoType != ''">and WAIN_WASO_TYPE = #{wainWasoType}</if>
- <if test="watArea != null and watArea != ''">and WAT_AREA = #{watArea}</if>
- <if test="wainNum != null and wainNum != ''">and WAIN_NUM = #{wainNum}</if>
- <if test="wainUse != null and wainUse != ''">and WAIN_USE = #{wainUse}</if>
- <if test="wasuObjType != null and wasuObjType != ''">and WASU_OBJ_TYPE = #{wasuObjType}</if>
- <if test="desAnnWain != null and desAnnWain != ''">and DES_ANN_WAIN = #{desAnnWain}</if>
- <if test="desAnnWasuPop != null and desAnnWasuPop != ''">and DES_ANN_WASU_POP = #{desAnnWasuPop}</if>
- <if test="waquGoal != null and waquGoal != ''">and WAQU_GOAL = #{waquGoal}</if>
- <if test="ifMonWqua != null and ifMonWqua != ''">and IF_MON_WQUA = #{ifMonWqua}</if>
- <if test="wquaCat != null and wquaCat != ''">and WQUA_CAT = #{wquaCat}</if>
- <if test="ifWquaUptoSta != null and ifWquaUptoSta != ''">and IF_WQUA_UPTO_STA = #{ifWquaUptoSta}</if>
- <if test="note != null and note != ''">and NOTE = #{note}</if>
- <if test="state != null and state != ''">and STATE = #{state}</if>
- <if test="dataStat != null and dataStat != ''">and DATA_STAT = #{dataStat}</if>
- <if test="persId != null and persId != ''">and PERS_ID = #{persId}</if>
- <if test="groupId != null and groupId != ''">and GROUP_ID = #{groupId}</if>
- <if test="inTm != null">and IN_TM = #{inTm}</if>
- <if test="upTm != null">and UP_TM = #{upTm}</if>
- <if test="safetyStat != null and safetyStat != ''">and SAFETY_STAT = #{safetyStat}</if>
- <if test="measuresStat != null and measuresStat != ''">and MEASURES_STAT = #{measuresStat}</if>
- <if test="waterStat != null and waterStat != ''">and WATER_STAT = #{waterStat}</if>
- <if test="insTel != null and insTel != ''">and INS_TEL = #{insTel}</if>
- <if test="insWaterUnit != null and insWaterUnit != ''">and INS_WATER_UNIT = #{insWaterUnit}</if>
- <if test="insWaterTel != null and insWaterTel != ''">and INS_WATER_TEL = #{insWaterTel}</if>
- <choose>
- <when test="province != null and province != ''">and PROVINCE = #{province}</when>
- <otherwise>
- and province is null
- </otherwise>
- </choose>
- </trim>
- </sql>
- <select id="get" resultMap="bisInspSwhsRgstrResultMap" parameterType="String" >
- select <include refid="table_columns" /> from BIS_INSP_SWHS_RGSTR where ID = #{id}
- </select>
- <select id="getBy" resultMap="bisInspSwhsRgstrResultMap">
- select <include refid="table_columns" /> from BIS_INSP_SWHS_RGSTR <include refid="page_where" />
- </select>
- <select id="findAll" resultMap="bisInspSwhsRgstrResultMap">
- select <include refid="table_columns" /> from BIS_INSP_SWHS_RGSTR
- </select>
- <select id="findList" resultMap="bisInspSwhsRgstrResultMap">
- select <include refid="table_columns" /> from BIS_INSP_SWHS_RGSTR <include refid="page_where" />
- </select>
- <select id="selectCount" resultType="int" >
- select count(ID) from BIS_INSP_SWHS_RGSTR <include refid="page_where" />
- </select>
- <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspSwhsRgstr">
- insert into BIS_INSP_SWHS_RGSTR( <include refid="table_columns" /> )
- values ( <include refid="entity_properties" /> )
- </insert>
- <delete id="delete" parameterType="java.lang.String">
- delete from BIS_INSP_SWHS_RGSTR where ID = #{id}
- </delete>
- <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspSwhsRgstr">
- delete from BIS_INSP_SWHS_RGSTR <include refid="page_where" />
- </delete>
- <update id="deleteInFlag" parameterType="java.lang.String">
- update BIS_INSP_SWHS_RGSTR set flag_valid = 0 where ID = #{id}
- </update>
- <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspSwhsRgstr">
- update BIS_INSP_SWHS_RGSTR
- <trim prefix="set" suffixOverrides=",">
- <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
- <if test="swhsId != null and swhsId != ''">SWHS_ID = #{swhsId},</if>
- <if test="swhsCode != null and swhsCode != ''">SWHS_CODE = #{swhsCode},</if>
- <if test="swhsName != null and swhsName != ''">SWHS_NAME = #{swhsName},</if>
- <if test="province != null and province != ''"> PROVINCE = #{province},</if>
- <if test="insName != null and insName != ''">INS_NAME = #{insName},</if>
- <if test="insPers != null and insPers != ''">INS_PERS = #{insPers},</if>
- <if test="insWaterPers != null and insWaterPers != ''">INS_WATER_PERS = #{insWaterPers},</if>
- <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
- <if test="swhsLoc != null and swhsLoc != ''">SWHS_LOC = #{swhsLoc},</if>
- <if test="centerX != null and centerX != ''">CENTER_X = #{centerX},</if>
- <if test="centerY != null and centerY != ''">CENTER_Y = #{centerY},</if>
- <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
- <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
- <if test="wainWasoType != null and wainWasoType != ''">WAIN_WASO_TYPE = #{wainWasoType},</if>
- <if test="watArea != null and watArea != ''">WAT_AREA = #{watArea},</if>
- <if test="wainNum != null and wainNum != ''">WAIN_NUM = #{wainNum},</if>
- <if test="wainUse != null and wainUse != ''">WAIN_USE = #{wainUse},</if>
- <if test="wasuObjType != null and wasuObjType != ''">WASU_OBJ_TYPE = #{wasuObjType},</if>
- <if test="desAnnWain != null and desAnnWain != ''">DES_ANN_WAIN = #{desAnnWain},</if>
- <if test="desAnnWasuPop != null and desAnnWasuPop != ''">DES_ANN_WASU_POP = #{desAnnWasuPop},</if>
- <if test="waquGoal != null and waquGoal != ''">WAQU_GOAL = #{waquGoal},</if>
- <if test="ifMonWqua != null and ifMonWqua != ''">IF_MON_WQUA = #{ifMonWqua},</if>
- <if test="wquaCat != null and wquaCat != ''">WQUA_CAT = #{wquaCat},</if>
- <if test="ifWquaUptoSta != null and ifWquaUptoSta != ''">IF_WQUA_UPTO_STA = #{ifWquaUptoSta},</if>
- <if test="note != null and note != ''">NOTE = #{note},</if>
- <if test="state != null and state != ''">STATE = #{state},</if>
- <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
- <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
- <if test="groupId != null and groupId != ''">GROUP_ID = #{groupId},</if>
- <if test="inTm != null">IN_TM = #{inTm},</if>
- <if test="upTm != null">UP_TM = #{upTm},</if>
- <if test="safetyStat != null and safetyStat != ''">SAFETY_STAT = #{safetyStat},</if>
- <if test="measuresStat != null and measuresStat != ''">MEASURES_STAT = #{measuresStat},</if>
- <if test="waterStat != null and waterStat != ''">WATER_STAT = #{waterStat},</if>
- <if test="insTel != null and insTel != ''">INS_TEL = #{insTel},</if>
- <if test="insWaterUnit != null and insWaterUnit != ''">INS_WATER_UNIT = #{insWaterUnit},</if>
- <if test="insWaterTel != null and insWaterTel != ''">INS_WATER_TEL = #{insWaterTel},</if>
- </trim>
- <where>ID = #{id}</where>
- </update>
- <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspSwhsRgstr">
- update BIS_INSP_SWHS_RGSTR
- <trim prefix="set" suffixOverrides=",">
- <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
- <if test="swhsId != null and swhsId != ''">SWHS_ID = #{swhsId},</if>
- <if test="swhsCode != null and swhsCode != ''">SWHS_CODE = #{swhsCode},</if>
- <if test="swhsName != null and swhsName != ''">SWHS_NAME = #{swhsName},</if>
- <if test="insName != null and insName != ''">INS_NAME = #{insName},</if>
- <if test="insPers != null and insPers != ''">INS_PERS = #{insPers},</if>
- <if test="insWaterPers != null and insWaterPers != ''">INS_WATER_PERS = #{insWaterPers},</if>
- <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
- <if test="swhsLoc != null and swhsLoc != ''">SWHS_LOC = #{swhsLoc},</if>
- <if test="centerX != null and centerX != ''">CENTER_X = #{centerX},</if>
- <if test="centerY != null and centerY != ''">CENTER_Y = #{centerY},</if>
- <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
- <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
- <if test="wainWasoType != null and wainWasoType != ''">WAIN_WASO_TYPE = #{wainWasoType},</if>
- <if test="province != null and province != ''"> PROVINCE = #{province},</if>
- <if test="watArea != null and watArea != ''">WAT_AREA = #{watArea},</if>
- <if test="wainNum != null and wainNum != ''">WAIN_NUM = #{wainNum},</if>
- <if test="wainUse != null and wainUse != ''">WAIN_USE = #{wainUse},</if>
- <if test="wasuObjType != null and wasuObjType != ''">WASU_OBJ_TYPE = #{wasuObjType},</if>
- <if test="desAnnWain != null and desAnnWain != ''">DES_ANN_WAIN = #{desAnnWain},</if>
- <if test="desAnnWasuPop != null and desAnnWasuPop != ''">DES_ANN_WASU_POP = #{desAnnWasuPop},</if>
- <if test="waquGoal != null and waquGoal != ''">WAQU_GOAL = #{waquGoal},</if>
- <if test="ifMonWqua != null and ifMonWqua != ''">IF_MON_WQUA = #{ifMonWqua},</if>
- <if test="wquaCat != null and wquaCat != ''">WQUA_CAT = #{wquaCat},</if>
- <if test="ifWquaUptoSta != null and ifWquaUptoSta != ''">IF_WQUA_UPTO_STA = #{ifWquaUptoSta},</if>
- <if test="note != null and note != ''">NOTE = #{note},</if>
- <if test="state != null and state != ''">STATE = #{state},</if>
- <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
- <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
- <if test="groupId != null and groupId != ''">GROUP_ID = #{groupId},</if>
- <if test="inTm != null">IN_TM = #{inTm},</if>
- <if test="upTm != null">UP_TM = #{upTm},</if>
- <if test="safetyStat != null and safetyStat != ''">SAFETY_STAT = #{safetyStat},</if>
- <if test="measuresStat != null and measuresStat != ''">MEASURES_STAT = #{measuresStat},</if>
- <if test="waterStat != null and waterStat != ''">WATER_STAT = #{waterStat},</if>
- <if test="insTel != null and insTel != ''">INS_TEL = #{insTel},</if>
- <if test="insWaterUnit != null and insWaterUnit != ''">INS_WATER_UNIT = #{insWaterUnit},</if>
- <if test="insWaterTel != null and insWaterTel != ''">INS_WATER_TEL = #{insWaterTel},</if>
- </trim>
- <include refid="page_where" />
- </update>
- <sql id="choseSql">
- <choose>
- <when test="province !=null and province !=''">
- and B.province like '${province}%'
- </when>
- <otherwise>
- and B.province is null
- </otherwise>
- </choose>
- </sql>
- <sql id="orgIdSql">
- <choose>
- <when test="orgId !=null and orgId !=''">
- and ORG_ID=#{orgId}
- </when>
- <otherwise>
- and ORG_ID is null
- </otherwise>
- </choose>
- </sql>
- <select id="getListByInspGroupIdObjType" resultType="cn.com.goldenwater.dcproj.model.BisInspSwhsRgstr"
- parameterType="cn.com.goldenwater.dcproj.param.PagePersObjParam">
- select t.*,C.id groupId,C.PNM groupName,B.obj_id
- from att_swhs_base t
- left join BIS_INSP_ALL_OBJ B
- on B.CODE = t.ID
- LEFT JOIN BIS_INSP_ALL C ON B.ID = C.ID
- and B.ptype = #{objType}
- where 1 = 1
- <if test='isAll == "0"'>and B.ID = #{inspGroupId}</if>
- <if test='isAll == "1"'>and B.ID LIKE '${inspGroupId}%'</if>
- <if test="adCode != null and adCode != ''">
- and t.AD_CODE like '${adCode}%'
- </if>
- <choose>
- <when test="province != null and province != ''">
- and B.AD_CODE LIKE '${province}%'
- </when>
- <otherwise>
- and B.AD_CODE is null
- </otherwise>
- </choose>
- </select>
- <!-- 其他自定义SQL -->
- <select id="findSwhsPage" parameterType="cn.com.goldenwater.dcproj.param.TypeParam" resultType="cn.com.goldenwater.dcproj.dto.BisInspRgstrDto">
- SELECT * FROM (
- select A.CODE,A.ID nodeId,
- A.NM,
- #{pType} PTYPE,
- B.center_X,
- B.center_y,
- B.GD_X as lgtd,
- B.GD_Y as lttd,
- B.GD_X,
- B.GD_y,
- A.OBJ_ID,B.ID ID,B.ID AS RGSTRID,
- (case when b.SWHS_LOC is null then c.SWHS_LOC else b.SWHS_LOC end) as location,
- (case when b.State is null then '0' else b.state end)STATE
- ,B.IN_TM,
- x.ad_full_name as adName,
- B.SAFETY_STAT,
- B.MEASURES_STAT,
- B.WATER_STAT,
- B.WAIN_WASO_TYPE as type,
- B.ad_code,
- ia.pnm groupName,
- (select pnm from BIS_INSP_ALL where id = ia.pid)||ia.pnm upGroupName,
- (case when b.INS_NAME is null then c.INS_NAME else b.INS_NAME end) as insName,
- C.swhs_code as objCode
- from BIS_INSP_ALL_OBJ
- A LEFT JOIN BIS_INSP_SWHS_RGSTR B ON A.OBJ_ID=B.OBJ_ID
- LEFT JOIN ATT_SWHS_BASE C ON A.CODE=C.ID
- left JOin ATT_AD_X_BASE x on B.ad_code = x.ad_code
- LEFT JOIN BIS_INSP_ALL ia on A.ID = ia.id
- where A.ptype= #{pType}
- <if test="tabType =='2'.toString()">
- and ia.entm <to_date(#{nowTime},'yyyy-MM-dd')+1
- </if>
- <if test="tabType =='1'.toString()">
- and ia.entm >=to_date(#{nowTime},'yyyy-MM-dd')
- </if>
- <include refid="choseSql"/>
- 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}
- <if test="adCode != null and adCode != ''">
- and a.ad_code like '${adCode}%'
- </if>
- <if test="adName != null and adName != ''">
- and a.adName like '%${adName}%'
- </if>
- <if test="plnaId !=null and plnaId !=''">
- and a.nodeId like '${plnaId}%'
- </if>
- <if test="groupId != null and groupId != ''">
- AND a.nodeId like '${groupId}%'
- </if>
- <if test="state !=null and state !=''">
- and STATE in (${state})
- </if>
- <if test="rsName !=null and rsName !=''">
- and a.nm like '%${rsName}%'
- </if>
- <if test="code !=null and code !=''">
- and a.code = #{code}
- </if>
- <if test="sttm != null and sttm != ''">and a.IN_TM>= TO_DATE(#{sttm},'YYYY-MM-DD')</if>
- <if test="entm != null and entm != ''">and a.IN_TM <= To_DATE(#{entm},'yyyy-MM-dd') + 1</if>
- order by nodeId asc
- <if test="orderBy != null and orderBy != ''">
- ,nlssort(nm,'NLS_SORT=SCHINESE_PINYIN_M')
- </if>
- </select>
- </mapper>
|