|
|
|
@ -241,6 +241,73 @@ |
|
|
|
order by CREATED_TIME desc |
|
|
|
LIMIT #{pageIndex},#{pageSize} |
|
|
|
</select> |
|
|
|
<select id="selectCountListPeople" |
|
|
|
resultType="java.lang.Integer"> |
|
|
|
select count(1) from( |
|
|
|
select data.name,data.gridName,data.identityFlag,data.houseId,data.populationId,data.identity,data.CREATED_TIME,data.identity as identityName from ( |
|
|
|
select |
|
|
|
t.RESIDENTS_NAME as name, |
|
|
|
group_concat(DISTINCT substring_index(t2.ALL_DEPT_NAMES,'-',-1)) as gridName, |
|
|
|
1 as identityFlag, |
|
|
|
'户主' as identity, |
|
|
|
'' as houseId, |
|
|
|
t.ID as populationId, |
|
|
|
t.CREATED_TIME |
|
|
|
from epdc_population_information t |
|
|
|
left join epdc_house_resident t1 on t.ID = t1.RESIDENT_ID and t1.DEL_FLAG = '0' |
|
|
|
left join epdc_housing_information t2 on t2.ID = t1.HOUSE_ID and t2.DEL_FLAG = '0' |
|
|
|
where t.DEL_FLAG = '0' and t.RESIDENTS_IDENTITY_NO is not null and t.RESIDENTS_IDENTITY_NO != '' and t1.IS_HOUSE_HEAD ='1' |
|
|
|
<if test="name != null and name != ''"> |
|
|
|
and t.RESIDENTS_NAME like concat('%', #{name}, '%') |
|
|
|
</if> |
|
|
|
<if test="phone != null and phone != ''"> |
|
|
|
and t.RESIDENTS_PHONE like concat('%', #{phone}, '%') |
|
|
|
</if> |
|
|
|
<if test="communityId != null and communityId != ''"> |
|
|
|
and find_in_set(#{communityId},t2.ALL_DEPT_IDS) |
|
|
|
</if> |
|
|
|
<if test="gridId != null and gridId != ''"> |
|
|
|
and find_in_set(#{gridId},t2.ALL_DEPT_IDS) |
|
|
|
</if> |
|
|
|
group by t.ID |
|
|
|
union all |
|
|
|
select |
|
|
|
t.RESIDENTS_NAME as name, |
|
|
|
t2.gridName, |
|
|
|
2 as identityFlag, |
|
|
|
'居住人' as identity, |
|
|
|
'' as houseId, |
|
|
|
t.ID as populationId, |
|
|
|
t.CREATED_TIME |
|
|
|
from epdc_population_information t |
|
|
|
left join epdc_house_resident t1 on t.ID = t1.RESIDENT_ID |
|
|
|
left join |
|
|
|
(select |
|
|
|
t.ID,group_concat(DISTINCT substring_index(t2.ALL_DEPT_NAMES,'-',-1)) as gridName |
|
|
|
from epdc_population_information t |
|
|
|
left join epdc_house_resident t1 on t.ID = t1.RESIDENT_ID and t1.DEL_FLAG ='0' |
|
|
|
left join epdc_housing_information t2 on t2.ID = t1.HOUSE_ID and t2.DEL_FLAG = '0' |
|
|
|
where t.DEL_FLAG = '0' and t.RESIDENTS_IDENTITY_NO is not null and t.RESIDENTS_IDENTITY_NO != '' and t1.IS_HOUSE_HEAD ='1' |
|
|
|
<if test="communityId != null and communityId != ''"> |
|
|
|
and find_in_set(#{communityId},t2.ALL_DEPT_IDS) |
|
|
|
</if> |
|
|
|
<if test="gridId != null and gridId != ''"> |
|
|
|
and find_in_set(#{gridId},t2.ALL_DEPT_IDS) |
|
|
|
</if> |
|
|
|
group by t.ID |
|
|
|
)t2 on t2.ID = t1.HOUSE_HEAD_ID |
|
|
|
where t.DEL_FLAG = '0' and t1.DEL_FLAG ='0' and t2.gridName is not null |
|
|
|
and (t.RESIDENTS_IDENTITY_NO is null or t.RESIDENTS_IDENTITY_NO = '') and t1.IS_HOUSE_HEAD = '0' |
|
|
|
<if test="name != null and name != ''"> |
|
|
|
and t.RESIDENTS_NAME like concat('%', #{name}, '%') |
|
|
|
</if> |
|
|
|
<if test="phone != null and phone != ''"> |
|
|
|
and t.RESIDENTS_PHONE like concat('%', #{phone}, '%') |
|
|
|
</if> |
|
|
|
group by t.ID)data |
|
|
|
order by CREATED_TIME desc |
|
|
|
)a |
|
|
|
</select> |
|
|
|
<select id="selectHouseUseDataForScreen" |
|
|
|
resultType="com.elink.esua.epdc.dto.epdc.result.EpdcScreenHouseUseResultDTO"> |
|
|
|
select |
|
|
|
@ -286,6 +353,38 @@ |
|
|
|
LIMIT #{pageIndex},#{pageSize} |
|
|
|
</if> |
|
|
|
</select> |
|
|
|
<select id="selectCountListGridRanking" resultType="java.lang.Integer"> |
|
|
|
<if test="rankCategory!=null and rankCategory == 0"> |
|
|
|
select count(1) from ( |
|
|
|
select ifnull(houseHead.houseHeadNum,0)+IFNULL(resident.residentNum,0) as total,houseHead.gridName from( |
|
|
|
select count(1) as houseHeadNum,GRID_ID,gridName from( |
|
|
|
select t2.GRID_ID,substring_index(t2.ALL_DEPT_NAMES,'-',-1) as gridName |
|
|
|
from epdc_population_information t |
|
|
|
left join epdc_house_resident t1 on t1.RESIDENT_ID = t.ID |
|
|
|
left join epdc_housing_information t2 on t2.ID = t1.HOUSE_ID |
|
|
|
where t.DEL_FLAG = '0' |
|
|
|
and t1.DEL_FLAG = '0' and t2.DEL_FLAG='0' |
|
|
|
and t1.IS_HOUSE_HEAD ='1' |
|
|
|
group by t2.GRID_ID,t.ID)end |
|
|
|
group by end.GRID_ID)houseHead |
|
|
|
left join |
|
|
|
(select count(1) as residentNum,GRID_ID,gridName from( |
|
|
|
select count(1),t3.GRID_ID,substring_index(t3.ALL_DEPT_NAMES,'-',-1) as gridName from epdc_population_information t |
|
|
|
left join epdc_house_resident t1 on t.ID = t1.RESIDENT_ID |
|
|
|
left join epdc_house_resident t2 on t1.HOUSE_HEAD_ID = t2.RESIDENT_ID |
|
|
|
left join epdc_housing_information t3 on t3.Id =t2.HOUSE_ID |
|
|
|
where t.DEL_FLAG ='0' and t1.IS_HOUSE_HEAD='0' and t2.DEL_FLAG ='0' and t3.DEL_FLAG ='0' |
|
|
|
group by t3.GRID_ID,t.ID)end |
|
|
|
group by end.GRID_ID)resident on houseHead.GRID_ID = resident.GRID_ID |
|
|
|
order by total desc)a |
|
|
|
</if> |
|
|
|
<if test="rankCategory!=null and rankCategory == 1"> |
|
|
|
select count(1) from ( |
|
|
|
select substring_index(ALL_DEPT_NAMES,'-',-1)gridName,count(1) as total from epdc_housing_information where DEL_FLAG ='0' |
|
|
|
group by GRID_ID |
|
|
|
order by total desc)a |
|
|
|
</if> |
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
|
|
</mapper> |