| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281 |
- <?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.ImpPersInfoDao">
- <resultMap type="cn.com.goldenwater.dcproj.model.ImpPersInfo" id="impPersInfoResultMap">
- <result property="id" column="ID"/>
- <result property="num" column="NUM"/>
- <result property="orgId" column="ORG_ID"/>
- <result property="orgNm" column="ORG_NM"/>
- <result property="adCode" column="AD_CODE"/>
- <result property="adName" column="AD_NAME"/>
- <result property="leadId" column="LEAD_ID"/>
- <result property="leadName" column="LEAD_NAME"/>
- <result property="leadUnitJob" column="LEAD_UNIT_JOB"/>
- <result property="crewId" column="CREW_ID"/>
- <result property="crewName" column="CREW_NAME"/>
- <result property="crewUnitJob" column="CREW_UNIT_JOB"/>
- <result property="lisonId" column="LISON_ID"/>
- <result property="lisonName" column="LISON_NAME"/>
- <result property="lisonUnitJob" column="LISON_UNIT_JOB"/>
- <result property="mnth" column="MNTH"/>
- <result property="oldGroupId" column="OLD_GROUP_ID"/>
- <result property="groupId" column="GROUP_ID"/>
- <result property="groupNm" column="GROUP_NM"/>
- </resultMap>
- <sql id="table_columns">
- ID,
- NUM,
- ORG_ID,
- ORG_NM,
- AD_CODE,
- AD_NAME,
- LEAD_ID,
- LEAD_NAME,
- LEAD_UNIT_JOB,
- CREW_ID,
- CREW_NAME,
- CREW_UNIT_JOB,
- LISON_ID,
- LISON_NAME,
- LISON_UNIT_JOB,
- MNTH,
- OLD_GROUP_ID,
- GROUP_ID,
- GROUP_NM
- </sql>
- <sql id="entity_properties">
- #{id},
- #{num},
- #{orgId},
- #{orgNm},
- #{adCode},
- #{adName},
- #{leadId},
- #{leadName},
- #{leadUnitJob},
- #{crewId},
- #{crewName},
- #{crewUnitJob},
- #{lisonId},
- #{lisonName},
- #{lisonUnitJob},
- #{mnth},
- #{oldGroupId},
- #{groupId},
- #{groupNm}
- </sql>
- <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
- <sql id="page_where">
- <trim prefix="where" prefixOverrides="and | or ">
- <if test="num != null and num != ''">and NUM = #{num}</if>
- <if test="orgId != null and orgId != ''">and ORG_ID = #{orgId}</if>
- <if test="orgNm != null and orgNm != ''">and ORG_NM = #{orgNm}</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="leadId != null and leadId != ''">and LEAD_ID = #{leadId}</if>
- <if test="leadName != null and leadName != ''">and LEAD_NAME = #{leadName}</if>
- <if test="leadUnitJob != null and leadUnitJob != ''">and LEAD_UNIT_JOB = #{leadUnitJob}</if>
- <if test="crewId != null and crewId != ''">and CREW_ID = #{crewId}</if>
- <if test="crewName != null and crewName != ''">and CREW_NAME = #{crewName}</if>
- <if test="crewUnitJob != null and crewUnitJob != ''">and CREW_UNIT_JOB = #{crewUnitJob}</if>
- <if test="lisonId != null and lisonId != ''">and LISON_ID = #{lisonId}</if>
- <if test="lisonName != null and lisonName != ''">and LISON_NAME = #{lisonName}</if>
- <if test="lisonUnitJob != null and lisonUnitJob != ''">and LISON_UNIT_JOB = #{lisonUnitJob}</if>
- <if test="mnth != null and mnth != ''">and MNTH = #{mnth}</if>
- <if test="oldGroupId != null and oldGroupId != ''">and OLD_GROUP_ID = #{oldGroupId}</if>
- <if test="groupId != null and groupId != ''">and GROUP_ID = #{groupId}</if>
- <if test="groupNm != null and groupNm != ''">and GROUP_NM = #{groupNm}</if>
- <if test="isLead != null and isLead != ''">and LEAD_ID is not null </if>
- </trim>
- </sql>
- <select id="get" resultMap="impPersInfoResultMap" parameterType="String">
- select
- <include refid="table_columns"/>
- from IMP_PERS_INFO where ID = #{id}
- </select>
- <select id="getBy" resultMap="impPersInfoResultMap">
- select
- <include refid="table_columns"/>
- from IMP_PERS_INFO
- <include refid="page_where"/>
- </select>
- <select id="findAll" resultMap="impPersInfoResultMap">
- select
- <include refid="table_columns"/>
- from IMP_PERS_INFO order by to_number(num)
- </select>
- <select id="findList" resultMap="impPersInfoResultMap">
- select
- <include refid="table_columns"/>
- from IMP_PERS_INFO
- <include refid="page_where"/>
- order by to_number(num)
- </select>
- <select id="getList" resultMap="impPersInfoResultMap">
- select <include refid="table_columns" /> from IMP_PERS_INFO where LEAD_ID is not null <include refid="page_where" />
- order by to_number(num)
- </select>
- <select id="selectCount" resultType="int">
- select count(ID) from IMP_PERS_INFO
- <include refid="page_where"/>
- </select>
- <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.ImpPersInfo">
- insert into IMP_PERS_INFO(
- <include refid="table_columns"/>
- )
- values (
- <include refid="entity_properties"/>
- )
- </insert>
- <delete id="delete" parameterType="java.lang.String">
- delete from IMP_PERS_INFO where ID = #{id}
- </delete>
- <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.ImpPersInfo">
- delete from IMP_PERS_INFO
- <include refid="page_where"/>
- </delete>
- <update id="deleteInFlag" parameterType="java.lang.String">
- update IMP_PERS_INFO set flag_valid = 0 where ID = #{id}
- </update>
- <update id="update" parameterType="cn.com.goldenwater.dcproj.model.ImpPersInfo">
- update IMP_PERS_INFO
- <trim prefix="set" suffixOverrides=",">
- <if test="num != null and num != ''">NUM = #{num},</if>
- <if test="orgId != null and orgId != ''">ORG_ID = #{orgId},</if>
- <if test="orgNm != null and orgNm != ''">ORG_NM = #{orgNm},</if>
- <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
- <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
- <if test="leadId != null and leadId != ''">LEAD_ID = #{leadId},</if>
- <if test="leadName != null and leadName != ''">LEAD_NAME = #{leadName},</if>
- <if test="leadUnitJob != null and leadUnitJob != ''">LEAD_UNIT_JOB = #{leadUnitJob},</if>
- <if test="crewId != null and crewId != ''">CREW_ID = #{crewId},</if>
- <if test="crewName != null and crewName != ''">CREW_NAME = #{crewName},</if>
- <if test="crewUnitJob != null and crewUnitJob != ''">CREW_UNIT_JOB = #{crewUnitJob},</if>
- <if test="lisonId != null and lisonId != ''">LISON_ID = #{lisonId},</if>
- <if test="lisonName != null and lisonName != ''">LISON_NAME = #{lisonName},</if>
- <if test="lisonUnitJob != null and lisonUnitJob != ''">LISON_UNIT_JOB = #{lisonUnitJob},</if>
- <if test="mnth != null and mnth != ''">MNTH = #{mnth},</if>
- <if test="oldGroupId != null and oldGroupId != ''">OLD_GROUP_ID = #{oldGroupId},</if>
- <if test="groupId != null and groupId != ''">GROUP_ID = #{groupId},</if>
- <if test="groupNm != null and groupNm != ''">GROUP_NM = #{groupNm},</if>
- </trim>
- <where>ID = #{id}</where>
- </update>
- <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.ImpPersInfo">
- update IMP_PERS_INFO
- <trim prefix="set" suffixOverrides=",">
- <if test="num != null and num != ''">NUM = #{num},</if>
- <if test="orgId != null and orgId != ''">ORG_ID = #{orgId},</if>
- <if test="orgNm != null and orgNm != ''">ORG_NM = #{orgNm},</if>
- <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
- <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
- <if test="leadId != null and leadId != ''">LEAD_ID = #{leadId},</if>
- <if test="leadName != null and leadName != ''">LEAD_NAME = #{leadName},</if>
- <if test="leadUnitJob != null and leadUnitJob != ''">LEAD_UNIT_JOB = #{leadUnitJob},</if>
- <if test="crewId != null and crewId != ''">CREW_ID = #{crewId},</if>
- <if test="crewName != null and crewName != ''">CREW_NAME = #{crewName},</if>
- <if test="crewUnitJob != null and crewUnitJob != ''">CREW_UNIT_JOB = #{crewUnitJob},</if>
- <if test="lisonId != null and lisonId != ''">LISON_ID = #{lisonId},</if>
- <if test="lisonName != null and lisonName != ''">LISON_NAME = #{lisonName},</if>
- <if test="lisonUnitJob != null and lisonUnitJob != ''">LISON_UNIT_JOB = #{lisonUnitJob},</if>
- <if test="mnth != null and mnth != ''">MNTH = #{mnth},</if>
- <if test="oldGroupId != null and oldGroupId != ''">OLD_GROUP_ID = #{oldGroupId},</if>
- <if test="groupId != null and groupId != ''">GROUP_ID = #{groupId},</if>
- <if test="groupNm != null and groupNm != ''">GROUP_NM = #{groupNm},</if>
- </trim>
- <include refid="page_where"/>
- </update>
- <!-- 其他自定义SQL -->
- <select id="getGroupId" parameterType="java.util.Map" resultType="java.util.Map">
- SELECT A.PERSID,A.PERTYPE,B.*,C.AD_CODE,C.AD_NAME FROM BIS_INSP_ALL_RLATION A
- LEFT JOIN BIS_INSP_ALL B ON A.ID = B.ID
- LEFT JOIN BIS_INSP_SEL_AREA C ON A.ID = C.ID
- WHERE 1=1
- <if test="persId != null and persId != ''"> AND A.PERSID = #{persId}</if>
- <if test="persType != null and persType != ''"> AND A.PERTYPE = #{persType}</if>
- <if test="mnth != null and mnth != ''"> AND B.INSP_MNTH = #{mnth}</if>
- <if test="id != null and id != ''"> AND A.ID LIKE concat(#{id},'%')</if>
- <if test="adCd != null and adCd != ''"> AND C.AD_CODE LIKE concat(#{adCd},'%')</if>
- <if test="persIds != null and persIds != ''"> AND A.PERSID in
- <foreach item="item" index="index" collection="persIds.split(',')" open="(" separator="," close=")">
- '${item}'
- </foreach>
- </if>
- ORDER BY A.ID
- </select>
- <select id="getOldGroups" parameterType="java.util.Map" resultType="java.util.Map">
- SELECT A.PERSID,A.PERTYPE,B.* FROM BIS_INSP_ALL_RLATION A
- LEFT JOIN BIS_INSP_ALL B ON A.ID = B.ID
- WHERE 1=1
- <if test="persId != null and persId != ''"> AND A.PERSID = #{persId}</if>
- <if test="persType != null and persType != ''"> AND A.PERTYPE = #{persType}</if>
- <if test="mnth != null and mnth != ''"> AND B.INSP_MNTH = #{mnth}</if>
- <if test="id != null and id != ''"> AND A.ID LIKE concat(#{id},'%')</if>
- <if test="persIds != null and persIds != ''"> AND A.PERSID in
- <foreach item="item" index="index" collection="persIds.split(',')" open="(" separator="," close=")">
- '${item}'
- </foreach>
- </if>
- ORDER BY A.ID
- </select>
- <select id="getNewGroups" parameterType="java.util.Map" resultType="java.util.Map">
- SELECT distinct B.*,C.AD_CODE,C.AD_NAME FROM BIS_INSP_ALL_RLATION A
- LEFT JOIN BIS_INSP_ALL B ON A.ID = B.ID
- LEFT JOIN BIS_INSP_SEL_AREA C ON A.ID = C.ID
- WHERE 1=1
- <if test="persId != null and persId != ''"> AND A.PERSID = #{persId}</if>
- <if test="persType != null and persType != ''"> AND A.PERTYPE = #{persType}</if>
- <if test="mnth != null and mnth != ''"> AND B.INSP_MNTH = #{mnth}</if>
- <if test="id != null and id != ''"> AND A.ID LIKE concat(#{id},'%')</if>
- <if test="adCd != null and adCd != ''"> AND C.AD_CODE LIKE concat(#{adCd},'%')</if>
- <if test="persIds != null and persIds != ''"> AND A.PERSID in
- <foreach item="item" index="index" collection="persIds.split(',')" open="(" separator="," close=")">
- '${item}'
- </foreach>
- </if>
- <if test="regId != null and regId != ''"> AND A.PERSID in (select d.rec_pers_id from bis_insp_rsvr_rgstr b
- left join BIS_INSP_RSVR_PROJECT d on b.rgstr_id = d.rgstr_id
- left join BIS_INSP_ALL_RLATION_PERS c on d.rec_pers_id = c.guid
- where b.rgstr_id = #{regId})
- </if>
- ORDER BY B.ID
- </select>
- <select id="getGroupIdByReg" parameterType="java.util.Map" resultType="java.util.Map">
- SELECT distinct B.*,C.AD_CODE,C.AD_NAME FROM BIS_INSP_ALL_RLATION A
- LEFT JOIN BIS_INSP_ALL B ON A.ID = B.ID
- LEFT JOIN BIS_INSP_SEL_AREA C ON A.ID = C.ID
- WHERE 1=1
- <if test="persId != null and persId != ''"> AND A.PERSID = #{persId}</if>
- <if test="regId != null and regId != ''"> AND A.PERSID in (select d.rec_pers_id from bis_insp_rsvr_rgstr b
- left join BIS_INSP_RSVR_PROJECT d on b.rgstr_id = d.rgstr_id
- left join BIS_INSP_ALL_RLATION_PERS c on d.rec_pers_id = c.guid
- where b.rgstr_id = #{regId})
- </if>
- <if test="mnth != null and mnth != ''"> AND B.INSP_MNTH = #{mnth}</if>
- <if test="id != null and id != ''"> AND A.ID LIKE concat(#{id},'%')</if>
- <if test="adCd != null and adCd != ''"> AND C.AD_CODE LIKE concat(#{adCd},'%')</if>
- ORDER BY B.ID
- </select>
- </mapper>
|