Java SpringMVC毕业项目实战-学生信息管理系统

*/

@Controller

@RequestMapping(“/file”)

public class FileController {

@Resource(name = “fileServiceImpl”)

private FileService fileService;

@RequestMapping(“/upload”)

public String fileUpload(@RequestParam MultipartFile file, FileVO filevo, HttpServletRequest request) throws IOException {

//上传路径保存设置

// 把文件写到磁盘

String fileName = file.getOriginalFilename();

String[] str = fileName.split(“\.”);

String uuid = UUID.randomUUID().toString().replaceAll(“-”,“”);

String headPath = “E://upload/” + uuid+ “.”+str[str.length-1];

File dest = new File(headPath);

file.transferTo(dest);

filevo.setFileID(uuid);

filevo.setFilePath(headPath);

filevo.setUserID(null);

try {

fileService.save(filevo);

} catch (Exception e) {

e.printStackTrace();

}

return “redirect:/admin/showFile”;

}

@RequestMapping(“/downFile”)

public void down(HttpServletRequest request, HttpServletResponse response,String fileID) throws Exception{

FileVO fileVO = fileService.findById(fileID);

String fileName = fileVO.getFilePath();

String[] str = fileName.split(“\.”);

InputStream bis = new BufferedInputStream(new FileInputStream(new File(fileName)));

String filename = fileVO.getFileName()+“\.”+str[str.length-1];

filename = URLEncoder.encode(filename,“UTF-8”);

response.addHeader(“Content-Disposition”, “attachment;filename=” + filename);

response.setContentType(“multipart/form-data”);

BufferedOutputStream out = new BufferedOutputStream(response.getOutputStream());

int len = 0;

while((len = bis.read()) != -1){

out.write(len);

out.flush();

}

out.close();

}

}

异常处理

package com.system.exception;

/**

  • 系统自定义异常类,针对预期异常,需要在程序中抛出此类的异常

*/

public class CustomException extends Exception {

//异常信息

public String message;

public CustomException(String message) {

super(message);

this.message=message;

}

public String getMessage() {

return message;

}

public void setMessage(String message) {

this.message = message;

}

}

主要数据库设计:


主要数据表有:专业表、课程表、文件信息表、角色表、学生选课表、老师表、学生表等

CREATE TABLE college (

collegeID int(11) NOT NULL,

collegeName varchar(200) NOT NULL COMMENT ‘课程名’,

PRIMARY KEY (collegeID)

) ENGINE=InnoDB DEFAULT CHARSET=utf8;

insert into college(collegeID,collegeName) values

(1,‘计算机系’),

(2,‘设计系’),

/*Table structure for table course */

DROP TABLE IF EXISTS course;

CREATE TABLE course (

courseID int(11) NOT NULL,

courseName varchar(200) NOT NULL COMMENT ‘课程名称’,

teacherID int(11) NOT NULL,

courseTime varchar(200) DEFAULT NULL COMMENT ‘开课时间’,

classRoom varchar(200) DEFAULT NULL COMMENT ‘开课地点’,

courseWeek int(200) DEFAULT NULL COMMENT ‘学时’,

courseType varchar(20) DEFAULT NULL COMMENT ‘课程类型’,

collegeID int(11) NOT NULL COMMENT ‘所属院系’,

score int(11) NOT NULL COMMENT ‘学分’,

PRIMARY KEY (courseID),

KEY collegeID (collegeID),

KEY teacherID (teacherID)

) ENGINE=InnoDB DEFAULT CHARSET=utf8;

/*Data for the table course */

insert into course(courseID,courseName,teacherID,courseTime,classRoom,courseWeek,courseType,collegeID,score) values

(1,‘C语言程序设计’,1001,‘周二’,‘科401’,18,‘必修课’,1,3),

(3,‘数据结构’,1001,‘周四’,‘科401’,18,‘必修课’,1,2),

(4,‘Java程序设计’,1002,‘周五’,‘科401’,18,‘必修课’,1,2),

(5,‘英语’,1002,‘周四’,‘X302’,18,‘必修课’,2,2),

(6,‘服装设计’,1003,‘周一’,‘科401’,18,‘选修课’,2,2);

/*Table structure for table role */

DROP TABLE IF EXISTS role;

CREATE TABLE role (

roleID int(11) NOT NULL,

roleName varchar(20) NOT NULL,

permissions varchar(255) DEFAULT NULL COMMENT ‘权限’,

PRIMARY KEY (roleID)

) ENGINE=InnoDB DEFAULT CHARSET=utf8;

insert into role(roleID,roleName,permissions) values

(0,‘admin’,NULL),

(1,‘teacher’,NULL),

(2,‘student’,NULL);

/*Table structure for table selectedcourse */

DROP TABLE IF EXISTS selectedcourse;

CREATE TABLE selectedcourse (

courseID int(11) NOT NULL,

studentID int(11) NOT NULL,

mark int(11) DEFAULT NULL COMMENT ‘成绩’,

KEY courseID (courseID),

KEY studentID (studentID)

) ENGINE=InnoDB DEFAULT CHARSET=utf8;

/*Data for the table selectedcourse */

insert into selectedcourse(courseID,studentID,mark) values

(2,10001,12),

(1,10001,95),

(1,10002,66),

(2,10003,99),

(5,10001,NULL),

/*Table structure for table student */

DROP TABLE IF EXISTS student;

CREATE TABLE student (

userID int(11) NOT NULL AUTO_INCREMENT,

userName varchar(200) NOT NULL,

sex varchar(20) DEFAULT NULL,

birthYear date DEFAULT NULL COMMENT ‘出生日期’,

grade date DEFAULT NULL COMMENT ‘入学时间’,

collegeID int(11) NOT NULL COMMENT ‘院系id’,

PRIMARY KEY (userID),

KEY collegeID (collegeID)

) ENGINE=InnoDB AUTO_INCREMENT=10008 DEFAULT CHARSET=utf8;

/*Data for the table student */

insert into student(userID,userName,sex,birthYear,grade,collegeID) values

(9999,‘mike1’,‘男’,‘1996-09-03’,‘2019-11-13’,3),

(10001,‘小红’,‘男’,‘2020-03-02’,‘2020-03-02’,1),

(10002,‘小绿’,‘男’,‘2020-03-10’,‘2020-03-10’,1),

(10003,‘小陈’,‘女’,‘1996-09-02’,‘2015-09-02’,2),

/*Table structure for table teacher */

DROP TABLE IF EXISTS teacher;

CREATE TABLE teacher (

userID int(11) NOT NULL AUTO_INCREMENT,

userName varchar(200) NOT NULL,

sex varchar(20) DEFAULT NULL,

birthYear date NOT NULL,

degree varchar(20) DEFAULT NULL COMMENT ‘学历’,

title varchar(255) DEFAULT NULL COMMENT ‘职称’,

grade date DEFAULT NULL COMMENT ‘入职时间’,

collegeID int(11) NOT NULL COMMENT ‘院系’,

PRIMARY KEY (userID),

KEY collegeID (collegeID)

) ENGINE=InnoDB AUTO_INCREMENT=1004 DEFAULT CHARSET=utf8;

/*Data for the table teacher */

insert into teacher(userID,userName,sex,birthYear,degree,title,grade,collegeID) values

(1001,‘刘老师’,‘女’,‘1990-03-08’,‘硕士’,‘副教授’,‘2015-09-02’,2),

(1002,‘张老师’,‘女’,‘1996-09-02’,‘博士’,‘讲师’,‘2015-09-02’,1),

(1003,‘软老师’,‘女’,‘1996-09-02’,‘硕士’,‘助教’,‘2017-07-07’,1);

/*Table structure for table userlogin */

CREATE TABLE userlogin (

userID int(11) NOT NULL AUTO_INCREMENT,

userName varchar(200) NOT NULL,

password varchar(200) NOT NULL,

role int(11) NOT NULL DEFAULT ‘2’ COMMENT ‘角色权限’,

PRIMARY KEY (userID),

KEY role (role)

) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8;

论文结构目录设计 :


一、 绪论 4

1.1 研究背景 4

1.2 系统设计概述 4

1.3 研究的内容 5

二、相关技术介绍 5

2.1 spring 5

2.2 Spring MVC 6

2.3 mybatis 7

2.4 JSP技术 7

2.5 jQuery 8

2.6 Mysql 8

三、需求分析和可行性 11

3.1 系统功能概述 11

3.2 系统运行环境 11

3.3 技术设计 12

3.4 社会可行性 12

3.5 安全性可行性 12

3.6 经济可行性 12

3.7 法律可行性 12

四、系统设计 13

4.1 系统模式架构 13

4.2系统层次架构 13

4.3系统功能详情设计 14

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值