commit d295140b27c2c7fb728676ec645736ba855b14af
Author: zrh050423 <14331304+zrh050423@user.noreply.gitee.com>
Date: Mon Oct 28 22:46:33 2024 +0800
1
diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..13566b8
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/.idea/artifacts/SimpleStudentManagementSystem_Web_exploded.xml b/.idea/artifacts/SimpleStudentManagementSystem_Web_exploded.xml
new file mode 100644
index 0000000..5160396
--- /dev/null
+++ b/.idea/artifacts/SimpleStudentManagementSystem_Web_exploded.xml
@@ -0,0 +1,13 @@
+
+
+ $PROJECT_DIR$/out/artifacts/SimpleStudentManagementSystem_Web_exploded
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..2461099
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml
new file mode 100644
index 0000000..28e60a1
--- /dev/null
+++ b/.idea/dataSources.xml
@@ -0,0 +1,19 @@
+
+
+
+
+ mysql.8
+ true
+ true
+ $PROJECT_DIR$/SimpleStudentManagementSystem/src/main/resources/application.properties
+ com.mysql.cj.jdbc.Driver
+ jdbc:mysql://10.33.66.120:3306/mb202201080137
+
+
+
+
+
+ $ProjectFileDir$
+
+
+
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 0000000..4821b4a
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
new file mode 100644
index 0000000..5a2f139
--- /dev/null
+++ b/.idea/jarRepositories.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..1dab215
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..a2a5b54
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/JavaEEHW1.iml b/JavaEEHW1.iml
new file mode 100644
index 0000000..9a5cfce
--- /dev/null
+++ b/JavaEEHW1.iml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Readme.md b/Readme.md
new file mode 100644
index 0000000..6b25699
--- /dev/null
+++ b/Readme.md
@@ -0,0 +1,38 @@
+# JavaEE第1次作业
+## SpringBoot + Thymeleaf 学生管理系统
+### 要求
+在已有代码基础上,增加课程管理和成绩管理的内容。
+请注意:
+1. 请重新建立一个名为“学号-HW1”的工程,并在你的git下重新建立名为“学号-HW1”的仓库,如工程和仓库名为:“202208010101-HW1”
+2. 一个新工程,请先检查Maven设置的仓库是否正确
+3. application.properties可能会乱码,乱码请查看语雀
+4. 数据库请使用统一提供的 "mb" 开头的数据库
+5. 主包名必须是你名字的缩写,如张三的包名应为:**edu.zs**
+6. service层必须先写接口再写实现类
+7. 请写好注释
+8. 提交作业时,请提交仓库地址与运行结果截图
+
+#### 学生管理
+##### 选做内容
+1. 显示性别时,显示具体的“男”或“女”,而不是数字
+
+#### 课程管理
+##### 必做内容
+1. 查询所有课程名
+2. 增加某个课程
+3. 更新某个课程
+4. 删除某个课程
+##### 选做内容
+1. 查询这个课程学生选课情况
+
+#### 成绩管理
+##### 必做内容
+1. 查询某个人所有成绩,注:查询时需要显示姓名和课程名,不能只有编号
+2. 增加某个人某条成绩
+3. 更新某个人某条成绩
+4. 删除某个人某条成绩
+##### 选做内容
+1. 查询某人成绩同时计算平均分
+
+### 更新内容
+1. 2024-10-20: 更新化简项目后,残留的cookie
\ No newline at end of file
diff --git a/SimpleStudentManagementSystem/pom.xml b/SimpleStudentManagementSystem/pom.xml
new file mode 100644
index 0000000..ab2f390
--- /dev/null
+++ b/SimpleStudentManagementSystem/pom.xml
@@ -0,0 +1,96 @@
+
+
+ 4.0.0
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 3.3.4
+
+
+ edu.zrh
+ SimpleStudentManagementSystem
+ 0.0.1-SNAPSHOT
+ SimpleStudentManagementSystem
+ SimpleStudentManagementSystem
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 17
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+ org.mybatis.spring.boot
+ mybatis-spring-boot-starter
+ 3.0.3
+
+
+ com.mysql
+ mysql-connector-j
+ runtime
+
+
+ org.projectlombok
+ lombok
+ true
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+ org.mybatis.spring.boot
+ mybatis-spring-boot-starter-test
+ 3.0.3
+ test
+
+
+ org.springframework.boot
+ spring-boot-starter-thymeleaf
+
+
+
+ org.springframework.boot
+ spring-boot-devtools
+ true
+
+
+
+
+
+
+ org.graalvm.buildtools
+ native-maven-plugin
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+ org.projectlombok
+ lombok
+
+
+
+
+
+
+
+
diff --git a/SimpleStudentManagementSystem/src/main/java/edu/zrh/Application.java b/SimpleStudentManagementSystem/src/main/java/edu/zrh/Application.java
new file mode 100644
index 0000000..85c2a34
--- /dev/null
+++ b/SimpleStudentManagementSystem/src/main/java/edu/zrh/Application.java
@@ -0,0 +1,15 @@
+package edu.zrh;
+
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication()
+@MapperScan("edu.zrh.mapper")
+public class Application {
+
+ public static void main(String[] args) {
+ SpringApplication.run(Application.class, args);
+ }
+
+}
diff --git a/SimpleStudentManagementSystem/src/main/java/edu/zrh/controller/AccountStudentController.java b/SimpleStudentManagementSystem/src/main/java/edu/zrh/controller/AccountStudentController.java
new file mode 100644
index 0000000..1ac1263
--- /dev/null
+++ b/SimpleStudentManagementSystem/src/main/java/edu/zrh/controller/AccountStudentController.java
@@ -0,0 +1,30 @@
+package edu.zrh.controller;
+
+import edu.zrh.pojo.Student;
+import edu.zrh.service.AccountStudentService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.*;
+
+@Controller
+public class AccountStudentController {
+ private final AccountStudentService accountStudentService;
+ @Autowired
+ public AccountStudentController(AccountStudentService accountStudentService) {
+ this.accountStudentService = accountStudentService;
+ }
+ @PostMapping("/accountstudent")
+ public String addAccountStudent(Student student,
+ Model model){
+ accountStudentService.addStudentAccount(student);
+ return "redirect:/students";
+ }
+
+ @GetMapping("/deleteaccountstudent/{account}")
+ public String deleteAccountStudent(@PathVariable String account, Model model){
+ System.out.println(account);
+ accountStudentService.deleteStudentAccount(account);
+ return "redirect:/students";
+ }
+}
diff --git a/SimpleStudentManagementSystem/src/main/java/edu/zrh/controller/LoginController.java b/SimpleStudentManagementSystem/src/main/java/edu/zrh/controller/LoginController.java
new file mode 100644
index 0000000..941dad0
--- /dev/null
+++ b/SimpleStudentManagementSystem/src/main/java/edu/zrh/controller/LoginController.java
@@ -0,0 +1,30 @@
+package edu.zrh.controller;
+
+import edu.zrh.service.AccountService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+
+@Controller
+public class LoginController {
+ private final AccountService accountService;
+ @Autowired
+ public LoginController(AccountService accountService) {
+ this.accountService = accountService;
+ }
+ @GetMapping({"/", "/login"})
+ public String loginPage(Model model){
+ model.addAttribute("title","教务系统");
+ return "login";
+ }
+ @PostMapping("/login")
+ public String login(String username, String password, Model model){
+ boolean result = accountService.validate(username, password);
+ if (result){
+ return "index";
+ }
+ return "login";
+ }
+}
diff --git a/SimpleStudentManagementSystem/src/main/java/edu/zrh/controller/StudentController.java b/SimpleStudentManagementSystem/src/main/java/edu/zrh/controller/StudentController.java
new file mode 100644
index 0000000..88cae4d
--- /dev/null
+++ b/SimpleStudentManagementSystem/src/main/java/edu/zrh/controller/StudentController.java
@@ -0,0 +1,49 @@
+package edu.zrh.controller;
+
+import edu.zrh.pojo.Student;
+import edu.zrh.service.StudentService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@Controller
+public class StudentController {
+ private final StudentService studentService;
+ @Autowired
+ public StudentController(StudentService studentService) {
+ this.studentService = studentService;
+ }
+ // 加载页面
+ @GetMapping("/studentpage")
+ public String getStudentPage(){
+ return "student";
+ }
+
+ @GetMapping("addstudentpage")
+ public String addStudentPage(){
+ return "addstudent";
+ }
+ // 处理数据
+ @GetMapping("/students")
+ public String getAllStudents(Model model){
+ List students = studentService.getAllStudents();
+ model.addAttribute("students",students);
+ return "student";
+ }
+ @GetMapping("updatestudentpage/{id}")
+ public String updateStudentPage(@PathVariable String id,
+ Model model){
+ Student student = studentService.getStudentById(id);
+ System.out.println(student);
+ model.addAttribute("student",student);
+ return "updatestudent";
+ }
+ @PostMapping("/updatestudent")
+ public String updateStudent(@ModelAttribute Student student) {
+ studentService.updateStudent(student);
+ return "redirect:/students";
+ }
+}
diff --git a/SimpleStudentManagementSystem/src/main/java/edu/zrh/mapper/AccountMapper.java b/SimpleStudentManagementSystem/src/main/java/edu/zrh/mapper/AccountMapper.java
new file mode 100644
index 0000000..c51c4b2
--- /dev/null
+++ b/SimpleStudentManagementSystem/src/main/java/edu/zrh/mapper/AccountMapper.java
@@ -0,0 +1,18 @@
+package edu.zrh.mapper;
+
+import edu.zrh.pojo.Account;
+
+import java.util.List;
+
+
+public interface AccountMapper {
+ // 查询账号
+ Account getAccount(String account);
+ // 添加账号
+ void insertAccount(Account account);
+
+ // 根据账号获取学生信息
+ List getAccountWithDetails();
+
+ void deleteByAccount(String account);
+}
diff --git a/SimpleStudentManagementSystem/src/main/java/edu/zrh/mapper/ScoreMapper.java b/SimpleStudentManagementSystem/src/main/java/edu/zrh/mapper/ScoreMapper.java
new file mode 100644
index 0000000..027145c
--- /dev/null
+++ b/SimpleStudentManagementSystem/src/main/java/edu/zrh/mapper/ScoreMapper.java
@@ -0,0 +1,24 @@
+package edu.zrh.mapper;
+
+import edu.zrh.pojo.Score;
+
+import java.util.List;
+
+
+public interface ScoreMapper {
+
+ // 新增成绩
+ void insert(Score score);
+
+ // 更新成绩
+ void update(Score score);
+
+ // 根据id删除成绩
+ void deleteById(Integer id);
+
+ // 批量删除成绩
+ void deleteByIds(List ids);
+
+ // 根据no查询成绩
+ List getAll();
+}
diff --git a/SimpleStudentManagementSystem/src/main/java/edu/zrh/mapper/StudentMapper.java b/SimpleStudentManagementSystem/src/main/java/edu/zrh/mapper/StudentMapper.java
new file mode 100644
index 0000000..c6650e4
--- /dev/null
+++ b/SimpleStudentManagementSystem/src/main/java/edu/zrh/mapper/StudentMapper.java
@@ -0,0 +1,32 @@
+package edu.zrh.mapper;
+
+import edu.zrh.pojo.Score;
+import edu.zrh.pojo.Student;
+
+import java.util.List;
+
+// 在运行时会自动生成该接口的实现类对象 并将该对交给IOC容器管理 成为一个bean
+
+public interface StudentMapper {
+ // 查询全部学生信息
+ List getAll();
+ List getAllCourseNames();
+ // 根据id查询学生
+ Student getById(String id);
+
+ // 添加学生
+ void insertStudent(Student student);
+
+ // 动态条件查询 根据姓名字数和性别查询
+ List getByCondition(Integer len, Integer gender);
+
+ // 动态更新学生
+ void update(Student student);
+
+ List getAllWithGender();
+
+ Student getStudentScoresById(String id);
+
+ void deleteById(String id);
+}
+
diff --git a/SimpleStudentManagementSystem/src/main/java/edu/zrh/mapper/StudentScoreMapper.java b/SimpleStudentManagementSystem/src/main/java/edu/zrh/mapper/StudentScoreMapper.java
new file mode 100644
index 0000000..219e21b
--- /dev/null
+++ b/SimpleStudentManagementSystem/src/main/java/edu/zrh/mapper/StudentScoreMapper.java
@@ -0,0 +1,8 @@
+package edu.zrh.mapper;
+
+import edu.zrh.pojo.StudentScore;
+
+
+public interface StudentScoreMapper {
+ StudentScore getByNo(String id);
+}
diff --git a/SimpleStudentManagementSystem/src/main/java/edu/zrh/pojo/Account.java b/SimpleStudentManagementSystem/src/main/java/edu/zrh/pojo/Account.java
new file mode 100644
index 0000000..51d792a
--- /dev/null
+++ b/SimpleStudentManagementSystem/src/main/java/edu/zrh/pojo/Account.java
@@ -0,0 +1,13 @@
+package edu.zrh.pojo;
+
+import lombok.Data;
+
+@Data
+public class Account extends BaseEntity {
+ private Integer id;
+ private String account;
+ private String password;
+ private Integer role = 1;
+ // 一对一查询
+ private Student studentDetails;
+}
diff --git a/SimpleStudentManagementSystem/src/main/java/edu/zrh/pojo/BaseEntity.java b/SimpleStudentManagementSystem/src/main/java/edu/zrh/pojo/BaseEntity.java
new file mode 100644
index 0000000..d5353a9
--- /dev/null
+++ b/SimpleStudentManagementSystem/src/main/java/edu/zrh/pojo/BaseEntity.java
@@ -0,0 +1,13 @@
+package edu.zrh.pojo;
+
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+@Data
+public class BaseEntity {
+ private Integer createBy;
+ private LocalDateTime createTime;
+ private Integer updateBy;
+ private LocalDateTime updateTime;
+}
diff --git a/SimpleStudentManagementSystem/src/main/java/edu/zrh/pojo/Course.java b/SimpleStudentManagementSystem/src/main/java/edu/zrh/pojo/Course.java
new file mode 100644
index 0000000..5ce425d
--- /dev/null
+++ b/SimpleStudentManagementSystem/src/main/java/edu/zrh/pojo/Course.java
@@ -0,0 +1,9 @@
+package edu.zrh.pojo;
+
+import lombok.Data;
+
+@Data
+public class Course extends BaseEntity{
+ private Integer id;
+ private String name;
+}
diff --git a/SimpleStudentManagementSystem/src/main/java/edu/zrh/pojo/Gender.java b/SimpleStudentManagementSystem/src/main/java/edu/zrh/pojo/Gender.java
new file mode 100644
index 0000000..b741228
--- /dev/null
+++ b/SimpleStudentManagementSystem/src/main/java/edu/zrh/pojo/Gender.java
@@ -0,0 +1,9 @@
+package edu.zrh.pojo;
+
+import lombok.Data;
+
+@Data
+public class Gender extends BaseEntity {
+ private Integer id;
+ private String name;
+}
diff --git a/SimpleStudentManagementSystem/src/main/java/edu/zrh/pojo/Score.java b/SimpleStudentManagementSystem/src/main/java/edu/zrh/pojo/Score.java
new file mode 100644
index 0000000..bf3f374
--- /dev/null
+++ b/SimpleStudentManagementSystem/src/main/java/edu/zrh/pojo/Score.java
@@ -0,0 +1,18 @@
+package edu.zrh.pojo;
+
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+@Data
+
+public class Score extends BaseEntity{
+ private Integer id;
+ private String studentId;
+ private String courseId;
+ private Integer score;
+ private LocalDateTime createTime;
+ // 学生和课程是一的一方
+ private Student student;
+ private Course course;
+}
diff --git a/SimpleStudentManagementSystem/src/main/java/edu/zrh/pojo/Student.java b/SimpleStudentManagementSystem/src/main/java/edu/zrh/pojo/Student.java
new file mode 100644
index 0000000..fe02e24
--- /dev/null
+++ b/SimpleStudentManagementSystem/src/main/java/edu/zrh/pojo/Student.java
@@ -0,0 +1,18 @@
+package edu.zrh.pojo;
+
+import lombok.*;
+
+import java.time.LocalDate;
+import java.util.List;
+
+@Data
+public class Student extends BaseEntity {
+ private String id;
+ private String name;
+ private Integer gender;
+ // @DateTimeFormat(pattern = "yyyy-MM-dd")
+ private LocalDate birthday;
+ // 性别是一的一方
+ private Gender genderDetails;
+ private List scores;
+}
diff --git a/SimpleStudentManagementSystem/src/main/java/edu/zrh/pojo/StudentScore.java b/SimpleStudentManagementSystem/src/main/java/edu/zrh/pojo/StudentScore.java
new file mode 100644
index 0000000..3e758c9
--- /dev/null
+++ b/SimpleStudentManagementSystem/src/main/java/edu/zrh/pojo/StudentScore.java
@@ -0,0 +1,11 @@
+package edu.zrh.pojo;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class StudentScore {
+ private Student student;
+ private List scores;
+}
diff --git a/SimpleStudentManagementSystem/src/main/java/edu/zrh/service/AccountService.java b/SimpleStudentManagementSystem/src/main/java/edu/zrh/service/AccountService.java
new file mode 100644
index 0000000..8208574
--- /dev/null
+++ b/SimpleStudentManagementSystem/src/main/java/edu/zrh/service/AccountService.java
@@ -0,0 +1,9 @@
+package edu.zrh.service;
+
+import edu.zrh.pojo.Account;
+
+public interface AccountService {
+ // 验证数据集账号密码
+ boolean validate(String username, String password);
+ void insertAccount(Account account);
+}
\ No newline at end of file
diff --git a/SimpleStudentManagementSystem/src/main/java/edu/zrh/service/AccountStudentService.java b/SimpleStudentManagementSystem/src/main/java/edu/zrh/service/AccountStudentService.java
new file mode 100644
index 0000000..dc46c9d
--- /dev/null
+++ b/SimpleStudentManagementSystem/src/main/java/edu/zrh/service/AccountStudentService.java
@@ -0,0 +1,12 @@
+package edu.zrh.service;
+
+
+import edu.zrh.pojo.Student;
+import org.springframework.transaction.annotation.Transactional;
+
+public interface AccountStudentService {
+ @Transactional
+ void addStudentAccount(Student student);
+ @Transactional
+ void deleteStudentAccount(String account);
+}
diff --git a/SimpleStudentManagementSystem/src/main/java/edu/zrh/service/StudentService.java b/SimpleStudentManagementSystem/src/main/java/edu/zrh/service/StudentService.java
new file mode 100644
index 0000000..57fb123
--- /dev/null
+++ b/SimpleStudentManagementSystem/src/main/java/edu/zrh/service/StudentService.java
@@ -0,0 +1,12 @@
+package edu.zrh.service;
+
+import edu.zrh.pojo.Student;
+
+import java.util.List;
+
+public interface StudentService {
+ List getAllStudents();
+ void insertStudent(Student student);
+ Student getStudentById(String id);
+ void updateStudent(Student student);
+}
diff --git a/SimpleStudentManagementSystem/src/main/java/edu/zrh/service/impl/AccountServiceImpl.java b/SimpleStudentManagementSystem/src/main/java/edu/zrh/service/impl/AccountServiceImpl.java
new file mode 100644
index 0000000..473420b
--- /dev/null
+++ b/SimpleStudentManagementSystem/src/main/java/edu/zrh/service/impl/AccountServiceImpl.java
@@ -0,0 +1,31 @@
+package edu.zrh.service.impl;
+
+import edu.zrh.mapper.AccountMapper;
+import edu.zrh.pojo.Account;
+import edu.zrh.service.AccountService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class AccountServiceImpl implements AccountService {
+
+ private final AccountMapper accountMapper;
+ @Autowired
+ public AccountServiceImpl(AccountMapper accountMapper) {
+ this.accountMapper = accountMapper;
+ }
+
+ @Override
+ public boolean validate(String username, String password) {
+ Account dbAccount = accountMapper.getAccount(username);
+ if(dbAccount != null && dbAccount.getPassword().equals(password)){
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public void insertAccount(Account account) {
+ accountMapper.insertAccount(account);
+ }
+}
diff --git a/SimpleStudentManagementSystem/src/main/java/edu/zrh/service/impl/AccountStudentServiceImpl.java b/SimpleStudentManagementSystem/src/main/java/edu/zrh/service/impl/AccountStudentServiceImpl.java
new file mode 100644
index 0000000..fafabde
--- /dev/null
+++ b/SimpleStudentManagementSystem/src/main/java/edu/zrh/service/impl/AccountStudentServiceImpl.java
@@ -0,0 +1,50 @@
+package edu.zrh.service.impl;
+
+import edu.zrh.mapper.AccountMapper;
+import edu.zrh.mapper.StudentMapper;
+import edu.zrh.pojo.Account;
+import edu.zrh.pojo.Student;
+import edu.zrh.service.AccountStudentService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.time.LocalDateTime;
+
+@Service
+public class AccountStudentServiceImpl implements AccountStudentService {
+
+ private final AccountMapper accountMapper;
+ private final StudentMapper studentMapper;
+ @Autowired
+ public AccountStudentServiceImpl(AccountMapper accountMapper, StudentMapper studentMapper) {
+ this.accountMapper = accountMapper;
+ this.studentMapper = studentMapper;
+ }
+ @Override
+ @Transactional
+ public void addStudentAccount(Student student) {
+ LocalDateTime now = LocalDateTime.now();
+ // 在数据库中创建Account
+ Account account = new Account();
+ account.setAccount(student.getId());// 学号
+ account.setPassword("12346"); // 默认密码
+ account.setRole(1); // 默认角色
+ account.setCreateBy(1);
+ account.setCreateTime(now);
+ accountMapper.insertAccount(account);
+ // 在数据库中创建Student
+ student.setCreateBy(1);
+ student.setCreateTime(now);
+ studentMapper.insertStudent(student);
+ }
+
+ @Override
+ @Transactional
+ public void deleteStudentAccount(String account) {
+ // 在数据库中删除student
+ studentMapper.deleteById(account);
+ // 在数据库中删除account
+ accountMapper.deleteByAccount(account);
+ }
+}
diff --git a/SimpleStudentManagementSystem/src/main/java/edu/zrh/service/impl/StudentServiceImpl.java b/SimpleStudentManagementSystem/src/main/java/edu/zrh/service/impl/StudentServiceImpl.java
new file mode 100644
index 0000000..ef92c7f
--- /dev/null
+++ b/SimpleStudentManagementSystem/src/main/java/edu/zrh/service/impl/StudentServiceImpl.java
@@ -0,0 +1,43 @@
+package edu.zrh.service.impl;
+
+import edu.zrh.mapper.StudentMapper;
+import edu.zrh.pojo.Student;
+import edu.zrh.service.StudentService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.time.LocalDateTime;
+import java.util.List;
+@Service
+public class StudentServiceImpl implements StudentService {
+ private final StudentMapper studentMapper;
+ @Autowired
+ public StudentServiceImpl(StudentMapper studentMapper) {
+ this.studentMapper = studentMapper;
+ }
+
+ @Override
+ public List getAllStudents() {
+ return studentMapper.getAll();
+ }
+ @Override
+ public void insertStudent(Student student) {
+ // 添加学生之前,需要先创建账号
+ studentMapper.insertStudent(student);
+ }
+
+
+ @Override
+ public Student getStudentById(String id) {
+ Student student = studentMapper.getById(id);
+ return student;
+ }
+
+ @Override
+ public void updateStudent(Student student) {
+ student.setUpdateBy(1);
+ student.setUpdateTime(LocalDateTime.now());
+ studentMapper.update(student);
+ }
+
+}
diff --git a/SimpleStudentManagementSystem/src/main/resources/application.properties b/SimpleStudentManagementSystem/src/main/resources/application.properties
new file mode 100644
index 0000000..932c2e4
--- /dev/null
+++ b/SimpleStudentManagementSystem/src/main/resources/application.properties
@@ -0,0 +1,25 @@
+spring.application.name=SimpleStudentManagementSystem
+spring.devtools.restart.enabled=true
+spring.devtools.restart.additional-paths=src/main/java
+spring.jackson.time-zone=Asia/Shanghai
+spring.devtools.restart.exclude=static/**
+
+spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
+spring.datasource.url=jdbc:mysql://10.33.66.120:3306/mb202201080137
+spring.datasource.username=mb202201080137
+spring.datasource.password=KQGTTX732721
+mybatis.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
+mybatis.configuration.map-underscore-to-camel-case=true
+
+mybatis.mapper-locations=classpath*:mapper/*.xml
+mybatis.type-aliases-package=edu.zrh.pojo
+
+spring.transaction.annotation-proxy-target-class=true
+
+
+server.port=8080
+server.servlet.context-path=/
+spring.thymeleaf.cache=false
+spring.thymeleaf.prefix=classpath:/templates/
+spring.thymeleaf.suffix=.html
+spring.mvc.hiddenmethod.filter.enabled=true
\ No newline at end of file
diff --git a/SimpleStudentManagementSystem/src/main/resources/mapper/AccountMapper.xml b/SimpleStudentManagementSystem/src/main/resources/mapper/AccountMapper.xml
new file mode 100644
index 0000000..06b79d3
--- /dev/null
+++ b/SimpleStudentManagementSystem/src/main/resources/mapper/AccountMapper.xml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+ select id, account, password, role
+ from account
+ where account = #{account}
+
+
+ delete from account where account = #{account}
+
+
+
+ insert into account(id, account, password, role, create_by)
+ values(#{id}, #{account}, #{password}, #{role}, #{createBy})
+
+
+ select a.id, a.account, s.`name`, s.gender, s.birthday
+ from account as a, student as s
+ where a.account = s.id
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SimpleStudentManagementSystem/src/main/resources/mapper/ScoreMapper.xml b/SimpleStudentManagementSystem/src/main/resources/mapper/ScoreMapper.xml
new file mode 100644
index 0000000..90af5d2
--- /dev/null
+++ b/SimpleStudentManagementSystem/src/main/resources/mapper/ScoreMapper.xml
@@ -0,0 +1,78 @@
+
+
+
+
+
+ insert into score(id, student_id, course_id, score, create_by, create_time)
+ values(#{id}, #{studentId}, #{courseId}, #{score}, #{createBy}, #{createTime})
+
+
+
+
+ update grade
+
+ grade = #{grade},
+ update_time = #{updateTime}
+
+ where no = #{no}
+
+
+
+
+ delete from score where id = #{id}
+
+
+
+ delete from score where id in
+
+ #{id}
+
+
+
+
+
+ SELECT score.id, s.`name` as student_name, c.`name` as course_name, score.score
+ FROM score, student as s, course as c
+ WHERE s.id = score.student_id and c.id = score.course_id
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SimpleStudentManagementSystem/src/main/resources/mapper/StudentMapper.xml b/SimpleStudentManagementSystem/src/main/resources/mapper/StudentMapper.xml
new file mode 100644
index 0000000..3fb791e
--- /dev/null
+++ b/SimpleStudentManagementSystem/src/main/resources/mapper/StudentMapper.xml
@@ -0,0 +1,122 @@
+
+
+
+
+
+ select id, name, gender, birthday
+ from student
+
+
+
+
+
+ select id, name, gender, birthday from student
+
+
+
+
+
+
+
+
+
+
+ id = #{id}
+
+
+
+
+
+
+
+
+ char_length(student.name) = #{len}
+
+
+ and gender = #{gender};
+
+
+
+
+
+
+
+ insert into student(id, name, gender, birthday, create_by, create_time)
+ values(#{id}, #{name}, #{gender}, #{birthday}, #{createBy}, #{createTime})
+
+
+
+
+
+ update student
+
+ name = #{name},
+ gender = #{gender},
+ birthday = #{birthday},
+ update_by = #{updateBy},
+ update_time = #{updateTime}
+
+ where id = #{id}
+
+
+
+
+
+
+
+
+
+ delete from student where id in
+
+ #{id}
+
+
+
+
+ delete from student where id = #{id}
+
+
+
+
+
+ SELECT s.id, s.`name`, g.id as gid, g.name as gname, s.birthday
+ from student as s
+ JOIN `gender` as g on g.id = s.gender
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ SELECT s.id as sid, s.`name` as sname, c.id as cid, c.`name` as cname, sc.`id` as scid, sc.score
+ FROM student as s, score as sc, course as c
+ where s.id = #{id} and s.id = sc.student_id and c.id = sc.course_id
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SimpleStudentManagementSystem/src/main/resources/mapper/StudentScoreMapper.xml b/SimpleStudentManagementSystem/src/main/resources/mapper/StudentScoreMapper.xml
new file mode 100644
index 0000000..eeae419
--- /dev/null
+++ b/SimpleStudentManagementSystem/src/main/resources/mapper/StudentScoreMapper.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+ SELECT s.id as sid, s.`name` as sname, c.id as cid, c.`name` as cname, sc.`id` as scid, sc.score
+ FROM student as s, score as sc, course as c
+ where s.id = #{id} and s.id = sc.student_id and c.id = sc.course_id
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SimpleStudentManagementSystem/src/main/resources/templates/addstudent.html b/SimpleStudentManagementSystem/src/main/resources/templates/addstudent.html
new file mode 100644
index 0000000..8248c34
--- /dev/null
+++ b/SimpleStudentManagementSystem/src/main/resources/templates/addstudent.html
@@ -0,0 +1,16 @@
+
+
+
+ 教务系统
+ 学生管理——添加
+ 查询
+ 添加
+
+
+
\ No newline at end of file
diff --git a/SimpleStudentManagementSystem/src/main/resources/templates/index.html b/SimpleStudentManagementSystem/src/main/resources/templates/index.html
new file mode 100644
index 0000000..7e8b7a7
--- /dev/null
+++ b/SimpleStudentManagementSystem/src/main/resources/templates/index.html
@@ -0,0 +1,15 @@
+
+
+
+
+ 教务系统
+
+
+ 教务系统
+
+
+
\ No newline at end of file
diff --git a/SimpleStudentManagementSystem/src/main/resources/templates/login.html b/SimpleStudentManagementSystem/src/main/resources/templates/login.html
new file mode 100644
index 0000000..597be6d
--- /dev/null
+++ b/SimpleStudentManagementSystem/src/main/resources/templates/login.html
@@ -0,0 +1,17 @@
+
+
+
+
+ Title
+
+
+
+ 登陆
+
+
+
+
\ No newline at end of file
diff --git a/SimpleStudentManagementSystem/src/main/resources/templates/student.html b/SimpleStudentManagementSystem/src/main/resources/templates/student.html
new file mode 100644
index 0000000..e9dee0c
--- /dev/null
+++ b/SimpleStudentManagementSystem/src/main/resources/templates/student.html
@@ -0,0 +1,31 @@
+
+
+
+ 教务系统
+ 学生管理
+ 查询
+ 添加
+
+
+ id
+ 姓名
+ 性别
+ 出生日期
+ 删除操作
+ 更新操作
+
+
+
+
+
+
+
+ 删除
+
+
+ 更新
+
+
+
+
+
\ No newline at end of file
diff --git a/SimpleStudentManagementSystem/src/main/resources/templates/updatestudent.html b/SimpleStudentManagementSystem/src/main/resources/templates/updatestudent.html
new file mode 100644
index 0000000..75b3c6c
--- /dev/null
+++ b/SimpleStudentManagementSystem/src/main/resources/templates/updatestudent.html
@@ -0,0 +1,16 @@
+
+
+
+ 教务系统
+ 学生管理——更新
+ 查询
+ 添加
+
+
+
\ No newline at end of file
diff --git a/SimpleStudentManagementSystem/src/test/java/edu/zrh/ApplicationTests.java b/SimpleStudentManagementSystem/src/test/java/edu/zrh/ApplicationTests.java
new file mode 100644
index 0000000..316dde7
--- /dev/null
+++ b/SimpleStudentManagementSystem/src/test/java/edu/zrh/ApplicationTests.java
@@ -0,0 +1,201 @@
+package edu.zrh;
+
+import edu.zrh.mapper.AccountMapper;
+import edu.zrh.mapper.ScoreMapper;
+import edu.zrh.mapper.StudentScoreMapper;
+import edu.zrh.mapper.StudentMapper;
+import edu.zrh.pojo.*;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.util.Arrays;
+import java.util.List;
+
+
+@SpringBootTest
+class ApplicationTests {
+ @Autowired
+ private StudentMapper studentMapper;
+ @Autowired
+ private ScoreMapper scoreMapper;
+ @Autowired
+ private StudentScoreMapper studentScoreMapper;
+ @Autowired
+ private AccountMapper accountMapper;
+
+ @Test
+ public void testGetAll(){
+ // 查询所有学生信息
+ List stuList = studentMapper.getAll();
+ for (Student student : stuList) {
+ // 显示性别为“男”或“女”
+ String gender = student.getGender() == 1 ? "男" : "女";
+ System.out.println("学生ID: " + student.getId() + ", 姓名: " + student.getName() + ", 性别: " + gender);
+ }
+ }
+ @Test
+ public void testGetAllCourses() {
+ // 查询所有课程名
+ List courseNames = scoreMapper.getAll();
+ for (Score courseName : courseNames) {
+ System.out.println("课程名: " + courseName);
+ }
+ }
+ @Test
+ public void testaddAllStudents() {
+ Score score=new Score();
+ score.setId(111);
+ score.setStudentId("1");
+ score.setCourseId("1");
+ score.setScore(1);
+ score.setCreateTime(LocalDateTime.now());
+ // 添加成绩
+ score.setStudentId("12138");
+ score.setCourseId("101");
+ scoreMapper.insert(score);
+ }
+ @Test
+ public void testDeleteScoreById(){
+ // 删除一条成绩
+ scoreMapper.deleteById(28);
+ }
+
+
+ @Test
+ public void testDeleteByIds(){
+ // 删除多条成绩
+ List ids = Arrays.asList(29,30,31);
+ scoreMapper.deleteByIds(ids);
+ }
+ @Test
+ public void testStudentGrade2(){
+ //查询学生成绩
+ StudentScore studentScore = studentScoreMapper.getByNo("12138");
+ System.out.println("学生:" + studentScore.getStudent().getName());
+ for (Score score : studentScore.getScores()){
+ System.out.println("课程:" + score.getCourse().getName() + ",成绩:" + score.getScore());
+ }
+ }
+ @Test
+ public void testGetById(){
+ // 根据 id 查学生
+ Student stu = studentMapper.getById("12138");
+ System.out.println(stu);
+ }
+
+ @Test
+ public void testGetByCondition(){
+ // 学生条件查询
+ List stuList = studentMapper.getByCondition(null, null);
+ System.out.println(stuList);
+ }
+
+ @Test
+ public void testInsertAccount(){
+ // 新增账号
+ Account account = new Account();
+ account.setAccount("12143");
+ account.setPassword("123456");
+ account.setCreateBy(1);
+ LocalDateTime now = LocalDateTime.now();
+ account.setCreateTime(now);
+ accountMapper.insertAccount(account);
+ }
+ @Test
+ public void testInsertStudent(){
+ Student student = new Student();
+ student.setId("12143");
+ student.setName("陆展博");
+ student.setGender(1);
+ student.setBirthday(LocalDate.of(2002,10,14));
+ student.setCreateBy(1);
+ LocalDateTime now = LocalDateTime.now();
+ student.setCreateTime(now);
+ studentMapper.insertStudent(student);
+ }
+ @Test
+ public void testInsertScore(){
+ Score score = new Score();
+ score.setStudentId("12142");
+ score.setCourseId("102");
+ score.setScore(90);
+ score.setCreateBy(1);
+ LocalDateTime now = LocalDateTime.now();
+ score.setCreateTime(now);
+ scoreMapper.insert(score);
+ System.out.println(score.getId());
+ }
+
+ @Test
+ public void testUpdateStudent(){
+ Student student = new Student();
+ student.setId("12141");
+ student.setName("张益达");
+ student.setUpdateBy(1);
+ LocalDateTime now = LocalDateTime.now();
+ student.setUpdateTime(now);
+ studentMapper.update(student);
+ }
+
+
+
+
+ @Test
+ public void testAccountWithDetails(){
+ // 一对一
+ List accounts = accountMapper.getAccountWithDetails();
+ System.out.println(accounts);
+ }
+
+ @Test
+ public void testStudentWithGender(){
+ List students = studentMapper.getAllWithGender();
+ System.out.println(students);
+ }
+
+ @Test
+ public void testScoreWithName(){
+ List scores = scoreMapper.getAll();
+ System.out.println(scores);
+ }
+ @Test
+ public void testStudentGrade(){
+ Student student = studentMapper.getStudentScoresById("12138");
+ System.out.println("学生:" + student.getName());
+ for (Score score : student.getScores()){
+ System.out.println("课程:" + score.getCourse().getName() + ",成绩:" + score.getScore());
+ System.out.println(score);
+ }
+ }
+
+
+ /*@Test
+ public void testGradeUpdate(){
+ Score score = new Score();
+ score.setStudentID("12142");
+ score.setCourseID("101");
+ score.setGrade(90);
+ score.setUpdateTime(LocalDateTime.now());
+ gradeMapper.update(score);
+ System.out.println(score);
+ }
+
+
+ @Test
+ public void testGradeDelete(){
+ gradeMapper.deleteByNo(24);
+ }
+
+
+ @Test
+ public void testGetByNo(){
+ Score score = gradeMapper.getByNo(1);
+ System.out.println(score);
+ }
+
+ */
+
+}
diff --git a/SimpleStudentManagementSystem/target/classes/application.properties b/SimpleStudentManagementSystem/target/classes/application.properties
new file mode 100644
index 0000000..932c2e4
--- /dev/null
+++ b/SimpleStudentManagementSystem/target/classes/application.properties
@@ -0,0 +1,25 @@
+spring.application.name=SimpleStudentManagementSystem
+spring.devtools.restart.enabled=true
+spring.devtools.restart.additional-paths=src/main/java
+spring.jackson.time-zone=Asia/Shanghai
+spring.devtools.restart.exclude=static/**
+
+spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
+spring.datasource.url=jdbc:mysql://10.33.66.120:3306/mb202201080137
+spring.datasource.username=mb202201080137
+spring.datasource.password=KQGTTX732721
+mybatis.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
+mybatis.configuration.map-underscore-to-camel-case=true
+
+mybatis.mapper-locations=classpath*:mapper/*.xml
+mybatis.type-aliases-package=edu.zrh.pojo
+
+spring.transaction.annotation-proxy-target-class=true
+
+
+server.port=8080
+server.servlet.context-path=/
+spring.thymeleaf.cache=false
+spring.thymeleaf.prefix=classpath:/templates/
+spring.thymeleaf.suffix=.html
+spring.mvc.hiddenmethod.filter.enabled=true
\ No newline at end of file
diff --git a/SimpleStudentManagementSystem/target/classes/edu/zrh/Application.class b/SimpleStudentManagementSystem/target/classes/edu/zrh/Application.class
new file mode 100644
index 0000000..2712794
Binary files /dev/null and b/SimpleStudentManagementSystem/target/classes/edu/zrh/Application.class differ
diff --git a/SimpleStudentManagementSystem/target/classes/edu/zrh/controller/AccountStudentController.class b/SimpleStudentManagementSystem/target/classes/edu/zrh/controller/AccountStudentController.class
new file mode 100644
index 0000000..055f33e
Binary files /dev/null and b/SimpleStudentManagementSystem/target/classes/edu/zrh/controller/AccountStudentController.class differ
diff --git a/SimpleStudentManagementSystem/target/classes/edu/zrh/controller/LoginController.class b/SimpleStudentManagementSystem/target/classes/edu/zrh/controller/LoginController.class
new file mode 100644
index 0000000..db709be
Binary files /dev/null and b/SimpleStudentManagementSystem/target/classes/edu/zrh/controller/LoginController.class differ
diff --git a/SimpleStudentManagementSystem/target/classes/edu/zrh/controller/StudentController.class b/SimpleStudentManagementSystem/target/classes/edu/zrh/controller/StudentController.class
new file mode 100644
index 0000000..6e0fcd5
Binary files /dev/null and b/SimpleStudentManagementSystem/target/classes/edu/zrh/controller/StudentController.class differ
diff --git a/SimpleStudentManagementSystem/target/classes/edu/zrh/mapper/AccountMapper.class b/SimpleStudentManagementSystem/target/classes/edu/zrh/mapper/AccountMapper.class
new file mode 100644
index 0000000..4f3dd85
Binary files /dev/null and b/SimpleStudentManagementSystem/target/classes/edu/zrh/mapper/AccountMapper.class differ
diff --git a/SimpleStudentManagementSystem/target/classes/edu/zrh/mapper/ScoreMapper.class b/SimpleStudentManagementSystem/target/classes/edu/zrh/mapper/ScoreMapper.class
new file mode 100644
index 0000000..fb4390c
Binary files /dev/null and b/SimpleStudentManagementSystem/target/classes/edu/zrh/mapper/ScoreMapper.class differ
diff --git a/SimpleStudentManagementSystem/target/classes/edu/zrh/mapper/StudentMapper.class b/SimpleStudentManagementSystem/target/classes/edu/zrh/mapper/StudentMapper.class
new file mode 100644
index 0000000..a2a9d26
Binary files /dev/null and b/SimpleStudentManagementSystem/target/classes/edu/zrh/mapper/StudentMapper.class differ
diff --git a/SimpleStudentManagementSystem/target/classes/edu/zrh/mapper/StudentScoreMapper.class b/SimpleStudentManagementSystem/target/classes/edu/zrh/mapper/StudentScoreMapper.class
new file mode 100644
index 0000000..02cd231
Binary files /dev/null and b/SimpleStudentManagementSystem/target/classes/edu/zrh/mapper/StudentScoreMapper.class differ
diff --git a/SimpleStudentManagementSystem/target/classes/edu/zrh/pojo/Account.class b/SimpleStudentManagementSystem/target/classes/edu/zrh/pojo/Account.class
new file mode 100644
index 0000000..d97651f
Binary files /dev/null and b/SimpleStudentManagementSystem/target/classes/edu/zrh/pojo/Account.class differ
diff --git a/SimpleStudentManagementSystem/target/classes/edu/zrh/pojo/BaseEntity.class b/SimpleStudentManagementSystem/target/classes/edu/zrh/pojo/BaseEntity.class
new file mode 100644
index 0000000..e4d849f
Binary files /dev/null and b/SimpleStudentManagementSystem/target/classes/edu/zrh/pojo/BaseEntity.class differ
diff --git a/SimpleStudentManagementSystem/target/classes/edu/zrh/pojo/Course.class b/SimpleStudentManagementSystem/target/classes/edu/zrh/pojo/Course.class
new file mode 100644
index 0000000..e6144f0
Binary files /dev/null and b/SimpleStudentManagementSystem/target/classes/edu/zrh/pojo/Course.class differ
diff --git a/SimpleStudentManagementSystem/target/classes/edu/zrh/pojo/Gender.class b/SimpleStudentManagementSystem/target/classes/edu/zrh/pojo/Gender.class
new file mode 100644
index 0000000..283e84c
Binary files /dev/null and b/SimpleStudentManagementSystem/target/classes/edu/zrh/pojo/Gender.class differ
diff --git a/SimpleStudentManagementSystem/target/classes/edu/zrh/pojo/Score.class b/SimpleStudentManagementSystem/target/classes/edu/zrh/pojo/Score.class
new file mode 100644
index 0000000..88cf718
Binary files /dev/null and b/SimpleStudentManagementSystem/target/classes/edu/zrh/pojo/Score.class differ
diff --git a/SimpleStudentManagementSystem/target/classes/edu/zrh/pojo/Student.class b/SimpleStudentManagementSystem/target/classes/edu/zrh/pojo/Student.class
new file mode 100644
index 0000000..b476595
Binary files /dev/null and b/SimpleStudentManagementSystem/target/classes/edu/zrh/pojo/Student.class differ
diff --git a/SimpleStudentManagementSystem/target/classes/edu/zrh/pojo/StudentScore.class b/SimpleStudentManagementSystem/target/classes/edu/zrh/pojo/StudentScore.class
new file mode 100644
index 0000000..2a10f77
Binary files /dev/null and b/SimpleStudentManagementSystem/target/classes/edu/zrh/pojo/StudentScore.class differ
diff --git a/SimpleStudentManagementSystem/target/classes/edu/zrh/service/AccountService.class b/SimpleStudentManagementSystem/target/classes/edu/zrh/service/AccountService.class
new file mode 100644
index 0000000..8c1be0a
Binary files /dev/null and b/SimpleStudentManagementSystem/target/classes/edu/zrh/service/AccountService.class differ
diff --git a/SimpleStudentManagementSystem/target/classes/edu/zrh/service/AccountStudentService.class b/SimpleStudentManagementSystem/target/classes/edu/zrh/service/AccountStudentService.class
new file mode 100644
index 0000000..3f07c2c
Binary files /dev/null and b/SimpleStudentManagementSystem/target/classes/edu/zrh/service/AccountStudentService.class differ
diff --git a/SimpleStudentManagementSystem/target/classes/edu/zrh/service/StudentService.class b/SimpleStudentManagementSystem/target/classes/edu/zrh/service/StudentService.class
new file mode 100644
index 0000000..b79f748
Binary files /dev/null and b/SimpleStudentManagementSystem/target/classes/edu/zrh/service/StudentService.class differ
diff --git a/SimpleStudentManagementSystem/target/classes/edu/zrh/service/impl/AccountServiceImpl.class b/SimpleStudentManagementSystem/target/classes/edu/zrh/service/impl/AccountServiceImpl.class
new file mode 100644
index 0000000..cc1a59f
Binary files /dev/null and b/SimpleStudentManagementSystem/target/classes/edu/zrh/service/impl/AccountServiceImpl.class differ
diff --git a/SimpleStudentManagementSystem/target/classes/edu/zrh/service/impl/AccountStudentServiceImpl.class b/SimpleStudentManagementSystem/target/classes/edu/zrh/service/impl/AccountStudentServiceImpl.class
new file mode 100644
index 0000000..1ffb977
Binary files /dev/null and b/SimpleStudentManagementSystem/target/classes/edu/zrh/service/impl/AccountStudentServiceImpl.class differ
diff --git a/SimpleStudentManagementSystem/target/classes/edu/zrh/service/impl/StudentServiceImpl.class b/SimpleStudentManagementSystem/target/classes/edu/zrh/service/impl/StudentServiceImpl.class
new file mode 100644
index 0000000..1d05461
Binary files /dev/null and b/SimpleStudentManagementSystem/target/classes/edu/zrh/service/impl/StudentServiceImpl.class differ
diff --git a/SimpleStudentManagementSystem/target/classes/mapper/AccountMapper.xml b/SimpleStudentManagementSystem/target/classes/mapper/AccountMapper.xml
new file mode 100644
index 0000000..06b79d3
--- /dev/null
+++ b/SimpleStudentManagementSystem/target/classes/mapper/AccountMapper.xml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+ select id, account, password, role
+ from account
+ where account = #{account}
+
+
+ delete from account where account = #{account}
+
+
+
+ insert into account(id, account, password, role, create_by)
+ values(#{id}, #{account}, #{password}, #{role}, #{createBy})
+
+
+ select a.id, a.account, s.`name`, s.gender, s.birthday
+ from account as a, student as s
+ where a.account = s.id
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SimpleStudentManagementSystem/target/classes/mapper/ScoreMapper.xml b/SimpleStudentManagementSystem/target/classes/mapper/ScoreMapper.xml
new file mode 100644
index 0000000..90af5d2
--- /dev/null
+++ b/SimpleStudentManagementSystem/target/classes/mapper/ScoreMapper.xml
@@ -0,0 +1,78 @@
+
+
+
+
+
+ insert into score(id, student_id, course_id, score, create_by, create_time)
+ values(#{id}, #{studentId}, #{courseId}, #{score}, #{createBy}, #{createTime})
+
+
+
+
+ update grade
+
+ grade = #{grade},
+ update_time = #{updateTime}
+
+ where no = #{no}
+
+
+
+
+ delete from score where id = #{id}
+
+
+
+ delete from score where id in
+
+ #{id}
+
+
+
+
+
+ SELECT score.id, s.`name` as student_name, c.`name` as course_name, score.score
+ FROM score, student as s, course as c
+ WHERE s.id = score.student_id and c.id = score.course_id
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SimpleStudentManagementSystem/target/classes/mapper/StudentMapper.xml b/SimpleStudentManagementSystem/target/classes/mapper/StudentMapper.xml
new file mode 100644
index 0000000..3fb791e
--- /dev/null
+++ b/SimpleStudentManagementSystem/target/classes/mapper/StudentMapper.xml
@@ -0,0 +1,122 @@
+
+
+
+
+
+ select id, name, gender, birthday
+ from student
+
+
+
+
+
+ select id, name, gender, birthday from student
+
+
+
+
+
+
+
+
+
+
+ id = #{id}
+
+
+
+
+
+
+
+
+ char_length(student.name) = #{len}
+
+
+ and gender = #{gender};
+
+
+
+
+
+
+
+ insert into student(id, name, gender, birthday, create_by, create_time)
+ values(#{id}, #{name}, #{gender}, #{birthday}, #{createBy}, #{createTime})
+
+
+
+
+
+ update student
+
+ name = #{name},
+ gender = #{gender},
+ birthday = #{birthday},
+ update_by = #{updateBy},
+ update_time = #{updateTime}
+
+ where id = #{id}
+
+
+
+
+
+
+
+
+
+ delete from student where id in
+
+ #{id}
+
+
+
+
+ delete from student where id = #{id}
+
+
+
+
+
+ SELECT s.id, s.`name`, g.id as gid, g.name as gname, s.birthday
+ from student as s
+ JOIN `gender` as g on g.id = s.gender
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ SELECT s.id as sid, s.`name` as sname, c.id as cid, c.`name` as cname, sc.`id` as scid, sc.score
+ FROM student as s, score as sc, course as c
+ where s.id = #{id} and s.id = sc.student_id and c.id = sc.course_id
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SimpleStudentManagementSystem/target/classes/mapper/StudentScoreMapper.xml b/SimpleStudentManagementSystem/target/classes/mapper/StudentScoreMapper.xml
new file mode 100644
index 0000000..eeae419
--- /dev/null
+++ b/SimpleStudentManagementSystem/target/classes/mapper/StudentScoreMapper.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+ SELECT s.id as sid, s.`name` as sname, c.id as cid, c.`name` as cname, sc.`id` as scid, sc.score
+ FROM student as s, score as sc, course as c
+ where s.id = #{id} and s.id = sc.student_id and c.id = sc.course_id
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SimpleStudentManagementSystem/target/classes/templates/addstudent.html b/SimpleStudentManagementSystem/target/classes/templates/addstudent.html
new file mode 100644
index 0000000..8248c34
--- /dev/null
+++ b/SimpleStudentManagementSystem/target/classes/templates/addstudent.html
@@ -0,0 +1,16 @@
+
+
+
+ 教务系统
+ 学生管理——添加
+ 查询
+ 添加
+
+
+
\ No newline at end of file
diff --git a/SimpleStudentManagementSystem/target/classes/templates/index.html b/SimpleStudentManagementSystem/target/classes/templates/index.html
new file mode 100644
index 0000000..7e8b7a7
--- /dev/null
+++ b/SimpleStudentManagementSystem/target/classes/templates/index.html
@@ -0,0 +1,15 @@
+
+
+
+
+ 教务系统
+
+
+ 教务系统
+
+
+
\ No newline at end of file
diff --git a/SimpleStudentManagementSystem/target/classes/templates/login.html b/SimpleStudentManagementSystem/target/classes/templates/login.html
new file mode 100644
index 0000000..597be6d
--- /dev/null
+++ b/SimpleStudentManagementSystem/target/classes/templates/login.html
@@ -0,0 +1,17 @@
+
+
+
+
+ Title
+
+
+
+ 登陆
+
+
+
+
\ No newline at end of file
diff --git a/SimpleStudentManagementSystem/target/classes/templates/student.html b/SimpleStudentManagementSystem/target/classes/templates/student.html
new file mode 100644
index 0000000..e9dee0c
--- /dev/null
+++ b/SimpleStudentManagementSystem/target/classes/templates/student.html
@@ -0,0 +1,31 @@
+
+
+
+ 教务系统
+ 学生管理
+ 查询
+ 添加
+
+
+ id
+ 姓名
+ 性别
+ 出生日期
+ 删除操作
+ 更新操作
+
+
+
+
+
+
+
+ 删除
+
+
+ 更新
+
+
+
+
+
\ No newline at end of file
diff --git a/SimpleStudentManagementSystem/target/classes/templates/updatestudent.html b/SimpleStudentManagementSystem/target/classes/templates/updatestudent.html
new file mode 100644
index 0000000..75b3c6c
--- /dev/null
+++ b/SimpleStudentManagementSystem/target/classes/templates/updatestudent.html
@@ -0,0 +1,16 @@
+
+
+
+ 教务系统
+ 学生管理——更新
+ 查询
+ 添加
+
+
+
\ No newline at end of file
diff --git a/SimpleStudentManagementSystem/target/test-classes/edu/zrh/ApplicationTests.class b/SimpleStudentManagementSystem/target/test-classes/edu/zrh/ApplicationTests.class
new file mode 100644
index 0000000..44c5bf6
Binary files /dev/null and b/SimpleStudentManagementSystem/target/test-classes/edu/zrh/ApplicationTests.class differ