| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229 |
- <?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.BisInspAllRlationDao">
- <resultMap type="cn.com.goldenwater.dcproj.model.BisInspAllRlation" id="bisInspAllRlationResultMap">
- <result property="persid" column="PERSID"/>
- <result property="id" column="ID"/>
- <result property="pertype" column="PERTYPE"/>
- <result property="impData" column="IMP_DATA"/>
- <result property="orgId" column="ORG_ID"/>
- <result property="adCode" column="AD_CODE"/>
- <result property="type" column="TYPE"/>
- </resultMap>
- <sql id="table_columns">
- PERSID,
- ID,
- PERTYPE,
- IMP_DATA,ORG_ID,AD_CODE,TYPE
- </sql>
- <sql id="entity_properties">
- #{persid},
- #{id},
- #{pertype},
- #{impData},#{orgId},#{adCode},#{type}
- </sql>
- <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
- <sql id="page_where">
- <trim prefix="where" prefixOverrides="and | or ">
- <if test="id != null and id != ''">and ID = #{id}</if>
- <if test="persid != null and persid != ''">and PERSID = #{persid}</if>
- <if test="pertype != null and pertype != ''">and PERTYPE = #{pertype}</if>
- <if test="orgId != null and orgId != ''">and ORG_ID = #{orgId}</if>
- <if test="adCode != null and adCode != ''">and AD_CODE = #{adCode}</if>
- <choose>
- <when test="province != null and province != ''">
- and AD_CODE = #{province}
- </when>
- <otherwise>
- and AD_CODE is null
- </otherwise>
- </choose>
- </trim>
- </sql>
- <select id="get" resultMap="bisInspAllRlationResultMap" parameterType="String">
- select
- <include refid="table_columns"/>
- from BIS_INSP_ALL_RLATION where ID = #{id}
- </select>
- <select id="getBy" resultMap="bisInspAllRlationResultMap">
- select
- <include refid="table_columns"/>
- from BIS_INSP_ALL_RLATION n where n.id like '${id}%'
- <if test="pertype != null and pertype != ''">
- and n.pertype=#{pertype}
- </if>
- <if test="adCode !=null and adCode !=''">
- and n.AD_CODE=#{adCode}
- </if>
- <if test="orgId !=null and orgId !=''">
- and n.org_id=#{orgId}
- </if>
- and n.persid=#{persid}
- </select>
- <select id="findAll" resultMap="bisInspAllRlationResultMap">
- select
- <include refid="table_columns"/>
- from BIS_INSP_ALL_RLATION
- </select>
- <select id="findList" resultMap="bisInspAllRlationResultMap">
- select
- <include refid="table_columns"/>
- from BIS_INSP_ALL_RLATION
- <include refid="page_where"/>
- </select>
- <select id="selectCount" resultType="int">
- select count(ID) from BIS_INSP_ALL_RLATION
- <include refid="page_where"/>
- </select>
- <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspAllRlation">
- insert into BIS_INSP_ALL_RLATION(
- <include refid="table_columns"/>
- )
- values (
- <include refid="entity_properties"/>
- )
- </insert>
- <delete id="delete" parameterType="java.lang.String">
- delete from BIS_INSP_ALL_RLATION where ID = #{id}
- </delete>
- <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspAllRlation">
- delete from BIS_INSP_ALL_RLATION
- <where>
- <if test="id != null and id != ''">and ID = #{id}</if>
- <if test="persid != null and persid != ''">and PERSID = #{persid}</if>
- <if test="pertype != null and pertype != ''">and PERTYPE = #{pertype}</if>
- <if test="orgId != null and orgId != ''">and ORG_ID = #{orgId}</if>
- <if test="adCode != null and adCode != ''">and AD_CODE = #{adCode}</if>
- </where>
- </delete>
- <update id="deleteInFlag" parameterType="java.lang.String">
- update BIS_INSP_ALL_RLATION set flag_valid = 0 where ID = #{id}
- </update>
- <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspAllRlation">
- update BIS_INSP_ALL_RLATION
- <trim prefix="set" suffixOverrides=",">
- <if test="pertype != null and pertype != ''">PERTYPE = #{pertype},</if>
- <if test="impData != null and impData != ''">IMP_DATA = #{impData},</if>
- <if test="adCode !=null and adCode !=''">
- AD_CODE=#{adCode},
- </if>
- <if test="orgId !=null and orgId !=''">
- org_id=#{orgId},
- </if>
- </trim>
- <where>ID = #{id} and PERSID = #{persid}</where>
- </update>
- <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspAllRlation">
- update BIS_INSP_ALL_RLATION
- <trim prefix="set" suffixOverrides=",">
- <if test="id != null and id != ''">ID = #{id},</if>
- <if test="persid != null and persid != ''">PERSID = #{persid},</if>
- <if test="pertype != null and pertype != ''">PERTYPE = #{pertype},</if>
- <if test="impData != null and impData != ''">IMP_DATA = #{impData},</if>
- <if test="adCode !=null and adCode !=''">
- AD_CODE=#{adCode},
- </if>
- <if test="orgId !=null and orgId !=''">
- org_id=#{orgId},
- </if>
- </trim>
- <include refid="page_where"/>
- </update>
- <!-- 其他自定义SQL -->
- <delete id="deleteMemberBy" parameterType="cn.com.goldenwater.dcproj.param.BisInspAllRlationParam">
- delete from BIS_INSP_ALL_RLATION where ID = #{id} AND PERSID = #{persid}
- </delete>
- <select id="getIdByPersid" resultType="java.lang.String">
- SELECT ID
- FROM BIS_INSP_ALL_RLATION
- WHERE PERSID = #{persid}
- <if test="id != null and id != ''">
- and ID like '%${id}%'
- </if>
- <if test="pType != null and pType != ''">
- and TYPE = #{pType}
- </if>
- </select>
- <select id="getPnmByPersid" resultType="java.lang.String">
- SELECT C.PNM
- FROM BIS_INSP_ALL_RLATION B
- JOIN BIS_INSP_ALL C ON B.ID = C.ID
- WHERE PERSID = #{persid}
- <if test="id != null and id != ''">
- and C.ID like '%${id}%'
- </if>
- <if test="orgId != null and orgId != '' ">
- AND B.ID LIKE '___${orgId}%'
- </if>
- <if test="pType != null and pType != ''">and B.ID like '${pType}%'</if>
- <if test="sttm != null and sttm != '' and entm != null and entm != '' ">
- AND TO_DATE(TO_CHAR(C.STTM, 'YYYY-MM-DD'), 'YYYY-MM-DD') >= TO_DATE(#{sttm}, 'YYYY-MM-DD')
- AND TO_DATE(TO_CHAR(C.ENTM, 'YYYY-MM-DD'), 'YYYY-MM-DD') < TO_DATE(#{entm}, 'YYYY-MM-DD') + 1
- </if>
- </select>
- <select id="getObjByPersid" resultType="java.lang.String">
- SELECT T.NAME
- FROM BIS_INSP_ALL_RLATION B
- JOIN BIS_INSP_ALL C ON B.ID = C.ID
- JOIN ATT_INSP_TYPE T ON SUBSTR(B.ID, 0, 3) = T.CODE
- WHERE PERSID = #{persid}
- <if test="id != null and id != ''">
- and C.ID like '%${id}%'
- </if>
- <if test="orgId != null and orgId != '' ">
- AND B.ID LIKE '___${orgId}%'
- </if>
- <if test="pType != null and pType != ''">and B.ID like '${pType}%'</if>
- <if test="sttm != null and sttm != '' and entm != null and entm != '' ">
- AND TO_DATE(TO_CHAR(C.STTM, 'YYYY-MM-DD'), 'YYYY-MM-DD') >= TO_DATE(#{sttm}, 'YYYY-MM-DD')
- AND TO_DATE(TO_CHAR(C.ENTM, 'YYYY-MM-DD'), 'YYYY-MM-DD') < TO_DATE(#{entm}, 'YYYY-MM-DD') + 1
- </if>
- </select>
- <select id="getPersNameById" resultType="java.util.Map">
- SELECT B.PERTYPE, C.PERS_NAME
- FROM BIS_INSP_ALL_RLATION B
- JOIN BIS_INSP_ALL_RLATION_PERS C ON B.PERSID = C.GUID
- WHERE B.ID like '%${id}%'
- <if test="pertype != null and pertype != ''">AND B.PERTYPE = #{pertype}</if>
- </select>
- <select id="getPersPhoneById" resultType="java.util.Map">
- SELECT B.PERTYPE, C.MOBILENUMB
- FROM BIS_INSP_ALL_RLATION B
- JOIN BIS_INSP_ALL_RLATION_PERS C ON B.PERSID = C.GUID
- WHERE B.ID like '%${id}%'
- <if test="pertype != null and pertype != ''">AND B.PERTYPE = #{pertype}</if>
- </select>
-
- <!-- 福建省 标准化示范工地 获取当前用户在所在督查组的身份 -->
- <select id="getPerTypeByUserIdandObjId" resultMap="bisInspAllRlationResultMap">
- select ar.* from bis_insp_all_rlation ar
- where type = #{pType} and org_id = #{orgId} and PERSID = #{persid}
- </select>
- </mapper>
|