From b94fffb01c94100b34e2908b4fe79c1c554b0912 Mon Sep 17 00:00:00 2001 From: xuhy <3313886187@qq.com> Date: 星期四, 02 一月 2025 13:55:03 +0800 Subject: [PATCH] 代码 --- ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TIndexMenuServiceImpl.java | 13 +++++++++---- 1 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TIndexMenuServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TIndexMenuServiceImpl.java index d7eac65..8da223a 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TIndexMenuServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TIndexMenuServiceImpl.java @@ -1,5 +1,6 @@ package com.ruoyi.system.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -15,6 +16,7 @@ import java.time.LocalDate; import java.util.*; +import java.util.stream.Collectors; /** * <p> @@ -33,13 +35,16 @@ @Override public List<AllertTitleDto> allert(List<String> cityCode) { List<AllertTitleDto> allert = new ArrayList<>(); + List<String> strings = new ArrayList<>(); for (String s : cityCode) { - List<AllertTitleDto> allert1 = this.baseMapper.allert(Collections.singletonList(s)); - allert.addAll(allert1); + strings.add(s); } + List<AllertTitleDto> allert1 = this.baseMapper.allert(strings); + allert.addAll(allert1); + allert = allert.stream().distinct().collect(Collectors.toList()); + List<TTitleMajor> tTitleMajorList = titleMajorMapper.selectList(new LambdaQueryWrapper<TTitleMajor>()); for (AllertTitleDto allertTitleDto : allert) { - List<TTitleMajor> tTitleMajors = titleMajorMapper.selectList(Wrappers.lambdaQuery(TTitleMajor.class) - .eq(TTitleMajor::getTechnicalId, allertTitleDto.getId())); + List<TTitleMajor> tTitleMajors = tTitleMajorList.stream().filter(e -> e.getTechnicalId().equals(allertTitleDto.getId())).collect(Collectors.toList()); allertTitleDto.setChildren(tTitleMajors); } return allert; -- Gitblit v1.7.1