楼栋拼接字符串

develop
Angel 10 months ago
parent d42629f210
commit fd9650eafd

@ -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<MetaRealEstateInfo> list(MetaRealEstateInfo metaRealEstateInfo) {
startPage();
List<MetaRealEstateInfo> list = metaRealEstateInfoService.list(new QueryWrapper<>(metaRealEstateInfo));
return getDataTable(list);
// Create a new list of DTOs
List<MetaRealEstateInfoDTO> 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

@ -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;
}
}
Loading…
Cancel
Save