use of com.zyd.blog.business.entity.File 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;
}
use of com.zyd.blog.business.entity.File 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);
}
use of com.zyd.blog.business.entity.File 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));
}
use of com.zyd.blog.business.entity.File in project OneBlog by zhangyd-c.
the class BizFileServiceImpl method remove.
@Override
@Transactional(rollbackFor = Exception.class)
public void remove(Long[] ids) {
for (Long id : ids) {
File oldFile = this.getByPrimaryKey(id);
this.removeByPrimaryKey(id);
try {
FileUploader uploader = new GlobalFileUploader();
uploader.delete(oldFile.getFilePath(), oldFile.getUploadType());
} catch (Exception ignored) {
}
}
}
use of com.zyd.blog.business.entity.File 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;
}
Aggregations