<?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.panzhihua.service_community.dao.ComMngPopulationDAO">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="BaseResultMap" type="com.panzhihua.service_community.model.dos.ComMngPopulationDO">
|
<id column="id" property="id" />
|
<result column="street_id" property="streetId" />
|
<result column="act_id" property="actId" />
|
<result column="village_id" property="villageId" />
|
<result column="name" property="name" />
|
<result column="sex" property="sex" />
|
<result column="certificate_type" property="certificateType" />
|
<result column="card_no" property="cardNo" />
|
<result column="card_no_expiration_date" property="cardNoExpirationDate" />
|
<result column="card_no_str" property="cardNoStr" />
|
<result column="road" property="road" />
|
<result column="door_no" property="doorNo" />
|
<result column="floor" property="floor" />
|
<result column="unit_no" property="unitNo" />
|
<result column="house_no" property="houseNo" />
|
<result column="political_outlook" property="politicalOutlook" />
|
<result column="work_company" property="workCompany" />
|
<result column="special_situation" property="specialSituation" />
|
<result column="phone" property="phone" />
|
<result column="out_or_local" property="outOrLocal" />
|
<result column="census_register" property="censusRegister" />
|
<result column="person_type" property="personType" />
|
<result column="country" property="country" />
|
<result column="date_of_departure" property="dateOfDeparture" />
|
<result column="native_place" property="nativePlace" />
|
<result column="nation_code" property="nationCode" />
|
<result column="nation" property="nation" />
|
<result column="is_rent" property="isRent" />
|
<result column="culture_level" property="cultureLevel" />
|
<result column="marriage" property="marriage" />
|
<result column="healthy" property="healthy" />
|
<result column="blood_type" property="bloodType" />
|
<result column="religion" property="religion" />
|
<result column="profession" property="profession" />
|
<result column="person_status" property="personStatus" />
|
<result column="death" property="death" />
|
<result column="head_portrait" property="headPortrait" />
|
<result column="monthly_income" property="monthlyIncome" />
|
<result column="family_status" property="familyStatus" />
|
<result column="birthday" property="birthday" />
|
<result column="goal_in_china" property="goalInChina" />
|
<result column="date_of_arrival" property="dateOfArrival" />
|
<result column="label" property="label" />
|
<result column="card_photo_front" property="cardPhotoFront" />
|
<result column="card_photo_back" property="cardPhotoBack" />
|
<result column="family_book" property="familyBook" />
|
<result column="delete_flag" property="deleteFlag" />
|
<result column="remark" property="remark" />
|
<result column="create_at" property="createAt" />
|
<result column="update_at" property="updateAt" />
|
<result column="residence" property="residence" />
|
<result column="address" property="address" />
|
<result column="house_id" property="houseId" />
|
</resultMap>
|
|
<!-- 通用查询结果列 -->
|
<sql id="Base_Column_List">
|
id, street_id, act_id, village_id, name, sex, certificate_type, card_no, card_no_expiration_date, card_no_str, road, door_no, floor, unit_no, house_no, political_outlook, work_company, special_situation, phone, out_or_local, census_register, person_type, country, date_of_departure, native_place, nation_code, nation, is_rent, culture_level, marriage, healthy, blood_type, religion, profession, person_status, death, head_portrait, monthly_income, family_status, birthday, goal_in_china, date_of_arrival, label, card_photo_front, card_photo_back, family_book, delete_flag, remark, create_at, update_at, residence, address, house_id
|
</sql>
|
|
<update id="updateAll" parameterType="java.util.List">
|
<foreach collection="populationList" item="item" index="index" separator=";">
|
update com_mng_population
|
<set>
|
<if test="item.streetId != null">
|
`street_id` = #{item.streetId},
|
</if>
|
<if test="item.actId != null">
|
`act_id` = #{item.actId},
|
</if>
|
<if test="item.villageId != null">
|
`village_id` = #{item.villageId},
|
</if>
|
<if test="item.name != null and item.name !=""">
|
`name` = #{item.name},
|
</if>
|
<if test="item.sex != null">
|
`sex` = #{item.sex},
|
</if>
|
<if test="item.certificateType != null and item.certificateType !=""">
|
`certificate_type` = #{item.certificateType},
|
</if>
|
<if test="item.cardNo != null and item.cardNo !=""">
|
`card_no` = #{item.cardNo},
|
</if>
|
<if test="item.cardNoExpirationDate != null">
|
`card_no_expiration_date` = #{item.cardNoExpirationDate},
|
</if>
|
<if test="item.cardNoStr != null and item.cardNoStr !=""">
|
`card_no_str` = #{item.cardNoStr},
|
</if>
|
<if test="item.road != null and item.road !=""">
|
`road` = #{item.road},
|
</if>
|
<if test="item.doorNo != null and item.doorNo !=""">
|
`door_no` = #{item.doorNo},
|
</if>
|
<if test="item.floor != null and item.floor !=""">
|
`floor` = #{item.floor},
|
</if>
|
<if test="item.unitNo != null and item.unitNo !=""">
|
`unit_no` = #{item.unitNo},
|
</if>
|
<if test="item.houseNo != null and item.houseNo !=""">
|
`house_no` = #{item.houseNo},
|
</if>
|
<if test="item.politicalOutlook != null">
|
`political_outlook` = #{item.politicalOutlook},
|
</if>
|
<if test="item.workCompany != null and item.workCompany !=""">
|
`work_company` = #{item.workCompany},
|
</if>
|
<if test="item.specialSituation != null and item.specialSituation !=""">
|
`special_situation` = #{item.specialSituation},
|
</if>
|
<if test="item.phone != null and item.phone !=""">
|
`phone` = #{item.phone},
|
</if>
|
<if test="item.outOrLocal != null">
|
`out_or_local` = #{item.outOrLocal},
|
</if>
|
<if test="item.censusRegister != null and item.censusRegister !=""">
|
`census_register` = #{item.censusRegister},
|
</if>
|
<if test="item.personType != null and item.personType !=""">
|
`person_type` = #{item.personType},
|
</if>
|
<if test="item.country != null and item.country !=""">
|
`country` = #{item.country},
|
</if>
|
<if test="item.dateOfDeparture != null">
|
`date_of_departure` = #{item.dateOfDeparture},
|
</if>
|
<if test="item.nativePlace != null and item.nativePlace !=""">
|
`native_place` = #{item.nativePlace},
|
</if>
|
<if test="item.nationCode != null and item.nationCode !=""">
|
`nation_code` = #{item.nationCode},
|
</if>
|
<if test="item.nation != null and item.nation !=""">
|
`nation` = #{item.nation},
|
</if>
|
<if test="item.isRent != null">
|
`is_rent` = #{item.isRent},
|
</if>
|
<if test="item.cultureLevel != null">
|
`culture_level` = #{item.cultureLevel},
|
</if>
|
<if test="item.marriage != null">
|
`marriage` = #{item.marriage},
|
</if>
|
<if test="item.healthy != null and item.healthy !=""">
|
`healthy` = #{item.healthy},
|
</if>
|
<if test="item.bloodType != null and item.bloodType !=""">
|
`blood_type` = #{item.bloodType},
|
</if>
|
<if test="item.religion != null and item.religion !=""">
|
`religion` = #{item.religion},
|
</if>
|
<if test="item.profession != null and item.profession !=""">
|
`profession` = #{item.profession},
|
</if>
|
<if test="item.personStatus != null and item.personStatus !=""">
|
`person_status` = #{item.personStatus},
|
</if>
|
<if test="item.death != null and item.death !=""">
|
`death` = #{item.death},
|
</if>
|
<if test="item.headPortrait != null and item.headPortrait !=""">
|
`head_portrait` = #{item.headPortrait},
|
</if>
|
<if test="item.monthlyIncome != null and item.monthlyIncome !=""">
|
`monthly_income` = #{item.monthlyIncome},
|
</if>
|
<if test="item.familyStatus != null and item.familyStatus !=""">
|
`family_status` = #{item.familyStatus},
|
</if>
|
<if test="item.birthday != null and item.birthday !=""">
|
`birthday` = #{item.birthday},
|
</if>
|
<if test="item.goalInChina != null and item.goalInChina !=""">
|
`goal_in_china` = #{item.goalInChina},
|
</if>
|
<if test="item.label != null and item.label !=""">
|
`label` = #{item.label},
|
</if>
|
<if test="item.dateOfArrival != null">
|
`date_of_arrival` = #{item.dateOfArrival},
|
</if>
|
<if test="item.cardPhotoFront != null and item.cardPhotoFront !=""">
|
`card_photo_front` = #{item.cardPhotoFront},
|
</if>
|
<if test="item.cardPhotoBack != null and item.cardPhotoBack !=""">
|
`card_photo_back` = #{item.cardPhotoBack},
|
</if>
|
<if test="item.familyBook != null and item.familyBook !=""">
|
`family_book` = #{item.familyBook},
|
</if>
|
<if test="item.deleteFlag != null">
|
`delete_flag` = #{item.deleteFlag},
|
</if>
|
<if test="item.remark != null and item.remark !=""">
|
`remark` = #{item.remark},
|
</if>
|
<if test="item.residence != null and item.residence !=""">
|
`residence` = #{item.residence},
|
</if>
|
<if test="item.address != null and item.address !=""">
|
`address` = #{item.address},
|
</if>
|
<if test="item.houseId != null">
|
`house_id` = #{item.houseId},
|
</if>
|
`update_at` = NOW()
|
</set>
|
WHERE `id` = #{item.id}
|
</foreach>
|
;
|
</update>
|
|
<select id="pagePopulationListApp" resultType="com.panzhihua.common.model.vos.grid.PopulationListVO">
|
SELECT
|
cmp.id,
|
cmp.`name`,
|
cmp.phone,
|
cmp.card_no,
|
cmpct.label,
|
cmp.address,
|
cmp.nation,
|
cmp.political_outlook,
|
cmv.lng,
|
cmv.lat,
|
cmp.sex
|
FROM
|
com_mng_population AS cmp
|
LEFT JOIN com_mng_village AS cmv ON cmv.village_id = cmp.village_id
|
LEFT JOIN com_mng_population_community_tags AS cmpct ON cmp.id = cmpct.population_id
|
WHERE
|
cmpct.community_id = #{populationListDTO.communityId}
|
<if test = 'populationListDTO.keyWord != null and populationListDTO.keyWord != ""' >
|
AND (cmp.`name` LIKE concat (#{populationListDTO.keyWord},'%') or cmp.card_no_str like concat (#{populationListDTO.keyWord},'%'))
|
</if>
|
<if test = 'populationListDTO.label != null and populationListDTO.label != ""' >
|
AND cmpct.label LIKE concat ('%',#{populationListDTO.label},'%')
|
</if>
|
<if test="populationListDTO.outOrLocal != null">
|
AND cmp.out_or_local = #{populationListDTO.outOrLocal}
|
</if>
|
</select>
|
|
<resultMap id="selectMap" type="com.panzhihua.common.model.vos.community.VillageVO">
|
<result property="value" column="villageId"/>
|
<result property="label" column="villageName"/>
|
<collection property="children" ofType="com.panzhihua.common.model.vos.community.BuildingVO"
|
column="{village_id = village_id}"
|
javaType="java.util.ArrayList">
|
<result property="value" column="id"/>
|
<result property="label" column="name"/>
|
</collection>
|
</resultMap>
|
|
<select id="getSecondHouseAddress" resultMap="selectMap">
|
select t.village_id as villageId,concat(t.alley,t.house_num,'号') as villageName,t1.id,concat(t1.unit_no,'栋',t1.floor,'单元',t1.code,'号') as name from com_mng_village t left join com_mng_population_house t1 on t.village_id = t1.village_id where t.community_id=#{communityId}
|
</select>
|
|
<select id="getSecondHouse" resultMap="selectMap">
|
select t.village_id as villageId,concat(t.alley,t.house_num,'号') as villageName,t1.id,concat(t1.unit_no,'栋') as name from com_mng_village t left join com_mng_population_house t1 on t.village_id = t1.village_id where t.community_id=#{communityId} GROUP BY t.village_id,t1.unit_no
|
</select>
|
|
|
|
<delete id="deletePopulaitonRelation">
|
delete from com_mng_population_community_tags where population_id in
|
<foreach item="item" collection="ids" separator="," open="(" close=")" index="">
|
#{item}
|
</foreach>
|
</delete>
|
|
<select id="pagePopulation" resultType="com.panzhihua.common.model.vos.community.ComMngPopulationVO">
|
SELECT cmp.`name`, cmp.id, cmp.street_id, cmp.act_id,
|
cmp.village_id, cmp.sex, cmp.card_no, cmp.road, cmp.door_no, cmp.floor,
|
cmp.unit_no, cmp.house_no, cmp.political_outlook, cmp.work_company,
|
cmp.special_situation, cmp.phone, cmp.remark, cmp.native_place, cmp.nation,
|
cmpct.label, cmp.marriage, cmp.culture_level, cmp.profession, cmp.out_or_local,
|
cmp.census_register, cmp.healthy, cmp.birthday, cmp.update_at, cmp.address,
|
cmp.is_rent FROM com_mng_population_community_tags as cmpct
|
LEFT JOIN com_mng_population AS cmp ON cmp.id = cmpct.population_id
|
<where>
|
<if test='comMngPopulationVO.name != null and comMngPopulationVO.name != ""'>
|
AND cmp.`name` LIKE concat(#{comMngPopulationVO.name},'%') </if>
|
<if test='comMngPopulationVO.label != null and comMngPopulationVO.label != ""'>
|
AND cmpct.label LIKE concat('%',#{comMngPopulationVO.label},'%') </if>
|
<if test='comMngPopulationVO.actId != null'> and cmpct.community_id = #{comMngPopulationVO.actId}
|
</if> <if test='comMngPopulationVO.outOrLocal != null'>
|
and cmp.out_or_local = #{comMngPopulationVO.outOrLocal} </if>
|
<if test='comMngPopulationVO.villageId != null and comMngPopulationVO.villageId != ""'>
|
and cmp.village_id = #{comMngPopulationVO.villageId} </if>
|
<if test='comMngPopulationVO.road != null and comMngPopulationVO.road != ""'>
|
AND cmp.road = #{comMngPopulationVO.road} </if>
|
<if test='comMngPopulationVO.doorNo != null and comMngPopulationVO.doorNo != ""'>
|
AND cmp.door_no = #{comMngPopulationVO.doorNo} </if>
|
<if test='comMngPopulationVO.floor != null and comMngPopulationVO.floor != ""'>
|
AND cmp.floor = #{comMngPopulationVO.floor} </if>
|
<if test='comMngPopulationVO.isDeath != null'>
|
AND cmp.death = #{comMngPopulationVO.isDeath} </if>
|
<if test='comMngPopulationVO.unitNo != null and comMngPopulationVO.unitNo != ""'>
|
AND cmp.unit_no = #{comMngPopulationVO.unitNo} </if>
|
<if test='comMngPopulationVO.houseNo != null and comMngPopulationVO.houseNo != ""'>
|
AND cmp.house_no = #{comMngPopulationVO.houseNo} </if>
|
<if test='comMngPopulationVO.sex != null and comMngPopulationVO.sex != ""'>
|
AND cmp.sex = #{comMngPopulationVO.sex} </if>
|
<if test='comMngPopulationVO.ageStartTime != null and comMngPopulationVO.ageStartTime != "" and comMngPopulationVO.ageEndTime == null'>
|
AND date_format(cmp.birthday,'%Y-%m-%d') <![CDATA[ <= ]]> #{comMngPopulationVO.ageStartTime} </if>
|
<if test='comMngPopulationVO.ageEndTime != null and comMngPopulationVO.ageEndTime != "" and comMngPopulationVO.ageStartTime == null'>
|
AND date_format(cmp.birthday,'%Y-%m-%d') <![CDATA[ >= ]]> #{comMngPopulationVO.ageEndTime} </if>
|
<if test='comMngPopulationVO.ageStartTime != null and comMngPopulationVO.ageEndTime != null and comMngPopulationVO.ageStartTime == comMngPopulationVO.ageEndTime'>
|
AND cmp.birthday BETWEEN #{comMngPopulationVO.ageStartTimeEnd} and #{comMngPopulationVO.ageEndTime}
|
</if>
|
<if test='comMngPopulationVO.ageStartTime != null and comMngPopulationVO.ageEndTime != null and comMngPopulationVO.ageStartTime != comMngPopulationVO.ageEndTime'>
|
AND cmp.birthday BETWEEN #{comMngPopulationVO.ageEndTimeEnd} and #{comMngPopulationVO.ageStartTime}
|
</if>
|
<if test='comMngPopulationVO.nativePlace != null and comMngPopulationVO.nativePlace != ""'>
|
AND cmp.native_place LIKE concat(#{comMngPopulationVO.nativePlace},'%') </if>
|
<if test='comMngPopulationVO.nation != null and comMngPopulationVO.nation != ""'>
|
AND cmp.nation = #{comMngPopulationVO.nation} </if>
|
<if test='comMngPopulationVO.politicalOutlook != null and comMngPopulationVO.politicalOutlook != ""'>
|
AND cmp.political_outlook = #{comMngPopulationVO.politicalOutlook} </if>
|
<if test='comMngPopulationVO.cardNo != null and comMngPopulationVO.cardNo != ""'>
|
AND cmp.card_no = #{comMngPopulationVO.cardNo} </if>
|
<if test='comMngPopulationVO.remark != null and comMngPopulationVO.remark != ""'>
|
AND cmp.remark = #{comMngPopulationVO.remark} </if>
|
<if test='comMngPopulationVO.keyWord != null and comMngPopulationVO.keyWord != ""'>
|
AND (cmp.`name` like concat (#{comMngPopulationVO.keyWord},'%') or
|
cmp.card_no_str = #{comMngPopulationVO.keyWord} or cmpct.label like concat ('%',#{comMngPopulationVO.keyWord},'%')
|
)
|
</if>
|
</where>
|
order by cmp.create_at desc
|
</select>
|
|
<select id="specialInputUser" resultType="com.panzhihua.common.model.vos.user.InputUserInfoVO">
|
SELECT
|
cmp.id,
|
cmv.`name` AS areaName,
|
cmv.alley AS alley,
|
cmv.house_num AS houseNum,
|
cmp.`name`,
|
cmp.phone,
|
cmpct.label AS tags,
|
cmp.create_at
|
FROM
|
com_mng_population_community_tags as cmpct
|
LEFT JOIN com_mng_population AS cmp ON cmp.id = cmpct.population_id
|
LEFT JOIN com_mng_village AS cmv ON cmv.village_id = cmp.village_id
|
WHERE
|
cmpct.community_id = #{pageInputUserDTO.communityId}
|
AND cmpct.label IS NOT NULL
|
<if test='pageInputUserDTO.name != null and pageInputUserDTO.name != ""'>
|
AND cmp.`name` LIKE concat(#{pageInputUserDTO.name},'%')
|
</if>
|
<if test='pageInputUserDTO.areaName != null and pageInputUserDTO.areaName != ""'>
|
AND cmv.`alley` LIKE concat(#{pageInputUserDTO.areaName},'%')
|
</if>
|
<if test='pageInputUserDTO.tags != null and pageInputUserDTO.tags != ""'>
|
AND cmpct.label like concat('%',#{pageInputUserDTO.tags},'%')
|
</if>
|
ORDER BY
|
cmp.create_at DESC
|
</select>
|
|
<select id="query" resultType="com.panzhihua.common.model.vos.community.ComMngPopulationNoSecretVO">
|
select * from com_mng_population
|
<where>
|
1=1
|
<if test="commonPage.name !=null and commonPage.name.trim() !=''">
|
and name like concat('%',#{commonPage.name},'%')
|
</if>
|
<if test="commonPage.paramId !=null and commonPage.paramId !=''">
|
and act_id = #{commonPage.paramId}
|
</if>
|
</where>
|
</select>
|
|
<resultMap id="selectMap2" type="com.panzhihua.common.model.vos.community.ComMngPopulationDetailVO">
|
<id column="id" property="id" />
|
<result column="street_id" property="streetId" />
|
<result column="act_id" property="actId" />
|
<result column="village_id" property="villageId" />
|
<result column="name" property="name" />
|
<result column="sex" property="sex" />
|
<result column="card_no" property="cardNo" />
|
<result column="card_no_str" property="cardNoStr" />
|
<result column="road" property="road" />
|
<result column="door_no" property="doorNo" />
|
<result column="floor" property="floor" />
|
<result column="unit_no" property="unitNo" />
|
<result column="phone" property="phone"/>
|
<result column="house_no" property="houseNo" />
|
<result column="political_outlook" property="politicalOutlook" />
|
<result column="work_company" property="workCompany" />
|
<result column="special_situation" property="specialSituation" />
|
<result column="remark" property="remark" />
|
<result column="create_at" property="createAt" />
|
<result column="update_at" property="updateAt" />
|
<result column="address" property="address" />
|
<collection property="houseList" column="{id = id}" ofType="com.panzhihua.common.model.vos.user.ComMngHouseVo" javaType="java.util.ArrayList">
|
<result column="house_address" property="address"/>
|
<result column="house_house_id" property="houseId" />
|
<result column="house_residence" property="residence" />
|
<result column="popul_id" property="populId"/>
|
<result column="status" property="status"/>
|
<result column="s_relation" property="relation"/>
|
<result column="s_srelation_id" property="relationId"/>
|
</collection>
|
</resultMap>
|
|
<select id="getById" resultMap="selectMap2">
|
select t.*,t2.address as house_address,t2.house_id as house_house_id ,t2.residence as house_residence ,t2.status,t2.relation as s_relation,t2.relation_id as s_relation_id,t2.popul_id from com_mng_population t left join ( select t.address,t1.house_id,t1.popul_id,t1.relation,t1.relation_id,t.status,t1.residence from com_mng_population_house t left join com_mng_population_house_user t1 on t.id = t1.house_id) t2 on t.id = t2.popul_id where t.id =#{id}
|
</select>
|
|
<select id="getPopulationDetailApp" resultType="com.panzhihua.common.model.vos.grid.PopulationDetailVO">
|
SELECT
|
cmp.id,
|
cmp.`name`,
|
cmp.phone,
|
cmp.card_no,
|
cmp.address,
|
cmp.culture_level,
|
cmp.nation,
|
cmp.political_outlook,
|
cmp.sex,
|
cmp.birthday,
|
cmp.native_place,
|
cmp.healthy,
|
cmp.is_rent,
|
cmv.alley AS road,
|
cmv.house_num AS doorNo,
|
cmp.floor,
|
cmp.unit_no,
|
cmp.house_no,
|
cmp.work_company,
|
cmp.census_register,
|
cmp.out_or_local,
|
cmp.remark,
|
cmp.marriage
|
FROM
|
com_mng_population AS cmp
|
LEFT JOIN com_mng_village AS cmv ON cmv.village_id = cmp.village_id
|
WHERE
|
cmp.id = #{populationId}
|
</select>
|
|
<select id="getCommunityTagList" resultType="com.panzhihua.common.model.vos.community.ComMngPopulationCommunityTagsVo">
|
SELECT
|
cmpct.population_id,
|
cmpct.community_id,
|
cmpct.label,
|
ca.`name` AS communityName
|
FROM
|
com_mng_population_community_tags AS cmpct
|
LEFT JOIN com_act AS ca ON ca.community_id = cmpct.community_id
|
WHERE
|
cmpct.population_id = #{populationId}
|
</select>
|
|
<select id="getGridPopulationAdminList" resultType="com.panzhihua.common.model.vos.grid.admin.ComMngPopulationListVO">
|
SELECT cmp.id, cmp.`name` AS userName,
|
cmpct.label, cmp.card_no, cmp.card_no_str, cmp.sex, cmp.address,
|
cmp.political_outlook, cmp.census_register, cmp.house_id, cmp.phone,
|
IFNULL(cmp.house_id,0) as isHouse,
|
( SELECT event_status FROM event_visiting_tasks WHERE event_status in (1,2,3,5) AND visiter_id = cmp.id ORDER BY create_at DESC LIMIT 1 ) AS eventStatus,
|
( SELECT create_at FROM event_visiting_tasks WHERE event_status in (1,2,3,5) AND visiter_id = cmp.id ORDER BY create_at DESC LIMIT 1 ) AS createAt
|
FROM
|
com_mng_population AS cmp left join com_mng_population_community_tags as cmpct on cmp.id = cmpct.population_id where 1=1
|
<if test='populationListDTO.keyWord != null and populationListDTO.keyWord != ""'>
|
AND (cmp.name like concat (#{populationListDTO.keyWord},'%') or cmp.card_no = #{populationListDTO.cardNo} or cmp.address like concat (#{populationListDTO.keyWord},'%'))
|
</if> <if test='populationListDTO.label != null and populationListDTO.label != ""'>
|
AND cmpct.label like concat ('%',#{populationListDTO.label},'%') </if>
|
<if test='populationListDTO.sex != null'> AND cmp.sex = #{populationListDTO.sex} </if>
|
<if test='populationListDTO.isHouse != null and populationListDTO.isHouse == 1'>
|
AND cmp.house_id is not null </if>
|
<if test='populationListDTO.isHouse != null and populationListDTO.isHouse == 2'>
|
AND cmp.house_id is null </if> <if test='populationListDTO.communityId != null'>
|
AND cmpct.community_id = #{populationListDTO.communityId} </if>
|
<if test='populationListDTO.politicalOutlook != null'>
|
AND cmp.political_outlook = #{populationListDTO.politicalOutlook} </if>
|
</select>
|
|
<select id="getEventScreenLeftDown" resultType="com.panzhihua.common.model.vos.community.screen.event.EventLeftDownStatisticsVO">
|
SELECT count( e.id ) AS eventZATotal, IFNULL(( SELECT
|
count( e1.id ) FROM `event` AS e1
|
LEFT JOIN event_grid_data AS egd1 ON egd1.id = e1.grid_id WHERE
|
egd1.grid_community_id = #{screenEventDTO.communityId} AND event_category = 1
|
AND event_type = 1 AND event_deal_status = 4
|
<if test='screenEventDTO.startTime != null and screenEventDTO.startTime != ""'>
|
AND e1.create_at <![CDATA[>=]]> #{screenEventDTO.startTime} </if>
|
<if test='screenEventDTO.endTime != null and screenEventDTO.endTime != ""'>
|
AND e1.create_at <![CDATA[<=]]> #{screenEventDTO.endTime} </if> ), 0
|
) AS yesEventZATotal, IFNULL(( SELECT count( e2.id ) FROM
|
`event` AS e2 LEFT JOIN event_grid_data AS egd2 ON egd2.id = e2.grid_id WHERE
|
egd2.grid_community_id = #{screenEventDTO.communityId} AND event_category = 1
|
AND event_type = 5 AND event_status = 2
|
<if test='screenEventDTO.startTime != null and screenEventDTO.startTime != ""'>
|
AND e2.create_at <![CDATA[>=]]> #{screenEventDTO.startTime} </if>
|
<if test='screenEventDTO.endTime != null and screenEventDTO.endTime != ""'>
|
AND e2.create_at <![CDATA[<=]]> #{screenEventDTO.endTime} </if> ), 0
|
) AS eventTFTotal, IFNULL(( SELECT count( e3.id ) FROM `event` AS e3
|
LEFT JOIN event_grid_data AS egd3 ON egd3.id = e3.grid_id WHERE
|
egd3.grid_community_id = #{screenEventDTO.communityId} AND event_category = 1
|
AND event_type = 5 AND event_deal_status = 4
|
<if test='screenEventDTO.startTime != null and screenEventDTO.startTime != ""'>
|
AND e3.create_at <![CDATA[>=]]> #{screenEventDTO.startTime} </if>
|
<if test='screenEventDTO.endTime != null and screenEventDTO.endTime != ""'>
|
AND e3.create_at <![CDATA[<=]]> #{screenEventDTO.endTime} </if> ), 0
|
) AS yesEventTFTotal, IFNULL(( SELECT count( e4.id ) FROM
|
`event` AS e4 LEFT JOIN event_grid_data AS egd4 ON egd4.id = e4.grid_id WHERE
|
egd4.grid_community_id = #{screenEventDTO.communityId} AND event_category = 1
|
AND event_type = 6 AND event_status = 2
|
<if test='screenEventDTO.startTime != null and screenEventDTO.startTime != ""'>
|
AND e4.create_at <![CDATA[>=]]> #{screenEventDTO.startTime} </if>
|
<if test='screenEventDTO.endTime != null and screenEventDTO.endTime != ""'>
|
AND e4.create_at <![CDATA[<=]]> #{screenEventDTO.endTime} </if> ), 0
|
) AS eventTSTotal, IFNULL(( SELECT count( e5.id ) FROM `event` AS e5
|
LEFT JOIN event_grid_data AS egd5 ON egd5.id = e5.grid_id WHERE
|
egd5.grid_community_id = #{screenEventDTO.communityId} AND event_category = 1
|
AND event_type = 6 AND event_deal_status = 4
|
<if test='screenEventDTO.startTime != null and screenEventDTO.startTime != ""'>
|
AND e5.create_at <![CDATA[>=]]> #{screenEventDTO.startTime} </if>
|
<if test='screenEventDTO.endTime != null and screenEventDTO.endTime != ""'>
|
AND e5.create_at <![CDATA[<=]]> #{screenEventDTO.endTime} </if> ), 0
|
) AS yesEventTSTotal, IFNULL(( SELECT count( e6.id ) FROM
|
`event` AS e6 LEFT JOIN event_grid_data AS egd6 ON egd6.id = e6.grid_id WHERE
|
egd6.grid_community_id = #{screenEventDTO.communityId} AND event_category = 1
|
AND event_type = 3 AND event_status = 2
|
<if test='screenEventDTO.startTime != null and screenEventDTO.startTime != ""'>
|
AND e6.create_at <![CDATA[>=]]> #{screenEventDTO.startTime} </if>
|
<if test='screenEventDTO.endTime != null and screenEventDTO.endTime != ""'>
|
AND e6.create_at <![CDATA[<=]]> #{screenEventDTO.endTime} </if> ), 0
|
) AS eventMDTotal, IFNULL(( SELECT count( e7.id ) FROM `event` AS e7
|
LEFT JOIN event_grid_data AS egd7 ON egd7.id = e7.grid_id WHERE
|
egd7.grid_community_id = #{screenEventDTO.communityId} AND event_category = 1
|
AND event_type = 3 AND event_deal_status = 4
|
<if test='screenEventDTO.startTime != null and screenEventDTO.startTime != ""'>
|
AND e7.create_at <![CDATA[>=]]> #{screenEventDTO.startTime} </if>
|
<if test='screenEventDTO.endTime != null and screenEventDTO.endTime != ""'>
|
AND e7.create_at <![CDATA[<=]]> #{screenEventDTO.endTime} </if> ), 0
|
) AS yesEventMDTotal, IFNULL(( SELECT count( e8.id ) FROM
|
`event` AS e8 LEFT JOIN event_grid_data AS egd8 ON egd8.id = e8.grid_id WHERE
|
egd8.grid_community_id = #{screenEventDTO.communityId} AND event_category = 1
|
AND event_type = 4 AND event_status = 2
|
<if test='screenEventDTO.startTime != null and screenEventDTO.startTime != ""'>
|
AND e8.create_at <![CDATA[>=]]> #{screenEventDTO.startTime} </if>
|
<if test='screenEventDTO.endTime != null and screenEventDTO.endTime != ""'>
|
AND e8.create_at <![CDATA[<=]]> #{screenEventDTO.endTime} </if> ), 0
|
) AS eventBWDTotal, IFNULL(( SELECT count( e9.id ) FROM `event` AS e9
|
LEFT JOIN event_grid_data AS egd9 ON egd9.id = e9.grid_id WHERE
|
egd9.grid_community_id = #{screenEventDTO.communityId} AND event_category = 1
|
AND event_type = 4 AND event_deal_status = 4
|
<if test='screenEventDTO.startTime != null and screenEventDTO.startTime != ""'>
|
AND e9.create_at <![CDATA[>=]]> #{screenEventDTO.startTime} </if>
|
<if test='screenEventDTO.endTime != null and screenEventDTO.endTime != ""'>
|
AND e9.create_at <![CDATA[<=]]> #{screenEventDTO.endTime} </if> ), 0
|
) AS yesEventBWDTotal, IFNULL(( SELECT count( e10.id ) FROM
|
`event` AS e10 LEFT JOIN event_grid_data AS egd10 ON egd10.id = e10.grid_id WHERE
|
egd10.grid_community_id = #{screenEventDTO.communityId} AND event_category = 1
|
AND event_type = 2 AND event_status = 2
|
<if test='screenEventDTO.startTime != null and screenEventDTO.startTime != ""'>
|
AND e10.create_at <![CDATA[>=]]> #{screenEventDTO.startTime} </if>
|
<if test='screenEventDTO.endTime != null and screenEventDTO.endTime != ""'>
|
AND e10.create_at <![CDATA[<=]]> #{screenEventDTO.endTime} </if> ), 0
|
) AS eventGGTotal, IFNULL(( SELECT count( e11.id ) FROM
|
`event` AS e11 LEFT JOIN event_grid_data AS egd11 ON egd11.id = e11.grid_id WHERE
|
egd11.grid_community_id = #{screenEventDTO.communityId} AND event_category = 1
|
AND event_type = 2 AND event_deal_status = 4
|
<if test='screenEventDTO.startTime != null and screenEventDTO.startTime != ""'>
|
AND e11.create_at <![CDATA[>=]]> #{screenEventDTO.startTime} </if>
|
<if test='screenEventDTO.endTime != null and screenEventDTO.endTime != ""'>
|
AND e11.create_at <![CDATA[<=]]> #{screenEventDTO.endTime} </if> ), 0
|
) AS yesEventGGTotal,
|
IFNULL(( SELECT count( id ) FROM com_act_easy_photo WHERE del_tag = 0 AND community_id = #{screenEventDTO.communityId}
|
<if test='screenEventDTO.startTime != null and screenEventDTO.startTime != ""'>
|
AND create_at <![CDATA[>=]]> #{screenEventDTO.startTime} </if>
|
<if test='screenEventDTO.endTime != null and screenEventDTO.endTime != ""'>
|
AND create_at <![CDATA[<=]]> #{screenEventDTO.endTime} </if> ), 0 ) AS eventSSPTotal,
|
IFNULL(( SELECT count( id ) FROM com_act_easy_photo WHERE del_tag = 0 AND `status` = 4 AND community_id = #{screenEventDTO.communityId}
|
<if test='screenEventDTO.startTime != null and screenEventDTO.startTime != ""'>
|
AND create_at <![CDATA[>=]]> #{screenEventDTO.startTime} </if>
|
<if test='screenEventDTO.endTime != null and screenEventDTO.endTime != ""'>
|
AND create_at <![CDATA[<=]]> #{screenEventDTO.endTime} </if> ), 0 ) AS yesEventSSPTotal
|
FROM `event` AS e LEFT JOIN event_grid_data AS egd ON egd.id = e.grid_id WHERE
|
egd.grid_community_id = #{screenEventDTO.communityId} AND event_status = 2 AND event_category = 1
|
AND event_type = 1
|
<if test='screenEventDTO.startTime != null and screenEventDTO.startTime != ""'>
|
AND e.create_at <![CDATA[>=]]> #{screenEventDTO.startTime} </if>
|
<if test='screenEventDTO.endTime != null and screenEventDTO.endTime != ""'>
|
AND e.create_at <![CDATA[<=]]> #{screenEventDTO.endTime}
|
</if>
|
</select>
|
|
<update id="updatePopulationUnit">
|
update com_mng_population set unit_no = #{newUnitNo} where village_id = #{villageId} and floor = #{floor} and unit_no = #{oldUnitNo}
|
</update>
|
</mapper>
|