| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288 |
- <?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.BisZhejiangJgRgstrDao">
- <resultMap type="cn.com.goldenwater.dcproj.model.BisZhejiangJgRgstr" id="bisZhejiangJgRgstrResultMap">
- <result property="id" column="ID"/>
- <result property="objId" column="OBJ_ID"/>
- <result property="regsNm" column="REGS_NM"/>
- <result property="departId" column="DEPART_ID"/>
- <result property="adCode" column="AD_CODE"/>
- <result property="persId" column="PERS_ID"/>
- <result property="intm" column="INTM"/>
- <result property="uptm" column="UPTM"/>
- <result property="note" column="NOTE"/>
- <result property="dataStat" column="DATA_STAT"/>
- <result property="state" column="STATE"/>
- <result property="adFullName" column="AD_FULL_NAME"/>
- <result property="telphone" column="TELPHONE"/>
- <result property="lgtd" column="LGTD"/>
- <result property="lttd" column="LTTD"/>
- <result property="lgtdpc" column="LGTDPC"/>
- <result property="lttdpc" column="LTTDPC"/>
- <result property="jgState" column="JG_STATE"/>
- </resultMap>
-
- <sql id="table_columns">
- ID,
- OBJ_ID,
- REGS_NM,
- DEPART_ID,
- AD_CODE,
- PERS_ID,
- INTM,
- UPTM,
- NOTE,
- DATA_STAT,
- STATE,
- AD_FULL_NAME,
- TELPHONE,
- LGTD,
- LTTD,
- LGTDPC,
- LTTDPC,
- JG_STATE
- </sql>
- <sql id="entity_properties">
- #{id},
- #{objId},
- #{regsNm},
- #{departId},
- #{adCode},
- #{persId},
- #{intm},
- #{uptm},
- #{note},
- #{dataStat},
- #{state},
- #{adFullName},
- #{telphone},
- #{lgtd},
- #{lttd},
- #{lgtdpc},
- #{lttdpc},
- #{jgState}
- </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="regsNm != null and regsNm != ''">and REGS_NM = #{regsNm}</if>
- <if test="departId != null and departId != ''">and DEPART_ID = #{departId}</if>
- <if test="adCode != null and adCode != ''">and AD_CODE = #{adCode}</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>
- <if test="note != null and note != ''">and NOTE = #{note}</if>
- <if test="dataStat != null and dataStat != ''">and DATA_STAT = #{dataStat}</if>
- <if test="state != null and state != ''">and STATE = #{state}</if>
- <if test="adFullName != null and adFullName != ''">and AD_FULL_NAME = #{adFullName}</if>
- <if test="telphone != null and telphone != ''">and TELPHONE = #{telphone}</if>
- <if test="lgtd != null and lgtd != ''">and LGTD = #{lgtd}</if>
- <if test="lttd != null and lttd != ''">and LTTD = #{lttd}</if>
- <if test="lgtdpc != null and lgtdpc != ''">and LGTDPC = #{lgtdpc}</if>
- <if test="lttdpc != null and lttdpc != ''">and LTTDPC = #{lttdpc}</if>
- <if test="jgState != null and jgState != ''">and JG_STATE = #{jgState}</if>
- </trim>
- </sql>
- <select id="get" resultMap="bisZhejiangJgRgstrResultMap" parameterType="String" >
- select <include refid="table_columns" /> from BIS_ZHEJIANG_JG_RGSTR where ID = #{id}
- </select>
- <select id="getBy" resultMap="bisZhejiangJgRgstrResultMap">
- select <include refid="table_columns" /> from BIS_ZHEJIANG_JG_RGSTR <include refid="page_where" />
- </select>
- <select id="findAll" resultMap="bisZhejiangJgRgstrResultMap">
- select <include refid="table_columns" /> from BIS_ZHEJIANG_JG_RGSTR
- </select>
- <select id="findList" resultMap="bisZhejiangJgRgstrResultMap">
- select <include refid="table_columns" /> from BIS_ZHEJIANG_JG_RGSTR <include refid="page_where" />
- </select>
- <select id="selectCount" resultType="int" >
- select count(ID) from BIS_ZHEJIANG_JG_RGSTR <include refid="page_where" />
- </select>
- <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisZhejiangJgRgstr">
- insert into BIS_ZHEJIANG_JG_RGSTR( <include refid="table_columns" /> )
- values ( <include refid="entity_properties" /> )
- </insert>
- <delete id="delete" parameterType="java.lang.String">
- delete from BIS_ZHEJIANG_JG_RGSTR where ID = #{id}
- </delete>
- <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisZhejiangJgRgstr">
- delete from BIS_ZHEJIANG_JG_RGSTR <include refid="page_where" />
- </delete>
- <update id="deleteInFlag" parameterType="java.lang.String">
- update BIS_ZHEJIANG_JG_RGSTR set flag_valid = 0 where ID = #{id}
- </update>
- <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisZhejiangJgRgstr">
- update BIS_ZHEJIANG_JG_RGSTR
- <trim prefix="set" suffixOverrides=",">
- <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
- <if test="regsNm != null and regsNm != ''">REGS_NM = #{regsNm},</if>
- <if test="departId != null and departId != ''">DEPART_ID = #{departId},</if>
- <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</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>
- <if test="note != null and note != ''">NOTE = #{note},</if>
- <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
- <if test="state != null and state != ''">STATE = #{state},</if>
- <if test="adFullName != null and adFullName != ''">AD_FULL_NAME = #{adFullName},</if>
- <if test="telphone != null and telphone != ''">TELPHONE = #{telphone},</if>
- <if test="lgtd != null and lgtd != ''">LGTD = #{lgtd},</if>
- <if test="lttd != null and lttd != ''">LTTD = #{lttd},</if>
- <if test="lgtdpc != null and lgtdpc != ''">LGTDPC = #{lgtdpc},</if>
- <if test="lttdpc != null and lttdpc != ''">LTTDPC = #{lttdpc},</if>
- <if test="jgState != null and jgState != ''">JG_STATE = #{jgState},</if>
- </trim>
- <where>ID = #{id}</where>
- </update>
- <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisZhejiangJgRgstr">
- update BIS_ZHEJIANG_JG_RGSTR
- <trim prefix="set" suffixOverrides=",">
- <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
- <if test="regsNm != null and regsNm != ''">REGS_NM = #{regsNm},</if>
- <if test="departId != null and departId != ''">DEPART_ID = #{departId},</if>
- <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</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>
- <if test="note != null and note != ''">NOTE = #{note},</if>
- <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
- <if test="state != null and state != ''">STATE = #{state},</if>
- <if test="adFullName != null and adFullName != ''">AD_FULL_NAME = #{adFullName},</if>
- <if test="telphone != null and telphone != ''">TELPHONE = #{telphone},</if>
- <if test="lgtd != null and lgtd != ''">LGTD = #{lgtd},</if>
- <if test="lttd != null and lttd != ''">LTTD = #{lttd},</if>
- <if test="lgtdpc != null and lgtdpc != ''">LGTDPC = #{lgtdpc},</if>
- <if test="lttdpc != null and lttdpc != ''">LTTDPC = #{lttdpc},</if>
- <if test="jgState != null and jgState != ''">JG_STATE = #{jgState},</if>
- </trim>
- <include refid="page_where" />
- </update>
- <select id="getNotSuperviseGroupObj" resultType="cn.com.goldenwater.dcproj.model.BisZhejiangJgRgstr">
- select t.*,C.id groupId,C.PNM groupName,B.obj_id
- from ATT_ZHEJIANG_JG_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}
- 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>
- <select id="getZhejiangJgRegstrInfo" resultType="cn.com.goldenwater.dcproj.dto.BisInspRgstrDto">
- select * from
- (
- SELECT
- a.OBJ_ID AS objId,
- #{pType} as ptype,
- ( CASE WHEN a.STATE IS NULL THEN '0' ELSE a.STATE END ) AS state,
- ( CASE WHEN a.AD_FULL_NAME IS NULL THEN to_char( e.AD_FULL_NAME ) ELSE a.AD_FULL_NAME END ) location,
- a.INTM AS intm,
- a.UPTM AS uptm,
- b.id AS nodeId,
- a.id AS rgstrId,
- a.REGS_NM AS nm,
- a.JG_STATE,
- insp.pnm AS groupName
- FROM
- BIS_ZHEJIANG_JG_RGSTR A
- LEFT JOIN BIS_INSP_ALL_OBJ b ON a.OBJ_ID = b.OBJ_ID
- LEFT JOIN ATT_AD_X_BASE e ON A.AD_CODE = e.ad_code
- left join bis_insp_all insp on b.id=insp.id
- where 1=1 and
- REGEXP_LIKE(
- B.Id,'^('||
- ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{presId} and id like '042%'
- <include refid="orgIdSql"/>
- )>0 then
- (SELECT LISTAGG(id, '|') as
- id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{presId}
- <include refid="orgIdSql"/> and id like '042%' group by persid
- )
- else (select 'non' from dual) end)
- ||')')
- )a where 1=1
- <if test="sttm !=null and sttm !='' and entm !=null and entm !=''">
- and intm>=to_date(#{sttm},'yyyy-mm-dd') and intm <=to_date(#{entm},'yyyy-mm-dd')
- </if>
- <if test="state !=null and state !=''">
- and state = #{state}
- </if>
- <if test="adName !=null and adName !=''">
- and location like '%${adName}%'
- </if>
- <if test="groupId !=null and groupId !=''">
- and nodeId like '${groupId}%'
- </if>
- <if test="plnaId !=null and plnaId !=''">
- and nodeId like '${plnaId}%'
- </if>
- </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>
- <!-- 其他自定义SQL -->
- <select id="getListByInspGroupIdObjType" resultType="cn.com.goldenwater.dcproj.model.BisZhejiangJgRgstr" parameterType="cn.com.goldenwater.dcproj.param.PagePersObjParam">
- select t.*,C.id groupId,C.PNM groupName,B.obj_id,r.ad_full_name as loc
- from ATT_ZHEJIANG_JG_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}
- left join BIS_ZHEJIANG_JG_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>
|