| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259 |
- <?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.BisInspHystRgstrDao">
- <resultMap type="cn.com.goldenwater.dcproj.model.BisInspHystRgstr" id="bisInspHystRgstrResultMap">
- <result property="id" column="ID"/>
- <result property="objId" column="OBJ_ID"/>
- <result property="adCode" column="AD_CODE"/>
- <result property="adName" column="AD_NAME"/>
- <result property="adFullName" column="AD_FULL_NAME"/>
- <result property="isBeYreb" column="IS_BE_YREB"/>
- <result property="baseState" column="BASE_STATE"/>
- <result property="rectState" column="RECT_STATE"/>
- <result property="oocState" column="OOC_STATE"/>
- <result property="sfmngState" column="SFMNG_STATE"/>
- <result property="coMngState" column="CO_MNG_STATE"/>
- <result property="state" column="STATE"/>
- <result property="persId" column="PERS_ID"/>
- <result property="note" column="NOTE"/>
- <result property="intm" column="INTM"/>
- <result property="uptm" column="UPTM"/>
- </resultMap>
- <sql id="table_columns">
- ID,
- OBJ_ID,
- AD_CODE,
- AD_NAME,
- AD_FULL_NAME,
- IS_BE_YREB,
- BASE_STATE,
- RECT_STATE,
- OOC_STATE,
- SFMNG_STATE,
- CO_MNG_STATE,
- STATE,
- PERS_ID,
- NOTE,
- INTM,
- UPTM
- </sql>
- <sql id="entity_properties">
- #{id},
- #{objId},
- #{adCode},
- #{adName},
- #{adFullName},
- #{isBeYreb},
- #{baseState},
- #{rectState},
- #{oocState},
- #{sfmngState},
- #{coMngState},
- #{state},
- #{persId},
- #{note},
- #{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="adCode != null and adCode != ''">and AD_CODE = #{adCode}</if>
- <if test="adName != null and adName != ''">and AD_NAME = #{adName}</if>
- <if test="adFullName != null and adFullName != ''">and AD_FULL_NAME = #{adFullName}</if>
- <if test="isBeYreb != null and isBeYreb != ''">and IS_BE_YREB = #{isBeYreb}</if>
- <if test="baseState != null and baseState != ''">and BASE_STATE = #{baseState}</if>
- <if test="rectState != null and rectState != ''">and RECT_STATE = #{rectState}</if>
- <if test="oocState != null and oocState != ''">and OOC_STATE = #{oocState}</if>
- <if test="sfmngState != null and sfmngState != ''">and SFMNG_STATE = #{sfmngState}</if>
- <if test="coMngState != null and coMngState != ''">and CO_MNG_STATE = #{coMngState}</if>
- <if test="state != null and state != ''">and STATE = #{state}</if>
- <if test="persId != null and persId != ''">and PERS_ID = #{persId}</if>
- <if test="note != null and note != ''">and NOTE = #{note}</if>
- <if test="intm != null">and INTM = #{intm}</if>
- <if test="uptm != null">and UPTM = #{uptm}</if>
- </trim>
- </sql>
- <select id="get" resultMap="bisInspHystRgstrResultMap" parameterType="String">
- select
- <include refid="table_columns"/>
- from BIS_INSP_HYST_RGSTR where ID = #{id}
- </select>
- <select id="getBy" resultMap="bisInspHystRgstrResultMap">
- select
- <include refid="table_columns"/>
- from BIS_INSP_HYST_RGSTR
- <include refid="page_where"/>
- </select>
- <select id="findAll" resultMap="bisInspHystRgstrResultMap">
- select
- <include refid="table_columns"/>
- from BIS_INSP_HYST_RGSTR
- </select>
- <select id="findList" resultMap="bisInspHystRgstrResultMap">
- select
- <include refid="table_columns"/>
- from BIS_INSP_HYST_RGSTR
- <include refid="page_where"/>
- </select>
- <select id="selectCount" resultType="int">
- select count(ID) from BIS_INSP_HYST_RGSTR
- <include refid="page_where"/>
- </select>
- <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspHystRgstr">
- insert into BIS_INSP_HYST_RGSTR(
- <include refid="table_columns"/>
- )
- values (
- <include refid="entity_properties"/>
- )
- </insert>
- <delete id="delete" parameterType="java.lang.String">
- delete from BIS_INSP_HYST_RGSTR where ID = #{id}
- </delete>
- <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspHystRgstr">
- delete from BIS_INSP_HYST_RGSTR
- <include refid="page_where"/>
- </delete>
- <update id="deleteInFlag" parameterType="java.lang.String">
- update BIS_INSP_HYST_RGSTR set flag_valid = 0 where ID = #{id}
- </update>
- <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspHystRgstr">
- update BIS_INSP_HYST_RGSTR
- <trim prefix="set" suffixOverrides=",">
- <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
- <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
- <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
- <if test="adFullName != null and adFullName != ''">AD_FULL_NAME = #{adFullName},</if>
- <if test="isBeYreb != null and isBeYreb != ''">IS_BE_YREB = #{isBeYreb},</if>
- <if test="baseState != null and baseState != ''">BASE_STATE = #{baseState},</if>
- <if test="rectState != null and rectState != ''">RECT_STATE = #{rectState},</if>
- <if test="oocState != null and oocState != ''">OOC_STATE = #{oocState},</if>
- <if test="sfmngState != null and sfmngState != ''">SFMNG_STATE = #{sfmngState},</if>
- <if test="coMngState != null and coMngState != ''">CO_MNG_STATE = #{coMngState},</if>
- <if test="state != null and state != ''">STATE = #{state},</if>
- <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
- <if test="note != null and note != ''">NOTE = #{note},</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.BisInspHystRgstr">
- update BIS_INSP_HYST_RGSTR
- <trim prefix="set" suffixOverrides=",">
- <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
- <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
- <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
- <if test="adFullName != null and adFullName != ''">AD_FULL_NAME = #{adFullName},</if>
- <if test="isBeYreb != null and isBeYreb != ''">IS_BE_YREB = #{isBeYreb},</if>
- <if test="baseState != null and baseState != ''">BASE_STATE = #{baseState},</if>
- <if test="rectState != null and rectState != ''">RECT_STATE = #{rectState},</if>
- <if test="oocState != null and oocState != ''">OOC_STATE = #{oocState},</if>
- <if test="sfmngState != null and sfmngState != ''">SFMNG_STATE = #{sfmngState},</if>
- <if test="coMngState != null and coMngState != ''">CO_MNG_STATE = #{coMngState},</if>
- <if test="state != null and state != ''">STATE = #{state},</if>
- <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
- <if test="note != null and note != ''">NOTE = #{note},</if>
- <if test="intm != null">INTM = #{intm},</if>
- <if test="uptm != null">UPTM = #{uptm},</if>
- </trim>
- <include refid="page_where"/>
- </update>
- <!-- 其他自定义SQL -->
- <select id="findHystList" resultType="cn.com.goldenwater.dcproj.dto.BisInspHystRgstrDto">
- SELECT * FROM (
- select
- A.CODE, A.NM, A.OBJ_ID, A.pType, ia.pnm groupName,
- A.ID nodeId,
- ( CASE WHEN B.AD_FULL_NAME IS NULL THEN TO_CHAR( E.AD_FULL_NAME ) ELSE B.AD_FULL_NAME END ) adName,
- (case when b.State is null then '0' else b.state end) STATE,
- b.id as rgstrId,
- B.ID,
- B.AD_CODE,
- B.IS_BE_YREB,
- B.BASE_STATE,
- B.RECT_STATE,
- B.OOC_STATE,
- B.SFMNG_STATE,
- B.CO_MNG_STATE,
- B.PERS_ID,
- B.NOTE,
- B.INTM,
- B.UPTM
- FROM BIS_INSP_ALL_OBJ A
- JOIN BIS_INSP_HYST_RGSTR B ON A.OBJ_ID=B.OBJ_ID
- LEFT JOIN BIS_INSP_ALL IA ON A.ID = IA.ID
- LEFT JOIN ATT_AD_BASE E ON B.AD_CODE = E.AD_CODE
- <where>
- <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 20))
- <if test="year !=null and year !=''">
- and P.INSP_YEAR = #{year}
- </if>
- 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 )
- <if test="year !=null and year !=''">
- and P.INSP_YEAR = #{year}
- </if>
- )
- )
- </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>
- </where>
- ) A
- <where>
- <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="name !=null and name !=''">and a.nm like '%${name}%'</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>
- </where>
- order by nodeId asc
- <if test="orderBy != null and orderBy != ''">
- ,nlssort(nm,'NLS_SORT=SCHINESE_PINYIN_M')
- </if>
- </select>
- </mapper>
|