From 8788a78ad30c1bb9d50d91b10e76d3ae47ed8da2 Mon Sep 17 00:00:00 2001
From: huanghongfa <huanghongfa123456>
Date: 星期一, 07 六月 2021 09:28:23 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/test_future_wangge' into test_future_wangge

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComMngPopulationDAO.java |   25 ++++++++++++++++++++-----
 1 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComMngPopulationDAO.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComMngPopulationDAO.java
index bbb6de0..08c2cf9 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComMngPopulationDAO.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComMngPopulationDAO.java
@@ -7,6 +7,7 @@
 import com.panzhihua.common.model.dtos.user.PageInputUserDTO;
 import com.panzhihua.common.model.vos.area.AreaAddressVO;
 import com.panzhihua.common.model.vos.community.ComActMessageVO;
+import com.panzhihua.common.model.vos.community.ComMngPopulationTotalVO;
 import com.panzhihua.common.model.vos.community.ComMngPopulationVO;
 import com.panzhihua.common.model.vos.community.PageComActMessageVO;
 import com.panzhihua.common.model.vos.user.ComHouseMemberVo;
@@ -95,7 +96,7 @@
     List<ComMngPopulationVO> listPopulation(ComMngPopulationDTO populationVO);
 
 
-    @Select("select id,user_id,relationship,`name`,id_card,phone,age,health,job,create_at,update_at,card_photo_front,card_photo_back,family_book from com_mng_family_info where user_id=#{userId}")
+    @Select("select id,user_id,relationship,`name`,id_card,phone,age,health,job,create_at,update_at,card_photo_front,card_photo_back,family_book from com_mng_family_info where user_id=#{userId} order by create_at desc ")
     List<ComMngFamilyInfoVO> listFamilyByUserId(Long userId);
 
     @Select("select cmphu.popul_id,cmp.name,cmp.relation,cmp.age,cmp.phone,cmp.healthy,cmp.card_no,cmp.work_company from com_mng_population_house_user cmphu " +
@@ -134,6 +135,7 @@
             "cmp.census_register, \n" +
             "cmp.healthy, \n" +
             "cmp.birthday, \n" +
+            "cmp.update_at, \n" +
             "cmp.is_rent \n" +
             "FROM \n" +
             "com_mng_population AS cmp " +
@@ -144,6 +146,12 @@
             " </if> " +
             "<if test='comMngPopulationVO.actId != null'>" +
             " and cmp.act_id = #{comMngPopulationVO.actId} " +
+            " </if> " +
+            "<if test='comMngPopulationVO.outOrLocal != null'>" +
+            " and cmp.out_or_local = #{comMngPopulationVO.outOrLocal} " +
+            " </if> " +
+            "<if test='comMngPopulationVO.villageId != null'>" +
+            " and cmp.village_id = #{comMngPopulationVO.villageId} " +
             " </if> " +
             "<if test='comMngPopulationVO.road != null and comMngPopulationVO.road != &quot;&quot;'>" +
             "AND cmp.road = #{comMngPopulationVO.road} " +
@@ -166,11 +174,11 @@
             "<if test='comMngPopulationVO.sex != null and comMngPopulationVO.sex != &quot;&quot;'>" +
             "AND cmp.sex = #{comMngPopulationVO.sex} " +
             " </if> " +
-            "<if test='comMngPopulationVO.ageStart != null and comMngPopulationVO.ageStart != &quot;&quot;'>" +
-            "AND cmp.age <![CDATA[ >= ]]> #{comMngPopulationVO.ageStart} " +
+            "<if test='comMngPopulationVO.ageStartTime != null and comMngPopulationVO.ageStartTime != &quot;&quot;'>" +
+            "AND date_format(cmp.birthday,'%Y-%m-%d') <![CDATA[ <= ]]> #{comMngPopulationVO.ageStartTime} " +
             " </if> " +
-            "<if test='comMngPopulationVO.ageEnd != null and comMngPopulationVO.ageEnd != &quot;&quot;'>" +
-            "AND cmp.age <![CDATA[ <= ]]> #{comMngPopulationVO.ageEnd} " +
+            "<if test='comMngPopulationVO.ageEndTime != null and comMngPopulationVO.ageEndTime != &quot;&quot;'>" +
+            "AND date_format(cmp.birthday,'%Y-%m-%d') <![CDATA[ >= ]]> #{comMngPopulationVO.ageEndTime} " +
             " </if> " +
             "<if test='comMngPopulationVO.nativePlace != null and comMngPopulationVO.nativePlace != &quot;&quot;'>" +
             "AND cmp.native_place LIKE concat(#{comMngPopulationVO.nativePlace},'%') " +
@@ -223,4 +231,11 @@
             "(select district_name from com_mng_struct_area_district where district_adcode = #{districtCode}) as district" +
             "</script>")
     AreaAddressVO getAreaAddress(@Param("provinceCode") String provinceCode,@Param("cityCode") String cityCode,@Param("districtCode") String districtCode);
+
+    @Select("select count(id) as populationTotal " +
+            ",(select count(id) from com_mng_population where act_id = #{communityId} and out_or_local = 1) as localTotal " +
+            ",(select count(id) from com_mng_population where act_id = #{communityId} and out_or_local = 2) as outTotal " +
+            ",(select count(id) from com_mng_population where act_id = #{communityId} and label is not null) as specialTotal " +
+            " from com_mng_population as cmp where act_id = #{communityId}")
+    ComMngPopulationTotalVO getPopulationTotalByAdmin(@Param("communityId") Long communityId);
 }

--
Gitblit v1.7.1