370 lines
13 KiB
XML
370 lines
13 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.basepopulationinfo.IBasePopulationInfoDao">
|
|
|
|
<resultMap id="basePopulationInfoDTO" type="com.cm.population.pojo.dtos.basepopulationinfo.BasePopulationInfoDTO">
|
|
<id column="base_population_info_id" property="basePopulationInfoId"/>
|
|
<result column="id_card_number" property="idCardNumber"/>
|
|
<result column="full_name" property="fullName"/>
|
|
<result column="name_used_before" property="nameUsedBefore"/>
|
|
<result column="gender" property="gender"/>
|
|
<result column="gender_dictionary_name" property="genderDictionaryName"/>
|
|
<result column="birth_date" property="birthDate"/>
|
|
<result column="nation" property="nation"/>
|
|
<result column="nation_dictionary_name" property="nationDictionaryName"/>
|
|
<result column="native_place" property="nativePlace"/>
|
|
<result column="native_place_dictionary_name" property="nativePlaceDictionaryName"/>
|
|
<result column="political_status" property="politicalStatus"/>
|
|
<result column="political_status_dictionary_name" property="politicalStatusDictionaryName"/>
|
|
<result column="marital_status" property="maritalStatus"/>
|
|
<result column="marital_status_dictionary_name" property="maritalStatusDictionaryName"/>
|
|
<result column="education" property="education"/>
|
|
<result column="education_dictionary_name" property="educationDictionaryName"/>
|
|
<result column="religion" property="religion"/>
|
|
<result column="religion_dictionary_name" property="religionDictionaryName"/>
|
|
<result column="occupation_category" property="occupationCategory"/>
|
|
<result column="occupation_category_dictionary_name" property="occupationCategoryDictionaryName"/>
|
|
<result column="occupation" property="occupation"/>
|
|
<result column="service_space" property="serviceSpace"/>
|
|
<result column="telephone" property="telephone"/>
|
|
<result column="registered_residence" property="registeredResidence"/>
|
|
<result column="registered_residence_dictionary_name" property="registeredResidenceDictionaryName"/>
|
|
<result column="registered_residence_addr" property="registeredResidenceAddr"/>
|
|
<result column="current_residence" property="currentResidence"/>
|
|
<result column="current_residence_dictionary_name" property="currentResidenceDictionaryName"/>
|
|
<result column="current_residence_addr" property="currentResidenceAddr"/>
|
|
</resultMap>
|
|
|
|
<!-- 新增人员信息基础表 -->
|
|
<insert id="saveBasePopulationInfo" parameterType="map">
|
|
INSERT INTO gen_base_population_info(
|
|
base_population_info_id,
|
|
id_card_number,
|
|
full_name,
|
|
name_used_before,
|
|
gender,
|
|
birth_date,
|
|
nation,
|
|
native_place,
|
|
political_status,
|
|
marital_status,
|
|
education,
|
|
religion,
|
|
occupation_category,
|
|
occupation,
|
|
service_space,
|
|
telephone,
|
|
registered_residence,
|
|
registered_residence_addr,
|
|
current_residence,
|
|
current_residence_addr,
|
|
creator,
|
|
gmt_create,
|
|
modifier,
|
|
gmt_modified,
|
|
is_delete
|
|
) VALUES(
|
|
#{basePopulationInfoId},
|
|
#{idCardNumber},
|
|
#{fullName},
|
|
#{nameUsedBefore},
|
|
#{gender},
|
|
#{birthDate},
|
|
#{nation},
|
|
#{nativePlace},
|
|
#{politicalStatus},
|
|
#{maritalStatus},
|
|
#{education},
|
|
#{religion},
|
|
#{occupationCategory},
|
|
#{occupation},
|
|
#{serviceSpace},
|
|
#{telephone},
|
|
#{registeredResidence},
|
|
#{registeredResidenceAddr},
|
|
#{currentResidence},
|
|
#{currentResidenceAddr},
|
|
#{creator},
|
|
#{gmtCreate},
|
|
#{modifier},
|
|
#{gmtModified},
|
|
#{isDelete}
|
|
)
|
|
</insert>
|
|
|
|
<!-- 删除人员信息基础表 -->
|
|
<update id="removeBasePopulationInfo" parameterType="map">
|
|
UPDATE
|
|
gen_base_population_info
|
|
SET
|
|
is_delete = 1,
|
|
modifier = #{modifier},
|
|
gmt_modified = #{gmtModified}
|
|
WHERE
|
|
base_population_info_id IN
|
|
<foreach collection="basePopulationInfoIds" index="index" open="(" separator="," close=")">
|
|
#{basePopulationInfoIds[${index}]}
|
|
</foreach>
|
|
</update>
|
|
|
|
<!-- 删除人员信息基础表(物理) -->
|
|
<update id="deleteBasePopulationInfo" parameterType="map">
|
|
DELETE FROM
|
|
gen_base_population_info
|
|
WHERE
|
|
base_population_info_id IN
|
|
<foreach collection="basePopulationInfoIds" index="index" open="(" separator="," close=")">
|
|
#{basePopulationInfoIds[${index}]}
|
|
</foreach>
|
|
</update>
|
|
|
|
<!-- 修改人员信息基础表 -->
|
|
<update id="updateBasePopulationInfo" parameterType="map">
|
|
UPDATE
|
|
gen_base_population_info
|
|
SET
|
|
<if test="idCardNumber != null and idCardNumber != ''">
|
|
id_card_number = #{idCardNumber},
|
|
</if>
|
|
<if test="fullName != null and fullName != ''">
|
|
full_name = #{fullName},
|
|
</if>
|
|
<if test="nameUsedBefore != null and nameUsedBefore != ''">
|
|
name_used_before = #{nameUsedBefore},
|
|
</if>
|
|
<if test="gender != null and gender != ''">
|
|
gender = #{gender},
|
|
</if>
|
|
<if test="birthDate != null and birthDate != ''">
|
|
birth_date = #{birthDate},
|
|
</if>
|
|
<if test="nation != null and nation != ''">
|
|
nation = #{nation},
|
|
</if>
|
|
<if test="nativePlace != null and nativePlace != ''">
|
|
native_place = #{nativePlace},
|
|
</if>
|
|
<if test="politicalStatus != null and politicalStatus != ''">
|
|
political_status = #{politicalStatus},
|
|
</if>
|
|
<if test="maritalStatus != null and maritalStatus != ''">
|
|
marital_status = #{maritalStatus},
|
|
</if>
|
|
<if test="education != null and education != ''">
|
|
education = #{education},
|
|
</if>
|
|
<if test="religion != null and religion != ''">
|
|
religion = #{religion},
|
|
</if>
|
|
<if test="occupationCategory != null and occupationCategory != ''">
|
|
occupation_category = #{occupationCategory},
|
|
</if>
|
|
<if test="occupation != null and occupation != ''">
|
|
occupation = #{occupation},
|
|
</if>
|
|
<if test="serviceSpace != null and serviceSpace != ''">
|
|
service_space = #{serviceSpace},
|
|
</if>
|
|
<if test="telephone != null and telephone != ''">
|
|
telephone = #{telephone},
|
|
</if>
|
|
<if test="registeredResidence != null and registeredResidence != ''">
|
|
registered_residence = #{registeredResidence},
|
|
</if>
|
|
<if test="registeredResidenceAddr != null and registeredResidenceAddr != ''">
|
|
registered_residence_addr = #{registeredResidenceAddr},
|
|
</if>
|
|
<if test="currentResidence != null and currentResidence != ''">
|
|
current_residence = #{currentResidence},
|
|
</if>
|
|
<if test="currentResidenceAddr != null and currentResidenceAddr != ''">
|
|
current_residence_addr = #{currentResidenceAddr},
|
|
</if>
|
|
modifier = #{modifier},
|
|
gmt_modified = #{gmtModified}
|
|
WHERE
|
|
base_population_info_id = #{basePopulationInfoId}
|
|
</update>
|
|
|
|
<!-- 人员信息基础表详情 -->
|
|
<select id="getBasePopulationInfo" parameterType="map" resultMap="basePopulationInfoDTO">
|
|
SELECT
|
|
t1.id_card_number,
|
|
t1.full_name,
|
|
t1.name_used_before,
|
|
t1.gender,
|
|
t1.birth_date,
|
|
t1.nation,
|
|
t1.native_place,
|
|
t1.political_status,
|
|
t1.marital_status,
|
|
t1.education,
|
|
t1.religion,
|
|
t1.occupation_category,
|
|
t1.occupation,
|
|
t1.service_space,
|
|
t1.telephone,
|
|
t1.registered_residence,
|
|
t1.registered_residence_addr,
|
|
t1.current_residence,
|
|
t1.current_residence_addr,
|
|
t1.base_population_info_id
|
|
FROM
|
|
gen_base_population_info t1
|
|
WHERE
|
|
t1.is_delete = 0
|
|
<if test="basePopulationInfoId != null and basePopulationInfoId != ''">
|
|
AND t1.base_population_info_id = #{basePopulationInfoId}
|
|
</if>
|
|
<if test="idCardNumber != null and idCardNumber != ''">
|
|
AND t1.id_card_number = #{idCardNumber}
|
|
</if>
|
|
</select>
|
|
|
|
<!-- 人员信息基础表列表 -->
|
|
<select id="listBasePopulationInfo" parameterType="map" resultMap="basePopulationInfoDTO">
|
|
SELECT
|
|
t1.id_card_number,
|
|
t1.full_name,
|
|
t1.name_used_before,
|
|
t1.gender,
|
|
dt1.dictionary_name gender_dictionary_name,
|
|
t1.birth_date,
|
|
t1.nation,
|
|
dt2.dictionary_name nation_dictionary_name,
|
|
t1.native_place,
|
|
dt3.dictionary_name native_place_dictionary_name,
|
|
t1.political_status,
|
|
dt4.dictionary_name political_status_dictionary_name,
|
|
t1.marital_status,
|
|
dt5.dictionary_name marital_status_dictionary_name,
|
|
t1.education,
|
|
dt6.dictionary_name education_dictionary_name,
|
|
t1.religion,
|
|
dt7.dictionary_name religion_dictionary_name,
|
|
t1.occupation_category,
|
|
dt8.dictionary_name occupation_category_dictionary_name,
|
|
t1.occupation,
|
|
t1.service_space,
|
|
t1.telephone,
|
|
t1.registered_residence,
|
|
dt9.dictionary_name registered_residence_dictionary_name,
|
|
t1.registered_residence_addr,
|
|
t1.current_residence,
|
|
dt10.dictionary_name current_residence_dictionary_name,
|
|
t1.current_residence_addr,
|
|
t1.base_population_info_id
|
|
FROM
|
|
gen_base_population_info t1
|
|
LEFT JOIN
|
|
data_dictionary dt1
|
|
ON
|
|
dt1.dictionary_id = t1.gender
|
|
AND
|
|
dt1.is_delete = 0
|
|
LEFT JOIN
|
|
data_dictionary dt2
|
|
ON
|
|
dt2.dictionary_id = t1.nation
|
|
AND
|
|
dt2.is_delete = 0
|
|
LEFT JOIN
|
|
data_dictionary dt3
|
|
ON
|
|
dt3.dictionary_id = t1.native_place
|
|
AND
|
|
dt3.is_delete = 0
|
|
LEFT JOIN
|
|
data_dictionary dt4
|
|
ON
|
|
dt4.dictionary_id = t1.political_status
|
|
AND
|
|
dt4.is_delete = 0
|
|
LEFT JOIN
|
|
data_dictionary dt5
|
|
ON
|
|
dt5.dictionary_id = t1.marital_status
|
|
AND
|
|
dt5.is_delete = 0
|
|
LEFT JOIN
|
|
data_dictionary dt6
|
|
ON
|
|
dt6.dictionary_id = t1.education
|
|
AND
|
|
dt6.is_delete = 0
|
|
LEFT JOIN
|
|
data_dictionary dt7
|
|
ON
|
|
dt7.dictionary_id = t1.religion
|
|
AND
|
|
dt7.is_delete = 0
|
|
LEFT JOIN
|
|
data_dictionary dt8
|
|
ON
|
|
dt8.dictionary_id = t1.occupation_category
|
|
AND
|
|
dt8.is_delete = 0
|
|
LEFT JOIN
|
|
data_dictionary dt9
|
|
ON
|
|
dt9.dictionary_id = t1.registered_residence
|
|
AND
|
|
dt9.is_delete = 0
|
|
LEFT JOIN
|
|
data_dictionary dt10
|
|
ON
|
|
dt10.dictionary_id = t1.current_residence
|
|
AND
|
|
dt10.is_delete = 0
|
|
WHERE
|
|
t1.is_delete = 0
|
|
<if test="keywords != null and keywords != ''">
|
|
AND (
|
|
t1.full_name LIKE CONCAT('%', #{keywords}, '%')
|
|
OR
|
|
t1.id_card_number LIKE CONCAT('%', #{keywords}, '%')
|
|
<!-- 这里添加其他条件 -->
|
|
)
|
|
</if>
|
|
<if test="startTime != null and startTime != ''">
|
|
AND
|
|
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
|
|
</if>
|
|
<if test="endTime != null and endTime != ''">
|
|
AND
|
|
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
|
|
</if>
|
|
<if test="basePopulationInfoIds != null and basePopulationInfoIds.size > 0">
|
|
AND
|
|
t1.base_population_info_id IN
|
|
<foreach collection="basePopulationInfoIds" index="index" open="(" separator="," close=")">
|
|
#{basePopulationInfoIds[${index}]}
|
|
</foreach>
|
|
</if>
|
|
</select>
|
|
|
|
<!-- 人员信息基础表统计 -->
|
|
<select id="countBasePopulationInfo" parameterType="map" resultType="Integer">
|
|
SELECT
|
|
COUNT(*)
|
|
FROM
|
|
gen_base_population_info t1
|
|
WHERE
|
|
t1.is_delete = 0
|
|
<if test="gender != null and gender !=''">
|
|
AND t1.gender = #{gender}
|
|
</if>
|
|
<if test="userIds != null and userIds != ''">
|
|
AND t1.creator IN (${userIds})
|
|
</if>
|
|
<if test="startTime != null and startTime != ''">
|
|
AND
|
|
t1.gmt_create <![CDATA[ >= ]]> #{startTime}
|
|
</if>
|
|
<if test="endTime != null and endTime != ''">
|
|
AND
|
|
t1.gmt_create <![CDATA[ <= ]]> #{endTime}
|
|
</if>
|
|
</select>
|
|
|
|
</mapper> |