From 2e64c232ab6b51b2cecf1ee96e1e9b709234f326 Mon Sep 17 00:00:00 2001
From: huanghongfa <huanghongfa123456>
Date: 星期六, 21 八月 2021 16:35:14 +0800
Subject: [PATCH] 随手拍改版接口开发

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComMngPopulationHouseDAO.java |  113 ++++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 105 insertions(+), 8 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComMngPopulationHouseDAO.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComMngPopulationHouseDAO.java
index 4c56d2b..3d7862b 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComMngPopulationHouseDAO.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComMngPopulationHouseDAO.java
@@ -4,9 +4,16 @@
 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.ComMngPopulationDO;
 import com.panzhihua.service_community.model.dos.ComMngPopulationHouseDO;
+import org.apache.ibatis.annotations.Insert;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
@@ -21,21 +28,21 @@
 @Mapper
 public interface ComMngPopulationHouseDAO extends BaseMapper<ComMngPopulationHouseDO> {
 
-    @Select("select cmphu.house_id,cmph.address,cmph.status from com_mng_population_house_user cmphu " +
+    @Select("select cmphu.house_id,cmph.address,cmph.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<ComMngHouseVo> getPopulHouseListByPopulId(@Param("populId")Long populId);
 
     @Select("<script> " +
-            "select id,cmv.alley from com_mng_population_house as cmph left join com_mng_village as cmv on cmv.village_id = cmph.village_id where cmph.community_id = #{communityId}" +
-            "<if test='villageId != null'>" +
+            "select id as houseId,cmv.alley from com_mng_population_house as cmph left join com_mng_village as cmv on cmv.village_id = cmph.village_id where cmph.community_id = #{communityId}" +
+            "<if test='villageId != null and villageId != &quot;&quot;'>" +
             "and cmv.village_id = #{villageId}" +
             " </if> " +
             " </script>")
     List<ComMngCascadeHouseVO> getHouseLevelByAlley(@Param(value = "communityId") Long communityId,@Param(value = "villageId") Long villageId);
 
     @Select("<script> " +
-            "select id,cmv.alley,cmv.house_num from com_mng_population_house as cmph left join com_mng_village as cmv on cmv.village_id = cmph.village_id where cmph.community_id = #{communityId}" +
+            "select id as houseId,cmv.alley,cmv.house_num from com_mng_population_house as cmph left join com_mng_village as cmv on cmv.village_id = cmph.village_id where cmph.community_id = #{communityId}" +
             "<if test='name != null and name != &quot;&quot;'>" +
             "and cmv.alley = #{name}" +
             " </if> " +
@@ -46,7 +53,7 @@
     List<ComMngCascadeHouseVO> getHouseLevelByHouseNum(@Param("name") String name,@Param("communityId") Long communityId,@Param(value = "villageId") Long villageId);
 
     @Select("<script> " +
-            "select id,cmv.alley,cmv.house_num,cmph.floor from com_mng_population_house as cmph left join com_mng_village as cmv on cmv.village_id = cmph.village_id where cmph.community_id = #{communityId} " +
+            "select id as houseId,cmv.alley,cmv.house_num,cmph.floor from com_mng_population_house as cmph left join com_mng_village as cmv on cmv.village_id = cmph.village_id where cmph.community_id = #{communityId} " +
             "<if test='name != null and name != &quot;&quot;'>" +
             "and cmv.alley = #{name}" +
             " </if> " +
@@ -60,7 +67,7 @@
     List<ComMngCascadeHouseVO> getHouseLevelByFloor(@Param("name") String name,@Param("houseNum") String houseNum,@Param("communityId") Long communityId,@Param(value = "villageId") Long villageId);
 
     @Select("<script> " +
-            "select id,cmv.alley,cmv.house_num,cmph.floor,cmph.unit_no from com_mng_population_house as cmph left join com_mng_village as cmv on cmv.village_id = cmph.village_id where cmph.community_id = #{communityId} " +
+            "select id as houseId,cmv.alley,cmv.house_num,cmph.floor,cmph.unit_no from com_mng_population_house as cmph left join com_mng_village as cmv on cmv.village_id = cmph.village_id where cmph.community_id = #{communityId} " +
             "<if test='name != null and name != &quot;&quot;'>" +
             "and cmv.alley = #{name}" +
             " </if> " +
@@ -77,7 +84,7 @@
     List<ComMngCascadeHouseVO> getHouseLevelByUnitNo(@Param("name") String name,@Param("houseNum") String houseNum,@Param("floor") String floor,@Param("communityId") Long communityId,@Param(value = "villageId") Long villageId);
 
     @Select("<script> " +
-            "select cmph.id,cmv.alley,cmv.house_num,cmph.floor,cmph.unit_no,cmph.house_no from com_mng_population_house as cmph left join com_mng_village as cmv on cmv.village_id = cmph.village_id where cmph.community_id = #{communityId} " +
+            "select cmph.id as houseId,cmv.alley,cmv.house_num,cmph.floor,cmph.unit_no,cmph.house_no from com_mng_population_house as cmph left join com_mng_village as cmv on cmv.village_id = cmph.village_id where cmph.community_id = #{communityId} " +
             "<if test='name != null and name != &quot;&quot;'>" +
             "and cmv.alley = #{name}" +
             " </if> " +
@@ -137,7 +144,7 @@
             " AND cmv.alley = #{populationHouseAdminDTO.road}  " +
             " </if> " +
             "<if test='populationHouseAdminDTO.doorNo != null and populationHouseAdminDTO.doorNo != &quot;&quot; '>" +
-            " AND cmv.houseNum = #{populationHouseAdminDTO.doorNo}  " +
+            " AND cmv.house_num = #{populationHouseAdminDTO.doorNo}  " +
             " </if> " +
             "<if test='populationHouseAdminDTO.floor != null and populationHouseAdminDTO.floor != &quot;&quot; '>" +
             " AND cmph.floor = #{populationHouseAdminDTO.floor}  " +
@@ -150,6 +157,9 @@
             " </if> " +
             "<if test='populationHouseAdminDTO.villageId != null'>" +
             " and cmph.village_id = #{populationHouseAdminDTO.villageId} " +
+            " </if> " +
+            "<if test='populationHouseAdminDTO.address != null and populationHouseAdminDTO.address != &quot;&quot; '>" +
+            " AND cmph.address = #{populationHouseAdminDTO.address}  " +
             " </if> " +
             " </where>" +
             " order by update_at desc" +
@@ -173,5 +183,92 @@
             " from com_act as ca where ca.community_id = #{communityId}")
     ComMngVillageRegionVO getRegion(@Param("communityId") Long communityId);
 
+    @Select("<script> " +
+            "SELECT id, floor, unit_no, house_no, `status`,( SELECT count( id ) FROM com_mng_population_house_user WHERE house_id = cmph.id ) AS userNum " +
+            " FROM " +
+            " com_mng_population_house AS cmph " +
+            " <where> " +
+            "<if test='buildHouseAppDTO.villageId != null '>" +
+            " and cmph.village_id = #{buildHouseAppDTO.villageId}  " +
+            " </if> " +
+            "<if test='buildHouseAppDTO.floor != null and buildHouseAppDTO.floor !=&quot;&quot; '>" +
+            " and cmph.floor = #{buildHouseAppDTO.floor}  " +
+            " </if> " +
+            "<if test='buildHouseAppDTO.unitNo != null and buildHouseAppDTO.unitNo !=&quot;&quot; '>" +
+            " and cmph.unit_no = #{buildHouseAppDTO.unitNo}  " +
+            " </if> " +
+            "<if test='buildHouseAppDTO.houseNo != null and buildHouseAppDTO.houseNo !=&quot;&quot; '>" +
+            " and cmph.house_no like concat(#{buildHouseAppDTO.houseNo},'%')  " +
+            " </if> " +
+            " </where>" +
+            " </script>")
+    IPage<ComMngVillageBuildingHouseVO> 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("<script> " +
+            "SELECT " +
+            " cmp.id, " +
+            " cmphu.id as housePopulationId, " +
+            " cmp.sex, " +
+            " cmp.`name`, " +
+            " IFNULL( cmp.phone, '暂无' ) as phone, " +
+            " cmp.card_no, " +
+            " cmp.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  " +
+            "WHERE " +
+            " cmphu.house_id = #{houseId} " +
+            "<if test='relation != null '>" +
+            " AND cmphu.relation = #{relation}  " +
+            " </if> " +
+            "<if test='relationId != null '>" +
+            " AND cmphu.relation_id = #{relationId}  " +
+            " </if> " +
+            " </script>")
+    List<PopulationListVO> 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} order by create_at asc")
+    List<ComMngSubordinateVO> getHouseLevelByFloors(@Param("villageId") Long villageId);
+
+    @Select("select id as houseId,unit_no from com_mng_population_house where village_id = #{villageId} and floor = #{floor} order by create_at asc")
+    List<ComMngSubordinateVO> 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} order by create_at asc")
+    List<ComMngSubordinateVO> getHouseLevelByHouseNos(@Param("villageId") Long villageId,@Param("floor") String floor,@Param("unitNo") String unitNo);
+
+    @Insert("<script> " +
+            "insert into com_mng_population_house(`id`,`street_id`,`community_id`,`village_id`" +
+            ",`alley`,`house_num`,`unit_no`,`floor`,`house_no`,`code`,`address`,`status`" +
+            ",`purpose`,`control_status`,`is_empty`,`construct_purpose`,`construct_area`" +
+            ",`path`,`create_at`) values " +
+            "<foreach collection=\"houseList\" item=\"item\" index=\"index\" separator=\",\">\n" +
+            "        (#{item.id},#{item.streetId},#{item.communityId},#{item.villageId}" +
+            ",#{item.alley},#{item.houseNum},#{item.unitNo},#{item.floor}" +
+            ",#{item.houseNo},#{item.code},#{item.address},#{item.status}" +
+            ",#{item.purpose},#{item.controlStatus},#{item.isEmpty},#{item.constructPurpose}" +
+            ",#{item.constructArea},#{item.path},now())" +
+            "    </foreach>" +
+            " </script>")
+    void insertAll(@Param("houseList") List<ComMngPopulationHouseDO> houseList);
 }

--
Gitblit v1.7.1