mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-11-04 04:08:43 +08:00 
			
		
		
		
	修复引入多租户后,前端 <img /> 读取图片报错的问题
This commit is contained in:
		@@ -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);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -58,7 +58,7 @@ public class InfFileCoreServiceImpl implements InfFileCoreService {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public InfFileDO getFile(String path) {
 | 
			
		||||
        return fileMapper.selectById(path);
 | 
			
		||||
        return fileMapper.selectByPath(path);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user