From ed1dfc90a40a520ce50c2269f3fe8a0b09898e1e Mon Sep 17 00:00:00 2001 From: pxh4iabou <2044878308@qq.com> Date: Sun, 30 Apr 2023 01:25:50 +0800 Subject: [PATCH] ADD file via upload --- .../com/controller/NotesInfoController.java | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 src/main/java/com/controller/NotesInfoController.java diff --git a/src/main/java/com/controller/NotesInfoController.java b/src/main/java/com/controller/NotesInfoController.java new file mode 100644 index 0000000..f7e036c --- /dev/null +++ b/src/main/java/com/controller/NotesInfoController.java @@ -0,0 +1,56 @@ +package com.example.controller; + +import com.example.common.Result; +import com.example.entity.NotesInfo; +import com.example.service.NotesInfoService; +import com.example.vo.NotesInfoVo; +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 = "/notesInfo") +public class NotesInfoController { + @Resource + private NotesInfoService notesInfoService; + + @PostMapping + public Result add(@RequestBody NotesInfoVo info) { + notesInfoService.add(info); + return Result.success(info); + } + + @DeleteMapping("/{id}") + public Result delete(@PathVariable Long id) { + notesInfoService.delete(id); + return Result.success(); + } + + @PutMapping + public Result update(@RequestBody NotesInfoVo info) { + notesInfoService.update(info); + return Result.success(); + } + + @GetMapping("/{id}") + public Result detail(@PathVariable Long id) { + NotesInfo info = notesInfoService.findById(id); + return Result.success(info); + } + + @GetMapping + public Result> all() { + return Result.success(notesInfoService.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(notesInfoService.findPage(name, pageNum, pageSize, request)); + } +}