| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251 |
- <?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.BisInspRsraqgRgstrDao">
- <resultMap type="cn.com.goldenwater.dcproj.model.BisInspRsraqgRgstr" id="bisInspRsraqgRgstrResultMap">
- <result property="id" column="ID"/>
- <result property="objId" column="OBJ_ID"/>
- <result property="adName" column="AD_NAME"/>
- <result property="adCode" column="AD_CODE"/>
- <result property="loc" column="LOC"/>
- <result property="pcX" column="PC_X"/>
- <result property="pcY" column="PC_Y"/>
- <result property="gdX" column="GD_X"/>
- <result property="gdY" column="GD_Y"/>
- <result property="note" column="NOTE"/>
- <result property="state" column="STATE"/>
- <result property="persId" column="PERS_ID"/>
- <result property="groupId" column="GROUP_ID"/>
- <result property="intm" column="INTM"/>
- <result property="uptm" column="UPTM"/>
- </resultMap>
-
- <sql id="table_columns">
- ID,
- OBJ_ID,
- AD_NAME,
- AD_CODE,
- LOC,
- PC_X,
- PC_Y,
- GD_X,
- GD_Y,
- NOTE,
- STATE,
- PERS_ID,
- GROUP_ID,
- INTM,
- UPTM
- </sql>
- <sql id="entity_properties">
- #{id},
- #{objId},
- #{adName},
- #{adCode},
- #{loc},
- #{pcX},
- #{pcY},
- #{gdX},
- #{gdY},
- #{note},
- #{state},
- #{persId},
- #{groupId},
- #{intm},
- #{uptm}
- </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="adName != null and adName != ''">and AD_NAME = #{adName}</if>
- <if test="adCode != null and adCode != ''">and AD_CODE = #{adCode}</if>
- <if test="loc != null and loc != ''">and LOC = #{loc}</if>
- <if test="pcX != null and pcX != ''">and PC_X = #{pcX}</if>
- <if test="pcY != null and pcY != ''">and PC_Y = #{pcY}</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="note != null and note != ''">and NOTE = #{note}</if>
- <if test="state != null and state != ''">and STATE = #{state}</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 INTM = #{intm}</if>
- <if test="uptm != null">and UPTM = #{uptm}</if>
- </trim>
- </sql>
- <select id="get" resultMap="bisInspRsraqgRgstrResultMap" parameterType="String" >
- select <include refid="table_columns" /> from BIS_INSP_RSRAQG_RGSTR where ID = #{id}
- </select>
- <select id="getBy" resultMap="bisInspRsraqgRgstrResultMap">
- select <include refid="table_columns" /> from BIS_INSP_RSRAQG_RGSTR <include refid="page_where" />
- </select>
- <select id="findAll" resultMap="bisInspRsraqgRgstrResultMap">
- select <include refid="table_columns" /> from BIS_INSP_RSRAQG_RGSTR
- </select>
- <select id="findList" resultMap="bisInspRsraqgRgstrResultMap">
- select <include refid="table_columns" /> from BIS_INSP_RSRAQG_RGSTR <include refid="page_where" />
- </select>
- <select id="selectCount" resultType="int" >
- select count(ID) from BIS_INSP_RSRAQG_RGSTR <include refid="page_where" />
- </select>
- <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspRsraqgRgstr">
- insert into BIS_INSP_RSRAQG_RGSTR( <include refid="table_columns" /> )
- values ( <include refid="entity_properties" /> )
- </insert>
- <delete id="delete" parameterType="java.lang.String">
- update BIS_INSP_RSRAQG_RGSTR set DATA_STAT='9' where ID = #{id}
- </delete>
- <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspRsraqgRgstr">
- update BIS_INSP_RSRAQG_RGSTR set DATA_STAT='9' <include refid="page_where" />
- </delete>
- <update id="deleteInFlag" parameterType="java.lang.String">
- update BIS_INSP_RSRAQG_RGSTR set DATA_STAT = '9' where ID = #{id}
- </update>
- <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspRsraqgRgstr">
- update BIS_INSP_RSRAQG_RGSTR
- <trim prefix="set" suffixOverrides=",">
- <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
- <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
- <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
- <if test="loc != null and loc != ''">LOC = #{loc},</if>
- <if test="pcX != null and pcX != ''">PC_X = #{pcX},</if>
- <if test="pcY != null and pcY != ''">PC_Y = #{pcY},</if>
- <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
- <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
- <if test="note != null and note != ''">NOTE = #{note},</if>
- <if test="state != null and state != ''">STATE = #{state},</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">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.BisInspRsraqgRgstr">
- update BIS_INSP_RSRAQG_RGSTR
- <trim prefix="set" suffixOverrides=",">
- <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
- <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
- <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
- <if test="loc != null and loc != ''">LOC = #{loc},</if>
- <if test="pcX != null and pcX != ''">PC_X = #{pcX},</if>
- <if test="pcY != null and pcY != ''">PC_Y = #{pcY},</if>
- <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
- <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
- <if test="note != null and note != ''">NOTE = #{note},</if>
- <if test="state != null and state != ''">STATE = #{state},</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">INTM = #{intm},</if>
- <if test="uptm != null">UPTM = #{uptm},</if>
- </trim>
- <include refid="page_where" />
- </update>
- <!-- 其他自定义SQL -->
- <select id="findRsraqgRgstrPage" parameterType="cn.com.goldenwater.dcproj.param.TypeParam" resultType="cn.com.goldenwater.dcproj.dto.BisInspRgstrDto">
- SELECT * FROM (
- select A.CODE,A.ID nodeId,
- A.NM,
- '23' PTYPE,
- B.pc_x,
- B.pc_y,
- B.GD_X,
- B.GD_y,
- A.OBJ_ID,B.ID ID,B.ID rgstrId,
- (case when b.loc is null then c.ad_full_name else b.loc end) as location,
- (case when b.State is null then '0' else b.state end)STATE
- ,B.INTM
- ,B.UPTM
- ,c.AD_NAME as adName,
- ia.pnm groupName
- from BIS_INSP_ALL_OBJ
- A LEFT JOIN BIS_INSP_RSRAQG_RGSTR B ON A.OBJ_ID=B.OBJ_ID
- LEFT JOIN ATT_AD_X_BASE C ON A.CODE=C.AD_CODE
- LEFT JOIN BIS_INSP_ALL ia on A.ID = ia.id
- where A.ptype='23'
- <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"/>
- <if test="adName != null and adName != ''">and ad.AD_NAME LIKE '%${adName}%'</if>
- <if test="groupId != null and groupId != ''">and A.id = #{groupId}</if>
- <if test="adCode != null and adCode !=''">and B.AD_CODE like '${adCode}%'</if>
- <if test="plnaId !=null and plnaId !=''">
- and A.id like '${plnaId}%'
- </if>
- <if test="orgId != null and orgId !=''">and A.org_id = #{orgId}</if>
- <if test="sttm != null and sttm != '' and entm != null and entm != ''">
- AND B.intm >= TO_DATE(#{sttm},'YYYY-MM-DD') AND B.uptm < TO_DATE(#{entm},'YYYY-MM-DD')+1
- </if>
- and
- REGEXP_LIKE(
- A.Id,'^('||
- ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{presId} and id like '023%')>0 then
- (SELECT LISTAGG(id, '|') as
- id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{presId} and id like '023%' group by persid)
- else (select 'non' from dual) end)
- ||')')
- ) where 1 = 1
- <if test="state != null and state != ''">
- and state in (${state})
- </if>
- <if test="name != null and name != ''">
- and name like '%${name}%'
- </if>
- </select>
- <sql id="choseSql">
- <choose>
- <when test="province !=null and province !=''">
- and A.ad_code=#{province}
- </when>
- <otherwise>
- and A.ad_code is null
- </otherwise>
- </choose>
- </sql>
- <select id="getListRsraqByInspGroupIdObjType" resultType="cn.com.goldenwater.dcproj.model.BisInspRsraqgRgstr" parameterType="cn.com.goldenwater.dcproj.param.PagePersObjParam">
- select t.*,C.id groupId,C.PNM groupName,B.obj_id,r.loc
- from att_ad_base t
- left join BIS_INSP_ALL_OBJ B
- on B.CODE = t.ad_code
- LEFT JOIN BIS_INSP_ALL C ON B.ID = C.ID
- and B.ptype = #{objType}
- left join BIS_INSP_RSRAQG_RGSTR r on b.obj_id=r.obj_id
- 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>
- </mapper>
|