Search in sources :

Example 1 with BizFile

use of com.zyd.blog.persistence.beans.BizFile in project OneBlog by zhangyd-c.

the class BizFileServiceImpl method findPageBreakByCondition.

@Override
public PageInfo<File> findPageBreakByCondition(FileConditionVO vo) {
    PageHelper.startPage(vo.getPageNumber(), vo.getPageSize());
    List<BizFile> list = shopFileMapper.findPageBreakByCondition(vo);
    List<File> boList = getFiles(list);
    if (boList == null)
        return null;
    PageInfo bean = new PageInfo<BizFile>(list);
    bean.setList(boList);
    return bean;
}
Also used : PageInfo(com.github.pagehelper.PageInfo) BizFile(com.zyd.blog.persistence.beans.BizFile) MultipartFile(org.springframework.web.multipart.MultipartFile) File(com.zyd.blog.business.entity.File) BizFile(com.zyd.blog.persistence.beans.BizFile)

Example 2 with BizFile

use of com.zyd.blog.persistence.beans.BizFile in project OneBlog by zhangyd-c.

the class BizFileServiceImpl method getByPrimaryKey.

@Override
public File getByPrimaryKey(Long primaryKey) {
    Assert.notNull(primaryKey, "Invalid parameter");
    BizFile entity = shopFileMapper.selectByPrimaryKey(primaryKey);
    return new File(entity);
}
Also used : BizFile(com.zyd.blog.persistence.beans.BizFile) MultipartFile(org.springframework.web.multipart.MultipartFile) File(com.zyd.blog.business.entity.File) BizFile(com.zyd.blog.persistence.beans.BizFile)

Example 3 with BizFile

use of com.zyd.blog.persistence.beans.BizFile in project OneBlog by zhangyd-c.

the class BizFileServiceImpl method selectFileByPathAndUploadType.

@Override
public File selectFileByPathAndUploadType(String filePath, String uploadType) {
    if (StringUtils.isEmpty(filePath)) {
        return null;
    }
    BizFile file = new BizFile();
    file.setFilePath(filePath);
    if (StringUtils.isEmpty(uploadType)) {
        file.setUploadType(uploadType);
    }
    List<BizFile> fileList = shopFileMapper.select(file);
    return CollectionUtils.isEmpty(fileList) ? null : new File(fileList.get(0));
}
Also used : BizFile(com.zyd.blog.persistence.beans.BizFile) MultipartFile(org.springframework.web.multipart.MultipartFile) File(com.zyd.blog.business.entity.File) BizFile(com.zyd.blog.persistence.beans.BizFile)

Example 4 with BizFile

use of com.zyd.blog.persistence.beans.BizFile in project OneBlog by zhangyd-c.

the class BaseFileUploader method saveFile.

VirtualFile saveFile(VirtualFile virtualFile, boolean save, String uploadType) {
    if (save) {
        BizFileService fileService = SpringContextHolder.getBean(BizFileService.class);
        try {
            SysConfigService configService = SpringContextHolder.getBean(SysConfigService.class);
            Map<String, Object> config = configService.getConfigs();
            String storageType = (String) config.get(ConfigKeyEnum.STORAGE_TYPE.getKey());
            BizFile fileInfo = BeanConvertUtil.doConvert(virtualFile, BizFile.class);
            User sessionUser = SessionUtil.getUser();
            fileInfo.setUserId(null == sessionUser ? null : sessionUser.getId());
            fileInfo.setUploadType(uploadType);
            fileInfo.setStorageType(storageType);
            fileService.insert(new File(fileInfo));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    return virtualFile;
}
Also used : User(com.zyd.blog.business.entity.User) SysConfigService(com.zyd.blog.business.service.SysConfigService) BizFileService(com.zyd.blog.business.service.BizFileService) VirtualFile(com.zyd.blog.file.entity.VirtualFile) BizFile(com.zyd.blog.persistence.beans.BizFile) File(com.zyd.blog.business.entity.File) ZhydException(com.zyd.blog.framework.exception.ZhydException) GlobalFileException(com.zyd.blog.file.exception.GlobalFileException) BizFile(com.zyd.blog.persistence.beans.BizFile)

Aggregations

File (com.zyd.blog.business.entity.File)4 BizFile (com.zyd.blog.persistence.beans.BizFile)4 MultipartFile (org.springframework.web.multipart.MultipartFile)3 PageInfo (com.github.pagehelper.PageInfo)1 User (com.zyd.blog.business.entity.User)1 BizFileService (com.zyd.blog.business.service.BizFileService)1 SysConfigService (com.zyd.blog.business.service.SysConfigService)1 VirtualFile (com.zyd.blog.file.entity.VirtualFile)1 GlobalFileException (com.zyd.blog.file.exception.GlobalFileException)1 ZhydException (com.zyd.blog.framework.exception.ZhydException)1