| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351 |
- <?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.BisInspSamrmpRgstrDao">
- <resultMap type="cn.com.goldenwater.dcproj.model.BisInspSamrmpRgstr" id="bisInspSamrmpRgstrResultMap">
- <result property="id" column="ID"/>
- <result property="objId" column="OBJ_ID"/>
- <result property="prjId" column="PRJ_ID"/>
- <result property="prjName" column="PRJ_NAME"/>
- <result property="rvName" column="RV_NAME"/>
- <result property="adCode" column="AD_CODE"/>
- <result property="adName" column="AD_NAME"/>
- <result property="addr" column="ADDR"/>
- <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="smrmpState" column="SMRMP_STATE"/>
- <result property="state" column="STATE"/>
- <result property="groupLeader" column="GROUP_LEADER"/>
- <result property="groupLeaderTel" column="GROUP_LEADER_TEL"/>
- <result property="recPersId" column="REC_PERS_ID"/>
- <result property="recPers" column="REC_PERS"/>
- <result property="recPersTel" column="REC_PERS_TEL"/>
- <result property="intm" column="INTM"/>
- <result property="uptm" column="UPTM"/>
- <result property="note" column="NOTE"/>
- <result property="rvLong" column="RV_LONG"/>
- <result property="pgi" column="PGI"/>
- </resultMap>
- <sql id="table_columns">
- RV_LONG,
- PGI,
- ID,
- OBJ_ID,
- PRJ_ID,
- PRJ_NAME,
- RV_NAME,
- AD_CODE,
- AD_NAME,
- ADDR,
- CENTER_X,
- CENTER_Y,
- GD_X,
- GD_Y,
- SMRMP_STATE,
- STATE,
- GROUP_LEADER,
- GROUP_LEADER_TEL,
- REC_PERS_ID,
- REC_PERS,
- REC_PERS_TEL,
- INTM,
- UPTM,
- NOTE
- </sql>
- <sql id="entity_properties">
- #{rvLong},
- #{pgi},
- #{id},
- #{objId},
- #{prjId},
- #{prjName},
- #{rvName},
- #{adCode},
- #{adName},
- #{addr},
- #{centerX},
- #{centerY},
- #{gdX},
- #{gdY},
- #{smrmpState},
- #{state},
- #{groupLeader},
- #{groupLeaderTel},
- #{recPersId},
- #{recPers},
- #{recPersTel},
- #{intm},
- #{uptm},
- #{note}
- </sql>
- <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
- <sql id="page_where">
- <trim prefix="where" prefixOverrides="and | or ">
- <if test="rvLong != null and rvLong != ''">and RV_LONG = #{rvLong}</if>
- <if test="pgi != null and pgi != ''">and PGI = #{pgi}</if>
- <if test="objId != null and objId != ''">and OBJ_ID = #{objId}</if>
- <if test="prjId != null and prjId != ''">and PRJ_ID = #{prjId}</if>
- <if test="prjName != null and prjName != ''">and PRJ_NAME = #{prjName}</if>
- <if test="rvName != null and rvName != ''">and RV_NAME = #{rvName}</if>
- <if test="adCode != null and adCode != ''">and AD_CODE = #{adCode}</if>
- <if test="adName != null and adName != ''">and AD_NAME = #{adName}</if>
- <if test="addr != null and addr != ''">and ADDR = #{addr}</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="smrmpState != null and smrmpState != ''">and SMRMP_STATE = #{smrmpState}</if>
- <if test="state != null and state != ''">and STATE = #{state}</if>
- <if test="groupLeader != null and groupLeader != ''">and GROUP_LEADER = #{groupLeader}</if>
- <if test="groupLeaderTel != null and groupLeaderTel != ''">and GROUP_LEADER_TEL = #{groupLeaderTel}</if>
- <if test="recPersId != null and recPersId != ''">and REC_PERS_ID = #{recPersId}</if>
- <if test="recPers != null and recPers != ''">and REC_PERS = #{recPers}</if>
- <if test="recPersTel != null and recPersTel != ''">and REC_PERS_TEL = #{recPersTel}</if>
- <if test="intm != null">and INTM = #{intm}</if>
- <if test="uptm != null">and UPTM = #{uptm}</if>
- <if test="note != null and note != ''">and NOTE = #{note}</if>
- </trim>
- </sql>
- <select id="get" resultMap="bisInspSamrmpRgstrResultMap" parameterType="String">
- select
- <include refid="table_columns"/>
- from BIS_INSP_SAMRMP_RGSTR where ID = #{id}
- </select>
- <select id="getBy" resultMap="bisInspSamrmpRgstrResultMap">
- select
- <include refid="table_columns"/>
- from BIS_INSP_SAMRMP_RGSTR
- <include refid="page_where"/>
- </select>
- <select id="findAll" resultMap="bisInspSamrmpRgstrResultMap">
- select
- <include refid="table_columns"/>
- from BIS_INSP_SAMRMP_RGSTR
- </select>
- <select id="findList" resultMap="bisInspSamrmpRgstrResultMap">
- select
- <include refid="table_columns"/>
- from BIS_INSP_SAMRMP_RGSTR
- <include refid="page_where"/>
- </select>
- <select id="selectCount" resultType="int">
- select count(ID) from BIS_INSP_SAMRMP_RGSTR
- <include refid="page_where"/>
- </select>
- <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspSamrmpRgstr">
- insert into BIS_INSP_SAMRMP_RGSTR(
- <include refid="table_columns"/>
- )
- values (
- <include refid="entity_properties"/>
- )
- </insert>
- <delete id="delete" parameterType="java.lang.String">
- delete from BIS_INSP_SAMRMP_RGSTR where ID = #{id}
- </delete>
- <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspSamrmpRgstr">
- delete from BIS_INSP_SAMRMP_RGSTR
- <include refid="page_where"/>
- </delete>
- <update id="deleteInFlag" parameterType="java.lang.String">
- update BIS_INSP_SAMRMP_RGSTR set flag_valid = 0 where>ID = #{id}
- </update>
- <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspSamrmpRgstr">
- update BIS_INSP_SAMRMP_RGSTR
- <trim prefix="set" suffixOverrides=",">
- <if test="rvLong != null and rvLong != ''">RV_LONG = #{rvLong},</if>
- <if test="pgi != null and pgi != ''">PGI = #{pgi},</if>
- <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
- <if test="prjId != null and prjId != ''">PRJ_ID = #{prjId},</if>
- <if test="prjName != null and prjName != ''">PRJ_NAME = #{prjName},</if>
- <if test="rvName != null and rvName != ''">RV_NAME = #{rvName},</if>
- <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
- <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
- <if test="addr != null and addr != ''">ADDR = #{addr},</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="smrmpState != null and smrmpState != ''">SMRMP_STATE = #{smrmpState},</if>
- <if test="state != null and state != ''">STATE = #{state},</if>
- <if test="groupLeader != null and groupLeader != ''">GROUP_LEADER = #{groupLeader},</if>
- <if test="groupLeaderTel != null and groupLeaderTel != ''">GROUP_LEADER_TEL = #{groupLeaderTel},</if>
- <if test="recPersId != null and recPersId != ''">REC_PERS_ID = #{recPersId},</if>
- <if test="recPers != null and recPers != ''">REC_PERS = #{recPers},</if>
- <if test="recPersTel != null and recPersTel != ''">REC_PERS_TEL = #{recPersTel},</if>
- <if test="intm != null">INTM = #{intm},</if>
- <if test="uptm != null">UPTM = #{uptm},</if>
- <if test="note != null and note != ''">NOTE = #{note},</if>
- </trim>
- <where>ID = #{id}</where>
- </update>
- <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspSamrmpRgstr">
- update BIS_INSP_SAMRMP_RGSTR
- <trim prefix="set" suffixOverrides=",">
- <if test="rvLong != null and rvLong != ''">RV_LONG = #{rvLong},</if>
- <if test="pgi != null and pgi != ''">PGI = #{pgi},</if>
- <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
- <if test="prjId != null and prjId != ''">PRJ_ID = #{prjId},</if>
- <if test="prjName != null and prjName != ''">PRJ_NAME = #{prjName},</if>
- <if test="rvName != null and rvName != ''">RV_NAME = #{rvName},</if>
- <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
- <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
- <if test="addr != null and addr != ''">ADDR = #{addr},</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="smrmpState != null and smrmpState != ''">SMRMP_STATE = #{smrmpState},</if>
- <if test="state != null and state != ''">STATE = #{state},</if>
- <if test="groupLeader != null and groupLeader != ''">GROUP_LEADER = #{groupLeader},</if>
- <if test="groupLeaderTel != null and groupLeaderTel != ''">GROUP_LEADER_TEL = #{groupLeaderTel},</if>
- <if test="recPersId != null and recPersId != ''">REC_PERS_ID = #{recPersId},</if>
- <if test="recPers != null and recPers != ''">REC_PERS = #{recPers},</if>
- <if test="recPersTel != null and recPersTel != ''">REC_PERS_TEL = #{recPersTel},</if>
- <if test="intm != null">INTM = #{intm},</if>
- <if test="uptm != null">UPTM = #{uptm},</if>
- <if test="note != null and note != ''">NOTE = #{note},</if>
- </trim>
- <include refid="page_where"/>
- </update>
- <!-- 其他自定义SQL -->
- <select id="findSamrmpList" resultType="cn.com.goldenwater.dcproj.dto.BisInspRgstrDto">
- SELECT * FROM (
- select
- A.CODE,
- A.ID nodeId,
- A.NM,
- #{pType} pType,
- A.OBJ_ID,
- B.ID ID,
- b.id as rgstrId,
- (case when b.State is null then '0' else b.state end) STATE,
- B.intm,B.UPTM,
- b.AD_CODE,
- b.AD_NAME as adName,
- b.SMRMP_STATE,
- ia.pnm groupName
- from BIS_INSP_ALL_OBJ
- A LEFT JOIN BIS_INSP_SAMRMP_RGSTR B ON A.OBJ_ID=B.OBJ_ID
- LEFT JOIN BIS_INSP_ALL ia on A.ID = ia.id
- where A.ptype= #{pType}
- <if test="adCodes ==null or adCodes ==''">
- <choose>
- <when test='isAll =="1"'>
- </when>
- <otherwise>
- AND
- A.Id in (
- select distinct id from (
- SELECT P.id FROM BIS_INSP_ALL P START WITH P.PID IN (SELECT id FROM BIS_INSP_ALL_RLATION A
- WHERE A.PERSID = #{presId} AND Type=#{pType}
- and (length(id) between 2 and 10))
- CONNECT BY P.PID = PRIOR P.ID
- union all
- SELECT P.id FROM BIS_INSP_ALL P where p.id in (SELECT id FROM BIS_INSP_ALL_RLATION A
- WHERE A.PERSID = #{presId} AND Type=#{pType}
- and length(id)> 11 )
- )
- )
- </otherwise>
- </choose>
- </if>
- <if test="adCodes !=null and adCodes !=''">
- and
- <foreach item="item" index="index" collection="adCodes.split(',')" open="(" separator="or" close=")">
- b.ad_code like concat('${item}','%')
- </foreach>
- </if>
- ) A WHERE a.PTYPE=#{pType}
- <if test="adCode !=null and adCode !='' ">
- and a.AD_CODE like '${province}%'
- </if>
- <if test="plnaId !=null and plnaId !=''">
- and a.nodeId like '${plnaId}%'
- </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="adName != null and adName != ''">and a.adName like '%${adName}%'</if>
- <if test="sttm != null and sttm != ''">and a.Intm>= TO_DATE(#{sttm},'YYYY-MM-DD')</if>
- <if test="entm != null and entm != ''">and a.Intm < To_DATE(#{entm},'yyyy-MM-dd') + 1</if>
- <if test="groupId != null and groupId != ''">and a.nodeId = #{groupId}</if>
- order by nodeId asc
- <if test="orderBy != null and orderBy != ''">
- ,nlssort(nm,'NLS_SORT=SCHINESE_PINYIN_M')
- </if>
- </select>
- <select id="getListByInspGroupIdObjType" resultType="cn.com.goldenwater.dcproj.model.BisInspSamrmpRgstr">
- SELECT C.id groupId,C.PNM groupName,B.obj_id,
- T.RV_LONG,
- T.PGI,
- T.ID,
- T.PRJ_ID,
- T.PRJ_NAME,
- T.RV_NAME,
- T.AD_CODE,
- T.AD_NAME,
- T.ADDR,
- T.CENTER_X,
- T.CENTER_Y,
- T.GD_X,
- T.GD_Y,
- T.SMRMP_STATE,
- T.STATE,
- T.GROUP_LEADER,
- T.GROUP_LEADER_TEL,
- T.REC_PERS_ID,
- T.REC_PERS,
- T.REC_PERS_TEL,
- T.INTM,
- T.UPTM,
- T.NOTE
- FROM BIS_INSP_ALL_OBJ B
- LEFT JOIN BIS_INSP_SAMRMP_RGSTR t ON B.OBJ_ID = t.OBJ_ID
- LEFT JOIN BIS_INSP_ALL C ON B.ID = C.ID
- where B.ptype = #{objType}
- <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>
- <if test="wtdstNm != null and wtdstNm != ''">
- and t.PRJ_NAME like '${wtdstNm}%'
- </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>
|