feat: 开发中...

This commit is contained in:
2023-03-28 00:49:19 +08:00
parent db8d48a0f0
commit c92f52f67d
3 changed files with 24 additions and 17 deletions

View File

@@ -15,23 +15,23 @@ public class AttachController {
return ResponseVO.success(); return ResponseVO.success();
} }
@PutMapping("/{attachID}/")
public ResponseVO<Void> modifyAttach(@PathVariable String attachID, @RequestBody MultipartFile file) {
return ResponseVO.success();
}
@GetMapping("/{attachID}/") @GetMapping("/{attachID}/")
public ResponseVO<Void> getAttach(@PathVariable String attachID) { public ResponseVO<Void> getAttach(@PathVariable String attachID) {
return ResponseVO.success(); return ResponseVO.success();
} }
@DeleteMapping("/{attachID}/")
public ResponseVO<Void> deleteAttach(@PathVariable String attachID) {
return ResponseVO.success();
}
@GetMapping("/") @GetMapping("/")
public ResponseVO<Void> getAttachList() { public ResponseVO<Void> getAttachList() {
return ResponseVO.success(); return ResponseVO.success();
} }
@PutMapping("/{attachID}/")
public ResponseVO<Void> modifyAttach(@PathVariable String attachID, @RequestBody MultipartFile file) {
return ResponseVO.success();
}
@DeleteMapping("/{attachID}/")
public ResponseVO<Void> deleteAttach(@PathVariable String attachID) {
return ResponseVO.success();
}
} }

View File

@@ -1,10 +1,8 @@
package cn.hamster3.application.blog.dao; package cn.hamster3.application.blog.dao;
import cn.hamster3.application.blog.entity.BlogEntity; import cn.hamster3.application.blog.entity.BlogEntity;
import org.springframework.data.jpa.repository.EntityGraph; import org.springframework.data.jpa.repository.*;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import java.util.Optional; import java.util.Optional;
@@ -12,4 +10,9 @@ public interface BlogRepository extends JpaRepository<BlogEntity, Long>, JpaSpec
@EntityGraph(attributePaths = {"content"}) @EntityGraph(attributePaths = {"content"})
@Query("select b from BlogEntity b where b.id = ?1") @Query("select b from BlogEntity b where b.id = ?1")
Optional<BlogEntity> findByIDWithContent(Long id); Optional<BlogEntity> findByIDWithContent(Long id);
@Transactional
@Modifying
@Query("update BlogEntity b set b.title = ?1, b.abstracts = ?2, b.password = ?3, b.content = ?4 where b.id = ?5")
void updateTitleAndAbstractsAndPasswordAndContentById(String title, String abstracts, String password, String content, Long id);
} }

View File

@@ -67,9 +67,13 @@ public class BlogService implements IBlogService {
return ResponseVO.failed("not login."); return ResponseVO.failed("not login.");
} }
//todo 权限检查 //todo 权限检查
BlogEntity entity = blogMapper.voToEntity(requireVO); blogRepo.updateTitleAndAbstractsAndPasswordAndContentById(
entity.setId(blogID); requireVO.getTitle(),
blogRepo.save(entity); requireVO.getAbstracts(),
requireVO.getPassword(),
requireVO.getContent(),
blogID
);
return ResponseVO.success(); return ResponseVO.success();
} }