From 1ca0a169cfe04c12a82a117d643a66f8e2957689 Mon Sep 17 00:00:00 2001 From: pxh4iabou <2044878308@qq.com> Date: Sun, 30 Apr 2023 01:25:41 +0800 Subject: [PATCH] ADD file via upload --- .../NotesInfoCommentController.java | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 src/main/java/com/controller/NotesInfoCommentController.java diff --git a/src/main/java/com/controller/NotesInfoCommentController.java b/src/main/java/com/controller/NotesInfoCommentController.java new file mode 100644 index 0000000..27a0ccc --- /dev/null +++ b/src/main/java/com/controller/NotesInfoCommentController.java @@ -0,0 +1,63 @@ +package com.example.controller; + +import com.example.common.Result; +import com.example.entity.NotesInfoComment; +import com.example.vo.NotesInfoCommentVo; +import com.example.service.NotesInfoCommentService; + +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.util.List; + +@RestController +@RequestMapping(value = "/notesInfoComment") +public class NotesInfoCommentController { + @Resource + private NotesInfoCommentService notesInfoCommentService; + + @PostMapping + public Result add(@RequestBody NotesInfoComment commentInfo, HttpServletRequest request) { + notesInfoCommentService.add(commentInfo, request); + return Result.success(commentInfo); + } + + @DeleteMapping("/{id}") + public Result delete(@PathVariable Long id) { + notesInfoCommentService.delete(id); + return Result.success(); + } + + @PutMapping + public Result update(@RequestBody NotesInfoComment commentInfo) { + notesInfoCommentService.update(commentInfo); + return Result.success(); + } + + @GetMapping("/{id}") + public Result detail(@PathVariable Long id) { + NotesInfoComment commentInfo = notesInfoCommentService.findById(id); + return Result.success(commentInfo); + } + + @GetMapping + public Result> all() { + return Result.success(notesInfoCommentService.findAll()); + } + + @GetMapping("/page/{name}") + public Result> page(@PathVariable String name, + @RequestParam(defaultValue = "1") Integer pageNum, + @RequestParam(defaultValue = "5") Integer pageSize, + HttpServletRequest request) { + return Result.success(notesInfoCommentService.findPage(name, pageNum, pageSize)); + } + + @GetMapping("/findByForeignId/{id}") + public Result> findByForeignId (@PathVariable Long id) { + return Result.success(notesInfoCommentService.findByForeignId(id)); + } +}