修复引入多租户后,前端 <img /> 读取图片报错的问题

This commit is contained in:
YunaiV
2021-12-15 13:08:15 +08:00
parent b99f364d92
commit abf61bfdea
6 changed files with 671 additions and 727 deletions

View File

@ -2,11 +2,27 @@ package cn.iocoder.yudao.coreservice.modules.infra.dal.mysql.file;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.file.InfFileDO;
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface InfFileCoreMapper extends BaseMapperX<InfFileDO> {
default Integer selectCountById(String id) {
return selectCount("id", id);
}
/**
* 基于 Path 获取文件
* 实际上,是基于 ID 查询
* 由于前端使用 <img /> 的方式获取图片,所以需要忽略租户的查询
*
* @param path 路径
* @return 文件
*/
@InterceptorIgnore(tenantLine = "true")
default InfFileDO selectByPath(String path) {
return selectById(path);
}
}

View File

@ -58,7 +58,7 @@ public class InfFileCoreServiceImpl implements InfFileCoreService {
@Override
public InfFileDO getFile(String path) {
return fileMapper.selectById(path);
return fileMapper.selectByPath(path);
}
}