11 changed files with 672 additions and 2 deletions
@ -0,0 +1,115 @@ |
|||
package org.dromara.demo.controller; |
|||
|
|||
import java.util.List; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import lombok.RequiredArgsConstructor; |
|||
import jakarta.servlet.http.HttpServletResponse; |
|||
import jakarta.validation.constraints.*; |
|||
import cn.dev33.satoken.annotation.SaCheckPermission; |
|||
import org.dromara.demo.domain.AreaInfo; |
|||
import org.dromara.demo.domain.vo.AreaInfoFinalVo; |
|||
import org.springframework.web.bind.annotation.*; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.dromara.common.idempotent.annotation.RepeatSubmit; |
|||
import org.dromara.common.log.annotation.Log; |
|||
import org.dromara.common.web.core.BaseController; |
|||
import org.dromara.common.mybatis.core.page.PageQuery; |
|||
import org.dromara.common.core.domain.R; |
|||
import org.dromara.common.core.validate.AddGroup; |
|||
import org.dromara.common.core.validate.EditGroup; |
|||
import org.dromara.common.log.enums.BusinessType; |
|||
import org.dromara.common.excel.utils.ExcelUtil; |
|||
import org.dromara.demo.domain.vo.AreaInfoVo; |
|||
import org.dromara.demo.domain.bo.AreaInfoBo; |
|||
import org.dromara.demo.service.IAreaInfoService; |
|||
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|||
|
|||
/** |
|||
* 区域信息 |
|||
* |
|||
* @author GJH |
|||
* @date 2025-08-19 |
|||
*/ |
|||
@Validated |
|||
@RequiredArgsConstructor |
|||
@RestController |
|||
@RequestMapping("/evr/area") |
|||
public class AreaInfoController extends BaseController { |
|||
|
|||
private final IAreaInfoService areaInfoService; |
|||
|
|||
/** |
|||
* 查询区域信息列表 |
|||
*/ |
|||
//@SaCheckPermission("area:area:list")
|
|||
@GetMapping("/list") |
|||
public TableDataInfo<AreaInfoVo> list(AreaInfoBo bo, PageQuery pageQuery) { |
|||
return areaInfoService.queryPageList(bo, pageQuery); |
|||
} |
|||
|
|||
/** |
|||
* 导出区域信息列表 |
|||
*/ |
|||
//@SaCheckPermission("area:area:export")
|
|||
@Log(title = "区域信息", businessType = BusinessType.EXPORT) |
|||
@PostMapping("/export") |
|||
public void export(AreaInfoBo bo, HttpServletResponse response) { |
|||
List<AreaInfoVo> list = areaInfoService.queryList(bo); |
|||
ExcelUtil.exportExcel(list, "区域信息", AreaInfoVo.class, response); |
|||
} |
|||
|
|||
@GetMapping("/getList") |
|||
public R<List<AreaInfoFinalVo>> getList(AreaInfoBo bo) { |
|||
List<AreaInfoFinalVo> rs = areaInfoService.getList(bo); |
|||
return R.ok(rs); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 获取区域信息详细信息 |
|||
* |
|||
* @param id 主键 |
|||
*/ |
|||
//@SaCheckPermission("area:area:query")
|
|||
@GetMapping("/{id}") |
|||
public R<AreaInfoVo> getInfo(@NotNull(message = "主键不能为空") |
|||
@PathVariable String id) { |
|||
return R.ok(areaInfoService.queryById(id)); |
|||
} |
|||
|
|||
/** |
|||
* 新增区域信息 |
|||
*/ |
|||
//@SaCheckPermission("area:area:add")
|
|||
@Log(title = "区域信息", businessType = BusinessType.INSERT) |
|||
@RepeatSubmit() |
|||
@PostMapping() |
|||
public R<Void> add(@Validated(AddGroup.class) @RequestBody AreaInfoBo bo) { |
|||
return toAjax(areaInfoService.insertByBo(bo)); |
|||
} |
|||
|
|||
/** |
|||
* 修改区域信息 |
|||
*/ |
|||
//@SaCheckPermission("area:area:edit")
|
|||
@Log(title = "区域信息", businessType = BusinessType.UPDATE) |
|||
@RepeatSubmit() |
|||
@PutMapping() |
|||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody AreaInfoBo bo) { |
|||
return toAjax(areaInfoService.updateByBo(bo)); |
|||
} |
|||
|
|||
/** |
|||
* 删除区域信息 |
|||
* |
|||
* @param ids 主键串 |
|||
*/ |
|||
//@SaCheckPermission("area:area:remove")
|
|||
@Log(title = "区域信息", businessType = BusinessType.DELETE) |
|||
@DeleteMapping("/{ids}") |
|||
public R<Void> remove(@NotEmpty(message = "主键不能为空") |
|||
@PathVariable String[] ids) { |
|||
return toAjax(areaInfoService.deleteWithValidByIds(List.of(ids), true)); |
|||
} |
|||
} |
@ -0,0 +1,77 @@ |
|||
package org.dromara.demo.domain; |
|||
|
|||
import org.dromara.common.tenant.core.TenantEntity; |
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.io.Serial; |
|||
|
|||
/** |
|||
* 区域信息对象 area_info |
|||
* |
|||
* @author GJH |
|||
* @date 2025-08-19 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@TableName("area_info") |
|||
public class AreaInfo extends TenantEntity { |
|||
|
|||
@Serial |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 主键 |
|||
*/ |
|||
@TableId(value = "id") |
|||
private String id; |
|||
|
|||
/** |
|||
* 控制区 |
|||
*/ |
|||
private String district; |
|||
|
|||
/** |
|||
* 水体 |
|||
*/ |
|||
private String river; |
|||
|
|||
/** |
|||
* 控制断面 |
|||
*/ |
|||
private String controlSection; |
|||
|
|||
/** |
|||
* 目标 |
|||
*/ |
|||
private String goal; |
|||
|
|||
/** |
|||
* 十一五 |
|||
*/ |
|||
private String thirdFive; |
|||
|
|||
/** |
|||
* 十二五 |
|||
*/ |
|||
private String fourthFive; |
|||
|
|||
/** |
|||
* 十三五 |
|||
*/ |
|||
private String fifthFive; |
|||
|
|||
/** |
|||
* 当前状态 |
|||
*/ |
|||
private Long status; |
|||
|
|||
/** |
|||
* 删除标志(0代表存在 2代表删除) |
|||
*/ |
|||
@TableLogic |
|||
private String delFlag; |
|||
|
|||
|
|||
} |
@ -0,0 +1,78 @@ |
|||
package org.dromara.demo.domain.bo; |
|||
|
|||
import org.dromara.demo.domain.AreaInfo; |
|||
import org.dromara.common.mybatis.core.domain.BaseEntity; |
|||
import org.dromara.common.core.validate.AddGroup; |
|||
import org.dromara.common.core.validate.EditGroup; |
|||
import io.github.linpeilie.annotations.AutoMapper; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import jakarta.validation.constraints.*; |
|||
|
|||
/** |
|||
* 区域信息业务对象 area_info |
|||
* |
|||
* @author GJH |
|||
* @date 2025-08-19 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@AutoMapper(target = AreaInfo.class, reverseConvertGenerate = false) |
|||
public class AreaInfoBo extends BaseEntity { |
|||
|
|||
/** |
|||
* 主键 |
|||
*/ |
|||
//@NotBlank(message = "主键不能为空", groups = { EditGroup.class })
|
|||
private String id; |
|||
|
|||
/** |
|||
* 控制区 |
|||
*/ |
|||
//@NotBlank(message = "控制区不能为空", groups = { AddGroup.class, EditGroup.class })
|
|||
private String district; |
|||
|
|||
/** |
|||
* 水体 |
|||
*/ |
|||
//@NotBlank(message = "水体不能为空", groups = { AddGroup.class, EditGroup.class })
|
|||
private String river; |
|||
|
|||
/** |
|||
* 控制断面 |
|||
*/ |
|||
//@NotBlank(message = "控制断面不能为空", groups = { AddGroup.class, EditGroup.class })
|
|||
private String controlSection; |
|||
|
|||
/** |
|||
* 目标 |
|||
*/ |
|||
//@NotBlank(message = "目标不能为空", groups = { AddGroup.class, EditGroup.class })
|
|||
private String goal; |
|||
|
|||
/** |
|||
* 十一五 |
|||
*/ |
|||
//@NotBlank(message = "十一五不能为空", groups = { AddGroup.class, EditGroup.class })
|
|||
private String thirdFive; |
|||
|
|||
/** |
|||
* 十二五 |
|||
*/ |
|||
//@NotBlank(message = "十二五不能为空", groups = { AddGroup.class, EditGroup.class })
|
|||
private String fourthFive; |
|||
|
|||
/** |
|||
* 十三五 |
|||
*/ |
|||
//@NotBlank(message = "十三五不能为空", groups = { AddGroup.class, EditGroup.class })
|
|||
private String fifthFive; |
|||
|
|||
/** |
|||
* 当前状态 |
|||
*/ |
|||
//@NotNull(message = "当前状态不能为空", groups = { AddGroup.class, EditGroup.class })
|
|||
private Long status; |
|||
|
|||
|
|||
} |
@ -0,0 +1,14 @@ |
|||
package org.dromara.demo.domain.vo; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
import java.util.List; |
|||
@Data |
|||
@AllArgsConstructor |
|||
@NoArgsConstructor |
|||
public class AreaInfoFinalVo { |
|||
private List<AreaInfoVo> areaInfo; |
|||
private String description; |
|||
} |
@ -0,0 +1,86 @@ |
|||
package org.dromara.demo.domain.vo; |
|||
|
|||
import org.dromara.demo.domain.AreaInfo; |
|||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
|||
import com.alibaba.excel.annotation.ExcelProperty; |
|||
import org.dromara.common.excel.annotation.ExcelDictFormat; |
|||
import org.dromara.common.excel.convert.ExcelDictConvert; |
|||
import io.github.linpeilie.annotations.AutoMapper; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serial; |
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
|
|||
|
|||
/** |
|||
* 区域信息视图对象 area_info |
|||
* |
|||
* @author GJH |
|||
* @date 2025-08-19 |
|||
*/ |
|||
@Data |
|||
@ExcelIgnoreUnannotated |
|||
@AutoMapper(target = AreaInfo.class) |
|||
public class AreaInfoVo implements Serializable { |
|||
|
|||
@Serial |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 主键 |
|||
*/ |
|||
@ExcelProperty(value = "主键") |
|||
private String id; |
|||
|
|||
/** |
|||
* 控制区 |
|||
*/ |
|||
@ExcelProperty(value = "控制区") |
|||
private String district; |
|||
|
|||
/** |
|||
* 水体 |
|||
*/ |
|||
@ExcelProperty(value = "水体") |
|||
private String river; |
|||
|
|||
/** |
|||
* 控制断面 |
|||
*/ |
|||
@ExcelProperty(value = "控制断面") |
|||
private String controlSection; |
|||
|
|||
/** |
|||
* 目标 |
|||
*/ |
|||
@ExcelProperty(value = "目标") |
|||
private String goal; |
|||
|
|||
/** |
|||
* 十一五 |
|||
*/ |
|||
@ExcelProperty(value = "十一五") |
|||
private String thirdFive; |
|||
|
|||
/** |
|||
* 十二五 |
|||
*/ |
|||
@ExcelProperty(value = "十二五") |
|||
private String fourthFive; |
|||
|
|||
/** |
|||
* 十三五 |
|||
*/ |
|||
@ExcelProperty(value = "十三五") |
|||
private String fifthFive; |
|||
|
|||
/** |
|||
* 当前状态 |
|||
*/ |
|||
@ExcelProperty(value = "当前状态") |
|||
private Long status; |
|||
|
|||
|
|||
} |
@ -0,0 +1,36 @@ |
|||
package org.dromara.demo.listener; |
|||
|
|||
import com.alibaba.excel.context.AnalysisContext; |
|||
import com.alibaba.excel.read.listener.ReadListener; |
|||
import jakarta.annotation.Resource; |
|||
import org.dromara.demo.domain.AreaInfo; |
|||
import org.dromara.demo.domain.bo.AreaInfoBo; |
|||
import org.dromara.demo.domain.bo.ProjectInfoBo; |
|||
import org.dromara.demo.domain.vo.AreaInfoVo; |
|||
import org.dromara.demo.domain.vo.ProjectInfoVo; |
|||
import org.dromara.demo.service.IAreaInfoService; |
|||
import org.dromara.demo.service.IProjectInfoService; |
|||
import org.springframework.beans.BeanUtils; |
|||
|
|||
public class AreaListener implements ReadListener<AreaInfoVo> { |
|||
|
|||
@Resource |
|||
private IAreaInfoService areaInfoService ; |
|||
|
|||
public AreaListener(IAreaInfoService areaInfoService) { |
|||
this.areaInfoService = areaInfoService; |
|||
} |
|||
|
|||
@Override |
|||
public void invoke(AreaInfoVo areaInfoVo, AnalysisContext analysisContext) { |
|||
AreaInfoBo areaInfo = new AreaInfoBo(); |
|||
BeanUtils.copyProperties(areaInfoVo,areaInfo); |
|||
areaInfoService.insertByBo(areaInfo); |
|||
|
|||
} |
|||
|
|||
@Override |
|||
public void doAfterAllAnalysed(AnalysisContext analysisContext) { |
|||
|
|||
} |
|||
} |
@ -0,0 +1,15 @@ |
|||
package org.dromara.demo.mapper; |
|||
|
|||
import org.dromara.demo.domain.AreaInfo; |
|||
import org.dromara.demo.domain.vo.AreaInfoVo; |
|||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; |
|||
|
|||
/** |
|||
* 区域信息Mapper接口 |
|||
* |
|||
* @author GJH |
|||
* @date 2025-08-19 |
|||
*/ |
|||
public interface AreaInfoMapper extends BaseMapperPlus<AreaInfo, AreaInfoVo> { |
|||
|
|||
} |
@ -0,0 +1,71 @@ |
|||
package org.dromara.demo.service; |
|||
|
|||
import org.dromara.demo.domain.vo.AreaInfoFinalVo; |
|||
import org.dromara.demo.domain.vo.AreaInfoVo; |
|||
import org.dromara.demo.domain.bo.AreaInfoBo; |
|||
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|||
import org.dromara.common.mybatis.core.page.PageQuery; |
|||
|
|||
import java.util.Collection; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 区域信息Service接口 |
|||
* |
|||
* @author GJH |
|||
* @date 2025-08-19 |
|||
*/ |
|||
public interface IAreaInfoService { |
|||
|
|||
/** |
|||
* 查询区域信息 |
|||
* |
|||
* @param id 主键 |
|||
* @return 区域信息 |
|||
*/ |
|||
AreaInfoVo queryById(String id); |
|||
|
|||
/** |
|||
* 分页查询区域信息列表 |
|||
* |
|||
* @param bo 查询条件 |
|||
* @param pageQuery 分页参数 |
|||
* @return 区域信息分页列表 |
|||
*/ |
|||
TableDataInfo<AreaInfoVo> queryPageList(AreaInfoBo bo, PageQuery pageQuery); |
|||
|
|||
/** |
|||
* 查询符合条件的区域信息列表 |
|||
* |
|||
* @param bo 查询条件 |
|||
* @return 区域信息列表 |
|||
*/ |
|||
List<AreaInfoVo> queryList(AreaInfoBo bo); |
|||
|
|||
/** |
|||
* 新增区域信息 |
|||
* |
|||
* @param bo 区域信息 |
|||
* @return 是否新增成功 |
|||
*/ |
|||
Boolean insertByBo(AreaInfoBo bo); |
|||
|
|||
/** |
|||
* 修改区域信息 |
|||
* |
|||
* @param bo 区域信息 |
|||
* @return 是否修改成功 |
|||
*/ |
|||
Boolean updateByBo(AreaInfoBo bo); |
|||
|
|||
/** |
|||
* 校验并批量删除区域信息信息 |
|||
* |
|||
* @param ids 待删除的主键集合 |
|||
* @param isValid 是否进行有效性校验 |
|||
* @return 是否删除成功 |
|||
*/ |
|||
Boolean deleteWithValidByIds(Collection<String> ids, Boolean isValid); |
|||
|
|||
List<AreaInfoFinalVo> getList(AreaInfoBo bo); |
|||
} |
@ -0,0 +1,160 @@ |
|||
package org.dromara.demo.service.impl; |
|||
|
|||
import org.dromara.common.core.utils.MapstructUtils; |
|||
import org.dromara.common.core.utils.StringUtils; |
|||
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|||
import org.dromara.common.mybatis.core.page.PageQuery; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|||
import lombok.RequiredArgsConstructor; |
|||
import org.dromara.demo.domain.vo.AreaInfoFinalVo; |
|||
import org.springframework.stereotype.Service; |
|||
import org.dromara.demo.domain.bo.AreaInfoBo; |
|||
import org.dromara.demo.domain.vo.AreaInfoVo; |
|||
import org.dromara.demo.domain.AreaInfo; |
|||
import org.dromara.demo.mapper.AreaInfoMapper; |
|||
import org.dromara.demo.service.IAreaInfoService; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.Collection; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* 区域信息Service业务层处理 |
|||
* |
|||
* @author GJH |
|||
* @date 2025-08-19 |
|||
*/ |
|||
@RequiredArgsConstructor |
|||
@Service |
|||
public class AreaInfoServiceImpl implements IAreaInfoService { |
|||
|
|||
private final AreaInfoMapper baseMapper; |
|||
|
|||
/** |
|||
* 查询区域信息 |
|||
* |
|||
* @param id 主键 |
|||
* @return 区域信息 |
|||
*/ |
|||
@Override |
|||
public AreaInfoVo queryById(String id){ |
|||
return baseMapper.selectVoById(id); |
|||
} |
|||
|
|||
/** |
|||
* 分页查询区域信息列表 |
|||
* |
|||
* @param bo 查询条件 |
|||
* @param pageQuery 分页参数 |
|||
* @return 区域信息分页列表 |
|||
*/ |
|||
@Override |
|||
public TableDataInfo<AreaInfoVo> queryPageList(AreaInfoBo bo, PageQuery pageQuery) { |
|||
LambdaQueryWrapper<AreaInfo> lqw = buildQueryWrapper(bo); |
|||
Page<AreaInfoVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw); |
|||
return TableDataInfo.build(result); |
|||
} |
|||
|
|||
/** |
|||
* 查询符合条件的区域信息列表 |
|||
* |
|||
* @param bo 查询条件 |
|||
* @return 区域信息列表 |
|||
*/ |
|||
@Override |
|||
public List<AreaInfoVo> queryList(AreaInfoBo bo) { |
|||
LambdaQueryWrapper<AreaInfo> lqw = buildQueryWrapper(bo); |
|||
return baseMapper.selectVoList(lqw); |
|||
} |
|||
|
|||
private LambdaQueryWrapper<AreaInfo> buildQueryWrapper(AreaInfoBo bo) { |
|||
Map<String, Object> params = bo.getParams(); |
|||
LambdaQueryWrapper<AreaInfo> lqw = Wrappers.lambdaQuery(); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getDistrict()), AreaInfo::getDistrict, bo.getDistrict()); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getRiver()), AreaInfo::getRiver, bo.getRiver()); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getControlSection()), AreaInfo::getControlSection, bo.getControlSection()); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getGoal()), AreaInfo::getGoal, bo.getGoal()); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getThirdFive()), AreaInfo::getThirdFive, bo.getThirdFive()); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getFourthFive()), AreaInfo::getFourthFive, bo.getFourthFive()); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getFifthFive()), AreaInfo::getFifthFive, bo.getFifthFive()); |
|||
lqw.eq(bo.getStatus() != null, AreaInfo::getStatus, bo.getStatus()); |
|||
return lqw; |
|||
} |
|||
|
|||
/** |
|||
* 新增区域信息 |
|||
* |
|||
* @param bo 区域信息 |
|||
* @return 是否新增成功 |
|||
*/ |
|||
@Override |
|||
public Boolean insertByBo(AreaInfoBo bo) { |
|||
AreaInfo add = MapstructUtils.convert(bo, AreaInfo.class); |
|||
validEntityBeforeSave(add); |
|||
boolean flag = baseMapper.insert(add) > 0; |
|||
if (flag) { |
|||
bo.setId(add.getId()); |
|||
} |
|||
return flag; |
|||
} |
|||
|
|||
/** |
|||
* 修改区域信息 |
|||
* |
|||
* @param bo 区域信息 |
|||
* @return 是否修改成功 |
|||
*/ |
|||
@Override |
|||
public Boolean updateByBo(AreaInfoBo bo) { |
|||
AreaInfo update = MapstructUtils.convert(bo, AreaInfo.class); |
|||
validEntityBeforeSave(update); |
|||
return baseMapper.updateById(update) > 0; |
|||
} |
|||
|
|||
/** |
|||
* 保存前的数据校验 |
|||
*/ |
|||
private void validEntityBeforeSave(AreaInfo entity){ |
|||
//TODO 做一些数据校验,如唯一约束
|
|||
} |
|||
|
|||
/** |
|||
* 校验并批量删除区域信息信息 |
|||
* |
|||
* @param ids 待删除的主键集合 |
|||
* @param isValid 是否进行有效性校验 |
|||
* @return 是否删除成功 |
|||
*/ |
|||
@Override |
|||
public Boolean deleteWithValidByIds(Collection<String> ids, Boolean isValid) { |
|||
if(isValid){ |
|||
//TODO 做一些业务上的校验,判断是否需要校验
|
|||
} |
|||
return baseMapper.deleteByIds(ids) > 0; |
|||
} |
|||
|
|||
@Override |
|||
public List<AreaInfoFinalVo> getList(AreaInfoBo bo) { |
|||
String des = "从“九五~十三五”期间,XX区实际实施项目208项,其中完工168项。累计完成总投资为199.38亿元。\n" + |
|||
"累积完成4座污水处理厂新建与扩建,新建8座调蓄池;管道建设641.45km;河道清淤14.86万m3;生态修复2193.96亩。"; |
|||
|
|||
// 从数据库中获取的所有区域信息
|
|||
List<AreaInfoVo> areaInfoVos = this.queryList(bo); |
|||
|
|||
// 按 district(区域)分组
|
|||
Map<String, List<AreaInfoVo>> groupedByDistrict = areaInfoVos.stream() |
|||
.collect(Collectors.groupingBy(AreaInfoVo::getDistrict)); |
|||
|
|||
// 转换为 List<AreaInfoFinalVo>
|
|||
List<AreaInfoFinalVo> result = new ArrayList<>(); |
|||
for (Map.Entry<String, List<AreaInfoVo>> entry : groupedByDistrict.entrySet()) { |
|||
result.add(new AreaInfoFinalVo(entry.getValue(), des)); // description 先为 null
|
|||
} |
|||
|
|||
return result; |
|||
} |
|||
} |
Loading…
Reference in new issue