huang
2025-05-20 e5b578d2c586ca9f664e31d3759952752255fdd3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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;
 
/**
 * <p>
 * 页面表 前端控制器
 * </p>
 *
 * @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<Page> 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);
    }
}