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
package com.govmade.modules.system.controller;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.govmade.common.utils.R;
import com.govmade.modules.basic.controller.AbstractController;
import com.govmade.modules.system.entity.MenuEntity;
import com.govmade.modules.system.service.MenuService;
/**
* 系统管理 - 菜单设置
*
* @author Fred
* @email fangtaosh@qq.com
* @date 2018年8月3日
*/
@RestController
@RequestMapping("/system/menu")
public class MenuController extends AbstractController {
@Autowired
private MenuService menuService;
/**
* 菜单列表
*/
@GetMapping("/list")
public R list(Map<String, Object> params) {
menuService.queryPage(params);
return null;
}
/**
* 保存或更新用户
*/
@PostMapping("/save")
public R save(MenuEntity menu) {
if (null == menu.getId()) {
if (this.menuService.checkMenu(menu.getName()) > 0) {
return R.error(menu.getName() + " 已存在!");
}
}
return R.ok();
}
/**
* 根据ID查询菜单
*
* @param id
* @return
*/
@GetMapping("info/{id}")
public R info(@PathVariable("id") Long id) {
return R.ok().put("menu", menuService.queryById(id));
}
}