class AttachFileServiceImpl implements AttachFileService {

    @Autowired
    private AttachFileMapper attachFileMapper;

    @Autowired
    private Environment environment;

    @Autowired
    private MinioTemplate minioTemplate;

    @Override
    public PageVO<AttachFileVO> page(PageDTO pageDTO, String fileName, Long fileGroupId) {
        return PageUtil.doPage(pageDTO, () -> attachFileMapper.list(fileName, AuthUserContext.get().getTenantId(), fileGroupId));
    }

    @Override
    public void save(List<AttachFile> attachFiles) {
        attachFileMapper.save(attachFiles, AuthUserContext.get().getTenantId());
    }

    @Override
    public void update(AttachFile attachFile) {
        attachFileMapper.update(attachFile);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void deleteById(Long fileId) {
        AttachFile attachFile = attachFileMapper.getById(fileId);
        deleteFile(attachFile.getFilePath());
        attachFileMapper.deleteById(fileId);
    }

    @Override
    public Boolean updateFileName(AttachFile attachFile) {
        if (Objects.isNull(attachFile.getFileName()) && Objects.isNull(attachFile.getAttachFileGroupId())) {
            return Boolean.TRUE;
        }
        attachFileMapper.update(attachFile);
        return Boolean.TRUE;
    }

    /**
     * 根据文件路径，删除文件
     * @param filePath 文件路径
     */
    public void deleteFile(String filePath){<FILL_FUNCTION_BODY>}
}

        // 获取文件的实际路径--数据库中保存的文件路径为： / + 实际的文件路径
        if (StrUtil.isNotBlank(filePath)) {
            filePath = filePath.substring(1);
        }
        try {
            minioTemplate.removeObject(filePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
    
<no_super_class>