| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289 |
- <?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.AttWiuBaseDao">
- <resultMap type="cn.com.goldenwater.dcproj.model.AttWiuBase" id="attWiuBaseResultMap">
- <result property="id" column="ID"/>
- <result property="wiuCode" column="WIU_CODE"/>
- <result property="wiuName" column="WIU_NAME"/>
- <result property="wintCode" column="WINT_CODE"/>
- <result property="idtType" column="IDT_TYPE"/>
- <result property="name" column="NAME"/>
- <result property="adName" column="AD_NAME"/>
- <result property="adCode" column="AD_CODE"/>
- <result property="wiuNat" column="WIU_NAT"/>
- <result property="wiuNatName" column="WIU_NAT_NAME"/>
- <result property="codeType" column="CODE_TYPE"/>
- <result property="codeVal" column="CODE_VAL"/>
- <result property="wiuContact" column="WIU_CONTACT"/>
- <result property="wiuContactTel" column="WIU_CONTACT_TEL"/>
- <result property="inTm" column="IN_TM"/>
- <result property="upTm" column="UP_TM"/>
- <result property="wiuLong" column="WIU_LONG"/>
- <result property="wiuLat" column="WIU_LAT"/>
- <result property="gdX" column="GD_X"/>
- <result property="gdY" column="GD_Y"/>
- <result property="unitType" column="UNIT_TYPE"/>
- <result property="ndstyType" column="NDSTY_TYPE"/>
- <result property="rgstrAddr" column="RGSTR_ADDR"/>
- <result property="bizAddr" column="BIZ_ADDR"/>
- <result property="note" column="NOTE"/>
- </resultMap>
- <sql id="table_columns">
- ID,
- WIU_CODE,
- WIU_NAME,
- WINT_CODE,
- IDT_TYPE,
- AD_NAME,
- AD_CODE,
- NAME,
- WIU_NAT,
- WIU_NAT_NAME,
- CODE_TYPE,
- CODE_VAL,
- WIU_CONTACT,
- WIU_CONTACT_TEL,
- IN_TM,
- UP_TM,
- WIU_LONG,
- WIU_LAT,
- GD_X,
- GD_Y,
- UNIT_TYPE,
- NDSTY_TYPE,
- RGSTR_ADDR,
- BIZ_ADDR,
- NOTE
- </sql>
- <sql id="entity_properties">
- #{id},
- #{wiuCode},
- #{wiuName},
- #{wintCode},
- #{idtType},
- #{adName},
- #{adCode},
- #{name},
- #{wiuNat},
- #{wiuNatName},
- #{codeType},
- #{codeVal},
- #{wiuContact},
- #{wiuContactTel},
- #{inTm},
- #{upTm},
- #{wiuLong},
- #{wiuLat},
- #{gdX},
- #{gdY},
- #{unitType},
- #{ndstyType},
- #{rgstrAddr},
- #{bizAddr},
- #{note}
- </sql>
- <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
- <sql id="page_where">
- <trim prefix="where" prefixOverrides="and | or ">
- <if test="unitType != null and unitType != ''">and UNIT_TYPE = #{unitType}</if>
- <if test="ndstyType != null and ndstyType != ''">and NDSTY_TYPE = #{ndstyType}</if>
- <if test="rgstrAddr != null and rgstrAddr != ''">and RGSTR_ADDR = #{rgstrAddr}</if>
- <if test="bizAddr != null and bizAddr != ''">and BIZ_ADDR = #{bizAddr}</if>
- <if test="wiuCode != null and wiuCode != ''">and WIU_CODE = #{wiuCode}</if>
- <if test="wiuName != null and wiuName != ''">and WIU_NAME = #{wiuName}</if>
- <if test="wintCode != null and wintCode != ''">and WINT_CODE = #{wintCode}</if>
- <if test="idtType != null and idtType != ''">and IDT_TYPE = #{idtType}</if>
- <if test="name != null and name != ''">and NAME = #{name}</if>
- <if test="adName != null and adName != ''">and AD_NAME = #{adName}</if>
- <if test="adCode != null and adCode != ''">and AD_CODE = #{adCode}</if>
- <if test="wiuNat != null and wiuNat != ''">and WIU_NAT = #{wiuNat}</if>
- <if test="wiuNatName != null and wiuNatName != ''">and WIU_NAT_NAME = #{wiuNatName}</if>
- <if test="codeType != null and codeType != ''">and CODE_TYPE = #{codeType}</if>
- <if test="codeVal != null and codeVal != ''">and CODE_VAL = #{codeVal}</if>
- <if test="wiuContact != null and wiuContact != ''">and WIU_CONTACT = #{wiuContact}</if>
- <if test="wiuContactTel != null and wiuContactTel != ''">and WIU_CONTACT_TEL = #{wiuContactTel}</if>
- <if test="inTm != null">and IN_TM = #{inTm}</if>
- <if test="upTm != null">and UP_TM = #{upTm}</if>
- <if test="wiuLong != null and wiuLong != ''">and WIU_LONG = #{wiuLong}</if>
- <if test="wiuLat != null and wiuLat != ''">and WIU_LAT = #{wiuLat}</if>
- <if test="gdX != null and gdX != ''">and GD_X = #{gdX}</if>
- <if test="gdY != null and gdY != ''">and GD_Y = #{gdY}</if>
- </trim>
- </sql>
- <select id="get" resultMap="attWiuBaseResultMap" parameterType="String">
- select
- <include refid="table_columns"/>
- from ATT_WIU_BASE where ID = #{id}
- </select>
- <select id="getBy" resultMap="attWiuBaseResultMap">
- select
- <include refid="table_columns"/>
- from ATT_WIU_BASE
- <include refid="page_where"/>
- </select>
- <select id="findList" resultMap="attWiuBaseResultMap">
- select
- <include refid="table_columns"/>
- from ATT_WIU_BASE
- <include refid="page_where"/>
- </select>
- <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.AttWiuBase">
- insert into ATT_WIU_BASE(
- <include refid="table_columns"/>
- )
- values (
- <include refid="entity_properties"/>
- )
- </insert>
- <delete id="delete" parameterType="java.lang.String">
- delete from ATT_WIU_BASE where ID = #{id}
- </delete>
- <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.AttWiuBase">
- delete from ATT_WIU_BASE
- <include refid="page_where"/>
- </delete>
- <update id="deleteInFlag" parameterType="java.lang.String">
- update ATT_WIU_BASE set flag_valid = 0 where ID = #{id}
- </update>
- <update id="update" parameterType="cn.com.goldenwater.dcproj.model.AttWiuBase">
- update ATT_WIU_BASE
- <trim prefix="set" suffixOverrides=",">
- <if test="note != null and note != ''">NOTE = #{note},</if>
- <if test="unitType != null and unitType != ''">UNIT_TYPE = #{unitType},</if>
- <if test="ndstyType != null and ndstyType != ''">NDSTY_TYPE = #{ndstyType},</if>
- <if test="rgstrAddr != null and rgstrAddr != ''">RGSTR_ADDR = #{rgstrAddr},</if>
- <if test="bizAddr != null and bizAddr != ''">BIZ_ADDR = #{bizAddr},</if>
- <if test="wiuCode != null and wiuCode != ''">WIU_CODE = #{wiuCode},</if>
- <if test="wiuName != null and wiuName != ''">WIU_NAME = #{wiuName},</if>
- <if test="wintCode != null and wintCode != ''">WINT_CODE = #{wintCode},</if>
- <if test="idtType != null and idtType != ''">IDT_TYPE = #{idtType},</if>
- <if test="name != null and name != ''">NAME = #{name},</if>
- <if test="wiuNat != null and wiuNat != ''">WIU_NAT = #{wiuNat},</if>
- <if test="wiuNatName != null and wiuNatName != ''">WIU_NAT_NAME = #{wiuNatName},</if>
- <if test="codeType != null and codeType != ''">CODE_TYPE = #{codeType},</if>
- <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
- <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
- <if test="codeVal != null and codeVal != ''">CODE_VAL = #{codeVal},</if>
- <if test="wiuContact != null and wiuContact != ''">WIU_CONTACT = #{wiuContact},</if>
- <if test="wiuContactTel != null and wiuContactTel != ''">WIU_CONTACT_TEL = #{wiuContactTel},</if>
- <if test="inTm != null">IN_TM = #{inTm},</if>
- <if test="upTm != null">UP_TM = #{upTm},</if>
- <if test="wiuLong != null and wiuLong != ''">WIU_LONG = #{wiuLong},</if>
- <if test="wiuLat != null and wiuLat != ''">WIU_LAT = #{wiuLat},</if>
- <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
- <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
- </trim>
- <where>ID = #{id}</where>
- </update>
- <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.AttWiuBase">
- update ATT_WIU_BASE
- <trim prefix="set" suffixOverrides=",">
- <if test="unitType != null and unitType != ''">UNIT_TYPE = #{unitType},</if>
- <if test="ndstyType != null and ndstyType != ''">NDSTY_TYPE = #{ndstyType},</if>
- <if test="rgstrAddr != null and rgstrAddr != ''">RGSTR_ADDR = #{rgstrAddr},</if>
- <if test="bizAddr != null and bizAddr != ''">BIZ_ADDR = #{bizAddr},</if>
- <if test="wiuCode != null and wiuCode != ''">WIU_CODE = #{wiuCode},</if>
- <if test="wiuName != null and wiuName != ''">WIU_NAME = #{wiuName},</if>
- <if test="wintCode != null and wintCode != ''">WINT_CODE = #{wintCode},</if>
- <if test="idtType != null and idtType != ''">IDT_TYPE = #{idtType},</if>
- <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
- <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
- <if test="name != null and name != ''">NAME = #{name},</if>
- <if test="wiuNat != null and wiuNat != ''">WIU_NAT = #{wiuNat},</if>
- <if test="wiuNatName != null and wiuNatName != ''">WIU_NAT_NAME = #{wiuNatName},</if>
- <if test="codeType != null and codeType != ''">CODE_TYPE = #{codeType},</if>
- <if test="codeVal != null and codeVal != ''">CODE_VAL = #{codeVal},</if>
- <if test="wiuContact != null and wiuContact != ''">WIU_CONTACT = #{wiuContact},</if>
- <if test="wiuContactTel != null and wiuContactTel != ''">WIU_CONTACT_TEL = #{wiuContactTel},</if>
- <if test="inTm != null">IN_TM = #{inTm},</if>
- <if test="upTm != null">UP_TM = #{upTm},</if>
- <if test="wiuLong != null and wiuLong != ''">WIU_LONG = #{wiuLong},</if>
- <if test="wiuLat != null and wiuLat != ''">WIU_LAT = #{wiuLat},</if>
- <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
- <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
- </trim>
- <include refid="page_where"/>
- </update>
- <!-- 其他自定义SQL -->
- <select id="getMaxCode" resultType="string" parameterType="string">
- select MAX(WIU_Code) as code from ATT_WIU_BASE e where e.ad_code LIKE #{adCode}||'%'
- </select>
- <sql id="orgIdSql">
- <choose>
- <when test="orgId !=null and orgId !=''">
- and ORG_ID=#{orgId}
- </when>
- <otherwise>
- and ORG_ID is null
- </otherwise>
- </choose>
- </sql>
- <select id="getObjByPersId" parameterType="cn.com.goldenwater.dcproj.param.PersObjParam"
- resultType="cn.com.goldenwater.dcproj.model.AttWiuBase">
- SELECT A.* ,B.OBJ_ID,B.ID groupId,C.ID rgstrId FROM ATT_WIU_BASE A LEFT JOIN BIS_INSP_ALL_OBJ B ON A.id = B.CODE
- LEFT JOIN BIS_INSP_WIU_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}<include refid="orgIdSql"/>)>0
- then
- (SELECT LISTAGG(id, '|') as
- id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{persGuid}<include refid="orgIdSql"/> GROUP BY PERSID)
- 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.WIU_NAME LIKE '%${adName}%'</if>
- <if test="adCode != null and adCode != ''">and A.AD_CODE LIKE '${adCode}%'</if>
- </select>
- <select id="getObjListNotInspGroupId" parameterType="String"
- resultType="cn.com.goldenwater.dcproj.model.AttWiuBase">
- select t.*
- from ATT_WIU_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>
- <select id="getObjId" parameterType="String"
- resultType="cn.com.goldenwater.dcproj.model.AttWiuBase">
- SELECT
- <include refid="table_columns"/>
- FROM ATT_WIU_BASE
- WHERE ID = (SELECT CODE FROM BIS_INSP_ALL_OBJ WHERE OBJ_ID = #{objId})
- </select>
- </mapper>
|