基于javaweb mysql的销售团队后台管理系统(java SpringBoot FreeMarker bootstrap echarts mysql)
程序开发
2023-09-03 22:46:52
项目介绍
该项目为后管系统,主要功能包括:
看板、业务机会管理、客户管理、联系人管理、我的日报、团队日报、主数据管理:组织架构管理;系统管理:用户管理、角色管理、菜单管理等;
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可
4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
5.数据库:MySql 5.7版本;
6.是否Maven项目:是;
技术栈
-
后端:SpringBoot+mybatis
-
前端:FreeMarker+Angular+bootstrap+echarts+jQuery
使用说明
-
使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
-
使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;
若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;
- 将项目中application-powerteam.yml配置文件中的数据库配置改为自己的配置;
- 前台访问路径:http://localhost:8080/
登录账号:admin 登录密码:admin
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
}@RequiresPermissions("sys:user:delete")@PostMapping("deleteSome")@ResponseBody@SysLog("删除系统用户数据(多个)")public ResponseEntity deleteSome(@RequestBody List users){if(users == null || users.size()==0){return ResponseEntity.failure("请选择需要删除的用户");}for (User u : users){if(u.getAdminUser()){return ResponseEntity.failure("不能删除超级管理员");}else{userService.deleteUser(u);}}return ResponseEntity.success("操作成功");
User user = userService.getById(id);if(user == null){return ResponseEntity.failure("用户不存在");}else if(user.getAdminUser()) {return ResponseEntity.failure("不能删除后台用户");}userService.deleteUser(user);return ResponseEntity.success("操作成功");}@RequiresPermissions("sys:user:delete")@PostMapping("deleteSome")@ResponseBody@SysLog("删除系统用户数据(多个)")public ResponseEntity deleteSome(@RequestBody List users){if(users == null || users.size()==0){return ResponseEntity.failure("请选择需要删除的用户");}
}}}if(StringUtils.isNotBlank(user.getTel())){if(!user.getTel().equals(oldUser.getTel())) {if (userService.userCount(user.getTel()) > 0) {return ResponseEntity.failure("该手机号已经被绑定");}}}userService.updateById(user);return ResponseEntity.success("操作成功");}@RequestMapping("changePassword")public String changePassword(ModelMap modelMap){modelMap.put("currentUser",userService.getById(MySysUser.id()));return "admin/user/changePassword";}@CrossOrigin
@RequestParam(value = "confirmPwd",required = false)String confirmPwd){if(StringUtils.isBlank(oldPwd)){return ResponseEntity.failure("旧密码不能为空");}if(StringUtils.isBlank(newPwd)){return ResponseEntity.failure("新密码不能为空");}if(StringUtils.isBlank(confirmPwd)){return ResponseEntity.failure("确认密码不能为空");}if(!confirmPwd.equals(newPwd)){return ResponseEntity.failure("确认密码与新密码不一致");}//小程序修改密码if(StringUtils.isBlank(userName)){//PC修改密码User user = userService.findUserById(MySysUser.id());
@PostMapping("changePassword")@ResponseBodypublic ResponseEntity changePassword(@RequestParam(value = "userName",required = false)String userName,@RequestParam(value = "oldPwd",required = false)String oldPwd,@RequestParam(value = "newPwd",required = false)String newPwd,@RequestParam(value = "confirmPwd",required = false)String confirmPwd){if(StringUtils.isBlank(oldPwd)){return ResponseEntity.failure("旧密码不能为空");}if(StringUtils.isBlank(newPwd)){return ResponseEntity.failure("新密码不能为空");}if(StringUtils.isBlank(confirmPwd)){return ResponseEntity.failure("确认密码不能为空");}if(!confirmPwd.equals(newPwd)){return ResponseEntity.failure("确认密码与新密码不一致");}//小程序修改密码if(StringUtils.isBlank(userName)){//PC修改密码User user = userService.findUserById(MySysUser.id());
}IPage rolePage = roleService.page(new Page<>(page,limit),roleWrapper);rolePageData.setCount(rolePage.getTotal());rolePageData.setData(setUserToRole(rolePage.getRecords()));return rolePageData;}private List setUserToRole(List roles){roles.forEach(r -> {if(StringUtils.isNotBlank(r.getCreateId())){User u = userService.findUserById(r.getCreateId());if(StringUtils.isBlank(u.getNickName())){u.setNickName(u.getLoginName());}r.setCreateUser(u);}if(StringUtils.isNotBlank(r.getUpdateId())){User u = userService.findUserById(r.getUpdateId());if(StringUtils.isBlank(u.getNickName())){u.setNickName(u.getLoginName());}r.setUpdateUser(u);}});return roles;}
loginType = attribute == null ? loginType : attribute.name();}if(LoginTypeEnum.ADMIN.name().equals(loginType)) {session.setAttribute(LOGIN_TYPE,LoginTypeEnum.ADMIN);return "admin/login";}else {session.setAttribute(LOGIN_TYPE,LoginTypeEnum.PAGE);return "login";}}@RequestMapping(value = "index")public String index(HttpSession session, @ModelAttribute(LOGIN_TYPE) String loginType) {if(StringUtils.isBlank(loginType)) {LoginTypeEnum attribute = (LoginTypeEnum) session.getAttribute(LOGIN_TYPE);loginType = attribute == null ? loginType : attribute.name();}
@RequestMapping(value = {"admin","admin/index"})public String adminIndex(RedirectAttributes attributes, ModelMap map) {Subject s = SecurityUtils.getSubject();attributes.addFlashAttribute(LOGIN_TYPE, LoginTypeEnum.ADMIN);if(s.isAuthenticated()) {return "redirect:index";}return "redirect:toLogin";}@RequestMapping(value = "toLogin")public String adminToLogin(HttpSession session, @ModelAttribute(LOGIN_TYPE) String loginType) {if(StringUtils.isBlank(loginType)) {LoginTypeEnum attribute = (LoginTypeEnum) session.getAttribute(LOGIN_TYPE);
}}@RequestMapping("admin/main")public String main(ModelMap map){return "admin/main";}/**** 获得用户所拥有的菜单列表* @return*/@RequestMapping("/admin/user/getUserMenu")@ResponseBodypublic List getUserMenu(){String userId = MySysUser.id();List list = menuService.getShowMenuByUser(userId);return list;}@RequestMapping("systemLogout")@SysLog("退出系统")public String logOut(){SecurityUtils.getSubject().logout();return "redirect:home";}
}
用户管理控制层:
@Controller
public ResponseEntity add(@RequestBody Role role){if(StringUtils.isBlank(role.getName())){return ResponseEntity.failure("角色名称不能为空");}if(roleService.getRoleNameCount(role.getName())>0){return ResponseEntity.failure("角色名称已存在");}roleService.saveRole(role);return ResponseEntity.success("操作成功");}@RequestMapping("edit")public String edit(String id,ModelMap modelMap){Role role = roleService.getRoleById(id);String menuIds = null;if(role != null) {menuIds = role.getMenuSet().stream().map(menu -> menu.getId()).collect(Collectors.joining(","));}Map map = new HashMap();map.put("parentId",null);map.put("isShow",Boolean.FALSE);List
return "admin/role/edit";}@RequiresPermissions("sys:role:edit")@PostMapping("edit")@ResponseBody@SysLog("保存编辑角色数据")public ResponseEntity edit(@RequestBody Role role){if(StringUtils.isBlank(role.getId())){return ResponseEntity.failure("角色ID不能为空");}if(StringUtils.isBlank(role.getName())){return ResponseEntity.failure("角色名称不能为空");}Role oldRole = roleService.getRoleById(role.getId());if(!oldRole.getName().equals(role.getName())){if(roleService.getRoleNameCount(role.getName())>0){return ResponseEntity.failure("角色名称已存在");}}roleService.updateRole(role);return ResponseEntity.success("操作成功");}@RequiresPermissions("sys:role:delete")@PostMapping("delete")@ResponseBody
标签:
上一篇:
angularJS的e2e和unit测试环境部署
下一篇:
相关文章
-
无相关信息