370 lines
12 KiB
XML
370 lines
12 KiB
XML
<?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="com.cm.population.dao.overseaspersonnel.IOverseasPersonnelDao">
|
|
|
|
<resultMap id="overseasPersonnelDTO" type="com.cm.population.pojo.dtos.overseaspersonnel.OverseasPersonnelDTO">
|
|
<id column="overseas_personnel_id" property="overseasPersonnelId"/>
|
|
<result column="to_china_purpose" property="toChinaPurpose"/>
|
|
<result column="service_address" property="serviceAddress"/>
|
|
<result column="nationality" property="nationality"/>
|
|
<result column="nationality_name" property="nationalityName"/>
|
|
<result column="card_year" property="cardYear"/>
|
|
<result column="card_number" property="cardNumber"/>
|
|
<result column="leave_date" property="leaveDate"/>
|
|
<result column="sex" property="sex"/>
|
|
<result column="live_address" property="liveAddress"/>
|
|
<result column="religious_belief" property="religiousBelief"/>
|
|
<result column="surname" property="surname"/>
|
|
<result column="occupation" property="occupation"/>
|
|
<result column="key_of_follow" property="keyOfFollow"/>
|
|
<result column="card_code" property="cardCode"/>
|
|
<result column="name" property="name"/>
|
|
<result column="live_detail_address" property="liveDetailAddress"/>
|
|
<result column="phone" property="phone"/>
|
|
<result column="chinese_name" property="chineseName"/>
|
|
<result column="arrive_date" property="arriveDate"/>
|
|
<result column="birthday" property="birthday"/>
|
|
<result column="occupation_type" property="occupationType"/>
|
|
</resultMap>
|
|
|
|
<!-- 新增境外人员 -->
|
|
<insert id="saveOverseasPersonnel" parameterType="map" useGeneratedKeys="true" keyProperty="id">
|
|
INSERT IGNORE INTO gen_overseas_personnel(
|
|
overseas_personnel_id,
|
|
to_china_purpose,
|
|
service_address,
|
|
nationality,
|
|
card_year,
|
|
card_number,
|
|
leave_date,
|
|
sex,
|
|
live_address,
|
|
religious_belief,
|
|
surname,
|
|
occupation,
|
|
key_of_follow,
|
|
card_code,
|
|
name,
|
|
live_detail_address,
|
|
phone,
|
|
chinese_name,
|
|
arrive_date,
|
|
birthday,
|
|
occupation_type,
|
|
creator,
|
|
gmt_create,
|
|
modifier,
|
|
gmt_modified,
|
|
is_delete
|
|
)
|
|
SELECT
|
|
#{overseasPersonnelId},
|
|
#{toChinaPurpose},
|
|
#{serviceAddress},
|
|
#{nationality},
|
|
#{cardYear},
|
|
#{cardNumber},
|
|
#{leaveDate},
|
|
#{sex},
|
|
#{liveAddress},
|
|
#{religiousBelief},
|
|
#{surname},
|
|
#{occupation},
|
|
#{keyOfFollow},
|
|
#{cardCode},
|
|
#{name},
|
|
#{liveDetailAddress},
|
|
#{phone},
|
|
#{chineseName},
|
|
#{arriveDate},
|
|
#{birthday},
|
|
#{occupationType},
|
|
#{creator},
|
|
#{gmtCreate},
|
|
#{modifier},
|
|
#{gmtModified},
|
|
#{isDelete}
|
|
FROM
|
|
DUAL
|
|
WHERE
|
|
NOT EXISTS (
|
|
SELECT
|
|
*
|
|
FROM
|
|
gen_overseas_personnel
|
|
WHERE
|
|
card_number = #{cardNumber}
|
|
AND is_delete = 0
|
|
)
|
|
</insert>
|
|
|
|
<!-- 新增境外人员 -->
|
|
<insert id="saveOverseaspersonnelList" parameterType="java.util.List">
|
|
INSERT IGNORE INTO gen_overseas_personnel(
|
|
overseas_personnel_id,
|
|
to_china_purpose,
|
|
service_address,
|
|
nationality,
|
|
card_year,
|
|
card_number,
|
|
leave_date,
|
|
sex,
|
|
live_address,
|
|
religious_belief,
|
|
surname,
|
|
occupation,
|
|
key_of_follow,
|
|
card_code,
|
|
name,
|
|
live_detail_address,
|
|
phone,
|
|
chinese_name,
|
|
arrive_date,
|
|
birthday,
|
|
occupation_type,
|
|
creator,
|
|
gmt_create,
|
|
modifier,
|
|
gmt_modified,
|
|
is_delete
|
|
)
|
|
<foreach collection="list" index="index" item="item" separator="union all">
|
|
SELECT
|
|
#{item.overseasPersonnelId},
|
|
#{item.toChinaPurpose},
|
|
#{item.serviceAddress},
|
|
#{item.nationality},
|
|
#{item.cardYear},
|
|
#{item.cardNumber},
|
|
#{item.leaveDate},
|
|
#{item.sex},
|
|
#{item.liveAddress},
|
|
#{item.religiousBelief},
|
|
#{item.surname},
|
|
#{item.occupation},
|
|
#{item.keyOfFollow},
|
|
#{item.cardCode},
|
|
#{item.name},
|
|
#{item.liveDetailAddress},
|
|
#{item.phone},
|
|
#{item.chineseName},
|
|
#{item.arriveDate},
|
|
#{item.birthday},
|
|
#{item.occupationType},
|
|
#{item.creator},
|
|
#{item.gmtCreate},
|
|
#{item.modifier},
|
|
#{item.gmtModified},
|
|
#{item.isDelete}
|
|
FROM
|
|
DUAL
|
|
WHERE
|
|
NOT EXISTS (
|
|
SELECT
|
|
*
|
|
FROM
|
|
gen_overseas_personnel
|
|
WHERE
|
|
card_number = #{item.cardNumber}
|
|
AND is_delete = 0
|
|
)
|
|
</foreach>
|
|
</insert>
|
|
|
|
<!-- 删除境外人员 -->
|
|
<update id="removeOverseasPersonnel" parameterType="map">
|
|
UPDATE
|
|
gen_overseas_personnel
|
|
SET
|
|
is_delete = 1,
|
|
modifier = #{modifier},
|
|
gmt_modified = #{gmtModified}
|
|
WHERE
|
|
overseas_personnel_id IN
|
|
<foreach collection="overseasPersonnelIds" index="index" open="(" separator="," close=")">
|
|
#{overseasPersonnelIds[${index}]}
|
|
</foreach>
|
|
</update>
|
|
|
|
<!-- 删除境外人员(物理) -->
|
|
<update id="deleteOverseasPersonnel" parameterType="map">
|
|
DELETE FROM
|
|
gen_overseas_personnel
|
|
WHERE
|
|
overseas_personnel_id IN
|
|
<foreach collection="overseasPersonnelIds" index="index" open="(" separator="," close=")">
|
|
#{overseasPersonnelIds[${index}]}
|
|
</foreach>
|
|
</update>
|
|
|
|
<!-- 修改境外人员 -->
|
|
<update id="updateOverseasPersonnel" parameterType="map">
|
|
UPDATE
|
|
gen_overseas_personnel
|
|
SET
|
|
<if test="toChinaPurpose != null and toChinaPurpose != ''">
|
|
to_china_purpose = #{toChinaPurpose},
|
|
</if>
|
|
<if test="serviceAddress != null and serviceAddress != ''">
|
|
service_address = #{serviceAddress},
|
|
</if>
|
|
<if test="nationality != null and nationality != ''">
|
|
nationality = #{nationality},
|
|
</if>
|
|
<if test="cardYear != null and cardYear != ''">
|
|
card_year = #{cardYear},
|
|
</if>
|
|
<if test="cardNumber != null and cardNumber != ''">
|
|
card_number = #{cardNumber},
|
|
</if>
|
|
<if test="leaveDate != null and leaveDate != ''">
|
|
leave_date = #{leaveDate},
|
|
</if>
|
|
<if test="sex != null and sex != ''">
|
|
sex = #{sex},
|
|
</if>
|
|
<if test="liveAddress != null and liveAddress != ''">
|
|
live_address = #{liveAddress},
|
|
</if>
|
|
<if test="religiousBelief != null and religiousBelief != ''">
|
|
religious_belief = #{religiousBelief},
|
|
</if>
|
|
<if test="surname != null and surname != ''">
|
|
surname = #{surname},
|
|
</if>
|
|
<if test="occupation != null and occupation != ''">
|
|
occupation = #{occupation},
|
|
</if>
|
|
<if test="keyOfFollow != null and keyOfFollow != ''">
|
|
key_of_follow = #{keyOfFollow},
|
|
</if>
|
|
<if test="cardCode != null and cardCode != ''">
|
|
card_code = #{cardCode},
|
|
</if>
|
|
<if test="name != null and name != ''">
|
|
name = #{name},
|
|
</if>
|
|
<if test="liveDetailAddress != null and liveDetailAddress != ''">
|
|
live_detail_address = #{liveDetailAddress},
|
|
</if>
|
|
<if test="phone != null and phone != ''">
|
|
phone = #{phone},
|
|
</if>
|
|
<if test="chineseName != null and chineseName != ''">
|
|
chinese_name = #{chineseName},
|
|
</if>
|
|
<if test="arriveDate != null and arriveDate != ''">
|
|
arrive_date = #{arriveDate},
|
|
</if>
|
|
<if test="birthday != null and birthday != ''">
|
|
birthday = #{birthday},
|
|
</if>
|
|
<if test="occupationType != null and occupationType != ''">
|
|
occupation_type = #{occupationType},
|
|
</if>
|
|
modifier = #{modifier},
|
|
gmt_modified = #{gmtModified}
|
|
WHERE
|
|
overseas_personnel_id = #{overseasPersonnelId}
|
|
</update>
|
|
|
|
<!-- 境外人员详情 -->
|
|
<select id="getOverseasPersonnel" parameterType="map" resultMap="overseasPersonnelDTO">
|
|
SELECT
|
|
t1.to_china_purpose,
|
|
t1.service_address,
|
|
t1.nationality,
|
|
t1.card_year,
|
|
t1.card_number,
|
|
t1.leave_date,
|
|
t1.sex,
|
|
t1.live_address,
|
|
t1.religious_belief,
|
|
t1.surname,
|
|
t1.occupation,
|
|
t1.key_of_follow,
|
|
t1.card_code,
|
|
t1.name,
|
|
t1.live_detail_address,
|
|
t1.phone,
|
|
t1.chinese_name,
|
|
t1.arrive_date,
|
|
t1.birthday,
|
|
t1.occupation_type,
|
|
t1.overseas_personnel_id
|
|
FROM
|
|
gen_overseas_personnel t1
|
|
WHERE
|
|
t1.is_delete = 0
|
|
<if test="overseasPersonnelId != null and overseasPersonnelId != ''">
|
|
AND
|
|
t1.overseas_personnel_id = #{overseasPersonnelId}
|
|
</if>
|
|
</select>
|
|
|
|
<!-- 境外人员列表 -->
|
|
<select id="listOverseasPersonnel" parameterType="map" resultMap="overseasPersonnelDTO">
|
|
SELECT
|
|
t1.to_china_purpose,
|
|
t1.service_address,
|
|
t1.nationality,
|
|
t1.card_year,
|
|
t1.card_number,
|
|
t1.leave_date,
|
|
t1.sex,
|
|
t1.live_address,
|
|
t1.religious_belief,
|
|
t1.surname,
|
|
t1.occupation,
|
|
t1.key_of_follow,
|
|
t1.card_code,
|
|
t1.name,
|
|
t1.live_detail_address,
|
|
t1.phone,
|
|
t1.chinese_name,
|
|
t1.arrive_date,
|
|
t1.birthday,
|
|
t1.occupation_type,
|
|
t1.overseas_personnel_id
|
|
FROM
|
|
gen_overseas_personnel t1
|
|
WHERE
|
|
t1.is_delete = 0
|
|
<if test="keywords != null and keywords != ''">
|
|
AND (
|
|
t1.surname LIKE CONCAT('%', #{keywords}, '%')
|
|
OR
|
|
t1.name LIKE CONCAT('%', #{keywords}, '%')
|
|
OR
|
|
t1.chinese_name LIKE CONCAT('%', #{keywords}, '%')
|
|
<!-- 这里添加其他条件 -->
|
|
)
|
|
</if>
|
|
<if test="startTime != null and startTime != ''">
|
|
AND
|
|
LEFT(t1.arrive_date, 10) <![CDATA[ >= ]]> #{startTime}
|
|
</if>
|
|
<if test="endTime != null and endTime != ''">
|
|
AND
|
|
LEFT(t1.leave_date, 10) <![CDATA[ <= ]]> #{endTime}
|
|
</if>
|
|
<if test="overseasPersonnelIds != null and overseasPersonnelIds.size > 0">
|
|
AND
|
|
t1.overseas_personnel_id IN
|
|
<foreach collection="overseasPersonnelIds" index="index" open="(" separator="," close=")">
|
|
#{overseasPersonnelIds[${index}]}
|
|
</foreach>
|
|
</if>
|
|
</select>
|
|
|
|
<!-- 境外人员统计 -->
|
|
<select id="countOverseasPersonnel" parameterType="map" resultType="Integer">
|
|
SELECT
|
|
COUNT(*)
|
|
FROM
|
|
gen_overseas_personnel t1
|
|
WHERE
|
|
t1.is_delete = 0
|
|
</select>
|
|
|
|
</mapper> |