作者主页:夜未央5788
简介:Java领域优质创作者、Java项目、学习资料、技术互助
文末获取源码
项目介绍
本项目分为管理员与游客两种角色,
超级管理员角色包含以下功能:
管理员登录,借还管理,资产添加,资产总览,借还报表,用户管理,角色管理,权限管理,资源类型,网点管理等功能。
游客角色包含以下功能:
游客首页-广告页等功能。
由于本程序规模不大,可供课程设计,毕业设计学习演示之用
PS:左上角WEB控制台点击进去管理页面,需要注意的是,管理员可以在后台添加无数个角色和权限,所以这个不是一个单角色的系统。
环境需要
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项目:是;
技术栈
1. 后端:springboot, mybatis, shiro
2. 前端:HTML+CSS+JavaScript+VUE
使用说明
1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;
若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;
3. 将项目中config/application.properties配置文件中的数据库配置改为自己的配置;
4. 运行项目,输入http://localhost:8080/ 登录
管理员账号/密码:admin/123456
运行截图
代码相关
网点管理控制器
@Api("网点管理")
@RestController
@RequestMapping("/point")
@RequiresPermissions(value = {"system-administrator-permission","sys:point"},logical = Logical.OR)
public class PointController {
@Autowired
private PointService pointService;
@ApiOperation(value = "添加网点")
@PostMapping("/add")
public ResultDto<Object> add(@RequestBody Point point){
return pointService.add(point);
}
@ApiOperation(value = "删除网点")
@DeleteMapping("/delete/{id}")
public ResultDto<Object> deleteById(@PathVariable("id") Long id) throws AssetException {
return pointService.deleteById(id);
}
@ApiOperation(value = "更新网点")
@PutMapping("/update")
public ResultDto<Object> update(@RequestBody Point point) {
return pointService.update(point);
}
@ApiOperation(value = "网点列表")
@GetMapping("/list")
public ResultDto<PageDto<Point>> getList(PointDto dto){
return pointService.getList(dto);
}
@ApiOperation(value = "网点树")
@GetMapping("/tree")
public ResultDto<List<Point>> getPointTree(){
return pointService.getResultTree();
}
@ApiOperation(value = "获取网点")
@GetMapping("/map")
public ResultDto<List<KeyValue>> getMapByPid(@RequestParam("pid") Long pid) throws AssetException {
return pointService.getMapByPid(pid);
}
@ApiOperation(value = "获取网点")
@GetMapping("/get")
public ResultDto<List<Point>> getPointByPid(@RequestParam(value = "pid",required = false) Long pid){
return pointService.getResultTreeNodesByPid(pid);
}
@ApiOperation(value = "获取网点")
@GetMapping("/get/{id}")
public ResultDto<Point> getPointById(@PathVariable("id") Long id){
return pointService.getResultTreeEntityById(id);
}
@ApiOperation(value = "获取网点")
@GetMapping("/root/query")
public ResultDto<List<Point>> getQueryRootPoint(){
ResultDto<List<Point>> result = new ResultDto<>(ResultCode.SUCCESS);
result.setObject(pointService.getQueryRootPoint());
return result;
}
@ApiOperation(value = "刷新网点缓存数据")
@PostMapping("/refresh")
public ResultDto<List<Point>> refresh(){
ResultDto<List<Point>> result = new ResultDto<>(ResultCode.SUCCESS);
pointService.refreshTreeData();
return result;
}
}
过滤器
@Configuration
public class ShiroConfig {
@Bean
public SimpleCookie rememberMeCookie(){
SimpleCookie simpleCookie = new SimpleCookie("rememberMe");
simpleCookie.setMaxAge(2592000);
return simpleCookie;
}
@Bean
public CookieRememberMeManager rememberMeManager(){
CookieRememberMeManager cookieRememberMeManager = new CookieRememberMeManager();
cookieRememberMeManager.setCookie(rememberMeCookie());
cookieRememberMeManager.setCipherKey(Base64.decode("bWluZS1hc3NldC1rZXk6QQ=="));
return cookieRememberMeManager;
}
@Bean
public Realm shiroRealm() {
return new ShiroRealm();
}
@Bean
public DefaultWebSecurityManager securityManager(Realm realm) {
DefaultWebSecurityManager sm = new DefaultWebSecurityManager();
sm.setRealm(realm);
sm.setRememberMeManager(rememberMeManager());
return sm;
}
@Bean
public ShiroFilterFactoryBean shiroFilterFactoryBean(DefaultWebSecurityManager sm) {
ShiroFilterFactoryBean shiroFilter = new ShiroFilterFactoryBean();
shiroFilter.setLoginUrl("/login");
shiroFilter.setSuccessUrl("/index");
shiroFilter.setUnauthorizedUrl("/forbidden");
Map<String, String> filterChainDefinitionMapping = new LinkedHashMap<>();
filterChainDefinitionMapping.put("/", "anon");
filterChainDefinitionMapping.put("/error", "anon");
filterChainDefinitionMapping.put("/init", "anon");
filterChainDefinitionMapping.put("/about", "anon");
filterChainDefinitionMapping.put("/public/**", "anon");
filterChainDefinitionMapping.put("/css/**", "anon");
filterChainDefinitionMapping.put("/example/**", "anon");
filterChainDefinitionMapping.put("/font-awesome/**", "anon");
filterChainDefinitionMapping.put("/fonts/**", "anon");
filterChainDefinitionMapping.put("/img/**", "anon");
filterChainDefinitionMapping.put("/js/**", "anon");
filterChainDefinitionMapping.put("/static/**", "anon");
filterChainDefinitionMapping.put("/**", "authc");
shiroFilter.setFilterChainDefinitionMap(filterChainDefinitionMapping);
shiroFilter.setSecurityManager(sm);
Map<String, Filter> filters = new HashMap<>();
filters.put("authc", new MyFormAuthenticationFilter());
filters.put("perms", new MyPermissionsAuthorizationFilter());
shiroFilter.setFilters(filters);
return shiroFilter;
}
@Bean
public AuthorizationAttributeSourceAdvisor getAuthorizationAttributeSourceAdvisor(SecurityManager securityManager){
AuthorizationAttributeSourceAdvisor advisor = new MyAuthorizationAttributeSourceAdvisor();
advisor.setSecurityManager(securityManager);
return advisor;
}
}
如果也想学习本系统,下面领取。回复:066springboot