From f4c181608411d60293c836621dc90b9120e3a451 Mon Sep 17 00:00:00 2001 From: JaneYork <janeyork1314@163.com> Date: 星期五, 22 七月 2022 15:27:00 +0800 Subject: [PATCH] 主动设置文件公共读,适配天翼云OSS 主动设置文件公共读,适配天翼云OSS。 天翼云,即便bucket设置公共读,文件默认也是private,除非手动设置,详见天翼云:https://console.xstore.ctyun.cn/doc/store/sdk/java/objectOperation/putObject.html 已测试: 所有兼容S3协议的OSS,已测试:阿里云、腾讯云、百度、京东、天翼、自建Minio、七牛 --- ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysNoticeServiceImpl.java | 35 ++++++++++++++++++++--------------- 1 files changed, 20 insertions(+), 15 deletions(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysNoticeServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysNoticeServiceImpl.java index 5c7f623..73a6736 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysNoticeServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysNoticeServiceImpl.java @@ -1,13 +1,14 @@ package com.ruoyi.system.service.impl; -import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ruoyi.common.core.domain.PageQuery; import com.ruoyi.common.core.page.TableDataInfo; -import com.ruoyi.common.utils.PageUtils; +import com.ruoyi.common.utils.StringUtils; import com.ruoyi.system.domain.SysNotice; import com.ruoyi.system.mapper.SysNoticeMapper; import com.ruoyi.system.service.ISysNoticeService; +import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import java.util.Arrays; @@ -16,18 +17,22 @@ /** * 鍏憡 鏈嶅姟灞傚疄鐜� * - * @author ruoyi + * @author Lion Li */ +@RequiredArgsConstructor @Service -public class SysNoticeServiceImpl extends ServicePlusImpl<SysNoticeMapper, SysNotice, SysNotice> implements ISysNoticeService { +public class SysNoticeServiceImpl implements ISysNoticeService { + + private final SysNoticeMapper baseMapper; @Override - public TableDataInfo<SysNotice> selectPageNoticeList(SysNotice notice) { + public TableDataInfo<SysNotice> selectPageNoticeList(SysNotice notice, PageQuery pageQuery) { LambdaQueryWrapper<SysNotice> lqw = new LambdaQueryWrapper<SysNotice>() - .like(StrUtil.isNotBlank(notice.getNoticeTitle()), SysNotice::getNoticeTitle, notice.getNoticeTitle()) - .eq(StrUtil.isNotBlank(notice.getNoticeType()), SysNotice::getNoticeType, notice.getNoticeType()) - .like(StrUtil.isNotBlank(notice.getCreateBy()), SysNotice::getCreateBy, notice.getCreateBy()); - return PageUtils.buildDataInfo(page(PageUtils.buildPage(),lqw)); + .like(StringUtils.isNotBlank(notice.getNoticeTitle()), SysNotice::getNoticeTitle, notice.getNoticeTitle()) + .eq(StringUtils.isNotBlank(notice.getNoticeType()), SysNotice::getNoticeType, notice.getNoticeType()) + .like(StringUtils.isNotBlank(notice.getCreateBy()), SysNotice::getCreateBy, notice.getCreateBy()); + Page<SysNotice> page = baseMapper.selectPage(pageQuery.build(), lqw); + return TableDataInfo.build(page); } /** @@ -38,7 +43,7 @@ */ @Override public SysNotice selectNoticeById(Long noticeId) { - return getById(noticeId); + return baseMapper.selectById(noticeId); } /** @@ -49,10 +54,10 @@ */ @Override public List<SysNotice> selectNoticeList(SysNotice notice) { - return list(new LambdaQueryWrapper<SysNotice>() - .like(StrUtil.isNotBlank(notice.getNoticeTitle()),SysNotice::getNoticeTitle,notice.getNoticeTitle()) - .eq(StrUtil.isNotBlank(notice.getNoticeType()),SysNotice::getNoticeType,notice.getNoticeType()) - .like(StrUtil.isNotBlank(notice.getCreateBy()),SysNotice::getCreateBy,notice.getCreateBy())); + return baseMapper.selectList(new LambdaQueryWrapper<SysNotice>() + .like(StringUtils.isNotBlank(notice.getNoticeTitle()), SysNotice::getNoticeTitle, notice.getNoticeTitle()) + .eq(StringUtils.isNotBlank(notice.getNoticeType()), SysNotice::getNoticeType, notice.getNoticeType()) + .like(StringUtils.isNotBlank(notice.getCreateBy()), SysNotice::getCreateBy, notice.getCreateBy())); } /** -- Gitblit v1.9.3