480 lines
19 KiB
XML
480 lines
19 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="cn.com.tenlion.commonpopulation.dao.basepopulationinfo.IBasePopulationInfoDao">
|
|
|
|
<resultMap id="basePopulationInfoDTO" type="cn.com.tenlion.commonpopulation.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="type" property="type"/>
|
|
<result column="subtype" property="subtype"/>
|
|
<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="area_id" property="areaId"/>
|
|
<result column="area_code" property="areaCode"/>
|
|
<result column="area_names" property="areaNames"/>
|
|
<result column="grid_id" property="gridId"/>
|
|
<result column="grid_name" property="gridName"/>
|
|
<result column="nation" property="nation"/>
|
|
<result column="nation_dictionary_name" property="nationDictionaryName"/>
|
|
<result column="native_place" property="nativePlace"/>
|
|
<result column="native_place_addr" property="nativePlaceAddr"/>
|
|
<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(
|
|
subtype,type,base_population_info_id, id_card_number, full_name, name_used_before, gender, birth_date,
|
|
area_id, area_code, area_names, grid_id, grid_name, nation, native_place, native_place_addr,
|
|
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(
|
|
'',#{type}, #{basePopulationInfoId}, #{idCardNumber}, #{fullName}, #{nameUsedBefore}, #{gender}, #{birthDate},
|
|
#{areaId}, #{areaCode}, #{areaNames}, #{gridId}, #{gridName}, #{nation}, #{nativePlace}, #{nativePlaceAddr},
|
|
#{politicalStatus}, #{maritalStatus}, #{education}, #{religion}, #{occupationCategory}, #{occupation},
|
|
#{serviceSpace}, #{telephone}, #{registeredResidence}, #{registeredResidenceAddr}, #{currentResidence},
|
|
#{currentResidenceAddr}, #{creator}, #{gmtCreate}, #{modifier}, #{gmtModified}, #{isDelete}
|
|
)
|
|
</insert>
|
|
|
|
<update id="updateSubtype" parameterType="map">
|
|
UPDATE
|
|
gen_base_population_info
|
|
SET
|
|
subtype = #{subtype}
|
|
WHERE
|
|
id_card_number = #{idCardNumber}
|
|
</update>
|
|
|
|
<!-- 删除人员信息基础表 -->
|
|
<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="updateUnbind" parameterType="map">
|
|
UPDATE
|
|
gen_base_population_info
|
|
SET
|
|
grid_id = '',
|
|
grid_name = ''
|
|
WHERE
|
|
base_population_info_id = #{basePopulationInfoId}
|
|
</update>
|
|
|
|
<update id="updateBase" parameterType="map">
|
|
UPDATE
|
|
gen_base_population_info
|
|
SET
|
|
type = #{type},
|
|
area_id = #{areaId},
|
|
area_code = #{areaCode},
|
|
area_names = #{areaNames},
|
|
grid_id = #{gridId},
|
|
grid_name = #{gridName},
|
|
modifier = #{modifier},
|
|
gmt_modified = #{gmtModified}
|
|
WHERE
|
|
base_population_info_id = #{basePopulationInfoId}
|
|
</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="type != null and type != ''">
|
|
type = #{type},
|
|
</if>
|
|
<if test="gender != null and gender != ''">
|
|
gender = #{gender},
|
|
</if>
|
|
<if test="birthDate != null and birthDate != ''">
|
|
birth_date = #{birthDate},
|
|
</if>
|
|
<if test="areaId != null and areaId != ''">
|
|
area_id = #{areaId},
|
|
</if>
|
|
<if test="areaCode != null and areaCode != ''">
|
|
area_code = #{areaCode},
|
|
</if>
|
|
<if test="areaNames != null and areaNames != ''">
|
|
area_names = #{areaNames},
|
|
</if>
|
|
<if test="gridId != null and gridId != ''">
|
|
grid_id = #{gridId},
|
|
</if>
|
|
<if test="gridName != null and gridName != ''">
|
|
grid_name = #{gridName},
|
|
</if>
|
|
<if test="nation != null and nation != ''">
|
|
nation = #{nation},
|
|
</if>
|
|
<if test="nativePlace != null and nativePlace != ''">
|
|
native_place = #{nativePlace},
|
|
</if>
|
|
<if test="nativePlaceAddr != null and nativePlaceAddr != ''">
|
|
native_place_addr = #{nativePlaceAddr},
|
|
</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.type,
|
|
t1.subtype,
|
|
t1.name_used_before,
|
|
t1.gender,
|
|
t1.birth_date,
|
|
t1.area_id,
|
|
t1.area_code,
|
|
t1.area_names,
|
|
t1.grid_id,
|
|
t1.grid_name,
|
|
t1.nation,
|
|
t1.native_place,
|
|
t1.native_place_addr,
|
|
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>
|
|
limit 1
|
|
</select>
|
|
|
|
<select id="listBaseAgeAndSex" parameterType="map" resultType="map">
|
|
SELECT
|
|
DATE_FORMAT(FROM_DAYS(TO_DAYS(NOW())-TO_DAYS(birth_date)), '%Y')+0 AS age,
|
|
gender
|
|
FROM
|
|
gen_base_population_info t1
|
|
WHERE
|
|
t1.is_delete = 0 AND t1.gender != '' AND t1.gender IS NOT NULL AND t1.birth_date != '' AND t1.birth_date IS NOT NULL
|
|
</select>
|
|
|
|
<!-- 人员信息基础表列表 -->
|
|
<select id="listBasePopulationInfo" parameterType="map" resultMap="basePopulationInfoDTO">
|
|
SELECT
|
|
t1.id_card_number,
|
|
t1.full_name,
|
|
t1.type,
|
|
t1.subtype,
|
|
t1.name_used_before,
|
|
t1.gender,
|
|
t1.birth_date,
|
|
t1.area_id,
|
|
t1.area_code,
|
|
t1.area_names,
|
|
t1.grid_id,
|
|
t1.grid_name,
|
|
t1.nation,
|
|
t1.native_place,
|
|
t1.native_place_addr,
|
|
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="keywords != null and keywords != ''">
|
|
AND (
|
|
t1.full_name LIKE CONCAT('%', #{keywords}, '%')
|
|
OR
|
|
t1.id_card_number LIKE CONCAT('%', #{keywords}, '%')
|
|
)
|
|
</if>
|
|
<if test="politicalStatus != null and politicalStatus !=''">
|
|
AND t1.political_status = #{politicalStatus}
|
|
</if>
|
|
<if test="nation != null and nation !=''">
|
|
AND t1.nation = #{nation}
|
|
</if>
|
|
<if test="fullName != null and fullName !=''">
|
|
AND t1.full_name LIKE CONCAT('%', #{fullName}, '%')
|
|
</if>
|
|
<if test="type != null and type !='' and type != 'null' and type != 'all' and type != 'undefined' ">
|
|
AND t1.type = #{type}
|
|
</if>
|
|
<if test="idCardNumber !=null and idCardNumber !=''">
|
|
AND t1.id_card_number LIKE CONCAT('%', #{idCardNumber}, '%')
|
|
</if>
|
|
<if test="telephone !=null and telephone !=''">
|
|
AND t1.telephone LIKE CONCAT('%', #{telephone}, '%')
|
|
</if>
|
|
<if test="areaCodeLike != null and areaCodeLike != ''">
|
|
AND t1.area_code LIKE CONCAT(#{areaCodeLike}, '%')
|
|
</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>
|
|
<if test="gridId != null and gridId !=''">
|
|
AND t1.grid_id = #{gridId}
|
|
</if>
|
|
<if test="gridIdList != null and gridIdList.size > 0">
|
|
AND t1.grid_id IN
|
|
<foreach collection="gridIdList" index="index" open="(" separator="," close=")">
|
|
#{gridIdList[${index}]}
|
|
</foreach>
|
|
</if>
|
|
ORDER BY gmt_create DESC
|
|
</select>
|
|
|
|
<!-- 查询所有数据字典数据-->
|
|
<select id="listDictionaryAll" parameterType="map" resultType="map">
|
|
select * from data_data where is_delete = '0'
|
|
</select>
|
|
|
|
<!-- 查询checkbox的值-->
|
|
<select id="getDictCheckBoxText" parameterType="map" resultType="map">
|
|
select
|
|
GROUP_CONCAT(t1.dictionary_name) dictionary_name
|
|
from
|
|
data_dictionary t1
|
|
WHERE
|
|
FIND_IN_SET(t1.dictionary_id,#{dictionaryId})
|
|
AND t1.is_delete = '0'
|
|
</select>
|
|
|
|
<!-- 人员信息基础表统计 -->
|
|
<select id="countBasePopulationInfo" parameterType="map" resultType="Integer">
|
|
SELECT
|
|
COUNT(id)
|
|
FROM
|
|
gen_base_population_info t1
|
|
WHERE
|
|
t1.is_delete = 0
|
|
<if test="showOther != null">
|
|
AND (t1.area_code = '' OR t1.area_code IS NULL)
|
|
</if>
|
|
<if test="type != null and type !='' and type != 'null' and type != 'all' and type != 'undefined' ">
|
|
AND t1.type = #{type}
|
|
</if>
|
|
<if test="subtype != null and subtype !=''">
|
|
AND t1.subtype LIKE CONCAT('%', CONCAT(#{subtype}, '%') )
|
|
</if>
|
|
<if test="areaCode != null and areaCode != ''">
|
|
AND t1.area_code = #{areaCode}
|
|
</if>
|
|
<if test="gridId != null and gridId != ''">
|
|
AND t1.grid_id = #{gridId}
|
|
</if>
|
|
<if test="areaCodeLike != null and areaCodeLike !=''">
|
|
AND t1.area_code LIKE CONCAT(#{areaCodeLike}, '%')
|
|
</if>
|
|
</select>
|
|
|
|
<select id="countBasePopulationInfoNew" parameterType="map" resultType="Integer">
|
|
SELECT
|
|
COUNT(id)
|
|
FROM
|
|
gen_base_population_info t1
|
|
WHERE
|
|
t1.is_delete = 0
|
|
<if test="type != null and type !='' and type != 'null' and type != 'all' and type != 'undefined' ">
|
|
AND t1.type = #{type}
|
|
</if>
|
|
<if test="subtype != null and subtype !=''">
|
|
AND t1.subtype LIKE CONCAT('%', CONCAT(#{subtype}, '%') )
|
|
</if>
|
|
<if test="areaCodeLike != null and areaCodeLike !=''">
|
|
AND t1.area_code LIKE CONCAT(#{areaCodeLike}, '%')
|
|
</if>
|
|
<if test="gridId != null and gridId != ''">
|
|
AND t1.grid_id = #{gridId}
|
|
</if>
|
|
<if test="gridIdList != null and gridIdList.size > 0">
|
|
AND t1.grid_id IN
|
|
<foreach collection="gridIdList" index="index" open="(" separator="," close=")">
|
|
#{gridIdList[${index}]}
|
|
</foreach>
|
|
</if>
|
|
</select>
|
|
|
|
<select id="countNumberBasePopulationNew" parameterType="map" resultType="Integer">
|
|
SELECT SUM(a.counts) FROM
|
|
(
|
|
SELECT
|
|
1 AS counts
|
|
FROM
|
|
gen_base_population_info t1
|
|
WHERE
|
|
t1.is_delete = 0
|
|
<if test="type != null and type !='' and type != 'null' and type != 'all' and type != 'undefined' ">
|
|
AND t1.type = #{type}
|
|
</if>
|
|
<if test="areaCode != null and areaCode != ''">
|
|
AND t1.area_code = #{areaCode}
|
|
</if>
|
|
<if test="areaCodeLike != null and areaCodeLike !=''">
|
|
AND t1.area_code LIKE CONCAT(#{areaCodeLike}, '%')
|
|
</if>
|
|
<if test="gridIdList != null and gridIdList.size > 0">
|
|
AND t1.grid_id IN
|
|
<foreach collection="gridIdList" index="index" open="(" separator="," close=")">
|
|
#{gridIdList[${index}]}
|
|
</foreach>
|
|
</if>
|
|
GROUP BY
|
|
t1.id_card_number
|
|
) a
|
|
</select>
|
|
|
|
<select id="getDefaultPageEducation" parameterType="map" resultType="map">
|
|
SELECT
|
|
education,
|
|
count(education) counts
|
|
FROM
|
|
gen_base_population_info
|
|
WHERE
|
|
LENGTH(education) >= 32
|
|
GROUP BY
|
|
education
|
|
ORDER BY counts DESC
|
|
</select>
|
|
|
|
<select id="getDefaultPageNation" parameterType="map" resultType="map">
|
|
SELECT
|
|
nation,
|
|
count(nation) counts
|
|
FROM
|
|
gen_base_population_info
|
|
WHERE
|
|
LENGTH(nation) >= 32
|
|
GROUP BY
|
|
nation
|
|
ORDER BY counts DESC
|
|
</select>
|
|
|
|
</mapper> |