From ca93fe7eb03bec91d5cb9f45ebb3b6c98819b7ff Mon Sep 17 00:00:00 2001
From: linwe <872216996@qq.com>
Date: Mon, 25 Dec 2023 18:01:09 +0800
Subject: [PATCH] 我的任务,里面审核搜索加上时间条件

---
 src/main/java/org/springblade/modules/house/mapper/HouseholdMapper.xml |   61 +++++++++++++++++++++++-------
 1 files changed, 47 insertions(+), 14 deletions(-)

diff --git a/src/main/java/org/springblade/modules/house/mapper/HouseholdMapper.xml b/src/main/java/org/springblade/modules/house/mapper/HouseholdMapper.xml
index 2b2f478..f087569 100644
--- a/src/main/java/org/springblade/modules/house/mapper/HouseholdMapper.xml
+++ b/src/main/java/org/springblade/modules/house/mapper/HouseholdMapper.xml
@@ -114,22 +114,51 @@
 
     <!--自定义分页数据查询-->
     <select id="selectHouseholdPage" resultMap="householdPageAndLabelMap">
-        select
-        jh.id,jh.house_code,jh.name,jh.phone_number,jh.associated_user_id,
-        jh.role_type,jh.associated_user_name,jh.relationship,jh.is_primary_contact,
-        jh.residential_status,jh.birthday,jh.id_card,jh.hkmt_pass,jh.passport,
-        ifnull(jh.gender,case when substring(jh.id_card,17,1)%2=1 then 1 else 0 end) as gender,
-        jh.ethnicity,jh.education,jh.hukou_registration,jh.work_status,employer,
-        jh.marital_status,jh.card_number,jh.other_contact,jh.current_address,jh.disability_cert,
-        jh.party_ember,jh.create_user,jh.create_time,jh.update_user,jh.update_time,jh.remark,
+        SELECT
+        jh.id,
+        jh.house_code,
+        jh.NAME,
+        jh.phone_number,
+        jh.associated_user_id,
+        jh.role_type,
+        jh.associated_user_name,
+        jh.relationship,
+        jh.is_primary_contact,
+        jh.residential_status,
+        jh.birthday,
+        jh.id_card,
+        jh.hkmt_pass,
+        jh.passport,
+        ifnull( jh.gender, CASE WHEN substring( jh.id_card, 17, 1 )% 2 = 1 THEN 1 ELSE 0 END ) AS gender,
+        jh.ethnicity,
+        jh.education,
+        jh.hukou_registration,
+        jh.work_status,
+        employer,
+        jh.marital_status,
+        jh.card_number,
+        jh.other_contact,
+        jh.current_address,
+        jh.disability_cert,
+        jh.party_ember,
+        jh.create_user,
+        jh.create_time,
+        jh.update_user,
+        jh.update_time,
+        jh.remark,
         jhs.district_name aoiName,
-        concat(jhs.building," ",unit," ",room) as address,
-        jda.town_street_name as townStreetName,jda.nei_name as neiName
-        from
+        concat( jhs.building, " ", unit, " ", room ) AS address,
+        jda.town_street_name AS townStreetName,
+        jda.nei_name AS neiName,
+        jg.grid_name
+        FROM
         jczz_household jh
-        join jczz_house jhs on jh.house_code = jhs.house_code and jhs.is_deleted = 0
-        left join jczz_doorplate_address jda on jda.address_code = jh.house_code
-        where jh.is_deleted = 0
+        LEFT JOIN jczz_house jhs ON jh.house_code = jhs.house_code
+        LEFT JOIN jczz_doorplate_address jda ON jda.address_code = jh.house_code
+        LEFT JOIN jczz_grid_range jgr on jgr.house_code=jda.address_code
+        LEFT JOIN jczz_grid jg on jg.id = jgr.grid_id
+        WHERE
+        jh.is_deleted = 0
         <if test="household.name!=null and household.name !=''">
             and jh.name like concat('%',#{household.name},'%')
         </if>
@@ -157,6 +186,10 @@
         <if test="household.housingRentalId != null ">
             and jh.housing_rental_id = #{household.housingRentalId}
         </if>
+        <if test="household.startTime != null and household.startTime != '' and household.endTime != null and household.endTime != '' ">
+            AND jh.create_time BETWEEN #{household.startTime} and #{household.endTime}
+        </if>
+        order by jh.create_time desc
     </select>
 
     <!--查询房屋集合信息-->

--
Gitblit v1.9.3