作者主页:Java毕设网
简介:Java领域优质创作者、Java项目、学习资料、技术互助
文末获取源码
一、项目介绍
本项目分为前后台,有管理员与用户两种角色;
管理员角色包含以下功能:
管理员登录,管理员主页,权限管理,分类管理,用户管理,文档管理,下载记录,上传记录等功能。
用户角色包含以下功能:
注册账号,登录,系统首页,我的资源查看,编辑资源,我的资料修改,文件上传,密码重置,邮箱信息,密码重置成功等功能。
二、环境需要
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 8.0/5.7版本;
6.是否Maven项目:是;
三、技术栈
HTML+CSS+JavaScript+mysql+Spring+SpringMVC+mybatis+Spring boot+vue
四、使用说明
1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,导入成功后请执行maven clean;maven install命令,然后运行;
3. 将项目中application.yml配置文件中的数据库配置改为自己的配置;
4. 运行项目,输入http://localhost:18091 登录
五、运行截图
前台界面





后台界面





六、相关代码
权限管理控制器
@RestController
@RequestMapping("/auth")
@Api(value = "/auth", description = "权限表相关操作")
public class AuthController {
private final IAuthService authService;
@Autowired
public AuthController(IAuthService authService) {this.authService = authService;}
@ApiOperation(value = "添加权限记录", notes = "设置指定用户对指定文件的权限")
@ApiImplicitParams({@ApiImplicitParam(name = "files", value = "文件", example = "file1,file2,file3", required = true),
@ApiImplicitParam(name = "users", value = "用户", example = "user1,user2,user3", required = true),
@ApiImplicitParam(name = "auths", value = "权限", example = "1,1,1,1", required = true)})
@AuthInterceptor(InterceptorLevel.ADMIN)
@RequestMapping(value = "", method = RequestMethod.POST)
public String add(String files, String users, String auths) {
System.out.println("files: " + files + " users: " + users + " auths: " + auths);
return ControllerUtils.getResponse(authService.addAuth(files, users, auths));
}
@ApiOperation(value = "获取权限记录")
@ApiImplicitParams({@ApiImplicitParam(name = "user", value = "用户", required = true), @ApiImplicitParam(name =
"file", value = "文件", required = true), @ApiImplicitParam(name = "offset", value = "偏移量", required = true)})
@AuthInterceptor(InterceptorLevel.ADMIN)
@RequestMapping(value = "/all", method = RequestMethod.GET)
public String getAuth(String user, String file, int offset) {
return Formatter.listToJson(authService.listAuth(user, file, offset));
}
@ApiOperation(value = "更新权限记录")
@ApiImplicitParams({@ApiImplicitParam(name = "auth", value = "权限值", required = true)})
@AuthInterceptor(InterceptorLevel.ADMIN)
@RequestMapping(value = "/{id}", method = RequestMethod.PUT)
public String updateAuth(@PathVariable("id") long id, String auth) {
return ControllerUtils.getResponse(authService.updateAuth(id, auth));
}
@ApiOperation(value = "批量删除权限记录")
@AuthInterceptor(InterceptorLevel.ADMIN)
@RequestMapping(value = "/batch/{ids}", method = RequestMethod.DELETE)
public String batchDelete(@PathVariable("ids") String ids) {
return ControllerUtils.getResponse(authService.batchDelete(ids));
}
}
分类管理控制器
@RestController
@RequestMapping("/category")
@Api(value = "/category", description = "文件分类相关操作")
public class CategoryController {
private final ICategoryService categoryService;
@Autowired
public CategoryController(ICategoryService categoryService) {this.categoryService = categoryService;}
@ApiOperation(value = "新增一个分类")
@AuthInterceptor(InterceptorLevel.ADMIN)
@RequestMapping(value = "/{name}", method = RequestMethod.POST)
public String add(@PathVariable("name") String name) {
return ControllerUtils.getResponse(categoryService.insert(name));
}
@ApiOperation(value = "更新分类名称")
@ApiImplicitParam(name = "name", value = "新的名称", required = true)
@AuthInterceptor(InterceptorLevel.ADMIN)
@RequestMapping(value = "/{id}", method = RequestMethod.PUT)
public String update(@PathVariable("id") int id, String name) {
boolean isSuccess = Checker.isNotEmpty(name) && categoryService.update(id, name);
return ControllerUtils.getResponse(isSuccess);
}
@ApiOperation(value = "删除一个分类")
@AuthInterceptor(InterceptorLevel.ADMIN)
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
public String remove(@PathVariable("id") int id) {
return ControllerUtils.getResponse(categoryService.remove(id));
}
@ApiOperation(value = "获取一个分类")
@AuthInterceptor(InterceptorLevel.NONE)
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
public String getById(@PathVariable("id") int id) {
Category category = categoryService.getById(id);
if (Checker.isNull(category)) {
return ControllerUtils.getResponse(ValueConsts.FALSE);
} else {
return category.toString();
}
}
@ApiOperation(value = "获取所有分类")
@AuthInterceptor(InterceptorLevel.NONE)
@RequestMapping(value = "/all", method = RequestMethod.GET)
public String getAll() {
return Formatter.listToJson(categoryService.list());
}
}
Java文档管理系统
355

被折叠的 条评论
为什么被折叠?



