diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..35410ca --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# 默认忽略的文件 +/shelf/ +/workspace.xml +# 基于编辑器的 HTTP 客户端请求 +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/ApifoxUploaderProjectSetting.xml b/.idea/ApifoxUploaderProjectSetting.xml new file mode 100644 index 0000000..67f6370 --- /dev/null +++ b/.idea/ApifoxUploaderProjectSetting.xml @@ -0,0 +1,13 @@ + + + + + + \ No newline at end of file diff --git a/.idea/BACKEND_ATTENDANCE.iml b/.idea/BACKEND_ATTENDANCE.iml new file mode 100644 index 0000000..d6ebd48 --- /dev/null +++ b/.idea/BACKEND_ATTENDANCE.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..5144545 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..63e9001 --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..3e44fab --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.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..712ab9d --- /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..df00c07 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,14 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/BACKEND_ATTENDANCE/.idea/workspace.xml b/BACKEND_ATTENDANCE/.idea/workspace.xml new file mode 100644 index 0000000..6255c14 --- /dev/null +++ b/BACKEND_ATTENDANCE/.idea/workspace.xml @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { + "associatedIndex": 3 +} + + + + { + "keyToString": { + "RunOnceActivity.OpenProjectViewOnStart": "true", + "RunOnceActivity.ShowReadmeOnStart": "true", + "WebServerToolWindowFactoryState": "false", + "git-widget-placeholder": "main", + "last_opened_file_path": "C:/Users/onelastkiss/Desktop/项目/bigbigmarket", + "node.js.detected.package.eslint": "true", + "node.js.detected.package.tslint": "true", + "node.js.selected.package.eslint": "(autodetect)", + "node.js.selected.package.tslint": "(autodetect)", + "vue.rearranger.settings.migration": "true" + } +} + + + + + + + + + + + + + + + 1728323291653 + + + + + + \ No newline at end of file diff --git a/BACKEND_ATTENDANCE/pom.xml b/BACKEND_ATTENDANCE/pom.xml new file mode 100644 index 0000000..b73080b --- /dev/null +++ b/BACKEND_ATTENDANCE/pom.xml @@ -0,0 +1,141 @@ + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 3.3.3 + + + com.example + attendance + 0.0.1-SNAPSHOT + attendance + attendance + + + 17 + + + + + + + org.springframework.boot + spring-boot-starter-web + + + + + org.mybatis.spring.boot + mybatis-spring-boot-starter + 3.0.3 + + + + + org.springframework.boot + spring-boot-devtools + runtime + true + + + + + 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 + + + + + com.alibaba + easyexcel + 3.0.5 + + + + + org.springframework.boot + spring-boot-starter-security + + + + + io.jsonwebtoken + jjwt-api + 0.11.5 + + + + io.jsonwebtoken + jjwt-impl + 0.11.5 + runtime + + + + io.jsonwebtoken + jjwt-jackson + 0.11.5 + runtime + + + + + org.springframework.security + spring-security-crypto + + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 17 + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + org.projectlombok + lombok + + + + + + + diff --git a/BACKEND_ATTENDANCE/src/main/java/com/example/attendance/controller/StudentController.java b/BACKEND_ATTENDANCE/src/main/java/com/example/attendance/controller/StudentController.java index 0cc0444..5f05577 100644 --- a/BACKEND_ATTENDANCE/src/main/java/com/example/attendance/controller/StudentController.java +++ b/BACKEND_ATTENDANCE/src/main/java/com/example/attendance/controller/StudentController.java @@ -47,6 +47,16 @@ public class StudentController { return ResponseEntity.ok(students); } + /** + * 获取所有学生的姓名 + * @return 学生姓名的字符串数组 + */ + @GetMapping("/names") + public ResponseEntity getAllStudentNames() { + String[] studentNames = studentService.getAllStudentNames(); + return ResponseEntity.ok(studentNames); + } + //添加学生信息 @PostMapping public ResponseEntity addStudent(@RequestBody Student student) { @@ -114,7 +124,7 @@ public class StudentController { return "学生数据导入失败:" + e.getMessage(); } } - /*导入学生数据 + /*导出学生数据 */ @GetMapping("/export-students") public ResponseEntity exportStudents() throws IOException { diff --git a/BACKEND_ATTENDANCE/src/main/java/com/example/attendance/entity/RollCallSettings.java b/BACKEND_ATTENDANCE/src/main/java/com/example/attendance/entity/RollCallSettings.java index 352ae8d..fbc537e 100644 --- a/BACKEND_ATTENDANCE/src/main/java/com/example/attendance/entity/RollCallSettings.java +++ b/BACKEND_ATTENDANCE/src/main/java/com/example/attendance/entity/RollCallSettings.java @@ -8,8 +8,7 @@ import lombok.NoArgsConstructor; @AllArgsConstructor @Data public class RollCallSettings { - private boolean isRollCall; // 点名(true)或提问(false) - private boolean triggerRandomEvent; // 是否触发随机事件 - private boolean wheelOfFortune; // 是否开启命运轮盘 - + private String rollCallMode; // 点名("点名")或提问("提问") + private String triggerRandomEvent; // 触发("触发")或不触发("不触发")随机事件 + private String wheelOfFortune; // 开启("是")或关闭("否")命运轮盘 } diff --git a/BACKEND_ATTENDANCE/src/main/java/com/example/attendance/mapper/StudentMapper.java b/BACKEND_ATTENDANCE/src/main/java/com/example/attendance/mapper/StudentMapper.java index 7249c6d..afca05a 100644 --- a/BACKEND_ATTENDANCE/src/main/java/com/example/attendance/mapper/StudentMapper.java +++ b/BACKEND_ATTENDANCE/src/main/java/com/example/attendance/mapper/StudentMapper.java @@ -46,4 +46,11 @@ public interface StudentMapper { */ @Select("SELECT * FROM student ORDER BY points DESC LIMIT #{size} OFFSET #{offset}") List findStudentsByRanking(@Param("offset") int offset, @Param("size") int size); + + /** + * 查询所有学生的姓名 + * @return 学生姓名的字符串数组 + */ + @Select("SELECT name FROM student") + String[] findAllStudentNames(); } diff --git a/BACKEND_ATTENDANCE/src/main/java/com/example/attendance/service/StudentService.java b/BACKEND_ATTENDANCE/src/main/java/com/example/attendance/service/StudentService.java index 6d5416b..ed977b7 100644 --- a/BACKEND_ATTENDANCE/src/main/java/com/example/attendance/service/StudentService.java +++ b/BACKEND_ATTENDANCE/src/main/java/com/example/attendance/service/StudentService.java @@ -19,4 +19,5 @@ public interface StudentService { void update(Student student); void delete(Long id); + String[] getAllStudentNames(); } diff --git a/BACKEND_ATTENDANCE/src/main/java/com/example/attendance/service/impl/RollCallServiceImpl.java b/BACKEND_ATTENDANCE/src/main/java/com/example/attendance/service/impl/RollCallServiceImpl.java index 2a97d9c..4a9d55f 100644 --- a/BACKEND_ATTENDANCE/src/main/java/com/example/attendance/service/impl/RollCallServiceImpl.java +++ b/BACKEND_ATTENDANCE/src/main/java/com/example/attendance/service/impl/RollCallServiceImpl.java @@ -6,7 +6,6 @@ import com.example.attendance.entity.Student; import com.example.attendance.service.RollCallService; import org.springframework.stereotype.Service; -import java.math.BigDecimal; import java.util.List; import java.util.Random; @@ -16,11 +15,11 @@ public class RollCallServiceImpl implements RollCallService { @Override public RollCallResponse startRollCall(List students, RollCallSettings settings) { // 1. 根据设定选择点名或提问模式 - String mode = settings.isRollCall() ? "点名" : "提问"; + String mode = "点名".equals(settings.getRollCallMode()) ? "点名" : "提问"; System.out.println("当前模式:" + mode); // 2. 处理命运轮盘 (所有人概率相等) - if (settings.isWheelOfFortune()) { + if ("是".equals(settings.getWheelOfFortune())) { return handleWheelOfFortune(students); } @@ -32,7 +31,7 @@ public class RollCallServiceImpl implements RollCallService { response.setPoints(selectedStudent.getPoints()); // 4. 判断是否触发随机事件 - if (settings.isTriggerRandomEvent()) { + if ("触发".equals(settings.getTriggerRandomEvent())) { response.setMessage("触发了随机事件: " + triggerRandomEvent()); } else { response.setMessage("没有触发随机事件," + selectedStudent.getName() + " 被点了!"); diff --git a/BACKEND_ATTENDANCE/src/main/java/com/example/attendance/service/impl/StudentServiceImpl.java b/BACKEND_ATTENDANCE/src/main/java/com/example/attendance/service/impl/StudentServiceImpl.java index b46f396..fa4ce1c 100644 --- a/BACKEND_ATTENDANCE/src/main/java/com/example/attendance/service/impl/StudentServiceImpl.java +++ b/BACKEND_ATTENDANCE/src/main/java/com/example/attendance/service/impl/StudentServiceImpl.java @@ -98,6 +98,7 @@ public class StudentServiceImpl implements StudentService { * @param studentNumber 学生编号 * @param pointsDelta 要加或减的积分值 */ + @Override public void adjustPoints(String studentNumber, BigDecimal pointsDelta) { Student student = studentMapper.findByStudentNumber(studentNumber); if (student == null) { @@ -114,6 +115,7 @@ public class StudentServiceImpl implements StudentService { * @param size 每页显示的记录数 * @return 学生排行榜 */ + @Override public List getStudentRanking(int page, int size) { int offset = page * size; return studentMapper.findStudentsByRanking(offset, size); @@ -148,4 +150,13 @@ public class StudentServiceImpl implements StudentService { public void delete(Long id) { studentMapper.delete(id); } + + /** + * 获取所有学生的姓名 + * @return 学生姓名的字符串数组 + */ + @Override + public String[] getAllStudentNames() { + return studentMapper.findAllStudentNames(); + } } \ No newline at end of file diff --git a/BACKEND_ATTENDANCE/src/main/main.iml b/BACKEND_ATTENDANCE/src/main/main.iml new file mode 100644 index 0000000..908ad4f --- /dev/null +++ b/BACKEND_ATTENDANCE/src/main/main.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/BACKEND_ATTENDANCE/src/test/test.iml b/BACKEND_ATTENDANCE/src/test/test.iml new file mode 100644 index 0000000..5ebc6f4 --- /dev/null +++ b/BACKEND_ATTENDANCE/src/test/test.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file