基于Java的学生管理系统

  • Post author:
  • Post category:java




学生管理系统ManageSystem



一、系统架构与环境



1.1 springboot2.3.4


1.2 maven3.3.9


1.3 jdk1.8


1.4 mysql5.7


1.5 ssm架构单服务节点



二、具备的功能



1. 用户管理


2. 文件上传下载


3. 菜单管理


4. 学生管理


5. 日志管理


6. 个人中心


7. 教师管理


8. 课程管理


9. 班级管理


10. 授课管理


11. 成绩管理



三、系统截图



3.1登录页面

系统登录页面



3.2管理员登录功能

管理员登录



3.3教师登录功能

教师登录功能



3.4学生登录功能

学生登录功能



3.5个人中心截图

个人中心



四、代码展示



4.1 上传文件代码
@RequestMapping("/uploadFile")
    @ResponseBody
    public ResponseResult upload(@RequestParam("file")MultipartFile file){
        System.out.println(file.toString());
        // 1.创建返回对象
        ResponseResult responseResult = new ResponseResult();
        // 2.创建一个json对象 用于存储返回数据信息
//        JSONObject result = new JSONObject();
        Map<String,Object> result = new HashMap<>();
        try{
            // 3.判断文件是否为空
            if(file.isEmpty()){
                responseResult.setInfo("上传文件不存在!!!");
                responseResult.setSuccess(false);
                return responseResult;
            }
            // 4.定义文件存放的路径
            String rootPath = fileConfiguration.getResourceDir();
            // 5.获取当前系统日期
            SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
            String currentDate = sdf.format(new Date());
            // 6.查询系统配置表,获取上传文件夹名称
            SystemConfig systemConfig = systemService.getSystem();
            String uploadDir = systemConfig.getUploaddir();
            // 7.构建文件存放的全目录
            File directory = new File(rootPath + File.separator+ uploadDir + File.separator + currentDate);
            // 8.判断这个目录是否存在 不存在则创建
            if(!directory.exists()){
                directory.mkdirs();
            }
            // 9.生成新的文件名称
            String newFileName = UUIDUtils.getPrimaryKey() + file.getOriginalFilename()
                                .substring(file.getOriginalFilename().lastIndexOf("."));
            // 10.获取创建好的绝对路径
            String absolutePath = directory.getAbsolutePath();
            // 11.构建上传路径
            File uploadpath = new File(absolutePath + File.separator + newFileName);
            // 12.上传文件
            file.transferTo(uploadpath);
            // 13.封装返回信息
            result.put("filepath", currentDate+File.separator + newFileName);
            result.put("name", newFileName);
            result.put("originalFilename", file.getOriginalFilename());
            result.put("filesize", file.getSize());
            result.put("filetype", file.getContentType());
            result.put("url", "http://localhost:8866/" + File.separator + uploadDir + File.separator + currentDate + File.separator + newFileName);
            responseResult.setSuccess(true);
            responseResult.setInfo("上传文件成功!!!");
            responseResult.setData(result);
            System.out.println(responseResult);
            return responseResult;
        }catch (Exception e){
            responseResult.setInfo("上传文件失败!!!");
            responseResult.setSuccess(false);
            return responseResult;
        }

    }



源码下载地址


点击下载源码包



版权声明:本文为qq_42445425原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。