提交 069cd96f authored 作者: Whispa's avatar Whispa

commit

上级 6f894555
......@@ -197,12 +197,15 @@ public class PostController {
return "deleted";
}
@Transactional(isolation = Isolation.READ_COMMITTED)
@Transactional()
@PostMapping("/upload")
public List<String> handleFileUpload(@RequestParam("files") MultipartFile[] files, @RequestParam("thumbs") MultipartFile[] thumbs, @ModelAttribute("Post") Post post,
public List<String> handleFileUpload(@RequestParam("files") MultipartFile[] files, @RequestParam("thumbs") MultipartFile[] thumbs, @ModelAttribute("Post") Post ePost,
RedirectAttributes redirectAttributes) throws IOException {
Post post = new Post();
TbCfUserInfo user = this.user.user();
post.setUser(user);
post.setDescription(ePost.getDescription());
post.setTitle(ePost.getTitle());
//repository.save(post);
List<String> list = new ArrayList<>();
List<String> thumbList = new ArrayList<>();
......@@ -244,9 +247,9 @@ public class PostController {
List<JsonTag> tags = null;
List<Hashtag> hashtags = null;
try {
tags = mapper.readValue(post.getTags(), new TypeReference<List<JsonTag>>() {
tags = mapper.readValue(ePost.getTags(), new TypeReference<List<JsonTag>>() {
});
hashtags = mapper.readValue(post.getHashtags(), new TypeReference<List<Hashtag>>() {
hashtags = mapper.readValue(ePost.getHashtags(), new TypeReference<List<Hashtag>>() {
});
} catch (JsonProcessingException e) {
System.out.println(e.getMessage());
......
......@@ -49,7 +49,8 @@ public class TbCfHomePageEntityController {
@GetMapping("home/listPosts/recommend")
public List<Post> postList2(@RequestParam(value = "userId",required = false) String id, @RequestParam(value = "pageNo") Integer pageNo, @RequestParam(value = "pageSize") Integer pageSize) {
Optional<TbCfUserInfo> byId = userRepository.findById(id);
//Optional<TbCfUserInfo> byId = userRepository.findById(id);
//if( !byId.isPresent() ) return new ArrayList<>();
return postRepository.findAllByOrderByCreateDateDesc(PageRequest.of(pageNo, pageSize)).toList();
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论