package com.web.controller.system;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.web.bean.SystemModule;
import com.web.service.ISystemModuleService;
import com.web.service.ISystemRoleModuleService;
@Controller
public class ModuleController {
@Resource
private ISystemModuleService smService = null;
@RequestMapping("view/module")
public ModelAndView toModule(Model model){
ModelAndView mav = new ModelAndView("view/system_module");
return mav;
}
@ResponseBody
@RequestMapping(value="view/getModuleListJson", method = RequestMethod.GET)
public String getModuleListJson(Model model){
List<SystemModule> systemModuleList = smService.selectSystemModuleList();
JSONArray json = new JSONArray();
for(SystemModule systemModule : systemModuleList){
SystemModule pModule = null;
String pName = "根节点";
if(systemModule.getParentId() != 1){
pModule = smService.selectByPrimaryKey(systemModule.getParentId());
pName = pModule.getModuleName();
}
JSONObject jo = new JSONObject();
jo.put("id", systemModule.getModuleId());
jo.put("pId", systemModule.getParentId());
jo.put("name", systemModule.getModuleName());
jo.put("curUrl", systemModule.getModuleUrl());
jo.put("isEnable", systemModule.getIsEnable());
jo.put("pName", pName);
jo.put("open", true);
json.add(jo);
}
return json.toJSONString();
}
/***
* 获取角色对应的模块列表
* @param model
* @return
*/
@ResponseBody
@RequestMapping(value="view/getModuleListJsonByRoleId", method = RequestMethod.GET)
public String getModuleListJsonByRoleId(HttpServletRequest request,Model model){
List<Integer> roleModuleIdList = new ArrayList<Integer>();
if(!"".equals(request.getParameter("roleId"))){
int roleId = Integer.parseInt(request.getParameter("roleId"));
List<SystemModule> systemRoleIdModuleList = smService.selectSystemModuleListByRoleId(roleId);
for(SystemModule systemModule : systemRoleIdModuleList){
roleModuleIdList.add(systemModule.getModuleId());
}
}
List<SystemModule> systemModuleList = smService.selectSystemModuleList();
JSONArray json = new JSONArray();
for(SystemModule systemModule : systemModuleList){
SystemModule pModule = null;
String pName = "根节点";
if(systemModule.getParentId() != 1){
pModule = smService.selectByPrimaryKey(systemModule.getParentId());
pName = pModule.getModuleName();
}
JSONObject jo = new JSONObject();
jo.put("id", systemModule.getModuleId());
jo.put("pId", systemModule.getParentId());
jo.put("name", systemModule.getModuleName());
jo.put("curUrl", systemModule.getModuleUrl());
jo.put("isEnable", systemModule.getIsEnable());
jo.put("pName", pName);
jo.put("open", true);
if(roleModuleIdList.contains(systemModule.getModuleId())){
jo.put("checked", true);
}
json.add(jo);
}
return json.toJSONString();
}
@ResponseBody
@RequestMapping(value="view/saveModule", method = RequestMethod.POST)
public ModelAndView saveModule(@RequestBody SystemModule systemModule){
smService.updateByPrimaryKey(systemModule);
ModelAndView mav = new ModelAndView("view/system_module");
return mav;
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
项目介绍: 本项目包含管理员与用户两种角色; 技术栈: 1. 后端:Spring+SpringMVC+Mybatis 2. 前端:JSP+CSS+JavaScript+jQuery+bootstrap+layui
资源详情
资源评论
资源推荐
收起资源包目录
Java项目:足球联赛管理系统(java+SSM+JSP+bootstrap+Mysql) (565个子文件)
.classpath 1KB
org.eclipse.wst.common.component 701B
org.eclipse.wst.jsdt.ui.superType.container 49B
ace.min.css 265KB
foundation.min.css 161KB
bootstrap.css 143KB
bootstrap.min.css 118KB
bootstrap.min.css 94KB
animate.css 71KB
font-awesome-ie7.min.css 37KB
ace-rtl.min.css 36KB
layui.css 31KB
ace-skins.min.css 26KB
bootstrap-theme.css 26KB
jquery-confirm.css 25KB
jquery-ui-1.10.3.full.min.css 24KB
bootstrap-theme.min.css 23KB
bootstrap-datepicker3.css 22KB
css.css 22KB
bootstrap-datetimepicker.min.css 22KB
rawgit-bootstrap-editable.css 22KB
font-awesome.min.css 22KB
jquery-confirm.min.css 21KB
bootstrap-datepicker3.min.css 21KB
bootstrap-editable.css 21KB
select2.css 19KB
layer.css 14KB
jquery.mCustomScrollbar.css 13KB
chosen.css 13KB
ui.jqgrid.css 12KB
bootstrap-datetimepicker.css 12KB
dropzone.css 11KB
fullcalendar.css 11KB
datepicker.css 10KB
laydate.css 8KB
awesome.css 8KB
layui.mobile.css 8KB
bootstrap-table.css 7KB
bootstrap-table.css 7KB
index.css 7KB
ace-ie.min.css 7KB
metroStyle.css 6KB
zTreeStyle.css 6KB
bootstrap-table.min.css 6KB
bootstrap-table.min.css 6KB
cyrillic.css 5KB
daterangepicker.css 5KB
css2.css 4KB
colorbox.css 4KB
foundation-datepicker.css 4KB
jquery-ui-1.10.3.custom.min.css 3KB
bootstrap-timepicker.css 3KB
colorpicker.css 2KB
demo.css 2KB
jquery.gritter.css 2KB
editcss.css 1KB
laypage.css 1KB
laypage.css 1KB
laypage.css 1KB
code.css 1KB
csspage1.css 809B
statitics.css 249B
csshome.css 26B
style.css 4B
iconfont.eot 52KB
glyphicons-halflings-regular.eot 20KB
glyphicons-halflings-regular.eot 14KB
loading.gif 9KB
loading-0.gif 6KB
zTreeStandard.gif 5KB
metro.gif 5KB
loading-2.gif 2KB
loading-1.gif 701B
loading.gif 381B
loading.gif 381B
loading.gif 381B
line_conn.gif 45B
ssm_zuqiusaisys.iml 5KB
jstl-1.2.jar 405KB
standard-1.1.0.jar 312KB
ModuleController.java 4KB
TeamController.java 4KB
DictController.java 3KB
GameController.java 3KB
UserController.java 3KB
LeagueController.java 3KB
LoginController.java 3KB
RoleController.java 3KB
TestMyBatis.java 2KB
SystemUser.java 2KB
TeamLeagueController.java 2KB
FootballGame.java 2KB
FootballLeague.java 2KB
DateTimeUtils.java 2KB
SystemModule.java 2KB
SystemUserServiceImpl.java 1KB
FootballTeamLeagueServiceImpl.java 1KB
SystemDictServiceImpl.java 1KB
SystemModuleServiceImpl.java 1KB
RoleModuleController.java 1KB
共 565 条
- 1
- 2
- 3
- 4
- 5
- 6
beyondwild
- 粉丝: 9536
- 资源: 4890
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 本地镜像源配置脚本本地镜像源配置脚本
- 与spoon配套使用的jdk
- 基于单片机的便携式粮食水分测试仪的研究
- 测绘基坑支护工程变形监测报告1.pdf
- 基于PHP+swoole实现的微信机器人,依赖vbot和微信网页版的功能,帮助管理微信群/聊天/踢人等+源码+开发文档+运行教程
- com.xunmeng.pinduoduo_Release_cd290ca9_ARM64.apk
- 2788727d-25a0-41b2-b6b4-265d193edb95.doc
- 基于AVR单片机的伺服电机系统研究
- Lab-Electronic Craft Practicum-2-Simulation of a Single Tube Com
- 贪吃蛇基于TypeScript
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论1