package com.panzhihua.service_community.dao; import java.util.List; import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.panzhihua.common.model.dtos.community.ComMngPopulationHouseAdminDTO; import com.panzhihua.common.model.dtos.grid.PageComMngVillageBuildHouseAppDTO; import com.panzhihua.common.model.vos.community.*; import com.panzhihua.common.model.vos.grid.ComMngVillageBuildingHouseDetailVO; import com.panzhihua.common.model.vos.grid.ComMngVillageBuildingHouseVO; import com.panzhihua.common.model.vos.grid.PopulationListVO; import com.panzhihua.common.model.vos.grid.admin.ComMngSubordinateVO; import com.panzhihua.common.model.vos.user.ComMngHouseVo; import com.panzhihua.service_community.model.dos.ComMngPopulationHouseDO; /** * @auther lyq * @create 2021-05-18 09:26:31 * @describe 社区管理》小区管理》实有房屋mapper类 */ @Mapper public interface ComMngPopulationHouseDAO extends BaseMapper { @Select("select cmphu.id, cmphu.house_id,cmph.address,cmph.status,cmph.purpose,cmph.control_status,cmphu.popul_id,cmphu.residence,cmphu.relation_id,cmphu.relation from com_mng_population_house_user cmphu " + " left join com_mng_population_house as cmph on cmph.id = cmphu.house_id " + " where cmphu.popul_id = #{populId}") List getPopulHouseListByPopulId(@Param("populId") Long populId); @Select("") List getHouseLevelByAlley(@Param(value = "communityId") Long communityId, @Param(value = "villageId") Long villageId); @Select("") List getHouseLevelByHouseNum(@Param("name") String name, @Param("communityId") Long communityId, @Param(value = "villageId") Long villageId); @Select("") List getHouseLevelByFloor(@Param("name") String name, @Param("houseNum") String houseNum, @Param("communityId") Long communityId, @Param(value = "villageId") Long villageId); @Select("") List getHouseLevelByUnitNo(@Param("name") String name, @Param("houseNum") String houseNum, @Param("floor") String floor, @Param("communityId") Long communityId, @Param(value = "villageId") Long villageId); @Select("") List getHouseLevelByHouseNo(@Param("name") String name, @Param("houseNum") String houseNum, @Param("floor") String floor, @Param("unitNo") String unitNo, @Param("communityId") Long communityId, @Param(value = "villageId") Long villageId); @Select("update com_mng_population_house set is_empty = #{isEmpty} where id = #{houseId}") void updateHouseByIsEmpty(@Param("houseId") Long houseId, @Param("isEmpty") Integer isEmpty); @Select("") IPage getPageHouse(Page page, @Param("populationHouseAdminDTO") ComMngPopulationHouseAdminDTO populationHouseAdminDTO); @Select("select id,address,status,purpose,control_status,update_at,code,construct_purpose,construct_area from com_mng_population_house where id = #{houseId}") ComMngPopulationHouseDetailAdminVO getHouseDetail(@Param("houseId") Long houseId); @Select("select count(id) as houseTotal" + ",(select count(id) from com_mng_population_house where is_empty = 1 and community_id = ${communityId}) as emptyTotal" + ",(select count(id) from com_mng_population_house where control_status = 2 and community_id = ${communityId}) as followTotal" + ",(select count(id) from com_mng_population_house where control_status = 3 and community_id = ${communityId}) as controlTotal" + " from com_mng_population_house as cmph where community_id = ${communityId}") ComMngPopulationHouseTotalVO getHouseTotalByAdmin(@Param("communityId") Long communityId); @Select("select (select province_name from com_mng_struct_area_province where province_adcode = ca.province_code) as provinceName," + "(select city_name from com_mng_struct_area_city where city_adcode = ca.city_code) as cityName," + "(select district_name from com_mng_struct_area_district where district_adcode = ca.area_code) as districtName" + ",ca.province_code as provinceAdcode,ca.city_code as cityAdcode,ca.area_code as districtAdcode" + " from com_act as ca where ca.community_id = ${communityId}") ComMngVillageRegionVO getRegion(@Param("communityId") Long communityId); @Select("") IPage getGridVillageBuildingHouseList(Page page, @Param("buildHouseAppDTO") PageComMngVillageBuildHouseAppDTO buildHouseAppDTO); @Select("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}") ComMngVillageBuildingHouseDetailVO getGridVillageBuildingHouseDetail(@Param("houseId") Long houseId); @Select("") List getGridVillageBuildingPopulationList(@Param("houseId") Long houseId, @Param("relation") Integer relation, @Param("relationId") Integer relationId); @Select("select id as houseId,floor from com_mng_population_house where village_id = #{villageId} and floor is not null group by floor order by create_at asc") List getHouseLevelByFloors(@Param("villageId") Long villageId); @Select("select id as houseId,unit_no from com_mng_population_house where village_id = #{villageId} and floor = #{floor} and unit_no is not null group by unit_no order by create_at asc") List getHouseLevelByUnitNos(@Param("villageId") Long villageId, @Param("floor") String floor); @Select("select id as houseId,house_no from com_mng_population_house where village_id = #{villageId} and floor = #{floor} and unit_no = #{unitNo} and house_no is not null group by house_no order by create_at asc") List getHouseLevelByHouseNos(@Param("villageId") Long villageId, @Param("floor") String floor, @Param("unitNo") String unitNo); @Insert("") void insertAll(@Param("houseList") List houseList); /** * 修改房屋关联单元号 * @param villageId 小区id * @param floor 楼栋号 * @param oldUnitNo 原单元号 * @param newUnitNo 新单元号 */ void updateHouseUnit(@Param("villageId") Long villageId, @Param("floor") String floor,@Param("oldUnitNo") String oldUnitNo,@Param("newUnitNo") String newUnitNo); /** * 修改房屋关联单元号 * @param houseList 需要修改的数据 */ void updateUnitAll(@Param("houseList") List houseList); }