btxtgxq-system-population/src/main/resources/mybatis/mapper/populationinfo/population-info-mapper.xml
2023-11-27 09:30:35 +08:00

1459 lines
54 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.populationinfo.IPopulationInfoDao">
<resultMap id="populationInfoAreaDTO" type="com.cm.population.pojo.dtos.populationinfo.PopulationInfoAreaDTO">
<result column="area_id" property="areaId"/>
<result column="area_name" property="areaName"/>
</resultMap>
<resultMap id="populationInfoBaseDTO" type="com.cm.population.pojo.dtos.populationinfo.PopulationInfoBaseDTO">
<result column="population_info_id" property="populationInfoId"/>
<result column="name" property="name"/>
<result column="idcard" property="idcard"/>
<result column="label" property="label"/>
<result column="idcard_type" property="idcardType"/>
<result column="birthday" property="birthday"/>
<result column="sex" property="sex"/>
<result column="nation" property="nation"/>
<result column="education" property="education"/>
<result column="health_status" property="healthStatus"/>
<result column="phone" property="phone"/>
<result column="is_oldage" property="isOldage"/>
<result column="is_disability" property="isDisability"/>
<result column="is_military" property="isMilitary"/>
<result column="is_succour" property="isSuccour"/>
<result column="is_party" property="isParty"/>
<result column="creator_area1" property="creatorArea1"/>
<result column="creator" property="creator"/>
</resultMap>
<resultMap id="populationInfoDTO" type="com.cm.population.pojo.dtos.populationinfo.PopulationInfoDTO">
<result column="population_info_id" property="populationInfoId"/>
<result column="name" property="name"/>
<result column="label" property="label"/>
<result column="idcard" property="idcard"/>
<result column="idcard_type" property="idcardType"/>
<result column="birthday" property="birthday"/>
<result column="sex" property="sex"/>
<result column="nation" property="nation"/>
<result column="education" property="education"/>
<result column="description" property="description"/>
<result column="organization" property="organization"/>
<result column="religion" property="religion"/>
<result column="marriage_status" property="marriageStatus"/>
<result column="marriage_change_time" property="marriageChangeTime"/>
<result column="marriage_first_time" property="marriageFirstTime"/>
<result column="social_security" property="socialSecurity"/>
<result column="health_status" property="healthStatus"/>
<result column="department_type" property="departmentType"/>
<result column="department" property="department"/>
<result column="pastion" property="pastion"/>
<result column="pastion_title" property="pastionTitle"/>
<result column="expertise" property="expertise"/>
<result column="phone" property="phone"/>
<result column="father_id" property="fatherId"/>
<result column="father_name" property="fatherName"/>
<result column="father_idcard" property="fatherIdcard"/>
<result column="father_phone" property="fatherPhone"/>
<result column="mother_id" property="motherId"/>
<result column="mother_name" property="motherName"/>
<result column="mother_idcard" property="motherIdcard"/>
<result column="mother_phone" property="motherPhone"/>
<result column="relationship" property="relationship"/>
<result column="domicile_address" property="domicileAddress"/>
<result column="domicile_address_type" property="domicileAddressType"/>
<result column="domicile_area_code" property="domicileAreaCode"/>
<result column="domicile_area_name" property="domicileAreaName"/>
<result column="origin_address" property="originAddress"/>
<result column="origin_area_code" property="originAreaCode"/>
<result column="origin_area_name" property="originAreaName"/>
<result column="flow_time" property="flowTime"/>
<result column="flow_reason" property="flowReason"/>
<result column="flow_reasontext" property="flowReasontext"/>
<result column="is_oldage" property="isOldage"/>
<result column="oldage_type" property="oldageType"/>
<result column="oldage_department" property="oldageDepartment"/>
<result column="oldage_lift" property="oldageLift"/>
<result column="oldage_health_status" property="oldageHealthStatus"/>
<result column="oldage_selfcare" property="oldageSelfcare"/>
<result column="oldage_live" property="oldageLive"/>
<result column="is_disability" property="isDisability"/>
<result column="disability_type" property="disabilityType"/>
<result column="disability_level" property="disabilityLevel"/>
<result column="disability_number" property="disabilityNumber"/>
<result column="disability_carnumber" property="disabilityCarnumber"/>
<result column="disability_address" property="disabilityAddress"/>
<result column="disability_area_code" property="disabilityAreaCode"/>
<result column="disability_area_name" property="disabilityAreaName"/>
<result column="disability_income" property="disabilityIncome"/>
<result column="disability_house" property="disabilityHouse"/>
<result column="disability_time" property="disabilityTime"/>
<result column="disability_guardian" property="disabilityGuardian"/>
<result column="disability_guardian_phone" property="disabilityGuardianPhone"/>
<result column="disability_guardian_relation" property="disabilityGuardianRelation"/>
<result column="is_military" property="isMilitary"/>
<result column="military_time" property="militaryTime"/>
<result column="military_position" property="militaryPosition"/>
<result column="is_succour" property="isSuccour"/>
<result column="succour_dibao" property="succourDibao"/>
<result column="succour_help" property="succourHelp"/>
<result column="succour_difficulty" property="succourDifficulty"/>
<result column="succour_subsidy" property="succourSubsidy"/>
<result column="is_party" property="isParty"/>
<result column="party_organization" property="partyOrganization"/>
<result column="party_time" property="partyTime"/>
<result column="othertext" property="othertext"/>
<result column="creator" property="creator"/>
<result column="creator_area1" property="creatorArea1"/>
</resultMap>
<resultMap id="populationInfoBO" type="com.cm.population.pojo.bos.populationinfo.PopulationInfoBO">
<result column="population_info_id" property="populationInfoId"/>
<result column="name" property="name"/>
<result column="idcard" property="idcard"/>
<result column="idcard_type" property="idcardType"/>
<result column="birthday" property="birthday"/>
<result column="sex" property="sex"/>
<result column="nation" property="nation"/>
<result column="education" property="education"/>
<result column="description" property="description"/>
<result column="organization" property="organization"/>
<result column="religion" property="religion"/>
<result column="marriage_status" property="marriageStatus"/>
<result column="marriage_change_time" property="marriageChangeTime"/>
<result column="marriage_first_time" property="marriageFirstTime"/>
<result column="social_security" property="socialSecurity"/>
<result column="health_status" property="healthStatus"/>
<result column="department" property="department"/>
<result column="pastion" property="pastion"/>
<result column="pastion_title" property="pastionTitle"/>
<result column="expertise" property="expertise"/>
<result column="phone" property="phone"/>
<result column="father_id" property="fatherId"/>
<result column="father_name" property="fatherName"/>
<result column="father_idcard" property="fatherIdcard"/>
<result column="father_phone" property="fatherPhone"/>
<result column="mother_id" property="motherId"/>
<result column="mother_name" property="motherName"/>
<result column="mother_idcard" property="motherIdcard"/>
<result column="mother_phone" property="motherPhone"/>
<result column="relationship" property="relationship"/>
<result column="domicile_address" property="domicileAddress"/>
<result column="origin_address" property="originAddress"/>
<result column="flow_time" property="flowTime"/>
<result column="flow_reason" property="flowReason"/>
<result column="flow_reasontext" property="flowReasontext"/>
<result column="is_oldage" property="isOldage"/>
<result column="oldage_type" property="oldageType"/>
<result column="oldage_department" property="oldageDepartment"/>
<result column="oldage_lift" property="oldageLift"/>
<result column="oldage_health_status" property="oldageHealthStatus"/>
<result column="oldage_selfcare" property="oldageSelfcare"/>
<result column="oldage_live" property="oldageLive"/>
<result column="is_disability" property="isDisability"/>
<result column="disability_type" property="disabilityType"/>
<result column="disability_level" property="disabilityLevel"/>
<result column="disability_number" property="disabilityNumber"/>
<result column="disability_carnumber" property="disabilityCarnumber"/>
<result column="disability_address" property="disabilityAddress"/>
<result column="disability_income" property="disabilityIncome"/>
<result column="disability_house" property="disabilityHouse"/>
<result column="disability_time" property="disabilityTime"/>
<result column="disability_guardian" property="disabilityGuardian"/>
<result column="disability_guardian_phone" property="disabilityGuardianPhone"/>
<result column="disability_guardian_relation" property="disabilityGuardianRelation"/>
<result column="is_military" property="isMilitary"/>
<result column="military_time" property="militaryTime"/>
<result column="military_position" property="militaryPosition"/>
<result column="is_succour" property="isSuccour"/>
<result column="succour_dibao" property="succourDibao"/>
<result column="succour_help" property="succourHelp"/>
<result column="succour_difficulty" property="succourDifficulty"/>
<result column="succour_subsidy" property="succourSubsidy"/>
<result column="is_party" property="isParty"/>
<result column="party_organization" property="partyOrganization"/>
<result column="party_time" property="partyTime"/>
<result column="othertext" property="othertext"/>
</resultMap>
<resultMap id="populationInfoPO" type="com.cm.population.pojo.pos.populationinfo.PopulationInfoPO">
<result column="population_info_id" property="populationInfoId"/>
<result column="name" property="name"/>
<result column="idcard" property="idcard"/>
<result column="idcard_type" property="idcardType"/>
<result column="birthday" property="birthday"/>
<result column="sex" property="sex"/>
<result column="nation" property="nation"/>
<result column="education" property="education"/>
<result column="description" property="description"/>
<result column="organization" property="organization"/>
<result column="religion" property="religion"/>
<result column="marriage_status" property="marriageStatus"/>
<result column="marriage_change_time" property="marriageChangeTime"/>
<result column="marriage_first_time" property="marriageFirstTime"/>
<result column="social_security" property="socialSecurity"/>
<result column="health_status" property="healthStatus"/>
<result column="department" property="department"/>
<result column="pastion" property="pastion"/>
<result column="pastion_title" property="pastionTitle"/>
<result column="expertise" property="expertise"/>
<result column="phone" property="phone"/>
<result column="father_id" property="fatherId"/>
<result column="father_name" property="fatherName"/>
<result column="father_idcard" property="fatherIdcard"/>
<result column="father_phone" property="fatherPhone"/>
<result column="mother_id" property="motherId"/>
<result column="mother_name" property="motherName"/>
<result column="mother_idcard" property="motherIdcard"/>
<result column="mother_phone" property="motherPhone"/>
<result column="relationship" property="relationship"/>
<result column="domicile_address" property="domicileAddress"/>
<result column="origin_address" property="originAddress"/>
<result column="flow_time" property="flowTime"/>
<result column="flow_reason" property="flowReason"/>
<result column="flow_reasontext" property="flowReasontext"/>
<result column="is_oldage" property="isOldage"/>
<result column="oldage_type" property="oldageType"/>
<result column="oldage_department" property="oldageDepartment"/>
<result column="oldage_lift" property="oldageLift"/>
<result column="oldage_health_status" property="oldageHealthStatus"/>
<result column="oldage_selfcare" property="oldageSelfcare"/>
<result column="oldage_live" property="oldageLive"/>
<result column="is_disability" property="isDisability"/>
<result column="disability_type" property="disabilityType"/>
<result column="disability_level" property="disabilityLevel"/>
<result column="disability_number" property="disabilityNumber"/>
<result column="disability_carnumber" property="disabilityCarnumber"/>
<result column="disability_address" property="disabilityAddress"/>
<result column="disability_income" property="disabilityIncome"/>
<result column="disability_house" property="disabilityHouse"/>
<result column="disability_time" property="disabilityTime"/>
<result column="disability_guardian" property="disabilityGuardian"/>
<result column="disability_guardian_phone" property="disabilityGuardianPhone"/>
<result column="disability_guardian_relation" property="disabilityGuardianRelation"/>
<result column="is_military" property="isMilitary"/>
<result column="military_time" property="militaryTime"/>
<result column="military_position" property="militaryPosition"/>
<result column="is_succour" property="isSuccour"/>
<result column="succour_dibao" property="succourDibao"/>
<result column="succour_help" property="succourHelp"/>
<result column="succour_difficulty" property="succourDifficulty"/>
<result column="succour_subsidy" property="succourSubsidy"/>
<result column="is_party" property="isParty"/>
<result column="party_organization" property="partyOrganization"/>
<result column="party_time" property="partyTime"/>
<result column="othertext" property="othertext"/>
</resultMap>
<!-- 取第一条 -->
<select id="getCreatorArea" parameterType="java.lang.String" resultMap="populationInfoAreaDTO">
SELECT
area_id,
area_name
FROM
v_community_boss
WHERE
community_boss_user_id = #{creator}
ORDER BY
community_boss_level DESC
LIMIT 1
</select>
<!-- 新增基础人口信息 -->
<insert id="save" parameterType="map">
INSERT INTO population_population_info(
population_info_id,
name,
idcard,
label,
idcard_type,
birthday,
sex,
nation,
education,
description,
organization,
religion,
marriage_status,
marriage_change_time,
marriage_first_time,
social_security,
health_status,
department_type,
department,
pastion,
pastion_title,
expertise,
phone,
father_id,
father_name,
father_idcard,
father_phone,
mother_id,
mother_name,
mother_idcard,
mother_phone,
relationship,
domicile_address,
domicile_address_type,
domicile_area_code,
domicile_area_name,
origin_address,
origin_area_code,
origin_area_name,
flow_time,
flow_reason,
flow_reasontext,
is_oldage,
oldage_type,
oldage_department,
oldage_lift,
oldage_health_status,
oldage_selfcare,
oldage_live,
is_disability,
disability_type,
disability_level,
disability_number,
disability_carnumber,
disability_address,
disability_area_code,
disability_area_name,
disability_income,
disability_house,
disability_time,
disability_guardian,
disability_guardian_phone,
disability_guardian_relation,
is_military,
military_time,
military_position,
is_succour,
succour_dibao,
succour_help,
succour_difficulty,
succour_subsidy,
is_party,
party_organization,
party_time,
othertext,
creator_area1,
creator,
gmt_create,
modifier,
gmt_modified,
is_delete
) VALUES(
#{populationInfoId},
#{name},
#{idcard},
#{label},
#{idcardType},
#{birthday},
#{sex},
#{nation},
#{education},
#{description},
#{organization},
#{religion},
#{marriageStatus},
#{marriageChangeTime},
#{marriageFirstTime},
#{socialSecurity},
#{healthStatus},
#{departmentType},
#{department},
#{pastion},
#{pastionTitle},
#{expertise},
#{phone},
#{fatherId},
#{fatherName},
#{fatherIdcard},
#{fatherPhone},
#{motherId},
#{motherName},
#{motherIdcard},
#{motherPhone},
#{relationship},
#{domicileAddress},
#{domicileAddressType},
#{domicileAreaCode},
#{domicileAreaName},
#{originAddress},
#{originAreaCode},
#{originAreaName},
#{flowTime},
#{flowReason},
#{flowReasontext},
#{isOldage},
#{oldageType},
#{oldageDepartment},
#{oldageLift},
#{oldageHealthStatus},
#{oldageSelfcare},
#{oldageLive},
#{isDisability},
#{disabilityType},
#{disabilityLevel},
#{disabilityNumber},
#{disabilityCarnumber},
#{disabilityAddress},
#{disabilityAreaCode},
#{disabilityAreaName},
#{disabilityIncome},
#{disabilityHouse},
#{disabilityTime},
#{disabilityGuardian},
#{disabilityGuardianPhone},
#{disabilityGuardianRelation},
#{isMilitary},
#{militaryTime},
#{militaryPosition},
#{isSuccour},
#{succourDibao},
#{succourHelp},
#{succourDifficulty},
#{succourSubsidy},
#{isParty},
#{partyOrganization},
#{partyTime},
#{othertext},
#{creatorArea1},
#{creator},
#{gmtCreate},
#{modifier},
#{gmtModified},
#{isDelete}
)
</insert>
<update id="updateCreator" parameterType="map">
UPDATE
population_population_info
SET
creator = #{creator},
creator_area1 = #{creatorArea1}
WHERE
population_info_id = #{populationInfoId}
</update>
<!-- 删除基础人口信息 -->
<update id="remove" parameterType="map">
UPDATE
population_population_info
SET
is_delete = 1,
modifier = #{modifier},
gmt_modified = #{gmtModified}
WHERE
population_info_id IN
<foreach collection="populationInfoIds" index="index" open="(" separator="," close=")">
#{populationInfoIds[${index}]}
</foreach>
</update>
<!-- 修改基础人口信息 -->
<update id="update" parameterType="map">
UPDATE
population_population_info
SET
<if test="populationInfoId != null">
population_info_id = #{populationInfoId},
</if>
<if test="name != null and name != ''">
name = #{name},
</if>
label = #{label},
<if test="idcard != null and idcard != ''">
idcard = #{idcard},
</if>
<if test="idcardType != null">
idcard_type = #{idcardType},
</if>
<if test="birthday != null and birthday != ''">
birthday = #{birthday},
</if>
<if test="sex != null">
sex = #{sex},
</if>
<if test="nation != null">
nation = #{nation},
</if>
<if test="education != null">
education = #{education},
</if>
<if test="description != null and description != ''">
description = #{description},
</if>
<if test="organization != null">
organization = #{organization},
</if>
<if test="religion != null">
religion = #{religion},
</if>
<if test="marriageStatus != null">
marriage_status = #{marriageStatus},
</if>
<if test="marriageChangeTime != null and marriageChangeTime != ''">
marriage_change_time = #{marriageChangeTime},
</if>
<if test="marriageFirstTime != null and marriageFirstTime != ''">
marriage_first_time = #{marriageFirstTime},
</if>
<if test="socialSecurity != null">
social_security = #{socialSecurity},
</if>
<if test="healthStatus != null">
health_status = #{healthStatus},
</if>
<if test="departmentType != null and departmentType != ''">
department_type = #{departmentType},
</if>
<if test="department != null and department != ''">
department = #{department},
</if>
<if test="pastion != null and pastion != ''">
pastion = #{pastion},
</if>
<if test="pastionTitle != null and pastionTitle != ''">
pastion_title = #{pastionTitle},
</if>
<if test="expertise != null and expertise != ''">
expertise = #{expertise},
</if>
<if test="phone != null and phone != ''">
phone = #{phone},
</if>
<if test="fatherId != null">
father_id = #{fatherId},
</if>
<if test="fatherName != null and fatherName != ''">
father_name = #{fatherName},
</if>
<if test="fatherIdcard != null and fatherIdcard != ''">
father_idcard = #{fatherIdcard},
</if>
<if test="fatherPhone != null and fatherPhone != ''">
father_phone = #{fatherPhone},
</if>
<if test="motherId != null">
mother_id = #{motherId},
</if>
<if test="motherName != null and motherName != ''">
mother_name = #{motherName},
</if>
<if test="motherIdcard != null and motherIdcard != ''">
mother_idcard = #{motherIdcard},
</if>
<if test="motherPhone != null and motherPhone != ''">
mother_phone = #{motherPhone},
</if>
<if test="relationship != null">
relationship = #{relationship},
</if>
<if test="domicileAddress != null and domicileAddress != ''">
domicile_address = #{domicileAddress},
</if>
<if test="domicileAddressType != null and domicileAddressType != ''">
domicile_address_type = #{domicileAddressType},
</if>
<if test="domicileAreaCode != null and domicileAreaCode != ''">
domicile_area_code = #{domicileAreaCode},
</if>
<if test="domicileAreaName != null and domicileAreaName != ''">
domicile_area_name = #{domicileAreaName},
</if>
<if test="originAddress != null and originAddress != ''">
origin_address = #{originAddress},
</if>
<if test="originAreaCode != null and originAreaCode != ''">
origin_area_code = #{originAreaCode},
</if>
<if test="originAreaName != null and originAreaName != ''">
origin_area_name = #{originAreaName},
</if>
<if test="flowTime != null and flowTime != ''">
flow_time = #{flowTime},
</if>
<if test="flowReason != null">
flow_reason = #{flowReason},
</if>
<if test="flowReasontext != null and flowReasontext != ''">
flow_reasontext = #{flowReasontext},
</if>
<if test="isOldage != null and isOldage != ''">
is_oldage = #{isOldage},
</if>
<if test="oldageType != null">
oldage_type = #{oldageType},
</if>
<if test="oldageDepartment != null and oldageDepartment != ''">
oldage_department = #{oldageDepartment},
</if>
<if test="oldageLift != null">
oldage_lift = #{oldageLift},
</if>
<if test="oldageHealthStatus != null">
oldage_health_status = #{oldageHealthStatus},
</if>
<if test="oldageSelfcare != null">
oldage_selfcare = #{oldageSelfcare},
</if>
<if test="oldageLive != null">
oldage_live = #{oldageLive},
</if>
<if test="isDisability != null and isDisability != ''">
is_disability = #{isDisability},
</if>
<if test="disabilityType != null">
disability_type = #{disabilityType},
</if>
<if test="disabilityLevel != null">
disability_level = #{disabilityLevel},
</if>
<if test="disabilityNumber != null and disabilityNumber != ''">
disability_number = #{disabilityNumber},
</if>
<if test="disabilityCarnumber != null and disabilityCarnumber != ''">
disability_carnumber = #{disabilityCarnumber},
</if>
<if test="disabilityAddress != null and disabilityAddress != ''">
disability_address = #{disabilityAddress},
</if>
<if test="disabilityAreaCode != null and disabilityAreaCode != ''">
disability_area_code = #{disabilityAreaCode},
</if>
<if test="disabilityAreaName != null and disabilityAreaName != ''">
disability_area_name = #{disabilityAreaName},
</if>
<if test="disabilityIncome != null">
disability_income = #{disabilityIncome},
</if>
<if test="disabilityHouse != null">
disability_house = #{disabilityHouse},
</if>
<if test="disabilityTime != null and disabilityTime != ''">
disability_time = #{disabilityTime},
</if>
<if test="disabilityGuardian != null and disabilityGuardian != ''">
disability_guardian = #{disabilityGuardian},
</if>
<if test="disabilityGuardianPhone != null and disabilityGuardianPhone != ''">
disability_guardian_phone = #{disabilityGuardianPhone},
</if>
<if test="disabilityGuardianRelation != null">
disability_guardian_relation = #{disabilityGuardianRelation},
</if>
<if test="isMilitary != null and isMilitary != ''">
is_military = #{isMilitary},
</if>
<if test="militaryTime != null and militaryTime != ''">
military_time = #{militaryTime},
</if>
<if test="militaryPosition != null">
military_position = #{militaryPosition},
</if>
<if test="isSuccour != null and isSuccour != ''">
is_succour = #{isSuccour},
</if>
<if test="succourDibao != null and succourDibao != ''">
succour_dibao = #{succourDibao},
</if>
<if test="succourHelp != null and succourHelp != ''">
succour_help = #{succourHelp},
</if>
<if test="succourDifficulty != null and succourDifficulty != ''">
succour_difficulty = #{succourDifficulty},
</if>
<if test="succourSubsidy != null and succourSubsidy != ''">
succour_subsidy = #{succourSubsidy},
</if>
<if test="isParty != null and isParty != ''">
is_party = #{isParty},
</if>
<if test="partyOrganization != null and partyOrganization != ''">
party_organization = #{partyOrganization},
</if>
<if test="partyTime != null and partyTime != ''">
party_time = #{partyTime},
</if>
<if test="othertext != null and othertext != ''">
othertext = #{othertext},
</if>
<if test="creatorArea1 != null and creatorArea1 != ''">
creator_area1 = #{creatorArea1},
</if>
modifier = #{modifier},
gmt_modified = #{gmtModified},
population_info_id = population_info_id
WHERE
population_info_id = #{populationInfoId}
</update>
<select id="getBase" parameterType="map" resultMap="populationInfoBaseDTO">
SELECT
t1.population_info_id,
t1.name,
t1.label,
t1.idcard,
t1.idcard_type,
t1.health_status,
t1.birthday,
t1.sex,
t1.nation,
t1.education,
t1.phone,
t1.is_oldage,
t1.is_disability,
t1.is_military,
t1.is_succour,
t1.is_party,
t1.creator,
t1.creator_area1
FROM
population_population_info t1
WHERE
t1.is_delete = 0
<if test="populationInfoId != null and populationInfoId != ''">
AND
t1.population_info_id = #{populationInfoId}
</if>
<if test="idcard != null and idcard != ''">
AND
t1.idcard = #{idcard}
</if>
</select>
<!-- 基础人口信息详情 -->
<select id="get" parameterType="map" resultMap="populationInfoDTO">
SELECT
t1.population_info_id,
t1.name,
t1.label,
t1.idcard,
t1.idcard_type,
t1.birthday,
t1.sex,
t1.nation,
t1.education,
t1.description,
t1.organization,
t1.religion,
t1.marriage_status,
t1.marriage_change_time,
t1.marriage_first_time,
t1.social_security,
t1.health_status,
t1.department_type,
t1.department,
t1.pastion,
t1.pastion_title,
t1.expertise,
t1.phone,
t1.father_id,
t1.father_name,
t1.father_idcard,
t1.father_phone,
t1.mother_id,
t1.mother_name,
t1.mother_idcard,
t1.mother_phone,
t1.relationship,
t1.domicile_address,
t1.domicile_address_type,
t1.domicile_area_code,
t1.domicile_area_name,
t1.origin_address,
t1.origin_area_code,
t1.origin_area_name,
t1.flow_time,
t1.flow_reason,
t1.flow_reasontext,
t1.is_oldage,
t1.oldage_type,
t1.oldage_department,
t1.oldage_lift,
t1.oldage_health_status,
t1.oldage_selfcare,
t1.oldage_live,
t1.is_disability,
t1.disability_type,
t1.disability_level,
t1.disability_number,
t1.disability_carnumber,
t1.disability_address,
t1.disability_area_code,
t1.disability_area_name,
t1.disability_income,
t1.disability_house,
t1.disability_time,
t1.disability_guardian,
t1.disability_guardian_phone,
t1.disability_guardian_relation,
t1.is_military,
t1.military_time,
t1.military_position,
t1.is_succour,
t1.succour_dibao,
t1.succour_help,
t1.succour_difficulty,
t1.succour_subsidy,
t1.is_party,
t1.party_organization,
t1.party_time,
t1.othertext,
t1.population_info_id,
t1.creator,
t1.creator_area1
FROM
population_population_info t1
WHERE
t1.is_delete = 0
<if test="populationInfoId != null and populationInfoId != ''">
AND
t1.population_info_id = #{populationInfoId}
</if>
<if test="idcard != null and idcard != ''">
AND
t1.idcard = #{idcard}
</if>
</select>
<!-- 基础人口信息详情 -->
<select id="getBO" parameterType="map" resultMap="populationInfoBO">
SELECT
t1.population_info_id,
t1.name,
t1.idcard,
t1.idcard_type,
t1.birthday,
t1.sex,
t1.nation,
t1.education,
t1.description,
t1.organization,
t1.religion,
t1.marriage_status,
t1.marriage_change_time,
t1.marriage_first_time,
t1.social_security,
t1.health_status,
t1.department,
t1.pastion,
t1.pastion_title,
t1.expertise,
t1.phone,
t1.father_id,
t1.father_name,
t1.father_idcard,
t1.father_phone,
t1.mother_id,
t1.mother_name,
t1.mother_idcard,
t1.mother_phone,
t1.relationship,
t1.domicile_address,
t1.origin_address,
t1.flow_time,
t1.flow_reason,
t1.flow_reasontext,
t1.is_oldage,
t1.oldage_type,
t1.oldage_department,
t1.oldage_lift,
t1.oldage_health_status,
t1.oldage_selfcare,
t1.oldage_live,
t1.is_disability,
t1.disability_type,
t1.disability_level,
t1.disability_number,
t1.disability_carnumber,
t1.disability_address,
t1.disability_income,
t1.disability_house,
t1.disability_time,
t1.disability_guardian,
t1.disability_guardian_phone,
t1.disability_guardian_relation,
t1.is_military,
t1.military_time,
t1.military_position,
t1.is_succour,
t1.succour_dibao,
t1.succour_help,
t1.succour_difficulty,
t1.succour_subsidy,
t1.is_party,
t1.party_organization,
t1.party_time,
t1.othertext
FROM
population_population_info t1
WHERE
1 = 1
<if test="populationInfoId != null and populationInfoId != ''">
AND
t1.population_info_id = #{populationInfoId}
</if>
</select>
<!-- 基础人口信息详情 -->
<select id="getPO" parameterType="map" resultMap="populationInfoPO">
SELECT
t1.population_info_id,
t1.name,
t1.idcard,
t1.idcard_type,
t1.birthday,
t1.sex,
t1.nation,
t1.education,
t1.description,
t1.organization,
t1.religion,
t1.marriage_status,
t1.marriage_change_time,
t1.marriage_first_time,
t1.social_security,
t1.health_status,
t1.department,
t1.pastion,
t1.pastion_title,
t1.expertise,
t1.phone,
t1.father_id,
t1.father_name,
t1.father_idcard,
t1.father_phone,
t1.mother_id,
t1.mother_name,
t1.mother_idcard,
t1.mother_phone,
t1.relationship,
t1.domicile_address,
t1.origin_address,
t1.flow_time,
t1.flow_reason,
t1.flow_reasontext,
t1.is_oldage,
t1.oldage_type,
t1.oldage_department,
t1.oldage_lift,
t1.oldage_health_status,
t1.oldage_selfcare,
t1.oldage_live,
t1.is_disability,
t1.disability_type,
t1.disability_level,
t1.disability_number,
t1.disability_carnumber,
t1.disability_address,
t1.disability_income,
t1.disability_house,
t1.disability_time,
t1.disability_guardian,
t1.disability_guardian_phone,
t1.disability_guardian_relation,
t1.is_military,
t1.military_time,
t1.military_position,
t1.is_succour,
t1.succour_dibao,
t1.succour_help,
t1.succour_difficulty,
t1.succour_subsidy,
t1.is_party,
t1.party_organization,
t1.party_time,
t1.othertext
FROM
population_population_info t1
WHERE
1 = 1
<if test="populationInfoId != null and populationInfoId != ''">
AND
t1.population_info_id = #{populationInfoId}
</if>
</select>
<!-- 基础人口信息列表 -->
<select id="list" parameterType="map" resultMap="populationInfoDTO">
SELECT
t1.population_info_id,
t1.name,
t1.idcard,
t1.label,
t1.idcard_type,
t1.birthday,
t1.sex,
t1.nation,
t1.education,
t1.description,
t1.organization,
t1.religion,
t1.marriage_status,
t1.marriage_change_time,
t1.marriage_first_time,
t1.social_security,
t1.health_status,
t1.department_type,
t1.department,
t1.pastion,
t1.pastion_title,
t1.expertise,
t1.phone,
t1.father_id,
t1.father_name,
t1.father_idcard,
t1.father_phone,
t1.mother_id,
t1.mother_name,
t1.mother_idcard,
t1.mother_phone,
t1.relationship,
t1.domicile_address,
t1.domicile_address_type,
t1.domicile_area_code,
t1.domicile_area_name,
t1.origin_address,
t1.origin_area_code,
t1.origin_area_name,
t1.flow_time,
t1.flow_reason,
t1.flow_reasontext,
t1.is_oldage,
t1.oldage_type,
t1.oldage_department,
t1.oldage_lift,
t1.oldage_health_status,
t1.oldage_selfcare,
t1.oldage_live,
t1.is_disability,
t1.disability_type,
t1.disability_level,
t1.disability_number,
t1.disability_carnumber,
t1.disability_address,
t1.disability_area_code,
t1.disability_area_name,
t1.disability_income,
t1.disability_house,
t1.disability_time,
t1.disability_guardian,
t1.disability_guardian_phone,
t1.disability_guardian_relation,
t1.is_military,
t1.military_time,
t1.military_position,
t1.is_succour,
t1.succour_dibao,
t1.succour_help,
t1.succour_difficulty,
t1.succour_subsidy,
t1.is_party,
t1.party_organization,
t1.party_time,
t1.othertext,
t1.creator,
t1.creator_area1
FROM
population_population_info t1
WHERE
t1.is_delete = 0
<if test="creator != null and creator != ''">
AND t1.creator = #{creator}
</if>
<if test="idcard != null and idcard != ''">
AND t1.idcard LIKE CONCAT('%', #{idcard}, '%')
</if>
<if test="name != null and name != ''">
AND t1.name LIKE CONCAT('%', #{name}, '%')
</if>
<if test="idcardType != null and idcardType != ''">
AND t1.idcard_type = #{idcardType}
</if>
<if test="nation != null and nation != ''">
AND t1.nation = #{nation}
</if>
<if test="sex != null and sex != ''">
AND t1.sex = #{sex}
</if>
<if test="organization != null and organization != '' and organization != '其他'">
AND t1.organization = #{organization}
</if>
<if test="organization != null and organization != '' and organization == '其他'">
AND ( t1.organization != '中国共产党党员' AND t1.organization != '中国共产主义青年团团员' AND t1.organization != '中国共产党预备党员')
</if>
<if test="type != null and type != '' and type == '常住人口'">
AND (t1.flow_time = '' OR t1.flow_time IS NULL)
</if>
<if test="type != null and type != '' and type == '流动人口'">
AND t1.flow_time != '' AND t1.flow_time IS NOT NULL
</if>
<if test="religion != null and religion != ''">
AND t1.religion = #{religion}
</if>
<if test="xinfang != null and xinfang != '' and xinfang == '矛盾纠纷'">
AND EXISTS (SELECT 1 FROM population_dispute temp WHERE temp.is_delete = 0 AND temp.party_population_info_id = t1.population_info_id)
</if>
<if test="xinfang != null and xinfang != '' and xinfang == '涉邪人员'">
AND EXISTS (SELECT 1 FROM population_cult temp WHERE temp.is_delete = 0 AND temp.population_info_id = t1.population_info_id)
</if>
<if test="xinfang != null and xinfang != '' and xinfang == '吸毒人员'">
AND EXISTS (SELECT 1 FROM population_drug temp WHERE temp.is_delete = 0 AND temp.population_info_id = t1.population_info_id)
</if>
<if test="xinfang != null and xinfang != '' and xinfang == '社会治安'">
AND EXISTS (SELECT 1 FROM population_security temp WHERE temp.is_delete = 0 AND temp.population_info_id = t1.population_info_id)
</if>
<if test="xinfang != null and xinfang != '' and xinfang == '重点上访'">
AND EXISTS (SELECT 1 FROM population_petition temp WHERE temp.is_delete = 0 AND temp.population_info_id = t1.population_info_id)
</if>
<if test="baozhang != null and baozhang != '' and baozhang == '老年人'">
AND is_oldage = '是'
</if>
<if test="baozhang != null and baozhang != '' and baozhang == '残疾人'">
AND is_disability = '是'
</if>
<if test="baozhang != null and baozhang != '' and baozhang == '退役/服役'">
AND is_military = '是'
</if>
<if test="baozhang != null and baozhang != '' and baozhang == '社会救助信息'">
AND is_succour = '是'
</if>
<if test="teshu != null and teshu != '' and teshu == '社区矫正'">
AND EXISTS (SELECT 1 FROM population_correct temp WHERE temp.is_delete = 0 AND temp.population_info_id = t1.population_info_id)
</if>
<if test="teshu != null and teshu != '' and teshu == '刑满释放'">
AND EXISTS (SELECT 1 FROM population_release temp WHERE temp.is_delete = 0 AND temp.population_info_id = t1.population_info_id)
</if>
<if test="age != null and age != '' and age == '0-20岁'">
AND TIMESTAMPDIFF(YEAR,DATE(t1.birthday),CURDATE()) &lt; 21
</if>
<if test="age != null and age != '' and age == '21-30岁'">
AND TIMESTAMPDIFF(YEAR,DATE(t1.birthday),CURDATE()) >= 21 AND TIMESTAMPDIFF(YEAR,DATE(t1.birthday),CURDATE()) &lt;= 30
</if>
<if test="age != null and age != '' and age == '31-40岁'">
AND TIMESTAMPDIFF(YEAR,DATE(t1.birthday),CURDATE()) >= 31 AND TIMESTAMPDIFF(YEAR,DATE(t1.birthday),CURDATE()) &lt;= 40
</if>
<if test="age != null and age != '' and age == '41-50岁'">
AND TIMESTAMPDIFF(YEAR,DATE(t1.birthday),CURDATE()) >= 41 AND TIMESTAMPDIFF(YEAR,DATE(t1.birthday),CURDATE()) &lt;= 50
</if>
<if test="age != null and age != '' and age == '50岁以上'">
AND TIMESTAMPDIFF(YEAR,DATE(t1.birthday),CURDATE()) > 50
</if>
<if test="jiedao != null and jiedao != ''">
AND t1.creator_area1 = #{jiedao}
</if>
<if test="keywords != null and keywords != ''">
AND (
<!-- 这里添加其他条件 -->
t1.name LIKE CONCAT('%', #{keywords}, '%')
OR
t1.idcard LIKE CONCAT('%', #{keywords}, '%')
)
</if>
<if test="populationInfoIds != null and populationInfoIds.size > 0">
AND
t1.population_info_id IN
<foreach collection="populationInfoIds" index="index" open="(" separator="," close=")">
#{populationInfoIds[${index}]}
</foreach>
</if>
<if test="houseId != null and houseId != ''">
AND
t1.population_info_id IN (
SELECT
hp.population_info_id
FROM
house_population hp
WHERE
hp.house_id = #{houseId}
)
</if>
ORDER BY t1.gmt_create DESC
</select>
<!-- 基础人口信息列表 -->
<select id="listBO" parameterType="map" resultMap="populationInfoBO">
SELECT
t1.population_info_id,
t1.name,
t1.idcard,
t1.idcard_type,
t1.birthday,
t1.sex,
t1.nation,
t1.education,
t1.description,
t1.organization,
t1.religion,
t1.marriage_status,
t1.marriage_change_time,
t1.marriage_first_time,
t1.social_security,
t1.health_status,
t1.department,
t1.pastion,
t1.pastion_title,
t1.expertise,
t1.phone,
t1.father_id,
t1.father_name,
t1.father_idcard,
t1.father_phone,
t1.mother_id,
t1.mother_name,
t1.mother_idcard,
t1.mother_phone,
t1.relationship,
t1.domicile_address,
t1.origin_address,
t1.flow_time,
t1.flow_reason,
t1.flow_reasontext,
t1.is_oldage,
t1.oldage_type,
t1.oldage_department,
t1.oldage_lift,
t1.oldage_health_status,
t1.oldage_selfcare,
t1.oldage_live,
t1.is_disability,
t1.disability_type,
t1.disability_level,
t1.disability_number,
t1.disability_carnumber,
t1.disability_address,
t1.disability_income,
t1.disability_house,
t1.disability_time,
t1.disability_guardian,
t1.disability_guardian_phone,
t1.disability_guardian_relation,
t1.is_military,
t1.military_time,
t1.military_position,
t1.is_succour,
t1.succour_dibao,
t1.succour_help,
t1.succour_difficulty,
t1.succour_subsidy,
t1.is_party,
t1.party_organization,
t1.party_time,
t1.othertext
FROM
population_population_info t1
WHERE
1 = 1
<if test="keywords != null and keywords != ''">
AND (
<!-- 这里添加其他条件 -->
t1.id LIKE CONCAT('%', #{keywords}, '%')
)
</if>
<if test="populationInfoIds != null and populationInfoIds.size > 0">
AND
t1.population_info_id IN
<foreach collection="populationInfoIds" index="index" open="(" separator="," close=")">
#{populationInfoIds[${index}]}
</foreach>
</if>
</select>
<!-- 基础人口信息列表 -->
<select id="listPO" parameterType="map" resultMap="populationInfoPO">
SELECT
t1.population_info_id,
t1.name,
t1.idcard,
t1.idcard_type,
t1.birthday,
t1.sex,
t1.nation,
t1.education,
t1.description,
t1.organization,
t1.religion,
t1.marriage_status,
t1.marriage_change_time,
t1.marriage_first_time,
t1.social_security,
t1.health_status,
t1.department,
t1.pastion,
t1.pastion_title,
t1.expertise,
t1.phone,
t1.father_id,
t1.father_name,
t1.father_idcard,
t1.father_phone,
t1.mother_id,
t1.mother_name,
t1.mother_idcard,
t1.mother_phone,
t1.relationship,
t1.domicile_address,
t1.origin_address,
t1.flow_time,
t1.flow_reason,
t1.flow_reasontext,
t1.is_oldage,
t1.oldage_type,
t1.oldage_department,
t1.oldage_lift,
t1.oldage_health_status,
t1.oldage_selfcare,
t1.oldage_live,
t1.is_disability,
t1.disability_type,
t1.disability_level,
t1.disability_number,
t1.disability_carnumber,
t1.disability_address,
t1.disability_income,
t1.disability_house,
t1.disability_time,
t1.disability_guardian,
t1.disability_guardian_phone,
t1.disability_guardian_relation,
t1.is_military,
t1.military_time,
t1.military_position,
t1.is_succour,
t1.succour_dibao,
t1.succour_help,
t1.succour_difficulty,
t1.succour_subsidy,
t1.is_party,
t1.party_organization,
t1.party_time,
t1.othertext
FROM
population_population_info t1
WHERE
1 = 1
<if test="keywords != null and keywords != ''">
AND (
<!-- 这里添加其他条件 -->
t1.id LIKE CONCAT('%', #{keywords}, '%')
)
</if>
<if test="populationInfoIds != null and populationInfoIds.size > 0">
AND
t1.population_info_id IN
<foreach collection="populationInfoIds" index="index" open="(" separator="," close=")">
#{populationInfoIds[${index}]}
</foreach>
</if>
</select>
<!-- 基础人口信息统计 -->
<select id="count" parameterType="map" resultType="Integer">
SELECT
COUNT(*)
FROM
population_population_info t1
WHERE
1 = 1
</select>
<!-- 批量获取基础人口信息详情——renpc -->
<select id="getBatch" parameterType="map" resultMap="populationInfoDTO">
SELECT
t1.population_info_id,
t1.name,
t1.label,
t1.idcard,
t1.idcard_type,
t1.birthday,
t1.sex,
t1.nation,
t1.education,
t1.description,
t1.organization,
t1.religion,
t1.marriage_status,
t1.marriage_change_time,
t1.marriage_first_time,
t1.social_security,
t1.health_status,
t1.department_type,
t1.department,
t1.pastion,
t1.pastion_title,
t1.expertise,
t1.phone,
t1.father_id,
t1.father_name,
t1.father_idcard,
t1.father_phone,
t1.mother_id,
t1.mother_name,
t1.mother_idcard,
t1.mother_phone,
t1.relationship,
t1.domicile_address,
t1.domicile_address_type,
t1.domicile_area_code,
t1.domicile_area_name,
t1.origin_address,
t1.origin_area_code,
t1.origin_area_name,
t1.flow_time,
t1.flow_reason,
t1.flow_reasontext,
t1.is_oldage,
t1.oldage_type,
t1.oldage_department,
t1.oldage_lift,
t1.oldage_health_status,
t1.oldage_selfcare,
t1.oldage_live,
t1.is_disability,
t1.disability_type,
t1.disability_level,
t1.disability_number,
t1.disability_carnumber,
t1.disability_address,
t1.disability_area_code,
t1.disability_area_name,
t1.disability_income,
t1.disability_house,
t1.disability_time,
t1.disability_guardian,
t1.disability_guardian_phone,
t1.disability_guardian_relation,
t1.is_military,
t1.military_time,
t1.military_position,
t1.is_succour,
t1.succour_dibao,
t1.succour_help,
t1.succour_difficulty,
t1.succour_subsidy,
t1.is_party,
t1.party_organization,
t1.party_time,
t1.othertext,
t1.population_info_id,
t1.creator
FROM
population_population_info t1
WHERE
t1.is_delete = 0
<if test="populationInfoIds != null and populationInfoIds.size > 0">
AND
t1.population_info_id IN
<foreach collection="populationInfoIds" index="index" open="(" separator="," close=")">
#{populationInfoIds[${index}]}
</foreach>
</if>
</select>
</mapper>