| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323 |
- <?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.AttFscBaseDao">
- <resultMap type="cn.com.goldenwater.dcproj.model.AttFscBase" id="attFscBaseResultMap">
- <result property="id" column="ID"/>
- <result property="code" column="CODE"/>
- <result property="name" column="NAME"/>
- <result property="type" column="TYPE"/>
- <result property="admOrg" column="ADM_ORG"/>
- <result property="adCode" column="AD_CODE"/>
- <result property="location" column="LOCATION"/>
- <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="persId" column="PERS_ID"/>
- <result property="intm" column="INTM"/>
- <result property="uptm" column="UPTM"/>
- </resultMap>
- <sql id="table_columns">
- ID,
- CODE,
- NAME,
- TYPE,
- ADM_ORG,
- AD_CODE,
- LOCATION,
- CENTER_X,
- CENTER_Y,
- GD_X,
- GD_Y,
- PERS_ID,
- INTM,
- UPTM
- </sql>
- <sql id="entity_properties">
- #{id},
- #{code},
- #{name},
- #{type},
- #{admOrg},
- #{adCode},
- #{location},
- #{centerX},
- #{centerY},
- #{gdX},
- #{gdY},
- #{persId},
- #{intm},
- #{uptm}
- </sql>
- <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
- <sql id="page_where">
- <trim prefix="where" prefixOverrides="and | or ">
- <if test="code != null and code != ''">and CODE = #{code}</if>
- <if test="name != null and name != ''">and NAME = #{name}</if>
- <if test="type != null and type != ''">and TYPE = #{type}</if>
- <if test="admOrg != null and admOrg != ''">and ADM_ORG = #{admOrg}</if>
- <if test="adCode != null and adCode != ''">and AD_CODE = #{adCode}</if>
- <if test="location != null and location != ''">and LOCATION = #{location}</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="persId != null and persId != ''">and PERS_ID = #{persId}</if>
- <if test="intm != null">and INTM = #{intm}</if>
- <if test="uptm != null">and UPTM = #{uptm}</if>
- </trim>
- </sql>
- <select id="get" resultMap="attFscBaseResultMap" parameterType="String">
- select
- <include refid="table_columns"/>
- from ATT_FSC_BASE where ID = #{id}
- </select>
- <select id="getBy" resultMap="attFscBaseResultMap">
- select
- <include refid="table_columns"/>
- from ATT_FSC_BASE
- <include refid="page_where"/>
- </select>
- <select id="findAll" resultMap="attFscBaseResultMap">
- select
- <include refid="table_columns"/>
- from ATT_FSC_BASE
- </select>
- <select id="findList" resultMap="attFscBaseResultMap">
- select
- <include refid="table_columns"/>
- from ATT_FSC_BASE
- <include refid="page_where"/>
- </select>
- <select id="selectCount" resultType="int">
- select count(ID) from ATT_FSC_BASE
- <include refid="page_where"/>
- </select>
- <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.AttFscBase">
- insert into ATT_FSC_BASE(
- <include refid="table_columns"/>
- )
- values (
- <include refid="entity_properties"/>
- )
- </insert>
- <delete id="delete" parameterType="java.lang.String">
- delete from ATT_FSC_BASE where ID = #{id}
- </delete>
- <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.AttFscBase">
- delete from ATT_FSC_BASE
- <include refid="page_where"/>
- </delete>
- <update id="deleteInFlag" parameterType="java.lang.String">
- update ATT_FSC_BASE set flag_valid = 0 where ID = #{id}
- </update>
- <update id="update" parameterType="cn.com.goldenwater.dcproj.model.AttFscBase">
- update ATT_FSC_BASE
- <trim prefix="set" suffixOverrides=",">
- <if test="code != null and code != ''">CODE = #{code},</if>
- <if test="name != null and name != ''">NAME = #{name},</if>
- <if test="type != null and type != ''">TYPE = #{type},</if>
- <if test="admOrg != null and admOrg != ''">ADM_ORG = #{admOrg},</if>
- <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
- <if test="location != null and location != ''">LOCATION = #{location},</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="persId != null and persId != ''">PERS_ID = #{persId},</if>
- <if test="intm != null">INTM = #{intm},</if>
- <if test="uptm != null">UPTM = #{uptm},</if>
- </trim>
- <where>ID = #{id}</where>
- </update>
- <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.AttFscBase">
- update ATT_FSC_BASE
- <trim prefix="set" suffixOverrides=",">
- <if test="code != null and code != ''">CODE = #{code},</if>
- <if test="name != null and name != ''">NAME = #{name},</if>
- <if test="type != null and type != ''">TYPE = #{type},</if>
- <if test="admOrg != null and admOrg != ''">ADM_ORG = #{admOrg},</if>
- <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
- <if test="location != null and location != ''">LOCATION = #{location},</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="persId != null and persId != ''">PERS_ID = #{persId},</if>
- <if test="intm != null">INTM = #{intm},</if>
- <if test="uptm != null">UPTM = #{uptm},</if>
- </trim>
- <include refid="page_where"/>
- </update>
- <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="getObjByPersId" resultType="cn.com.goldenwater.dcproj.model.AttFscBase" parameterType="cn.com.goldenwater.dcproj.param.PersObjParam">
- SELECT A.* ,B.OBJ_ID,B.ID groupId,C.ID rgstrId FROM ATT_FSC_BASE A LEFT JOIN BIS_INSP_ALL_OBJ B ON A.id = B.CODE
- LEFT JOIN BIS_INSP_FSC_RGSTR C ON B.OBJ_ID = C.OBJ_ID
- WHERE B.PTYPE = #{objType} AND
- REGEXP_LIKE(
- B.Id,'^('||
- ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{persGuid} and id like '009%'
- <include refid="orgIdSql"/>
- )>0 then
- (SELECT LISTAGG(id, '|') WITHIN GROUP(ORDER BY PERSID) as
- id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{persGuid} and id like '009%'
- <include refid="orgIdSql"/>
- )
- else (select 'non' from dual) end)
- ||')')
- <choose>
- <when test="province !=null and province !=''">
- and B.AD_CODE =#{province}
- </when>
- <otherwise>
- and B.AD_CODE is null
- </otherwise>
- </choose>
- <if test="adName != null and adName != ''">and A.NAME LIKE '%${adName}%'</if>
- <if test="adCode != null and adCode != ''">and A.AD_CODE LIKE '${adCode}%'</if>
- </select>
- <!-- 其他自定义SQL -->
- <select id="getBasePageInfoNotInFsc" parameterType="cn.com.goldenwater.dcproj.param.AttFscBaseParam"
- resultType="cn.com.goldenwater.dcproj.model.AttFscBase">
- select f.code,
- f.name,
- f.ad_code,
- f.location,
- f.center_x,
- f.center_y,
- f.gd_x,
- f.gd_y,
- f.type from (
- select to_char(rs.rs_code) as code,to_char(rs.rs_name) as name,to_char(rs.adm_div) as
- ad_Code,to_char(rs.rs_adm_name) as location,rs.center_x as center_X,rs.center_y as center_y,
- rs.center_x_gd as GD_X ,rs.center_y_gd as GD_Y, '1' as type from ATT_RS_BASE rs
- union all
- select t.obj_code as code,t.gate_name as name,t.ad_code as ad_code,t.location_cun as location, t.center_x as
- center_X,t.center_y as center_y,
- t.gd_x as GD_X,t.GD_Y as GD_Y,'2' as type from ATT_WAGA_BASE t
- union all
- select t.cws_code as code,t.cws_name as name ,t.addvcd as ad_code,t.cws_loc as location,t.cws_long as
- center_x,t.cws_lat as center_y,
- t.center_x_gd as GD_X ,t.center_y_gd as GD_Y,'3' as type from ATT_CWS_BASE t
- union all
- select t.id as code,t.nm as name,t.ad_code as ad_code,'' as location,t.lgtd as center_x,t.lttd as center_y,
- t.lgtd_pc as gd_x ,t.lttd_pc as gd_y,'4' as type from ATT_EMPWTPRJ_BASE t where t.eng_sta = '2'
- union all
- select t.id as code,t.nm as name,t.ad_code as ad_code,'' as location,t.lgtd as center_x,t.lttd as center_y,
- t.lgtd_pc as gd_x ,t.lttd_pc as gd_y,'4' as type from ATT_EMPWTPRJ_BASE t where t.eng_sta = '1'
- ) f
- where 1=1
- <if test="type != null and type != ''">
- and f.type = #{type}
- </if>
- <if test="province !=null and province !=''">
- AND f.ad_code like '${province}%'
- </if>
- <if test="name != null and name != ''">
- AND f.name like '%${name}%'
- </if>
- <if test="adCode != null and adCode != ''">
- AND f.ad_Code like '${adCode}%'
- </if>
- AND f.code not in (select code from att_fsc_base t where t.code is not null)
- </select>
- <update id="updateFscBase" parameterType="cn.com.goldenwater.dcproj.model.AttFscBase" >
- update ATT_FSC_BASE
- <trim prefix="set" suffixOverrides=",">
- CODE = #{code},
- <if test="name != null and name != ''">NAME = #{name},</if>
- <if test="type != null and type != ''">TYPE = #{type},</if>
- ADM_ORG = #{admOrg},
- AD_CODE = #{adCode},
- LOCATION = #{location},
- CENTER_X = #{centerX},
- CENTER_Y = #{centerY},
- <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
- <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
- <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
- <if test="intm != null">INTM = #{intm},</if>
- <if test="uptm != null">UPTM = #{uptm},</if>
- </trim>
- <where>ID = #{id}</where>
- </update>
- <select id="findListBy" parameterType="cn.com.goldenwater.dcproj.param.PersObjParam" resultType="cn.com.goldenwater.dcproj.model.AttFscBase">
- select
- A.ID,
- A.CODE,
- A.NAME,
- A.TYPE,
- A.ADM_ORG,
- A.AD_CODE,
- A.LOCATION,
- A.CENTER_X,
- A.CENTER_Y,
- A.GD_X,
- A.GD_Y,
- A.PERS_ID,
- A.INTM,
- A.UPTM
- from ATT_FSC_BASE A
- where 1=1
- <if test="adName != null and adName != ''">and A.name LIKE '%${adName}%'</if>
- <if test="adCode != null and adCode != ''">and A.AD_CODE LIKE '${adCode}%'</if>
- <if test="maxLgtd != null and maxLgtd != '' and minLgtd != null and minLgtd != ''">and A.CENTER_X BETWEEN
- #{minLgtd} AND #{maxLgtd}
- </if>
- <if test="maxLttd != null and maxLttd != '' and minLttd != null and minLttd != ''">and A.CENTER_Y BETWEEN
- #{minLttd} AND #{maxLttd}
- </if>
- </select>
- <select id="getObjListNotInspGroupId" resultType="cn.com.goldenwater.dcproj.model.AttWagaBase" parameterType="String">
- select t.*
- from ATT_FSC_BASE t
- where t.id not in (
- select CODE from BIS_INSP_ALL_OBJ B where id like concat(#{inspGroupId},'%') and B.obj_type=#{objType}
- <choose>
- <when test="province !=null and province !=''">
- and B.AD_CODE =#{province}
- </when>
- <otherwise>
- and B.AD_CODE is null
- </otherwise>
- </choose>
- )
- <if test="adName != null and adName != ''">and t.nm LIKE '%${adName}%'</if>
- <if test="adCode != null and adCode != ''">and t.AD_CODE LIKE '${adCode}%'</if>
- </select>
- </mapper>
|