zhanghua
2025-04-14 1cad14bca191807e18705c3a5526eda8151be439
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>
@@ -30,6 +38,24 @@
        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));
    }
    @Override
    public void deleteByCaseId(Long caseId, String handType) {
        LambdaQueryWrapper<ImageResources> wrapper = new QueryWrapper<ImageResources>().lambda().eq(ImageResources::getBelongToId, caseId).eq(ImageResources::getType, handType);
        imageResourcesMapper.delete(wrapper);
    }
}