| | |
| | | select t.village_id as villageId,t.name as villageName,t1.id,t1.name from com_mng_village t left join com_mng_building t1 on t.village_id = t1.village_id where t.community_id=#{id} and t1.id is not null |
| | | </select> |
| | | |
| | | <select id="pageBuildingAdmin" resultType="com.panzhihua.common.model.vos.community.building.admin.PageBuildingListAdminVo"> |
| | | SELECT |
| | | cmb.id, |
| | | cmv.village_id, |
| | | cmv.alley, |
| | | cmb.`name`, |
| | | cmv.`name` AS villageName, |
| | | cmv.house_num as doorNum, |
| | | cmb.unit_total, |
| | | cmb.build_floor_sum, |
| | | (select count(id) from com_mng_population_house where village_id = cmb.village_id and floor = cmb.`name`) as houseNum, |
| | | (select count(id) from com_mng_population where village_id = cmb.village_id and floor = cmb.`name`) as populationNum |
| | | FROM |
| | | com_mng_building AS cmb |
| | | LEFT JOIN com_mng_village AS cmv ON cmv.village_id = cmb.village_id |
| | | <where> |
| | | <if test="pageBuildingListDto.communityId != null"> |
| | | and cmb.act_id = #{pageBuildingListDto.communityId} |
| | | </if> |
| | | <if test="pageBuildingListDto.villageId != null"> |
| | | and cmb.village_id = #{pageBuildingListDto.villageId} |
| | | </if> |
| | | <if test="pageBuildingListDto.keyWord != null and pageBuildingListDto.keyWord != """> |
| | | and cmv.alley like concat(#{pageBuildingListDto.keyWord},'%') |
| | | </if> |
| | | </where> |
| | | order by cmb.create_at desc |
| | | </select> |
| | | |
| | | <select id="buildingListHeaderStatisticsAdmin" resultType="com.panzhihua.common.model.vos.community.building.admin.BuildingListHeaderStatisticsAdminVo"> |
| | | SELECT count( id ) AS buildNum,( SELECT count( id ) FROM com_mng_population_house WHERE community_id = cmb.act_id ) AS houseNum, |
| | | ( SELECT count( id ) FROM com_mng_population_community_tags WHERE community_id = cmb.act_id ) AS populationNum |
| | | FROM |
| | | com_mng_building AS cmb |
| | | WHERE |
| | | cmb.act_id = #{communityId} |
| | | </select> |
| | | |
| | | <select id="detailBuildAdmin" resultType="com.panzhihua.common.model.vos.community.building.admin.BuildingDetailAdminVo"> |
| | | SELECT |
| | | cmb.id, |
| | | cmv.alley, |
| | | cmv.house_num AS doorNum, |
| | | cmb.`name`, |
| | | cmv.`name` AS village, |
| | | cmv.village_id, |
| | | (select count(id) from com_mng_population_house where village_id = cmb.village_id and floor = cmb.`name`) as houseNum, |
| | | (select count(id) from com_mng_population_house where village_id = cmb.village_id and floor = cmb.`name` and `status` = 1) as liveTotal, |
| | | (select count(id) from com_mng_population_house where village_id = cmb.village_id and floor = cmb.`name` and `status` = 2) as leaseTotal, |
| | | (select count(id) from com_mng_population_house where village_id = cmb.village_id and floor = cmb.`name` and `status` = 3) as vacantNum |
| | | FROM |
| | | com_mng_building AS cmb |
| | | LEFT JOIN com_mng_village AS cmv ON cmv.village_id = cmb.village_id |
| | | where cmb.id = #{id} |
| | | </select> |
| | | |
| | | <select id="buildingUnitList" resultType="com.panzhihua.common.model.vos.grid.ComMngVillageBuildingVO"> |
| | | SELECT DISTINCT |
| | | village_id, |
| | | floor, |
| | | unit_no |
| | | FROM |
| | | com_mng_population_house AS cmph |
| | | WHERE |
| | | village_id = #{villageId} and floor = #{floor} |
| | | </select> |
| | | |
| | | <select id="getBuildingUnitHouseList" resultType="com.panzhihua.common.model.vos.grid.ComMngVillageBuildingHouseVO"> |
| | | SELECT id, floor, unit_no, house_no, `status`,floor_num as buildingNum, |
| | | ( SELECT count( id ) FROM com_mng_population_house_user WHERE house_id = cmph.id ) AS userNum |
| | | FROM |
| | | com_mng_population_house AS cmph |
| | | where cmph.village_id = #{pageBuildingListDto.villageId} |
| | | and cmph.floor = #{pageBuildingListDto.floor} |
| | | and cmph.unit_no = #{pageBuildingListDto.unit} |
| | | and cmph.house_no is not null |
| | | |
| | | order by floor_num asc |
| | | </select> |
| | | |
| | | <select id="getBuildingUnitHouseStatistics" resultType="Map"> |
| | | SELECT |
| | | count( id ) as houseNum, |
| | | (select count(id) from com_mng_population_house where village_id = #{villageId} and floor = #{floor} and unit_no = #{unit} and house_no is not null and `status` = 1) as liveTotal, |
| | | (select count(id) from com_mng_population_house where village_id = #{villageId} and floor = #{floor} and unit_no = #{unit} and house_no is not null and `status` = 2) as leaseTotal, |
| | | (select count(id) from com_mng_population_house where village_id = #{villageId} and floor = #{floor} and unit_no = #{unit} and house_no is not null and `status` = 3) as vacantNum |
| | | FROM |
| | | com_mng_population_house |
| | | WHERE |
| | | village_id = #{villageId} and floor = #{floor} and unit_no = #{unit} and house_no is not null |
| | | </select> |
| | | |
| | | <select id="buildingUnitHouseDetailAdmin" resultType="com.panzhihua.common.model.vos.grid.ComMngVillageBuildingHouseDetailVO"> |
| | | SELECT |
| | | cmph.id, |
| | | cmv.`name` AS villageName, |
| | | cmph.floor, |
| | | cmph.unit_no, |
| | | cmph.house_no, |
| | | cmph.address, |
| | | cmph.`status`, |
| | | cmv.lat, |
| | | cmv.lng |
| | | FROM |
| | | com_mng_population_house AS cmph |
| | | LEFT JOIN com_mng_village AS cmv ON cmv.village_id = cmph.village_id |
| | | WHERE |
| | | cmph.id = #{houseId} |
| | | </select> |
| | | |
| | | <select id="getGridVillageBuildingPopulationList" resultType="com.panzhihua.common.model.vos.grid.PopulationListVO"> |
| | | SELECT |
| | | cmp.id, |
| | | cmphu.id AS housePopulationId, |
| | | cmp.sex, |
| | | cmp.`name`, |
| | | IFNULL( cmp.phone, '暂无' ) AS phone, |
| | | cmp.card_no, |
| | | cmpct.label, |
| | | cmp.address, |
| | | cmp.nation, |
| | | cmphu.create_at, |
| | | cmp.political_outlook |
| | | FROM |
| | | com_mng_population_house_user AS cmphu |
| | | LEFT JOIN com_mng_population AS cmp ON cmp.id = cmphu.popul_id |
| | | LEFT JOIN com_mng_population_community_tags AS cmpct ON cmp.id = cmpct.population_id and community_id = #{communityId} |
| | | WHERE |
| | | cmphu.house_id = #{houseId} |
| | | <if test='relation != null '> |
| | | AND cmphu.relation = #{relation} |
| | | </if> |
| | | <if test='relationId != null '> |
| | | AND cmphu.relation_id = #{relationId} |
| | | </if> |
| | | group by id |
| | | </select> |
| | | |
| | | <select id="buildingVillageListAdmin" resultType="com.panzhihua.common.model.vos.community.ComMngVillageVO"> |
| | | SELECT |
| | | village_id, |
| | | alley, |
| | | house_num, |
| | | `name` |
| | | FROM |
| | | com_mng_village |
| | | WHERE |
| | | community_id = #{communityId} |
| | | </select> |
| | | |
| | | </mapper> |