package com.mes.md.controller; import com.mes.md.entity.Menu; import com.mes.md.entity.Page; import com.mes.md.service.MenuService; import com.mes.md.service.PageService; import com.mes.utils.Result; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.List; /** *

* 页面表 前端控制器 *

* * @author yanzhixin * @since 2024-09-05 */ @Api(tags = "页面") @RestController @RequestMapping("/page") public class PageController { @Autowired PageService pageService; @ApiOperation("返回所有菜单") @PostMapping("/findPagesAll") @ResponseBody public Result findPagesAll () { List pages=pageService.findPagesAll(); return Result.build(200,"成功",pages); } @ApiOperation("添加菜单") @PostMapping("/addPage") @ResponseBody public Result addPage (@RequestBody Page page) { int count=pageService.addPage(page); String message=count>0?"菜单添加成功:"+count:"菜单添加失败!"; return Result.build(200,message,count); } @ApiOperation("修改菜单") @PostMapping("/updatePage") @ResponseBody public Result updatePage (@RequestBody Page page) { int count=pageService.updatePage(page); String message=count>0?"菜单修改成功:"+count:"菜单修改失败!"; return Result.build(200,message,count); } @ApiOperation("删除菜单") @PostMapping("/deletePage") @ResponseBody public Result deletePage (@RequestBody Page page) { int count=pageService.deletePage(page); String message=count>0?"菜单删除成功:"+count:"菜单删除失败!"; return Result.build(200,message,count); } }