admin
2025-05-28 d7190eacc1b1289a3440368a129fd0f828ff2025
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
package tech.aiflowy.ai.controller;
 
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
import com.mybatisflex.core.paginate.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import tech.aiflowy.ai.entity.AiFirstMenu;
import tech.aiflowy.ai.entity.AiSecondMenu;
import tech.aiflowy.ai.service.AiFirstMenuService;
import tech.aiflowy.ai.service.AiSecondMenuService;
import tech.aiflowy.common.domain.Result;
 
import java.util.List;
 
@RestController
@RequestMapping("/api/v1/aiMenu")
public class AiMenuController {
 
    @Autowired
    private AiFirstMenuService aiFirstMenuService;
 
    /**
     * 创建一级菜单
     */
    @PostMapping("FirstMenu/save")
    public Result create(@RequestBody AiFirstMenu menu) {
        boolean success = aiFirstMenuService.save(menu);
        return Result.success(success);
    }
 
    /**
     * 删除一级菜单
     */
    @DeleteMapping("/FirstMenu/remove/{id}")
    public Result delete(@PathVariable Integer id) {
        boolean success = aiFirstMenuService.removeById(id);
        return Result.success(success);
    }
 
    /**
     * 更新一级菜单
     */
    @PutMapping("FirstMenu/update")
    public Result updateFirstMenu(@RequestBody AiFirstMenu menu) {
        boolean success = aiFirstMenuService.updateById(menu);
        return Result.success(success);
    }
 
    /**
     * 根据ID查询一级菜单
     */
    @GetMapping("/FirstMenu/{id}")
    public Result getByIdFirstMenu(@PathVariable Integer id) {
        AiFirstMenu menu = aiFirstMenuService.getById(id);
        return Result.success(menu);
    }
 
    /**
     * 分页查询一级菜单
     */
    @GetMapping("/FirstMenu/page")
    public Result pageFirstMenu(
            @RequestParam(defaultValue = "1") Integer pageNumber,
            @RequestParam(defaultValue = "10") Integer pageSize) {
        Page<AiFirstMenu> page = new Page<>(pageNumber, pageSize);
        page = aiFirstMenuService.page(page);
        return Result.success(page);
    }
 
    /**
     * 获取所有一级菜单
     */
    @GetMapping("FirstMenu/list")
    public Result listFirstMenu() {
        List<AiFirstMenu> list = aiFirstMenuService.list();
        return Result.success(list);
    }
    @Autowired
    private AiSecondMenuService aiSecondMenuService;
 
    /**
     * 创建二级菜单
     */
    @PostMapping("SecondMenu/save")
    public Result createSecondMenu(@RequestBody AiSecondMenu menu) {
        boolean success = aiSecondMenuService.save(menu);
        return Result.success(success);
    }
 
    /**
     * 删除二级菜单
     */
    @DeleteMapping("SecondMenu/remove/{id}")
    public Result deleteSecondMenu(@PathVariable Integer id) {
        boolean success = aiSecondMenuService.removeById(id);
        return Result.success(success);
    }
 
    /**
     * 更新二级菜单
     */
    @PutMapping("SecondMenu/update")
    public Result updateSecondMenu(@RequestBody AiSecondMenu menu) {
        boolean success = aiSecondMenuService.updateById(menu);
        return Result.success(success);
    }
 
    /**
     * 根据ID查询二级菜单
     */
    @GetMapping("SecondMenu/{id}")
    public Result getByIdSecondMenu(@PathVariable Integer id) {
        AiSecondMenu menu = aiSecondMenuService.getById(id);
        return Result.success(menu);
    }
 
    /**
     * 分页查询二级菜单
     */
    @GetMapping("SecondMenu/page")
    public Result pageSecondMenu(
            @RequestParam(defaultValue = "1") Integer pageNumber,
            @RequestParam(defaultValue = "10") Integer pageSize) {
        Page<AiSecondMenu> page = new Page<>(pageNumber, pageSize);
        page = aiSecondMenuService.page(page);
        return Result.success(page);
    }
 
    /**
     * 获取所有一级菜单
     */
    @GetMapping("SecondMenu/list")
    public Result listSecondMenu() {
        List<AiSecondMenu> list = aiSecondMenuService.list();
        return Result.success(list);
    }
}