基于java ssm springboot+mybatis酒庄内部管理系统设计和实现
作者:java李阳勇 时间:2023-09-24 23:51:17
咱们废话不多说进入主题、系统主页展示:
用户登录后进行系统首页:主要功能模块如下、分角色管理、超级管理员拥有最高权限、可以进行菜单灵活控制、
用户信息管理;
角色权限控制管理:
管理员查看灵活配置;
插入一小部分代码段
/**
* .
*
*
*
*
*/
package io.renren.modules.sys.controller;
import io.renren.common.annotation.SysLog;
import io.renren.common.exception.RRException;
import io.renren.common.utils.Constant;
import io.renren.common.utils.R;
import io.renren.modules.sys.entity.SysMenuEntity;
import io.renren.modules.sys.service.SysMenuService;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 系统菜单
*
* @author Mark s.com
*/
@RestController
@RequestMapping("/sys/menu")
public class SysMenuController extends AbstractController {
@Autowired
private SysMenuService sysMenuService;
/**
* 导航菜单
*/
@RequestMapping("/nav")
public R nav(){
List<SysMenuEntity> menuList = sysMenuService.getUserMenuList(getUserId());
return R.ok().put("menuList", menuList);
}
/**
* 所有菜单列表
*/
@RequestMapping("/list")
@RequiresPermissions("sys:menu:list")
public List<SysMenuEntity> list(){
List<SysMenuEntity> menuList = sysMenuService.list();
for(SysMenuEntity sysMenuEntity : menuList){
SysMenuEntity parentMenuEntity = sysMenuService.getById(sysMenuEntity.getParentId());
if(parentMenuEntity != null){
sysMenuEntity.setParentName(parentMenuEntity.getName());
}
}
return menuList;
}
/**
* 选择菜单(添加、修改菜单)
*/
@RequestMapping("/select")
@RequiresPermissions("sys:menu:select")
public R select(){
//查询列表数据
List<SysMenuEntity> menuList = sysMenuService.queryNotButtonList();
//添加顶级菜单
SysMenuEntity root = new SysMenuEntity();
root.setMenuId(0L);
root.setName("一级菜单");
root.setParentId(-1L);
root.setOpen(true);
menuList.add(root);
return R.ok().put("menuList", menuList);
}
/**
* 菜单信息
*/
@RequestMapping("/info/{menuId}")
@RequiresPermissions("sys:menu:info")
public R info(@PathVariable("menuId") Long menuId){
SysMenuEntity menu = sysMenuService.getById(menuId);
return R.ok().put("menu", menu);
}
/**
* 保存
*/
@SysLog("保存菜单")
@RequestMapping("/save")
@RequiresPermissions("sys:menu:save")
public R save(@RequestBody SysMenuEntity menu){
//数据校验
verifyForm(menu);
sysMenuService.save(menu);
return R.ok();
}
/**
* 修改
*/
@SysLog("修改菜单")
@RequestMapping("/update")
@RequiresPermissions("sys:menu:update")
public R update(@RequestBody SysMenuEntity menu){
//数据校验
verifyForm(menu);
sysMenuService.updateById(menu);
return R.ok();
}
/**
* 删除
*/
@SysLog("删除菜单")
@RequestMapping("/delete")
@RequiresPermissions("sys:menu:delete")
public R delete(long menuId){
if(menuId <= 31){
return R.error("系统菜单,不能删除");
}
//判断是否有子菜单或按钮
List<SysMenuEntity> menuList = sysMenuService.queryListParentId(menuId);
if(menuList.size() > 0){
return R.error("请先删除子菜单或按钮");
}
sysMenuService.delete(menuId);
return R.ok();
}
/**
* 验证参数是否正确
*/
private void verifyForm(SysMenuEntity menu){
if(StringUtils.isBlank(menu.getName())){
throw new RRException("菜单名称不能为空");
}
if(menu.getParentId() == null){
throw new RRException("上级菜单不能为空");
}
//菜单
if(menu.getType() == Constant.MenuType.MENU.getValue()){
if(StringUtils.isBlank(menu.getUrl())){
throw new RRException("菜单URL不能为空");
}
}
//上级菜单类型
int parentType = Constant.MenuType.CATALOG.getValue();
if(menu.getParentId() != 0){
SysMenuEntity parentMenu = sysMenuService.getById(menu.getParentId());
parentType = parentMenu.getType();
}
//目录、菜单
if(menu.getType() == Constant.MenuType.CATALOG.getValue() ||
menu.getType() == Constant.MenuType.MENU.getValue()){
if(parentType != Constant.MenuType.CATALOG.getValue()){
throw new RRException("上级菜单只能为目录类型");
}
return ;
}
//按钮
if(menu.getType() == Constant.MenuType.BUTTON.getValue()){
if(parentType != Constant.MenuType.MENU.getValue()){
throw new RRException("上级菜单只能为菜单类型");
}
return ;
}
}
}
简单模拟实现邮件群发给所有用户
红酒信息管理
通知公告信息管理
来源:https://blog.csdn.net/weixin_39709134/article/details/117266374
标签:java,springboot,管理系统
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Springboot快速入门教程
2023-03-02 21:50:56
![](https://img.aspxhome.com/file/2023/9/125319_0s.png)
QT5实现简单的TCP通信的实现
2023-11-02 21:24:48
![](https://img.aspxhome.com/file/2023/1/105171_0s.png)
浅析Java中接口和抽象类的七大区别
2022-01-16 21:09:36
![](https://img.aspxhome.com/file/2023/6/76266_0s.png)
JAVA使用POI获取Excel的列数与行数
2021-10-03 12:53:37
浅谈Mybatis通用Mapper使用方法
2023-02-15 17:46:52
SpringBoot应用线上重启脚本的命令详解
2022-02-05 18:21:52
android编程实现悬浮窗体的方法
2022-08-16 01:05:28
![](https://img.aspxhome.com/file/2023/2/139172_0s.gif)
总结一次C++ 程序优化历程
2023-11-02 22:38:30
关于Java中增强for循环使用的注意事项
2021-08-09 16:47:43
![](https://img.aspxhome.com/file/2023/7/63307_0s.png)
C#适配器模式的使用
2022-02-05 15:47:21
![](https://img.aspxhome.com/file/2023/6/88396_0s.jpg)
Springboot2.0处理自定义异常并返回json
2021-06-01 03:42:24
![](https://img.aspxhome.com/file/2023/0/62140_0s.png)
C#单线程和多线程的端口扫描器应用比较详解
2023-08-07 21:01:45
![](https://img.aspxhome.com/file/2023/2/96292_0s.jpg)
SpringBoot如何注册Servlet、Filter、Listener的几种方式
2023-07-15 05:15:08
Spring Bean后处理器详细介绍
2021-06-27 07:29:06
![](https://img.aspxhome.com/file/2023/4/61854_0s.png)
Android操作系统的架构设计分析
2022-07-12 11:02:26
![](https://img.aspxhome.com/file/2023/9/96799_0s.jpg)
Android自定义ScrollView实现放大回弹效果实例代码
2022-10-15 11:00:58
![](https://img.aspxhome.com/file/2023/2/137742_0s.gif)
Java中如何动态创建接口的实现方法
2023-11-25 15:13:02
![](https://img.aspxhome.com/file/2023/9/60259_0s.png)
Gradle学习教程之部署上传项目详解
2023-08-08 20:46:46
android虚拟键盘弹出遮挡登陆按钮问题的解决方法
2022-03-06 15:54:54
![](https://img.aspxhome.com/file/2023/8/126708_0s.gif)
C#使用HtmlAgilityPack抓取糗事百科内容实例
2022-01-16 10:45:16
![](https://img.aspxhome.com/file/2023/7/98177_0s.jpg)