use of com.baomidou.mybatisplus.core.toolkit.Wrappers in project shopzz by whoiszxl.
the class FileServiceImpl method delete.
@Override
public void delete(Long[] ids) {
if (ArrayUtils.isEmpty(ids)) {
ExceptionCatcher.catchValidateEx(ResponseResult.buildError("传参无效"));
}
List<FmsFile> fileList = list(Wrappers.<FmsFile>lambdaQuery().in(FmsFile::getId, ids));
if (fileList.isEmpty()) {
ExceptionCatcher.catchValidateEx(ResponseResult.buildError("传参无效"));
}
removeByIds(Arrays.asList(ids));
List<FileDeleteCommand> fileDeleteCommandList = fileList.stream().map(file -> {
FileDeleteCommand deleteCommand = new FileDeleteCommand();
deleteCommand.setRelativePath(file.getRelativePath());
deleteCommand.setFinalFileName(file.getFinalFileName());
deleteCommand.setId(file.getId());
return deleteCommand;
}).collect(Collectors.toList());
fileStrategy.delete(fileDeleteCommandList);
}
Aggregations