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 +++++++++++++++++++++++-------
 src/main/java/org/springblade/modules/house/vo/HouseholdVO.java                    |    7 +++
 src/main/java/org/springblade/modules/task/vo/TaskReportForRepairsVO.java          |    7 +++
 src/main/java/org/springblade/modules/house/entity/HouseRentalEntity.java          |    1 
 src/main/java/org/springblade/modules/house/vo/HouseRentalVO.java                  |    7 +++
 src/main/java/org/springblade/modules/house/mapper/HouseRentalMapper.xml           |    3 +
 src/main/java/org/springblade/modules/house/service/impl/HouseholdServiceImpl.java |   26 +++++++-----
 src/main/java/org/springblade/modules/task/mapper/TaskReportForRepairsMapper.xml   |    3 +
 8 files changed, 90 insertions(+), 25 deletions(-)

diff --git a/src/main/java/org/springblade/modules/house/entity/HouseRentalEntity.java b/src/main/java/org/springblade/modules/house/entity/HouseRentalEntity.java
index 6f004be..b7e5d4c 100644
--- a/src/main/java/org/springblade/modules/house/entity/HouseRentalEntity.java
+++ b/src/main/java/org/springblade/modules/house/entity/HouseRentalEntity.java
@@ -117,6 +117,7 @@
 	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
 	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
 	@ApiModelProperty("创建时间")
+	@TableField(value = "create_time",fill = FieldFill.INSERT)
 	private Date createTime;
 
 	/**
diff --git a/src/main/java/org/springblade/modules/house/mapper/HouseRentalMapper.xml b/src/main/java/org/springblade/modules/house/mapper/HouseRentalMapper.xml
index 9281865..765df40 100644
--- a/src/main/java/org/springblade/modules/house/mapper/HouseRentalMapper.xml
+++ b/src/main/java/org/springblade/modules/house/mapper/HouseRentalMapper.xml
@@ -121,6 +121,9 @@
                 AND TIMESTAMPDIFF( MONTH, jhr.rental_time, jhr.due_time )&lt;4
             </if>
         </if>
+        <if test="vo.startTime != null and vo.startTime != '' and vo.endTime != null and vo.endTime != '' ">
+            AND jhr.create_time BETWEEN #{vo.startTime} and #{vo.endTime}
+        </if>
         <include refid="filterHouseGrid"/>
     </select>
 
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>
 
     <!--查询房屋集合信息-->
diff --git a/src/main/java/org/springblade/modules/house/service/impl/HouseholdServiceImpl.java b/src/main/java/org/springblade/modules/house/service/impl/HouseholdServiceImpl.java
index 2b23e3f..0ed19f7 100644
--- a/src/main/java/org/springblade/modules/house/service/impl/HouseholdServiceImpl.java
+++ b/src/main/java/org/springblade/modules/house/service/impl/HouseholdServiceImpl.java
@@ -18,22 +18,18 @@
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.apache.logging.log4j.util.Strings;
 import org.springblade.common.node.TreeStringNode;
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.utils.BeanUtil;
 import org.springblade.modules.grid.service.IGridService;
-import org.springblade.modules.grid.vo.GridVO;
 import org.springblade.modules.house.entity.HouseholdEntity;
 import org.springblade.modules.house.excel.HouseHoldExcel;
 import org.springblade.modules.house.mapper.HouseholdMapper;
 import org.springblade.modules.house.service.IHouseholdService;
 import org.springblade.modules.house.vo.HouseholdOtherVO;
 import org.springblade.modules.house.vo.HouseholdVO;
-import org.springblade.modules.place.vo.PlaceVO;
 import org.springblade.modules.system.entity.DictBiz;
 import org.springblade.modules.system.entity.User;
 import org.springblade.modules.system.service.IDictBizService;
@@ -41,6 +37,7 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.StopWatch;
 
 import java.util.*;
 
@@ -64,16 +61,23 @@
 
 	@Override
 	public IPage<HouseholdVO> selectHouseholdPage(IPage<HouseholdVO> page, HouseholdVO household) {
+		StopWatch stopWatch = new StopWatch();
+		stopWatch.start();
+// doInsert();
+// 执行业务等
+
 		List<HouseholdVO> householdVOS = baseMapper.selectHouseholdPage(page, household);
 		// 遍历
-		for (HouseholdVO householdVO : householdVOS) {
-			// 设置对应的网格名称
-			GridVO gridVO = gridService.getGridDetailByHouseCode(householdVO.getHouseCode());
-			if (null!= gridVO){
-				householdVO.setGridName(gridVO.getGridName());
-			}
-		}
+		// for (HouseholdVO householdVO : householdVOS) {
+		// 	// 设置对应的网格名称
+		// 	GridVO gridVO = gridService.getGridDetailByHouseCode(householdVO.getHouseCode());
+		// 	if (null!= gridVO){
+		// 		householdVO.setGridName(gridVO.getGridName());
+		// 	}
+		// }
 		// 返回
+		stopWatch.stop();
+		System.out.println("selectHouseholdPage:" + stopWatch.getTotalTimeMillis());
 		return page.setRecords(householdVOS);
 	}
 
diff --git a/src/main/java/org/springblade/modules/house/vo/HouseRentalVO.java b/src/main/java/org/springblade/modules/house/vo/HouseRentalVO.java
index 1419f80..669ab8e 100644
--- a/src/main/java/org/springblade/modules/house/vo/HouseRentalVO.java
+++ b/src/main/java/org/springblade/modules/house/vo/HouseRentalVO.java
@@ -16,6 +16,7 @@
  */
 package org.springblade.modules.house.vo;
 
+import io.swagger.annotations.ApiModelProperty;
 import org.springblade.modules.house.entity.HouseRentalEntity;
 import org.springblade.core.tool.node.INode;
 import lombok.Data;
@@ -50,4 +51,10 @@
 	 */
 	private List<HouseholdVO> householdVOList = new ArrayList<>();
 
+	@ApiModelProperty("开始时间")
+	private String startTime;
+
+	@ApiModelProperty("结束时间")
+	private String endTime;
+
 }
diff --git a/src/main/java/org/springblade/modules/house/vo/HouseholdVO.java b/src/main/java/org/springblade/modules/house/vo/HouseholdVO.java
index e057196..0a711c9 100644
--- a/src/main/java/org/springblade/modules/house/vo/HouseholdVO.java
+++ b/src/main/java/org/springblade/modules/house/vo/HouseholdVO.java
@@ -16,6 +16,7 @@
  */
 package org.springblade.modules.house.vo;
 
+import io.swagger.annotations.ApiModelProperty;
 import org.springblade.modules.house.entity.HouseholdEntity;
 import org.springblade.core.tool.node.INode;
 import lombok.Data;
@@ -68,4 +69,10 @@
 	 */
 	private List<HouseholdLabelVO> householdLabelList = new ArrayList<>();
 
+	@ApiModelProperty("开始时间")
+	private String startTime;
+
+	@ApiModelProperty("结束时间")
+	private String endTime;
+
 }
diff --git a/src/main/java/org/springblade/modules/task/mapper/TaskReportForRepairsMapper.xml b/src/main/java/org/springblade/modules/task/mapper/TaskReportForRepairsMapper.xml
index c000980..1145a76 100644
--- a/src/main/java/org/springblade/modules/task/mapper/TaskReportForRepairsMapper.xml
+++ b/src/main/java/org/springblade/modules/task/mapper/TaskReportForRepairsMapper.xml
@@ -46,6 +46,9 @@
         <if test="vo.viewType != null">
             AND jtrfr.view_type = #{vo.viewType}
         </if>
+        <if test="vo.startTime != null and vo.startTime != '' and vo.endTime != null and vo.endTime != '' ">
+            AND jtrfr.create_time BETWEEN #{vo.startTime} and #{vo.endTime}
+        </if>
         <if test="vo.roleName!=null and vo.roleName!=''">
             <if test="vo.roleName=='网格员'">
                 <choose>
diff --git a/src/main/java/org/springblade/modules/task/vo/TaskReportForRepairsVO.java b/src/main/java/org/springblade/modules/task/vo/TaskReportForRepairsVO.java
index d07ba71..9d1ff9b 100644
--- a/src/main/java/org/springblade/modules/task/vo/TaskReportForRepairsVO.java
+++ b/src/main/java/org/springblade/modules/task/vo/TaskReportForRepairsVO.java
@@ -16,6 +16,7 @@
  */
 package org.springblade.modules.task.vo;
 
+import io.swagger.annotations.ApiModelProperty;
 import org.springblade.modules.task.entity.TaskReportForRepairsEntity;
 import org.springblade.core.tool.node.INode;
 import lombok.Data;
@@ -42,4 +43,10 @@
 	 */
 	private String roleName;
 
+	@ApiModelProperty("开始时间")
+	private String startTime;
+
+	@ApiModelProperty("结束时间")
+	private String endTime;
+
 }

--
Gitblit v1.9.3