MenuController类 package com.sdcet.controller; import com.sdcet.entity.Menu; import com.sdcet.entity.User; import com.sdcet.mapper.MenuMapper; import com.sdcet.util.ResponseMessage; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import java.util.Date; @Controller @ResponseBody @RequestMapping("/menu") public class MenuController { @Autowired private MenuMapper menuMapper; @PostMapping("/save") public ResponseMessage save(@RequestBody Menu menu) { Date date = new Date(); menu.setCreateTime(date); menu.setUpdateTime(date); return ResponseMessage.success(menuMapper.save(menu)); } @DeleteMapping("/delete") public ResponseMessage delete(Long id) { return ResponseMessage.success(menuMapper.delete(id)); } @GetMapping("/getMenuById") public ResponseMessage getUserById(Long id) { return ResponseMessage.success(menuMapper.selectMenuById(id)); } @GetMapping("getMenuByName") public ResponseMessage getUserByName(String name) { return ResponseMessage.success(menuMapper.selectMenuByName(name)); } //修改菜单 @PutMapping("/update") public ResponseMessage update(@RequestBody Menu menu) { return ResponseMessage.success(menuMapper.update(menu)); } }
2021-05-23
最新推荐文章于 2021-09-05 18:13:11 发布