| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301 |
- <?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.BisInspEfpRgstrDao">
- <resultMap type="cn.com.goldenwater.dcproj.model.BisInspEfpRgstr" id="bisInspEfpRgstrResultMap">
- <result property="id" column="ID"/>
- <result property="objId" column="OBJ_ID"/>
- <result property="objCode" column="OBJ_CODE"/>
- <result property="name" column="NAME"/>
- <result property="type" column="TYPE"/>
- <result property="pro" column="PRO"/>
- <result property="bas" column="BAS"/>
- <result property="orgId" column="ORG_ID"/>
- <result property="note" column="NOTE"/>
- <result property="state" column="STATE"/>
- <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="planStat" column="PLAN_STAT"/>
- <result property="reasonStat" column="REASON_STAT"/>
- <result property="proName" column="PRO_NAME"/>
- <result property="basName" column="BAS_NAME"/>
- </resultMap>
- <sql id="table_columns">
- PRO_NAME,
- BAS_NAME,
- PLAN_STAT,
- REASON_STAT,
- ID,
- OBJ_ID,
- OBJ_CODE,
- NAME,
- TYPE,
- PRO,
- BAS,
- ORG_ID,
- NOTE,
- STATE,
- REC_PERS_ID,
- REC_PERS,
- REC_PERS_TEL,
- INTM,
- UPTM
- </sql>
- <sql id="entity_properties">
- #{proName},
- #{basName},
- #{planStat},
- #{reasonStat},
- #{id},
- #{objId},
- #{objCode},
- #{name},
- #{type},
- #{pro},
- #{bas},
- #{orgId},
- #{note},
- #{state},
- #{recPersId},
- #{recPers},
- #{recPersTel},
- #{intm},
- #{uptm}
- </sql>
- <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
- <sql id="page_where">
- <trim prefix="where" prefixOverrides="and | or ">
- <if test="proName != null and proName != ''">and PRO_NAME = #{proName}</if>
- <if test="basName != null and basName != ''">and BAS_NAME = #{basName}</if>
- <if test="planStat != null and planStat != ''">and PLAN_STAT = #{planStat}</if>
- <if test="reasonStat != null and reasonStat != ''">and REASON_STAT = #{reasonStat}</if>
- <if test="objId != null and objId != ''">and OBJ_ID = #{objId}</if>
- <if test="objCode != null and objCode != ''">and OBJ_CODE = #{objCode}</if>
- <if test="name != null and name != ''">and NAME = #{name}</if>
- <if test="type != null and type != ''">and TYPE = #{type}</if>
- <if test="pro != null and pro != ''">and PRO = #{pro}</if>
- <if test="bas != null and bas != ''">and BAS = #{bas}</if>
- <if test="orgId != null and orgId != ''">and ORG_ID = #{orgId}</if>
- <if test="note != null and note != ''">and NOTE = #{note}</if>
- <if test="state != null and state != ''">and STATE = #{state}</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>
- </trim>
- </sql>
- <select id="get" resultMap="bisInspEfpRgstrResultMap" parameterType="String" >
- select <include refid="table_columns" /> from BIS_INSP_EFP_RGSTR where ID = #{id}
- </select>
- <select id="getBy" resultMap="bisInspEfpRgstrResultMap">
- select <include refid="table_columns" /> from BIS_INSP_EFP_RGSTR <include refid="page_where" />
- </select>
- <select id="findAll" resultMap="bisInspEfpRgstrResultMap">
- select <include refid="table_columns" /> from BIS_INSP_EFP_RGSTR
- </select>
- <select id="findList" resultMap="bisInspEfpRgstrResultMap">
- select <include refid="table_columns" /> from BIS_INSP_EFP_RGSTR <include refid="page_where" />
- </select>
- <select id="selectCount" resultType="int" >
- select count(ID) from BIS_INSP_EFP_RGSTR <include refid="page_where" />
- </select>
- <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspEfpRgstr">
- insert into BIS_INSP_EFP_RGSTR( <include refid="table_columns" /> )
- values ( <include refid="entity_properties" /> )
- </insert>
- <delete id="delete" parameterType="java.lang.String">
- delete from BIS_INSP_EFP_RGSTR where ID = #{id}
- </delete>
- <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspEfpRgstr">
- delete from BIS_INSP_EFP_RGSTR <include refid="page_where" />
- </delete>
- <update id="deleteInFlag" parameterType="java.lang.String">
- update BIS_INSP_EFP_RGSTR set DATA_STAT = '9' where ID = #{id}
- </update>
- <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspEfpRgstr">
- update BIS_INSP_EFP_RGSTR
- <trim prefix="set" suffixOverrides=",">
- <if test="proName != null and proName != ''">PRO_NAME = #{proName},</if>
- <if test="basName != null and basName != ''">BAS_NAME = #{basName},</if>
- <if test="planStat != null and planStat != ''">PLAN_STAT = #{planStat},</if>
- <if test="reasonStat != null and reasonStat != ''">REASON_STAT = #{reasonStat},</if>
- <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
- <if test="objCode != null and objCode != ''">OBJ_CODE = #{objCode},</if>
- <if test="name != null and name != ''">NAME = #{name},</if>
- <if test="type != null and type != ''">TYPE = #{type},</if>
- <if test="pro != null and pro != ''">PRO = #{pro},</if>
- <if test="bas != null and bas != ''">BAS = #{bas},</if>
- <if test="orgId != null and orgId != ''">ORG_ID = #{orgId},</if>
- <if test="note != null and note != ''">NOTE = #{note},</if>
- <if test="state != null and state != ''">STATE = #{state},</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>
- </trim>
- <where>ID = #{id}</where>
- </update>
- <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspEfpRgstr">
- update BIS_INSP_EFP_RGSTR
- <trim prefix="set" suffixOverrides=",">
- <if test="proName != null and proName != ''">PRO_NAME = #{proName},</if>
- <if test="basName != null and basName != ''">BAS_NAME = #{basName},</if>
- <if test="planStat != null and planStat != ''">PLAN_STAT = #{planStat},</if>
- <if test="reasonStat != null and reasonStat != ''">REASON_STAT = #{reasonStat},</if>
- <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
- <if test="objCode != null and objCode != ''">OBJ_CODE = #{objCode},</if>
- <if test="name != null and name != ''">NAME = #{name},</if>
- <if test="type != null and type != ''">TYPE = #{type},</if>
- <if test="pro != null and pro != ''">PRO = #{pro},</if>
- <if test="bas != null and bas != ''">BAS = #{bas},</if>
- <if test="orgId != null and orgId != ''">ORG_ID = #{orgId},</if>
- <if test="note != null and note != ''">NOTE = #{note},</if>
- <if test="state != null and state != ''">STATE = #{state},</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>
- </trim>
- <include refid="page_where" />
- </update>
- <!-- 其他自定义SQL -->
- <select id="findEfpList" parameterType="cn.com.goldenwater.dcproj.param.TypeParam"
- 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.pro as ad_name,b.type,b.PLAN_STAT,
- b.REASON_STAT,
- ia.pnm groupName
- from BIS_INSP_ALL_OBJ
- A LEFT JOIN BIS_INSP_EFP_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="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>
- <if test="adCodes ==null or adCodes ==''">
- and
- REGEXP_LIKE(
- A.Id,'^('||
- ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{presId}
- <include refid="choseSql"/>
- )>0 then
- (SELECT LISTAGG(id, '|') as
- id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{presId}
- <include refid="choseSql"/> GROUP BY PERSID
- )
- else (select 'non' from dual) end)
- ||')')
- </if>
- ) A WHERE a.PTYPE=#{pType}
- <if test="efpType != null and efpType != ''">
- and a.type = #{efpType}
- </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>
- <sql id="choseSql">
- <choose>
- <when test="province != null and province != ''">
- and AD_CODE LIKE '${province}%'
- </when>
- <otherwise>
- and AD_CODE is null
- </otherwise>
- </choose>
- </sql>
- <select id="getObjListNotInspGroupId" parameterType="String" resultType="cn.com.goldenwater.dcproj.model.AttEfpBase">
- select t.*
- from att_efp_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="getListByInspGroupIdObjType" parameterType="cn.com.goldenwater.dcproj.param.PagePersObjParam"
- resultType="cn.com.goldenwater.dcproj.model.AttEfpBase">
- select t.*,C.id groupId,C.PNM groupName,B.obj_id,'' as loc
- from ATT_efp_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_Insp_Efp_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>
|