<?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>
|
|
<select id="selectListIds" resultType="com.panzhihua.service_community.model.dos.ComMngPopulationDO">
|
SELECT id,card_no FROM com_mng_population
|
</select>
|
<!-- SELECT id,card_no FROM com_mng_population LIMIT 100-->
|
|
|
<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, cmp.person_type FROM com_mng_population_community_tags as cmpct
|
INNER 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},'%') or cmp.phone like concat ('%',#{comMngPopulationVO.keyWord},'%')
|
)
|
</if>
|
<if test="comMngPopulationVO.personType != null and comMngPopulationVO.personType != """>
|
AND cmp.person_type = #{comMngPopulationVO.personType}
|
</if>
|
</where>
|
order by cmp.create_at desc
|
</select>
|
|
<select id="exportOld" 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},'%') or cmp.phone 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 like '%吸毒%' or cmpct.label like '%矫正%' or cmpct.label like '%重精%' or cmpct.label like '%刑满%'
|
or cmpct.label like '%上访%' or cmpct.label like '%退役%' or cmpct.label like '%残疾%' or cmpct.label like '%低保%')
|
<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.`name` 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="specialInputUserExport" 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 like '%吸毒%' or cmpct.label like '%矫正%' or cmpct.label like '%重精%' or cmpct.label like '%刑满%'
|
or cmpct.label like '%上访%' or cmpct.label like '%退役%' or cmpct.label like '%残疾%' or cmpct.label like '%低保%')
|
<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>
|
|
<select id="selectCountByVillageId" resultType="Integer">
|
select count(*) from com_mng_population t LEFT JOIN com_mng_population_community_tags t1 on t.id= t1.population_id
|
where t.village_id=#{villageId} and t1.label like concat('%',#{label},'%')
|
</select>
|
|
<select id="getCivilParty" resultType="com.panzhihua.common.model.vos.community.screen.civil.CivilPartyStatisticsVO">
|
SELECT
|
count( id ) as committeeNum,
|
(select count(id) from com_pb_dyn where community_id = ${communityId} and `type` = 1) as dynNum,
|
(select count(id) from com_pb_activity where community_id = ${communityId}) as activityNum,
|
(select count(id) from com_act_micro_wish where community_id = ${communityId}) as wishNum,
|
(select count(id) from com_pb_member where community_id = ${communityId} and audit_result = 1) as partyNum,
|
(select count(id) from com_pb_org where community_id = ${communityId} and parent_id = 0) as organizationNum,
|
(select count(id) from com_mng_volunteer_mng where community_id = ${communityId} and state = 2) as volunteerNum,
|
(select count(id) from com_act_questnaire where community_id = ${communityId}) as questionnaireNum
|
FROM
|
com_pb_member_role
|
WHERE
|
community_id = ${communityId}
|
</select>
|
|
<select id="getCivilGovernment" resultType="com.panzhihua.common.model.vos.community.screen.civil.CivilGovernmentStatisticsVO">
|
SELECT
|
count( id ) as noticeNum,
|
(select count(id) from com_act_discuss where community_id = ${communityId} and is_del = 2) as discussNum,
|
(select count(id) from com_act_easy_photo where community_id = ${communityId} and del_tag = 0) as easyNum,
|
(select count(id) from com_act_neighbor_circle where community_id = ${communityId} and is_del = 2) as neighborNum,
|
(select count(id) from com_act_activity where community_id = ${communityId}) as activityNum,
|
(select count(id) from com_act_dyn where community_id = ${communityId}) as dynNum,
|
(select count(id) from com_act_warehouse_donates where community_id = ${communityId}) as loveNum,
|
(select count(id) from com_act_message where community_id = ${communityId}) as messageNum
|
FROM
|
com_act_announcement
|
WHERE
|
community_id = ${communityId}
|
</select>
|
|
<select id="getCivilGrid" resultType="com.panzhihua.common.model.vos.community.screen.civil.CivilGridStatisticsVO">
|
SELECT
|
count( e.id ) AS tfTodayNum,
|
(
|
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 = ${communityId}
|
AND e1.event_status = 2
|
AND e1.event_type = 1
|
AND e1.event_category = 1
|
AND e1.create_at BETWEEN DATE_FORMAT( NOW(), '%Y-%m-%d 00:00:00' )
|
AND DATE_FORMAT( NOW(), '%Y-%m-%d 23:59:59' )) AS zaTodayNum,
|
(
|
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 = ${communityId}
|
AND e2.event_status = 2
|
AND e2.event_type = 2
|
AND e2.event_category = 1
|
AND e2.create_at BETWEEN DATE_FORMAT( NOW(), '%Y-%m-%d 00:00:00' )
|
AND DATE_FORMAT( NOW(), '%Y-%m-%d 23:59:59' )) AS msTodayNum,
|
(
|
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 = ${communityId}
|
AND e3.event_status = 2
|
AND e3.event_type = 3
|
AND e3.event_category = 1
|
AND e3.create_at BETWEEN DATE_FORMAT( NOW(), '%Y-%m-%d 00:00:00' )
|
AND DATE_FORMAT( NOW(), '%Y-%m-%d 23:59:59' )) AS mdTodayNum,
|
(
|
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 = ${communityId}
|
AND e4.event_status = 2
|
AND e4.event_type = 6
|
AND e4.event_category = 1
|
AND e4.create_at BETWEEN DATE_FORMAT( NOW(), '%Y-%m-%d 00:00:00' )
|
AND DATE_FORMAT( NOW(), '%Y-%m-%d 23:59:59' )) AS tsTodayNum,
|
(
|
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 = ${communityId}
|
AND e5.event_status = 2
|
) AS eventNum,
|
(
|
SELECT
|
count( user_id )
|
FROM
|
sys_user AS su
|
INNER JOIN event_grid_member_relation egmr ON egmr.grid_member_id = su.user_id
|
WHERE
|
egmr.grid_community_id = ${communityId}
|
) AS xcNum,
|
( SELECT count( id ) FROM com_sw_patrol_record WHERE community_id = ${communityId} ) AS securityNum
|
FROM
|
`event` AS e
|
LEFT JOIN event_grid_data AS egd ON egd.id = e.grid_id
|
WHERE
|
egd.grid_community_id = ${communityId}
|
AND e.event_status = 2
|
AND e.event_type = 5
|
AND e.event_category = 1
|
AND e.create_at BETWEEN DATE_FORMAT( NOW(), '%Y-%m-%d 00:00:00' )
|
AND DATE_FORMAT(
|
NOW(),
|
'%Y-%m-%d 23:59:59')
|
</select>
|
|
<select id="getCivilConvenience" resultType="com.panzhihua.common.model.vos.community.screen.civil.CivilConvenienceStatisticsVO">
|
SELECT
|
count( id ) AS guideNum,
|
(
|
SELECT
|
count( carr.id )
|
FROM
|
com_act_reserve_record AS carr
|
LEFT JOIN com_act_reserve AS car ON car.id = carr.reserve_id
|
WHERE
|
car.title IN ( '返攀登记', '居家隔离', '11月24日之前居家隔离', '2021-11-4之前来攀登记' )
|
AND carr.community_id = ${communityId}
|
) AS situationNum,
|
( SELECT count( id ) FROM renting_hourse_register WHERE community_id = ${communityId} ) AS leaseNum,
|
(
|
SELECT
|
count( cpr.id )
|
FROM
|
com_property_repair AS cpr
|
LEFT JOIN com_property AS cp ON cp.id = cpr.property_id
|
WHERE
|
cp.community_id = ${communityId}
|
) AS repairNum,
|
( SELECT count( id ) FROM com_pension_auth_records WHERE community_id = ${communityId} ) AS pensionNum,
|
( SELECT count( id ) FROM com_elder_auth_records WHERE community_id = ${communityId} ) AS eldersNum,
|
(
|
SELECT
|
count( cmpct.id )
|
FROM
|
com_mng_population_community_tags AS cmpct
|
INNER JOIN com_mng_population AS cmp ON cmp.id = cmpct.population_id
|
WHERE
|
cmpct.label LIKE '%低保户%'
|
AND cmpct.community_id = ${communityId}
|
) AS subsistenceNum,
|
(
|
SELECT
|
count( cmpct.id )
|
FROM
|
com_mng_population_community_tags AS cmpct
|
INNER JOIN com_mng_population AS cmp ON cmp.id = cmpct.population_id
|
WHERE
|
cmpct.community_id = ${communityId}
|
AND cmp.death = 0
|
AND cmpct.label LIKE '%高龄老人%'
|
) AS allowanceNum
|
FROM
|
com_act_work_guide
|
</select>
|
|
|
<select id="westScreenStatics" resultType="com.panzhihua.common.model.vos.community.bigscreen.WestScreenStatics">
|
select ( SELECT count(*) FROM com_act_micro_wish AS camw LEFT JOIN com_act t1 on camw.community_id = t1.community_id
|
where t1.area_code ='510423' and camw.STATUS = 6 ) microWish ,
|
(select count(user_id) from sys_user t LEFT JOIN com_act t1 on t.community_id = t1.community_id
|
where t.type=1 and t.community_id is not null and t1.area_code ='510423') user,
|
(select count(id) from com_pb_org t LEFT JOIN com_act t1 on t.community_id = t1.community_id where parent_id = 0 and t1.area_code ='510423') partyOrg,
|
(select count(id) from com_pb_member t LEFT JOIN com_act t1 on t.community_id = t1.community_id where audit_result = 1 and t1.area_code ='510423') partyMember,
|
(select count(id) from com_mng_volunteer_mng t LEFT JOIN com_act t1 on t.community_id = t1.community_id where t.state = 2 and t1.area_code ='510423') volunteer,
|
(select count(id) from com_sw_patrol_record t LEFT JOIN com_act t1 on t.community_id = t1.community_id where t1.area_code ='510423') safety,
|
(select count(*) from com_act_reserve t LEFT JOIN com_act_reserve_record t1 on t.id = t1.reserve_id LEFT JOIN com_act t2 on t.community_id = t2.community_id where (title like '%居家隔离%' or title like '%返攀登记%' or title like '%来攀登记%') and t2.area_code ='510423' and t1.status = 2 ) reserve,
|
(select (select count(*) from com_act_activity t LEFT JOIN com_act t1 on t.community_id = t1.community_id where status !=6 and status !=1 and t1.area_code ='510423')+(select count(id) from com_pb_activity t LEFT JOIN com_act t1 on t.community_id = t1.community_id where status !=6 and status !=1 and t1.area_code ='510423')) activity,
|
(select count(*) from com_act_easy_photo t LEFT JOIN com_act t1 on t.community_id = t1.community_id
|
where status in (1,2,4) and del_tag = 0 and t1.area_code ='510423') neighbor,
|
(select count(*) from com_act_discuss t LEFT JOIN com_act t1 on t.community_id = t1.community_id
|
where is_del =2 and t1.area_code ='510423') discuss
|
</select>
|
|
<select id="getBasicsList" resultType="com.panzhihua.common.model.vos.community.screen.event.EventPopulationBasicsStatisticsVO">
|
SELECT
|
ca.community_id,
|
ca.`name` AS communityName,
|
(
|
SELECT
|
count( cmpct.id )
|
FROM
|
com_mng_population_community_tags AS cmpct
|
LEFT JOIN com_mng_population AS cmp ON cmp.id = cmpct.population_id
|
WHERE
|
cmpct.community_id = ca.community_id
|
) AS populationNum,
|
( SELECT count( village_id ) FROM com_mng_village AS cmv WHERE cmv.community_id = ca.community_id ) AS villageNum,
|
(select count(id) from com_mng_population_house as cmph where cmph.community_id = ca.community_id) as houseNum
|
FROM
|
com_act AS ca
|
LEFT JOIN com_street AS cs ON cs.street_id = ca.street_id
|
<where>
|
1=1
|
and ca.area_code = '510423' and ca.is_screen_statistics = 1 and ca.community_id!=1552661950301868035 and ca.community_id!=11
|
<if test="streetId != null and streetId != 0">
|
and cs.street_id = #{streetId}
|
</if>
|
</where>
|
order by cs.street_id desc,populationNum desc
|
</select>
|
|
<select id="getPopulationSpecial" resultType="com.panzhihua.common.model.vos.community.screen.event.EventPopulationSpecialStatisticsVO">
|
SELECT
|
count( cmpct.id ) AS cjTotal,
|
(
|
SELECT
|
count( cmpct1.id )
|
FROM
|
com_mng_population_community_tags AS cmpct1
|
LEFT JOIN com_act AS ca1 ON ca1.community_id = cmpct1.community_id
|
LEFT JOIN com_street AS cs1 ON cs1.street_id = ca1.street_id
|
WHERE
|
cmpct1.label LIKE '%低保户%' and ca1.area_code = '510423' and ca1.is_screen_statistics = 1
|
<if test="streetId != null and streetId != 0">
|
and cs1.street_id = #{streetId}
|
</if>
|
) as dbTotal ,
|
(
|
SELECT
|
count( cmpct3.id )
|
FROM
|
com_mng_population_community_tags AS cmpct3
|
LEFT JOIN com_act AS ca3 ON ca3.community_id = cmpct3.community_id
|
LEFT JOIN com_street AS cs3 ON cs3.street_id = ca3.street_id
|
WHERE
|
cmpct3.label LIKE '%特殊情况(重大病史/孕)%' and ca3.area_code = '510423' and ca3.is_screen_statistics = 1
|
<if test="streetId != null and streetId != 0">
|
and cs3.street_id = #{streetId}
|
</if>
|
) as tsTotal ,
|
(
|
SELECT
|
count( cmpct4.id )
|
FROM
|
com_mng_population_community_tags AS cmpct4
|
LEFT JOIN com_act AS ca4 ON ca4.community_id = cmpct4.community_id
|
LEFT JOIN com_street AS cs4 ON cs4.street_id = ca4.street_id
|
WHERE
|
cmpct4.label LIKE '%特扶家庭%' and ca4.area_code = '510423' and ca4.is_screen_statistics = 1
|
<if test="streetId != null and streetId != 0">
|
and cs4.street_id = #{streetId}
|
</if>
|
) as tfTotal,
|
(
|
SELECT
|
count( cmpct5.id )
|
FROM
|
com_mng_population_community_tags AS cmpct5
|
LEFT JOIN com_act AS ca5 ON ca5.community_id = cmpct5.community_id
|
LEFT JOIN com_street AS cs5 ON cs5.street_id = ca5.street_id
|
WHERE
|
cmpct5.label LIKE '%退役军人%' and ca5.area_code = '510423' and ca5.is_screen_statistics = 1
|
<if test="streetId != null and streetId != 0">
|
and cs5.street_id = #{streetId}
|
</if>
|
) as tyTotal,
|
(
|
SELECT
|
count( cmpct7.id )
|
FROM
|
com_mng_population_community_tags AS cmpct7
|
LEFT JOIN com_act AS ca7 ON ca7.community_id = cmpct7.community_id
|
LEFT JOIN com_street AS cs7 ON cs7.street_id = ca7.street_id
|
WHERE
|
cmpct7.label LIKE '%吸毒人员%' and ca7.area_code = '510423' and ca7.is_screen_statistics = 1
|
<if test="streetId != null and streetId != 0">
|
and cs7.street_id = #{streetId}
|
</if>
|
) as xdTotal,
|
(
|
SELECT
|
count( cmpct8.id )
|
FROM
|
com_mng_population_community_tags AS cmpct8
|
LEFT JOIN com_act AS ca8 ON ca8.community_id = cmpct8.community_id
|
LEFT JOIN com_street AS cs8 ON cs8.street_id = ca8.street_id
|
WHERE
|
cmpct8.label LIKE '%社区矫正%' and ca8.area_code = '510423' and ca8.is_screen_statistics = 1
|
<if test="streetId != null and streetId != 0">
|
and cs8.street_id = #{streetId}
|
</if>
|
) as jzTotal,
|
(
|
SELECT
|
count( cmpct9.id )
|
FROM
|
com_mng_population_community_tags AS cmpct9
|
LEFT JOIN com_act AS ca9 ON ca9.community_id = cmpct9.community_id
|
LEFT JOIN com_street AS cs9 ON cs9.street_id = ca9.street_id
|
WHERE
|
cmpct9.label LIKE '%邪教人员%' and ca9.area_code = '510423' and ca9.is_screen_statistics = 1
|
<if test="streetId != null and streetId != 0">
|
and cs9.street_id = #{streetId}
|
</if>
|
) as xjTotal,
|
(
|
SELECT
|
count( cmpct10.id )
|
FROM
|
com_mng_population_community_tags AS cmpct10
|
LEFT JOIN com_act AS ca10 ON ca10.community_id = cmpct10.community_id
|
LEFT JOIN com_street AS cs10 ON cs10.street_id = ca10.street_id
|
WHERE
|
cmpct10.label LIKE '%刑满释放%' and ca10.area_code = '510423' and ca10.is_screen_statistics = 1
|
<if test="streetId != null and streetId != 0">
|
and cs10.street_id = #{streetId}
|
</if>
|
) as xsTotal,
|
(
|
SELECT
|
count( cmpct11.id )
|
FROM
|
com_mng_population_community_tags AS cmpct11
|
LEFT JOIN com_act AS ca11 ON ca11.community_id = cmpct11.community_id
|
LEFT JOIN com_street AS cs11 ON cs11.street_id = ca11.street_id
|
WHERE
|
cmpct11.label LIKE '%上访人员%' and ca11.area_code = '510423' and ca11.is_screen_statistics = 1
|
<if test="streetId != null and streetId != 0">
|
and cs11.street_id = #{streetId}
|
</if>
|
) as sfTotal,
|
(
|
SELECT
|
count( cmpct12.id )
|
FROM
|
com_mng_population_community_tags AS cmpct12
|
LEFT JOIN com_act AS ca12 ON ca12.community_id = cmpct12.community_id
|
LEFT JOIN com_street AS cs12 ON cs12.street_id = ca12.street_id
|
WHERE
|
cmpct12.label LIKE '%精神障碍患者%' and ca12.area_code = '510423' and ca12.is_screen_statistics = 1
|
<if test="streetId != null and streetId != 0">
|
and cs12.street_id = #{streetId}
|
</if>
|
) as zjTotal
|
FROM
|
com_mng_population_community_tags AS cmpct
|
LEFT JOIN com_act AS ca ON ca.community_id = cmpct.community_id
|
LEFT JOIN com_street AS cs ON cs.street_id = ca.street_id
|
WHERE
|
cmpct.label LIKE '%残疾人%' and ca.area_code = '510423' and ca.is_screen_statistics = 1
|
<if test="streetId != null and streetId != 0">
|
and cs.street_id = #{streetId}
|
</if>
|
</select>
|
|
<select id="getPopulationListCardNo" resultType="string">
|
SELECT
|
cmp.card_no
|
FROM
|
com_mng_population_community_tags AS cmpct
|
LEFT JOIN com_mng_population AS cmp ON cmp.id = cmpct.population_id
|
LEFT JOIN com_act AS ca ON ca.community_id = cmpct.community_id
|
LEFT JOIN com_street AS cs ON cs.street_id = ca.street_id
|
<where>
|
and ca.area_code = '510423' and ca.is_screen_statistics = 1
|
<if test="streetId != null and streetId != 0">
|
and cs.street_id = #{streetId}
|
</if>
|
</where>
|
</select>
|
|
<select id="getPopulationAge" resultType="integer">
|
select count(age) from (
|
SELECT
|
YEAR (now()) - YEAR (substring(cmp.card_no_str, 7, 8)) age
|
FROM
|
com_mng_population_community_tags AS cmpct
|
LEFT JOIN com_mng_population AS cmp ON cmp.id = cmpct.population_id
|
LEFT JOIN com_act AS ca ON ca.community_id = cmpct.community_id
|
LEFT JOIN com_street AS cs ON cs.street_id = ca.street_id
|
|
<where>
|
and ca.area_code = '510423' and ca.is_screen_statistics = 1
|
<if test="streetId != null and streetId != 0">
|
and cs.street_id = #{streetId}
|
</if>
|
</where>
|
having age >= #{age}
|
) as ageDual
|
</select>
|
|
<select id="getComprehensiveStreetList" resultType="com.panzhihua.common.model.vos.community.screen.event.EventPopulationStreetVO">
|
SELECT
|
street_id,
|
`name`
|
FROM
|
com_street
|
WHERE
|
area_code = '510423' and app_id = 'wx0cef797390444b75'
|
ORDER BY
|
create_at DESC
|
</select>
|
|
<select id="baseInfo" resultType="com.panzhihua.common.model.vos.community.bigscreen.BaseInfo">
|
select count(id) as population,
|
IFNULL((select count(id) from com_mng_population_house where community_id = ${communityId}),0) as house,
|
IFNULL((select count(id) from com_mng_real_company where community_id = ${communityId}),0) as company,
|
IFNULL((select count(DISTINCT `name`) from com_mng_village where community_id = ${communityId}),0) as village,
|
IFNULL((select count(user_id) from sys_user where community_id = ${communityId} and type=1),0) as user,
|
IFNULL((select count(id) from com_pb_member where community_id = ${communityId} and audit_result =1 ),0) as partyMember,
|
IFNULL((select count(id) from com_mng_volunteer_mng where community_id = ${communityId} and state=2 ),0) as volunteer,
|
IFNULL((select count(id) from com_pb_org where community_id = ${communityId} and parent_id = 0),0) as partyOrg,
|
IFNULL((select count(id) from com_act_dpc where community_id = ${communityId} AND is_del = 0),0) as dpcNum
|
from com_mng_population_community_tags AS cmpct
|
where cmpct.community_id = ${communityId}
|
</select>
|
|
<select id="indexDynamic" resultType="com.panzhihua.common.model.vos.community.bigscreen.IndexDynamic">
|
|
SELECT count( id ) AS microWish,
|
IFNULL(( SELECT count( id ) FROM com_act_activity WHERE community_id = ${communityId} AND volunteer_max = 0),0) AS residentActivity,
|
IFNULL(( SELECT count( id ) FROM com_act_activity WHERE community_id = ${communityId} AND volunteer_max != 0),0) AS volunteerActivity,
|
IFNULL(( SELECT count( id ) FROM com_act_easy_photo WHERE status in (1,2,4) and del_tag = 0 AND community_id = ${communityId} ),0) AS easyPhoto,
|
IFNULL(( SELECT count( id ) FROM com_pb_activity WHERE community_id = ${communityId} ),0) AS partyActivity,
|
IFNULL(( SELECT count( id ) FROM com_act_questnaire WHERE community_id = ${communityId} and is_hide=0 ),0) AS questionnaire,
|
IFNULL(( SELECT count( id ) FROM com_act_dyn WHERE community_id = ${communityId} AND STATUS = 1 ),0) AS dynamic,
|
IFNULL(( SELECT count( id ) FROM com_convenient_merchants WHERE ( community_id = ${communityId} OR community_id = 0) AND is_del = 0 ),0) AS convenient,
|
IFNULL(( SELECT count( id ) FROM com_act_neighbor_circle WHERE community_id = ${communityId} AND is_del = 2 ),0) AS neighbor
|
FROM com_act_micro_wish AS camw WHERE camw.STATUS = 6
|
AND camw.community_id = ${communityId}
|
</select>
|
<select id="getGridsGovernanceEventList"
|
resultType="com.panzhihua.common.model.vos.community.screen.event.EventGridIncidentStatisticsVO">
|
SELECT event_type AS type, IFNULL( NULL, 1 ) AS eventType, e.id AS eventId, happent_lat_lng AS latLng, event_des AS content,
|
(SELECT url FROM event_resource WHERE ref_id = e.id AND classification = 1 AND `type` = 1 LIMIT 1) AS cover, e.create_at,
|
CASE
|
WHEN event_deal_status = 4 THEN 1
|
ELSE 2 END `status`
|
FROM `event` AS e
|
LEFT JOIN event_grid_data AS egd ON egd.id = e.grid_id
|
WHERE e.event_category = 1 AND e.event_type IN ( 1, 2, 3, 5, 6 )
|
AND e.event_status = 2 AND egd.grid_community_id = ${communityId} AND TO_DAYS(NOW()) - TO_DAYS(e.create_at) <= 30
|
UNION ALL SELECT
|
CASE
|
WHEN classify_id = 4 THEN 1
|
WHEN classify_id = 6 THEN 2
|
WHEN classify_id = 5 THEN 3
|
WHEN classify_id = 7 THEN 5
|
WHEN classify_id = 3 THEN 6
|
WHEN classify_id = 8 THEN 9
|
WHEN classify_id = 1 THEN 10
|
END type, IFNULL( NULL, 2 ) AS eventType, id AS eventId, lng_lat AS latLng, detail AS content, substring_index(photo_path_list, ',', 1) AS cover, create_at,
|
CASE
|
WHEN `status` = 4 THEN 1
|
ELSE 2 END `status`
|
FROM com_act_easy_photo WHERE community_id = ${communityId} AND `status` IN (1,2,4)
|
AND del_tag = 0 AND classify_id IN (1,3,4,5,6,7,8) AND TO_DAYS(NOW()) - TO_DAYS(create_at) <= 30
|
</select>
|
<select id="pageEventList"
|
resultType="com.panzhihua.common.model.vos.community.screen.event.EventGridIncidentStatisticsVO">
|
(SELECT event_type AS type, IFNULL( NULL, 1 ) AS eventType, e.id AS eventId, happent_lat_lng AS latLng,
|
event_des AS content,
|
(SELECT url FROM event_resource WHERE ref_id = e.id AND classification = 1 AND `type` = 1 LIMIT 1) AS cover,
|
e.create_at,
|
CASE
|
WHEN event_deal_status = 4 THEN 1
|
ELSE 2 END `status`
|
FROM `event` AS e
|
LEFT JOIN event_grid_data AS egd ON egd.id = e.grid_id
|
WHERE e.event_category = 1 AND e.event_type IN ( 1, 2, 3, 5, 6 )
|
AND e.event_status = 2 AND egd.grid_community_id = ${pageBaseDTO.communityId}
|
<if test="pageBaseDTO.param3 != null and pageBaseDTO.param3 == 1">
|
AND event_deal_status = 4
|
</if>
|
<if test="pageBaseDTO.param3 != null and pageBaseDTO.param3 == 2">
|
AND event_deal_status != 4
|
</if>
|
)
|
UNION ALL (SELECT
|
CASE
|
WHEN classify_id = 4 THEN 1
|
WHEN classify_id = 6 THEN 2
|
WHEN classify_id = 5 THEN 3
|
WHEN classify_id = 7 THEN 5
|
WHEN classify_id = 3 THEN 6
|
WHEN classify_id = 8 THEN 9
|
WHEN classify_id = 1 THEN 10
|
END type, IFNULL( NULL, 2 ) AS eventType, id AS eventId, lng_lat AS latLng, detail AS content, substring_index(photo_path_list, ',', 1) AS cover, create_at,
|
CASE
|
WHEN `status` = 4 THEN 1
|
ELSE 2 END `status`
|
FROM com_act_easy_photo WHERE community_id = ${pageBaseDTO.communityId} AND `status` IN (1,2,4)
|
AND del_tag = 0 AND classify_id IN (1,3,4,5,6,7,8)
|
<if test="pageBaseDTO.param3 != null and pageBaseDTO.param3 == 1">
|
AND `status` = 4
|
</if>
|
<if test="pageBaseDTO.param3 != null and pageBaseDTO.param3 == 2">
|
AND `status` != 4
|
</if>
|
) ORDER BY create_at DESC
|
</select>
|
<select id="getEventScreenSSPDateilNew"
|
resultType="com.panzhihua.common.model.vos.community.screen.event.EventNewStatisticsVO">
|
SELECT id, su.nick_name AS userName, su.image_url, caep.create_at, caep.detail AS eventDes,
|
caep.happen_addr AS happenAddress, caep.lng_lat AS happentLatLng, caep.photo_path_list,
|
CASE
|
WHEN classify_id = 4 THEN 1
|
WHEN classify_id = 6 THEN 2
|
WHEN classify_id = 5 THEN 3
|
WHEN classify_id = 7 THEN 5
|
WHEN classify_id = 3 THEN 6
|
WHEN classify_id = 8 THEN 9
|
WHEN classify_id = 1 THEN 10
|
END eventType, caep.status AS eventDealStatus
|
FROM com_act_easy_photo AS caep
|
LEFT JOIN sys_user AS su ON su.user_id = caep.sponsor_id
|
WHERE id = #{eventId}
|
</select>
|
<select id="getPopulationTotalByAdmin"
|
resultType="com.panzhihua.common.model.vos.community.ComMngPopulationTotalVO">
|
select count(cmpct.id) as populationTotal ,
|
(select count(cmpct.id) from com_mng_population_community_tags cmpct left join com_mng_population cmp on cmpct.population_id = cmp.id where cmpct.community_id = ${communityId} and cmp.out_or_local = 1) as localTotal ,
|
(select count(cmpct.id) from com_mng_population_community_tags cmpct left join com_mng_population cmp on cmpct.population_id = cmp.id where cmpct.community_id = ${communityId} and cmp.out_or_local = 2) as outTotal ,
|
(select count(cmpct.id) from com_mng_population_community_tags cmpct left join com_mng_population cmp on cmpct.population_id = cmp.id where cmpct.community_id = ${communityId} and (cmpct.label like '%吸毒%' or cmpct.label like '%矫正%' or cmpct.label like '%重精%' or cmpct.label like '%刑满%'
|
or cmpct.label like '%上访%' or cmpct.label like '%退役%' or cmpct.label like '%残疾%' or cmpct.label like '%低保%')) as specialTotal ,
|
(select count(DISTINCT `name`) from com_mng_village where community_id = ${communityId}) as villageTotal ,
|
(select count(id) from com_mng_building where act_id = ${communityId}) as buildNum ,
|
(select count(id) from com_mng_population_community_tags where community_id = ${communityId} and label LIKE CONCAT('%','吸毒人员','%')) as drugTotal ,
|
(select count(id) from com_mng_population_community_tags where community_id = ${communityId} and label LIKE CONCAT('%','社区矫正','%')) as correctTotal ,
|
(select count(id) from com_mng_population_community_tags where community_id = ${communityId} and label LIKE CONCAT('%','精神障碍患者','%')) as majorTotal ,
|
(select count(id) from com_mng_population_community_tags where community_id = ${communityId} and label LIKE CONCAT('%','邪教人员','%')) as cultTotal ,
|
(select count(id) from com_mng_population_community_tags where community_id = ${communityId} and label LIKE CONCAT('%','刑满释放','%')) as rehabilitationTotal ,
|
(select count(id) from com_mng_population_community_tags where community_id = ${communityId} and label LIKE CONCAT('%','重点人员','%')) as keyTotal ,
|
(select count(id) from com_mng_population_community_tags where community_id = ${communityId} and label LIKE CONCAT('%','退役军人','%')) as veteransTotal ,
|
(select count(id) from com_mng_population_community_tags where community_id = ${communityId} and label LIKE CONCAT('%','残疾人','%')) as disabilityTotal ,
|
(select count(id) from com_mng_population_community_tags where community_id = ${communityId} and label LIKE CONCAT('%','低保户','%')) as lowSecurityTotal ,
|
(select count(id) from com_mng_population_community_tags where community_id = ${communityId} and label LIKE CONCAT('%','高龄老人','%')) as elderTotal ,
|
(select count(id) from com_mng_population_community_tags where community_id = ${communityId} and label LIKE CONCAT('%','养老金人员','%')) as pensionTotal,
|
(select count(cmpct.id) from com_mng_population_community_tags cmpct INNER JOIN com_mng_population cmp on cmpct.population_id = cmp.id where cmpct.community_id = ${communityId} and cmp.person_type = 1) AS houseRegTotal,
|
(select count(cmpct.id) from com_mng_population_community_tags cmpct INNER JOIN com_mng_population cmp on cmpct.population_id = cmp.id where cmpct.community_id = ${communityId} and cmp.person_type = 2) AS leftTotal,
|
(select count(cmpct.id) from com_mng_population_community_tags cmpct INNER JOIN com_mng_population cmp on cmpct.population_id = cmp.id where cmpct.community_id = ${communityId} and cmp.person_type = 3) AS outOfTownTotal,
|
(select count(cmpct.id) from com_mng_population_community_tags cmpct INNER JOIN com_mng_population cmp on cmpct.population_id = cmp.id where cmpct.community_id = ${communityId} and cmp.person_type = 4) AS overseasTotal,
|
(select count(cmpct.id) from com_mng_population_community_tags cmpct INNER JOIN com_mng_population cmp on cmpct.population_id = cmp.id where cmpct.community_id = ${communityId} and cmp.person_type = 5) AS floatingTotal,
|
(select count(cmpct.id) from com_mng_population_community_tags cmpct INNER JOIN com_mng_population cmp on cmpct.population_id = cmp.id where cmpct.community_id = ${communityId} and cmp.person_type = 6) AS permanentTotal,
|
(select count(cmpct.id) from com_mng_population_community_tags cmpct INNER JOIN com_mng_population cmp on cmpct.population_id = cmp.id where cmpct.community_id = ${communityId} and cmp.person_type = 7) AS temporaryTotal
|
from com_mng_population_community_tags as cmpct inner join com_mng_population as cmp on cmp.id = cmpct.population_id where community_id = ${communityId}
|
</select>
|
|
|
<select id="getScreenIndexByEventList" resultType="com.panzhihua.common.model.vos.community.screen.index.IndexEventListStatisticsVO" >
|
SELECT e.happen_time as createAt, e.event_des,e.event_deal_status
|
FROM `event` AS e
|
LEFT JOIN event_grid_data AS egd ON egd.id = e.grid_id
|
WHERE
|
egd.grid_community_id = ${communityId}
|
AND e.event_deal_status IN ( 1, 4 )
|
ORDER BY e.happen_time DESC
|
LIMIT 8
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
</mapper>
|