From ca070436770f715572405880cfe548c02f639c73 Mon Sep 17 00:00:00 2001 From: 无关风月 <443237572@qq.com> Date: 星期三, 01 一月 2025 10:08:31 +0800 Subject: [PATCH] 代码修改 --- ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TIndexMenuServiceImpl.java | 29 +++++++++++++++++++++++++---- 1 files changed, 25 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 90fea1f..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,17 +1,22 @@ 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; import com.ruoyi.system.domain.TIndexMenu; +import com.ruoyi.system.domain.TTitleMajor; import com.ruoyi.system.dto.AllertTitleDto; import com.ruoyi.system.mapper.TIndexMenuMapper; +import com.ruoyi.system.mapper.TTitleMajorMapper; import com.ruoyi.system.service.TIndexMenuService; +import com.ruoyi.system.service.TTitleMajorService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.time.LocalDate; -import java.util.Collections; -import java.util.List; -import java.util.Map; +import java.util.*; +import java.util.stream.Collectors; /** * <p> @@ -24,9 +29,25 @@ @Service public class TIndexMenuServiceImpl extends ServiceImpl<TIndexMenuMapper, TIndexMenu> implements TIndexMenuService { + @Autowired + private TTitleMajorMapper titleMajorMapper; + @Override public List<AllertTitleDto> allert(List<String> cityCode) { - return this.baseMapper.allert(cityCode); + List<AllertTitleDto> allert = new ArrayList<>(); + List<String> strings = new ArrayList<>(); + for (String s : cityCode) { + 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 = tTitleMajorList.stream().filter(e -> e.getTechnicalId().equals(allertTitleDto.getId())).collect(Collectors.toList()); + allertTitleDto.setChildren(tTitleMajors); + } + return allert; } @Override -- Gitblit v1.7.1