From fd9650eafdd0075d075e19b0d45abe202e31dd28 Mon Sep 17 00:00:00 2001 From: Angel <1050374295@qq.com> Date: Wed, 10 Jan 2024 16:52:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A5=BC=E6=A0=8B=E6=8B=BC=E6=8E=A5=E5=AD=97?= =?UTF-8?q?=E7=AC=A6=E4=B8=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MetaRealEstateInfoController.java | 26 ++++++++++++++++++- .../domain/dto/MetaRealEstateInfoDTO.java | 16 ++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 gather-app/src/main/java/com/ruoyi/database/domain/dto/MetaRealEstateInfoDTO.java diff --git a/gather-app/src/main/java/com/ruoyi/database/controller/MetaRealEstateInfoController.java b/gather-app/src/main/java/com/ruoyi/database/controller/MetaRealEstateInfoController.java index 5dd2192..ff10074 100644 --- a/gather-app/src/main/java/com/ruoyi/database/controller/MetaRealEstateInfoController.java +++ b/gather-app/src/main/java/com/ruoyi/database/controller/MetaRealEstateInfoController.java @@ -3,6 +3,7 @@ package com.ruoyi.database.controller; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.ruoyi.database.domain.MetaRealEstateInfo; +import com.ruoyi.database.domain.dto.MetaRealEstateInfoDTO; import com.ruoyi.database.service.MetaRealEstateInfoService; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; @@ -13,10 +14,12 @@ import com.ruoyi.common.utils.poi.ExcelUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; +import org.springframework.beans.BeanUtils; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; import java.util.List; /** @@ -38,7 +41,28 @@ public class MetaRealEstateInfoController extends BaseController { public TableDataInfo list(MetaRealEstateInfo metaRealEstateInfo) { startPage(); List list = metaRealEstateInfoService.list(new QueryWrapper<>(metaRealEstateInfo)); - return getDataTable(list); + + // Create a new list of DTOs + List resultList = new ArrayList<>(); + + for (MetaRealEstateInfo info : list) { + // 检查realEstateAddress是否包含"独立商铺",如果是则跳过这些记录 + if (info.getRealEstateAddress() != null && info.getRealEstateAddress().contains("独立商铺")) { + continue; // 跳过包含"独立商铺"的记录 + } + + MetaRealEstateInfoDTO dto = new MetaRealEstateInfoDTO(); + // Copy existing fields + BeanUtils.copyProperties(info, dto); + + // Concatenate realEstateBriefAddress and buildingName and add "幢" + String concatenatedAddress = info.getRealEstateBriefAddress() + info.getBuildingName() + "幢"; + dto.setConcatenatedAddress(concatenatedAddress); + + // Add DTO to the result list + resultList.add(dto); + } + return getDataTable(resultList); } @PostMapping diff --git a/gather-app/src/main/java/com/ruoyi/database/domain/dto/MetaRealEstateInfoDTO.java b/gather-app/src/main/java/com/ruoyi/database/domain/dto/MetaRealEstateInfoDTO.java new file mode 100644 index 0000000..79b075b --- /dev/null +++ b/gather-app/src/main/java/com/ruoyi/database/domain/dto/MetaRealEstateInfoDTO.java @@ -0,0 +1,16 @@ +package com.ruoyi.database.domain.dto; + +import com.ruoyi.database.domain.MetaRealEstateInfo; + +public class MetaRealEstateInfoDTO extends MetaRealEstateInfo { + private String concatenatedAddress; + + // getters and setters for the new field + public String getConcatenatedAddress() { + return concatenatedAddress; + } + + public void setConcatenatedAddress(String concatenatedAddress) { + this.concatenatedAddress = concatenatedAddress; + } +}