|
|
@ -18,6 +18,7 @@ package org.springblade.resource.builder.oss; |
|
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springblade.core.cache.utils.CacheUtil; |
|
|
|
import org.springblade.core.cache.utils.CacheUtil; |
|
|
|
import org.springblade.core.log.exception.ServiceException; |
|
|
|
import org.springblade.core.log.exception.ServiceException; |
|
|
|
import org.springblade.core.oss.OssTemplate; |
|
|
|
import org.springblade.core.oss.OssTemplate; |
|
|
@ -44,6 +45,7 @@ import static org.springblade.core.cache.constant.CacheConstant.RESOURCE_CACHE; |
|
|
|
* |
|
|
|
* |
|
|
|
* @author Chill |
|
|
|
* @author Chill |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Slf4j |
|
|
|
public class OssBuilder { |
|
|
|
public class OssBuilder { |
|
|
|
|
|
|
|
|
|
|
|
public static final String OSS_CODE = "oss:code:"; |
|
|
|
public static final String OSS_CODE = "oss:code:"; |
|
|
@ -123,10 +125,13 @@ public class OssBuilder { |
|
|
|
* @return Oss |
|
|
|
* @return Oss |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public Oss getOss(String tenantId, String code) { |
|
|
|
public Oss getOss(String tenantId, String code) { |
|
|
|
|
|
|
|
log.info(">>>>>>> tenantId ={}",tenantId); |
|
|
|
|
|
|
|
log.info(">>>>>>> code ={}",code); |
|
|
|
String key = tenantId; |
|
|
|
String key = tenantId; |
|
|
|
LambdaQueryWrapper<Oss> lqw = Wrappers.<Oss>query().lambda().eq(Oss::getTenantId, tenantId); |
|
|
|
LambdaQueryWrapper<Oss> lqw = Wrappers.<Oss>query().lambda().eq(Oss::getTenantId, tenantId); |
|
|
|
// 获取传参的资源编号并查询,若有则返回,若没有则调启用的配置
|
|
|
|
// 获取传参的资源编号并查询,若有则返回,若没有则调启用的配置
|
|
|
|
String ossCode = StringUtil.isBlank(code) ? WebUtil.getParameter(OSS_PARAM_KEY) : code; |
|
|
|
String ossCode = StringUtil.isBlank(code) ? WebUtil.getParameter(OSS_PARAM_KEY) : code; |
|
|
|
|
|
|
|
log.info(">>>>>>> ossCode ={}",ossCode); |
|
|
|
if (StringUtil.isNotBlank(ossCode)) { |
|
|
|
if (StringUtil.isNotBlank(ossCode)) { |
|
|
|
key = key.concat(StringPool.DASH).concat(ossCode); |
|
|
|
key = key.concat(StringPool.DASH).concat(ossCode); |
|
|
|
lqw.eq(Oss::getOssCode, ossCode); |
|
|
|
lqw.eq(Oss::getOssCode, ossCode); |
|
|
|