From a4cd4c2d98392cd1036f36b96c262878743a7e63 Mon Sep 17 00:00:00 2001 From: zhanghua <314079846@qq.com> Date: 星期四, 05 九月 2024 19:52:22 +0800 Subject: [PATCH] Merge branch 'master' of http://42.193.1.25:9521/r/sccg_server --- ycl-platform/src/main/java/com/ycl/service/resources/impl/ImageResourcesServiceImpl.java | 23 +++++++++++++++++++++-- 1 files changed, 21 insertions(+), 2 deletions(-) diff --git a/ycl-platform/src/main/java/com/ycl/service/resources/impl/ImageResourcesServiceImpl.java b/ycl-platform/src/main/java/com/ycl/service/resources/impl/ImageResourcesServiceImpl.java index 1e06397..394120d 100644 --- a/ycl-platform/src/main/java/com/ycl/service/resources/impl/ImageResourcesServiceImpl.java +++ b/ycl-platform/src/main/java/com/ycl/service/resources/impl/ImageResourcesServiceImpl.java @@ -1,6 +1,9 @@ package com.ycl.service.resources.impl; +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ycl.entity.resources.ImageResources; @@ -10,6 +13,11 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; /** * <p> @@ -26,10 +34,21 @@ ImageResourcesMapper imageResourcesMapper; @Override - public Page<MediaVO> selectImages(Integer type, String startTime, String endTime, Long size, Long current) { + public Page<MediaVO> selectImages(String type, String startTime, String endTime, Long size, Long current) { Page<MediaVO> imagesVOPage = new Page<>(); imagesVOPage.setCurrent(current); imagesVOPage.setSize(size); - return imageResourcesMapper.selectImagePage(imagesVOPage,type,startTime,endTime); + return imageResourcesMapper.selectImagePage(imagesVOPage, type, startTime, endTime); } + + @Override + public Map<Long, String> getUrlMap(Collection<Long> ids, String type) { + LambdaQueryWrapper<ImageResources> wrapper = new QueryWrapper<ImageResources>().lambda().in(ImageResources::getBelongToId, ids).eq(ImageResources::getType, type); + List<ImageResources> list = imageResourcesMapper.selectList(wrapper); + if (CollUtil.isEmpty(list)) { + return new HashMap<>(); + } + return list.stream().collect(Collectors.toMap(ImageResources::getBelongToId, ImageResources::getUrl, (v1, v2) -> v1)); + } + } -- Gitblit v1.8.0