栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

基于javaweb+jsp的酒店人事管理系统(java+SSM+JSP+JQuery+Ajax+mysql)

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

基于javaweb+jsp的酒店人事管理系统(java+SSM+JSP+JQuery+Ajax+mysql)

一、项目运行

环境配置:
Jdk1.8 + Tomcat8.5 + mysql + Eclispe(IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持)

项目技术:
JSP +Spring + SpringMVC + MyBatis + html+ css + JavaScript + JQuery + Ajax 等等



适用

课程设计,大作业,毕业设计,项目练习,学习演示等

    public String saveRoleMenu(String ids,Integer roleId){
        Map map = new HashMap();
        //调用保存角色菜单关系的方法
        if(roleService.saveRoleMenu(ids,roleId)>0){
            map.put(SystemConstant.MESSAGE,"菜单分配成功");
        }else{
            map.put(SystemConstant.MESSAGE,"菜单分配失败");
        }
        return JSON.toJSONString(map);
    }
    
    @RequestMapping("/initRoleListByEmpId")
    public DataGridViewResult initRoleListByEmpId(int id){
        List> roleList = roleService.findRoleListByMap();
        //调用根据员工ID查询该员工拥有的角色列表的方法
        List roleIds = roleService.findEmployeeRoleByEmployeeId(id);
        //循环比较两个集合中的角色ID值是否相等,相等则选中该角色
        for (Map map : roleList) {
            //定义变量,标识是否选中
            boolean flag = false;//不选中
            //获取每一个角色ID
            Integer rid = (Integer) map.get("id");//id是主键,以主键作为map集合中key
        Map map = new HashMap();
        int updateRole = roleService.updateRole(role);
        if(updateRole>0){
            map.put(SystemConstant.SUCCESS,true);
            map.put(SystemConstant.MESSAGE,"修改成功");
        }else{
            map.put(SystemConstant.SUCCESS,false);
            map.put(SystemConstant.MESSAGE,"修改失败");
        }
        //map中存放的信息已json形式返回
        return JSON.toJSONString(map);
    }
    //删除角色信息
    @RequestMapping("/deleteById")
    public String deleteById(Integer id){
        Map map = new HashMap();
        int deleteById = roleService.deleteById(id);
        if (deleteById>0){
            map.put(SystemConstant.SUCCESS,true);//删除成功
            map.put(SystemConstant.MESSAGE,"删除成功");
        }else{
            map.put(SystemConstant.SUCCESS,false);//删除失败
            map.put(SystemConstant.MESSAGE,"删除失败");
        }
        return JSON.toJSONString(map);
    }
        }else{
            map.put(SystemConstant.SUCCESS,false);
            map.put(SystemConstant.MESSAGE,"很遗憾,注册失败,请重新尝试!");
        }
        return JSON.toJSONString(map);
    }
    
    @RequestMapping("/login")
    @ResponseBody
    public String login(String loginName, String password, HttpSession Session){
        Map map = new HashMap();
        //调用注册的方法
        User loginUser = userService.login(loginName, password);
        //登录判断
        if(loginUser!=null){
            //将密码清空
            loginUser.setPassword(null);
        }
        //创建集合保存树节点信息
        List treeNodes = new ArrayList();
        //循环遍历集合
        for (Menu menu : menuList) {
            //定义变量,标识是否选中
            String checkArr = "0";//0表示复选框不选中,1表示选中复选框
            //内层循环遍历当前角色拥有的权限菜单
            //循环比较的原因:比较两个集合中的数据是否有相同的,有相同的表示当前角色拥有这个权限
            for (Menu currentMenu : currentMenus) {
                //如果ID相等,表示当前角色有这个菜单,有这个菜单则需要将复选框选中
                if(menu.getId() == currentMenu.getId()){
                    checkArr ="1";//选中
        Map map = new HashMap();
        //调用注册的方法
        if(userService.addUser(user)>0){
            map.put(SystemConstant.SUCCESS,true);
            map.put(SystemConstant.MESSAGE,"恭喜你,注册成功!");
        }else{
            map.put(SystemConstant.SUCCESS,false);
            map.put(SystemConstant.MESSAGE,"很遗憾,注册失败,请重新尝试!");
        }
        return JSON.toJSONString(map);
    }
    
    @RequestMapping("/login")
    @ResponseBody
    public String login(String loginName, String password, HttpSession Session){
        Map map = new HashMap();
        //调用注册的方法
        User loginUser = userService.login(loginName, password);
        //登录判断
        if(loginUser!=null){
        }
        //创建集合保存树节点信息
        List treeNodes = new ArrayList();
        //循环遍历集合
        for (Menu menu : menuList) {
            //定义变量,标识是否选中
            String checkArr = "0";//0表示复选框不选中,1表示选中复选框
            //内层循环遍历当前角色拥有的权限菜单
            //循环比较的原因:比较两个集合中的数据是否有相同的,有相同的表示当前角色拥有这个权限
            for (Menu currentMenu : currentMenus) {
                //如果ID相等,表示当前角色有这个菜单,有这个菜单则需要将复选框选中
                if(menu.getId() == currentMenu.getId()){
                    checkArr ="1";//选中
                    break;
                }
            }
            //定义变量,表示菜单是否展开
            Boolean spread = (menu.getSpread()==null || menu.getSpread()==1) ? true : false;
            treeNodes.add(new TreeNode(menu.getId(),menu.getPid(),menu.getTitle(),spread,checkArr));
        }
        //将数据返回到页面
        if(userService.addUser(user)>0){
            map.put(SystemConstant.SUCCESS,true);
            map.put(SystemConstant.MESSAGE,"恭喜你,注册成功!");
        }else{
            map.put(SystemConstant.SUCCESS,false);
            map.put(SystemConstant.MESSAGE,"很遗憾,注册失败,请重新尝试!");
        }
        return JSON.toJSONString(map);
    }
    
    @RequestMapping("/login")
    @ResponseBody
    public String login(String loginName, String password, HttpSession Session){
        Map map = new HashMap();
        //调用注册的方法
        User loginUser = userService.login(loginName, password);
        //登录判断
    public DataGridViewResult list(RoleVo roleVo){
        //设置分页信息
        PageHelper.startPage(roleVo.getPage(),roleVo.getLimit());
        //调用分页查询的方法
        List roleList = roleService.findRoleList(roleVo);
        //创建分页对象
        PageInfo pageInfo = new PageInfo(roleList);
        //返回数据
        return new DataGridViewResult(pageInfo.getTotal(),pageInfo.getList());
    }
    //添加部门信息
    @RequestMapping("/addRole")
    public String addRole(Role role){
        //创建map存放信息
        Map map = new HashMap();
        int addRole = roleService.addRole(role);
        if(addRole>0){
            map.put(SystemConstant.SUCCESS,true);
            map.put(SystemConstant.MESSAGE,"添加成功");
        }else{
            map.put(SystemConstant.SUCCESS,false);
            map.put(SystemConstant.MESSAGE,"添加失败");
        }
        //map中存放的信息已json形式返回
        return JSON.toJSONString(map);
    }
    //修改角色信息
        if(ordersService.addOrders(orders)>0){
            map.put(SystemConstant.SUCCESS,true);
            map.put(SystemConstant.MESSAGE,"酒店预订成功");
        }else{
            map.put(SystemConstant.SUCCESS,false);
            map.put(SystemConstant.MESSAGE,"酒店预订失败,请重试!");
        }
        return JSON.toJSONString(map);
    }
}
角色管理控制层: 

@RequestMapping("/admin/role")
@RestController
public class RoleController {
    @Autowired
    private RoleService roleService;
    @Autowired
    private EmployeeService employeeService;
    @Autowired
    private MenuService menuService;
    

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/891983.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号