学生管理系统(student management system),前端使用Layui开发,后端使用Springboot + MyBatis plus 快速开发,项目实现了基本的增、(可批量)删、改以及分页条件查询。数据库使用常见MySQL。
文末有完整源码获取方式。
管理员表
CREATE TABLE `t_admin` (
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
`username` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '用户名',
`password` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '密码',
PRIMARY KEY (`id`) USING BTREE
)
班级表
CREATE TABLE `t_clazz` (
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
`name` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '班级名称',
`info` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '班级简介',
`teacher_name` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '班导名称',
PRIMARY KEY (`id`) USING BTREE
)
课程表
CREATE TABLE `t_course` (
`id` int NOT NULL AUTO_INCREMENT,
`name` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '课程名称',
`teacher_name` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '导师',
`course_date` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '课程日',
`course_time` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '课程时间',
`selected_num` int NULL DEFAULT 0 COMMENT '已选人数',
`max_num` int NULL DEFAULT 50 COMMENT '最大人数',
`info` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '简介',
PRIMARY KEY (`id`) USING BTREE
)
分数表
CREATE TABLE `t_score` (
`id` int NOT NULL AUTO_INCREMENT,
`student_name` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '学生名称',
`course_name` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '课程名称',
`score` int NULL DEFAULT NULL COMMENT '分数',
`info` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '简介',
PRIMARY KEY (`id`) USING BTREE
)
学生表
CREATE TABLE `t_student` (
`id` int NOT NULL AUTO_INCREMENT,
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '真实姓名',
`password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '密码',
`sex` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '性别',
`phone` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '手机',
`email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '邮箱',
`class_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '班级名称',
PRIMARY KEY (`id`) USING BTREE
)
导师表
CREATE TABLE `t_teacher` (
`id` int NOT NULL AUTO_INCREMENT,
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '姓名',
`password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '密码',
`sex` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '性别',
`phone` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '手机号',
PRIMARY KEY (`id`) USING BTREE
)
@Controller
@RequestMapping("/student")
public class StudentController {
@Autowired
private IStudentService studentService;
@GetMapping("/toView")
public String index() {
return "Student";
}
@GetMapping("/toEditView")
public String toAddView() {
return "Student_edit";
}
@GetMapping("/")
@ResponseBody
public ResultDto findAll() {
ResultDto success = success(studentService.list());
success.setCount((int) studentService.count());
return success;
}
@PostMapping("/findByParamAndLimit")
@ResponseBody
public ResultDto findByParam(String studentString, Integer limit, Integer page) {
Student student = JSONUtil.toBean(studentString, Student.class);
QueryWrapper<Student> queryWrapper = new QueryWrapper<>();
queryWrapper.eq(student.getId() != null, "id", student.getId());
queryWrapper.like(Strings.isNotBlank(student.getName()), "name", student.getName());
queryWrapper.like(Strings.isNotBlank(student.getPassword()), "password", student.getPassword());
queryWrapper.like(Strings.isNotBlank(student.getSex()), "sex", student.getSex());
queryWrapper.like(Strings.isNotBlank(student.getPhone()), "phone", student.getPhone());
queryWrapper.like(Strings.isNotBlank(student.getEmail()), "email", student.getEmail());
queryWrapper.like(Strings.isNotBlank(student.getClassName()), "class_name", student.getClassName());
Page<Student> studentPage = studentService.page(new Page<>(page, limit), queryWrapper);
ResultDto success = success(studentPage.getRecords());
success.setCount((int) studentPage.getTotal());
return success;
}
@GetMapping("/{id}")
@ResponseBody
public ResultDto findById(@PathVariable String id) {
return success(studentService.getById(id));
}
@PostMapping("/add")
@ResponseBody
public ResultDto add(@RequestBody Student student) {
return success(studentService.save(student));
}
@PostMapping("/update")
@ResponseBody
public ResultDto update(@RequestBody Student student) {
return success(studentService.updateById(student));
}
@GetMapping("/delete/{id}")
@ResponseBody
public ResultDto delete(@PathVariable String id) {
return success(studentService.removeById(id));
}
@PostMapping("/deleteBatch")
@ResponseBody
public ResultDto delete(@RequestBody List<String> ids) {
return success(studentService.removeBatchByIds(ids));
}
}
项目还有很多可扩展点,学习了解后可在源码上练手完善。✈️
关注微信公众号 菜鸟乐编程,然后发送:源码05学生信息管理系统
开发有成本,还希望多尊重,多支持!