抽取状态枚举,重构批量导入代码
parent
c9f092e060
commit
b53e8d62df
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1 @@
|
||||
{"mysqld_version_id":80402,"dd_version":80300,"sdi_version":80019,"dd_object_type":"Table","dd_object":{"name":"session_account_connect_attrs","mysql_version_id":80402,"created":20251120094414,"last_altered":20251120094414,"hidden":1,"options":"avg_row_length=0;key_block_size=0;keys_disabled=0;pack_record=1;server_p_s_table=1;stats_auto_recalc=0;stats_sample_pages=0;","columns":[{"name":"PROCESSLIST_ID","type":9,"is_nullable":false,"is_zerofill":false,"is_unsigned":true,"is_auto_increment":false,"is_virtual":false,"hidden":1,"ordinal_position":1,"char_length":20,"numeric_precision":20,"numeric_scale":0,"numeric_scale_null":false,"datetime_precision":0,"datetime_precision_null":1,"has_no_default":true,"default_value_null":false,"srs_id_null":true,"srs_id":0,"default_value":"AAAAAAAAAAA=","default_value_utf8_null":true,"default_value_utf8":"","default_option":"","update_option":"","comment":"","generation_expression":"","generation_expression_utf8":"","options":"interval_count=0;","se_private_data":"","engine_attribute":"","secondary_engine_attribute":"","column_key":2,"column_type_utf8":"bigint unsigned","elements":[],"collation_id":46,"is_explicit_collation":false},{"name":"ATTR_NAME","type":16,"is_nullable":false,"is_zerofill":false,"is_unsigned":false,"is_auto_increment":false,"is_virtual":false,"hidden":1,"ordinal_position":2,"char_length":128,"numeric_precision":0,"numeric_scale":0,"numeric_scale_null":true,"datetime_precision":0,"datetime_precision_null":1,"has_no_default":true,"default_value_null":false,"srs_id_null":true,"srs_id":0,"default_value":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAA","default_value_utf8_null":true,"default_value_utf8":"","default_option":"","update_option":"","comment":"","generation_expression":"","generation_expression_utf8":"","options":"interval_count=0;","se_private_data":"","engine_attribute":"","secondary_engine_attribute":"","column_key":2,"column_type_utf8":"varchar(32)","elements":[],"collation_id":46,"is_explicit_collation":false},{"name":"ATTR_VALUE","type":16,"is_nullable":true,"is_zerofill":false,"is_unsigned":false,"is_auto_increment":false,"is_virtual":false,"hidden":1,"ordinal_position":3,"char_length":4096,"numeric_precision":0,"numeric_scale":0,"numeric_scale_null":true,"datetime_precision":0,"datetime_precision_null":1,"has_no_default":false,"default_value_null":true,"srs_id_null":true,"srs_id":0,"default_value":"","default_value_utf8_null":true,"default_value_utf8":"","default_option":"","update_option":"","comment":"","generation_expression":"","generation_expression_utf8":"","options":"interval_count=0;","se_private_data":"","engine_attribute":"","secondary_engine_attribute":"","column_key":1,"column_type_utf8":"varchar(1024)","elements":[],"collation_id":46,"is_explicit_collation":false},{"name":"ORDINAL_POSITION","type":4,"is_nullable":true,"is_zerofill":false,"is_unsigned":false,"is_auto_increment":false,"is_virtual":false,"hidden":1,"ordinal_position":4,"char_length":11,"numeric_precision":10,"numeric_scale":0,"numeric_scale_null":false,"datetime_precision":0,"datetime_precision_null":1,"has_no_default":false,"default_value_null":true,"srs_id_null":true,"srs_id":0,"default_value":"","default_value_utf8_null":true,"default_value_utf8":"","default_option":"","update_option":"","comment":"","generation_expression":"","generation_expression_utf8":"","options":"interval_count=0;","se_private_data":"","engine_attribute":"","secondary_engine_attribute":"","column_key":1,"column_type_utf8":"int","elements":[],"collation_id":46,"is_explicit_collation":false}],"schema_ref":"performance_schema","se_private_id":18446744073709551615,"engine":"PERFORMANCE_SCHEMA","last_checked_for_upgrade_version_id":0,"comment":"","se_private_data":"","engine_attribute":"","secondary_engine_attribute":"","row_format":2,"partition_type":0,"partition_expression":"","partition_expression_utf8":"","default_partitioning":0,"subpartition_type":0,"subpartition_expression":"","subpartition_expression_utf8":"","default_subpartitioning":0,"indexes":[{"name":"PRIMARY","hidden":false,"is_generated":false,"ordinal_position":1,"comment":"","options":"flags=0;","se_private_data":"","type":1,"algorithm":4,"is_algorithm_explicit":false,"is_visible":true,"engine":"PERFORMANCE_SCHEMA","engine_attribute":"","secondary_engine_attribute":"","elements":[{"ordinal_position":1,"length":8,"order":1,"hidden":false,"column_opx":0},{"ordinal_position":2,"length":128,"order":1,"hidden":false,"column_opx":1}]}],"foreign_keys":[],"check_constraints":[],"partitions":[],"collation_id":46}}
|
||||
@ -0,0 +1 @@
|
||||
{"mysqld_version_id":80402,"dd_version":80300,"sdi_version":80019,"dd_object_type":"Table","dd_object":{"name":"session_connect_attrs","mysql_version_id":80402,"created":20251120094414,"last_altered":20251120094414,"hidden":1,"options":"avg_row_length=0;key_block_size=0;keys_disabled=0;pack_record=1;server_p_s_table=1;stats_auto_recalc=0;stats_sample_pages=0;","columns":[{"name":"PROCESSLIST_ID","type":9,"is_nullable":false,"is_zerofill":false,"is_unsigned":true,"is_auto_increment":false,"is_virtual":false,"hidden":1,"ordinal_position":1,"char_length":20,"numeric_precision":20,"numeric_scale":0,"numeric_scale_null":false,"datetime_precision":0,"datetime_precision_null":1,"has_no_default":true,"default_value_null":false,"srs_id_null":true,"srs_id":0,"default_value":"AAAAAAAAAAA=","default_value_utf8_null":true,"default_value_utf8":"","default_option":"","update_option":"","comment":"","generation_expression":"","generation_expression_utf8":"","options":"interval_count=0;","se_private_data":"","engine_attribute":"","secondary_engine_attribute":"","column_key":2,"column_type_utf8":"bigint unsigned","elements":[],"collation_id":46,"is_explicit_collation":false},{"name":"ATTR_NAME","type":16,"is_nullable":false,"is_zerofill":false,"is_unsigned":false,"is_auto_increment":false,"is_virtual":false,"hidden":1,"ordinal_position":2,"char_length":128,"numeric_precision":0,"numeric_scale":0,"numeric_scale_null":true,"datetime_precision":0,"datetime_precision_null":1,"has_no_default":true,"default_value_null":false,"srs_id_null":true,"srs_id":0,"default_value":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAA","default_value_utf8_null":true,"default_value_utf8":"","default_option":"","update_option":"","comment":"","generation_expression":"","generation_expression_utf8":"","options":"interval_count=0;","se_private_data":"","engine_attribute":"","secondary_engine_attribute":"","column_key":2,"column_type_utf8":"varchar(32)","elements":[],"collation_id":46,"is_explicit_collation":false},{"name":"ATTR_VALUE","type":16,"is_nullable":true,"is_zerofill":false,"is_unsigned":false,"is_auto_increment":false,"is_virtual":false,"hidden":1,"ordinal_position":3,"char_length":4096,"numeric_precision":0,"numeric_scale":0,"numeric_scale_null":true,"datetime_precision":0,"datetime_precision_null":1,"has_no_default":false,"default_value_null":true,"srs_id_null":true,"srs_id":0,"default_value":"","default_value_utf8_null":true,"default_value_utf8":"","default_option":"","update_option":"","comment":"","generation_expression":"","generation_expression_utf8":"","options":"interval_count=0;","se_private_data":"","engine_attribute":"","secondary_engine_attribute":"","column_key":1,"column_type_utf8":"varchar(1024)","elements":[],"collation_id":46,"is_explicit_collation":false},{"name":"ORDINAL_POSITION","type":4,"is_nullable":true,"is_zerofill":false,"is_unsigned":false,"is_auto_increment":false,"is_virtual":false,"hidden":1,"ordinal_position":4,"char_length":11,"numeric_precision":10,"numeric_scale":0,"numeric_scale_null":false,"datetime_precision":0,"datetime_precision_null":1,"has_no_default":false,"default_value_null":true,"srs_id_null":true,"srs_id":0,"default_value":"","default_value_utf8_null":true,"default_value_utf8":"","default_option":"","update_option":"","comment":"","generation_expression":"","generation_expression_utf8":"","options":"interval_count=0;","se_private_data":"","engine_attribute":"","secondary_engine_attribute":"","column_key":1,"column_type_utf8":"int","elements":[],"collation_id":46,"is_explicit_collation":false}],"schema_ref":"performance_schema","se_private_id":18446744073709551615,"engine":"PERFORMANCE_SCHEMA","last_checked_for_upgrade_version_id":0,"comment":"","se_private_data":"","engine_attribute":"","secondary_engine_attribute":"","row_format":2,"partition_type":0,"partition_expression":"","partition_expression_utf8":"","default_partitioning":0,"subpartition_type":0,"subpartition_expression":"","subpartition_expression_utf8":"","default_subpartitioning":0,"indexes":[{"name":"PRIMARY","hidden":false,"is_generated":false,"ordinal_position":1,"comment":"","options":"flags=0;","se_private_data":"","type":1,"algorithm":4,"is_algorithm_explicit":false,"is_visible":true,"engine":"PERFORMANCE_SCHEMA","engine_attribute":"","secondary_engine_attribute":"","elements":[{"ordinal_position":1,"length":8,"order":1,"hidden":false,"column_opx":0},{"ordinal_position":2,"length":128,"order":1,"hidden":false,"column_opx":1}]}],"foreign_keys":[],"check_constraints":[],"partitions":[],"collation_id":46}}
|
||||
File diff suppressed because one or more lines are too long
@ -0,0 +1 @@
|
||||
{"mysqld_version_id":80402,"dd_version":80300,"sdi_version":80019,"dd_object_type":"Table","dd_object":{"name":"status_by_host","mysql_version_id":80402,"created":20251120094414,"last_altered":20251120094414,"hidden":1,"options":"avg_row_length=0;key_block_size=0;keys_disabled=0;pack_record=1;server_p_s_table=1;stats_auto_recalc=0;stats_sample_pages=0;","columns":[{"name":"HOST","type":29,"is_nullable":true,"is_zerofill":false,"is_unsigned":false,"is_auto_increment":false,"is_virtual":false,"hidden":1,"ordinal_position":1,"char_length":255,"numeric_precision":0,"numeric_scale":0,"numeric_scale_null":true,"datetime_precision":0,"datetime_precision_null":1,"has_no_default":false,"default_value_null":true,"srs_id_null":true,"srs_id":0,"default_value":"","default_value_utf8_null":true,"default_value_utf8":"","default_option":"","update_option":"","comment":"","generation_expression":"","generation_expression_utf8":"","options":"interval_count=0;","se_private_data":"","engine_attribute":"","secondary_engine_attribute":"","column_key":4,"column_type_utf8":"char(255)","elements":[],"collation_id":11,"is_explicit_collation":true},{"name":"VARIABLE_NAME","type":16,"is_nullable":false,"is_zerofill":false,"is_unsigned":false,"is_auto_increment":false,"is_virtual":false,"hidden":1,"ordinal_position":2,"char_length":256,"numeric_precision":0,"numeric_scale":0,"numeric_scale_null":true,"datetime_precision":0,"datetime_precision_null":1,"has_no_default":true,"default_value_null":false,"srs_id_null":true,"srs_id":0,"default_value":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","default_value_utf8_null":true,"default_value_utf8":"","default_option":"","update_option":"","comment":"","generation_expression":"","generation_expression_utf8":"","options":"interval_count=0;","se_private_data":"","engine_attribute":"","secondary_engine_attribute":"","column_key":1,"column_type_utf8":"varchar(64)","elements":[],"collation_id":255,"is_explicit_collation":false},{"name":"VARIABLE_VALUE","type":16,"is_nullable":true,"is_zerofill":false,"is_unsigned":false,"is_auto_increment":false,"is_virtual":false,"hidden":1,"ordinal_position":3,"char_length":4096,"numeric_precision":0,"numeric_scale":0,"numeric_scale_null":true,"datetime_precision":0,"datetime_precision_null":1,"has_no_default":false,"default_value_null":true,"srs_id_null":true,"srs_id":0,"default_value":"","default_value_utf8_null":true,"default_value_utf8":"","default_option":"","update_option":"","comment":"","generation_expression":"","generation_expression_utf8":"","options":"interval_count=0;","se_private_data":"","engine_attribute":"","secondary_engine_attribute":"","column_key":1,"column_type_utf8":"varchar(1024)","elements":[],"collation_id":255,"is_explicit_collation":false}],"schema_ref":"performance_schema","se_private_id":18446744073709551615,"engine":"PERFORMANCE_SCHEMA","last_checked_for_upgrade_version_id":0,"comment":"","se_private_data":"","engine_attribute":"","secondary_engine_attribute":"","row_format":2,"partition_type":0,"partition_expression":"","partition_expression_utf8":"","default_partitioning":0,"subpartition_type":0,"subpartition_expression":"","subpartition_expression_utf8":"","default_subpartitioning":0,"indexes":[{"name":"HOST","hidden":false,"is_generated":false,"ordinal_position":1,"comment":"","options":"flags=0;","se_private_data":"","type":2,"algorithm":4,"is_algorithm_explicit":false,"is_visible":true,"engine":"PERFORMANCE_SCHEMA","engine_attribute":"","secondary_engine_attribute":"","elements":[{"ordinal_position":1,"length":255,"order":1,"hidden":false,"column_opx":0},{"ordinal_position":2,"length":256,"order":1,"hidden":false,"column_opx":1}]}],"foreign_keys":[],"check_constraints":[],"partitions":[],"collation_id":255}}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,83 +0,0 @@
|
||||
package yuxingshi.sms.server.controller;
|
||||
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import yuxingshi.sms.server.service.CourseService;
|
||||
import yuxingshi.sms.server.domain.dto.course.CourseManageDTO;
|
||||
import yuxingshi.sms.server.domain.dto.course.CourseQueryReqDTO;
|
||||
import yuxingshi.sms.server.domain.dto.course.CourseRespDTO;
|
||||
import yuxingshi.sms.common.core.domain.dto.BasePageDTO;
|
||||
import yuxingshi.sms.common.core.domain.vo.R;
|
||||
import yuxingshi.sms.common.core.domain.enums.UserRole;
|
||||
import yuxingshi.sms.common.intercepter.annotation.RequireIdentity;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/courses")
|
||||
public class CourseController {
|
||||
|
||||
@Autowired
|
||||
private CourseService courseService;
|
||||
|
||||
/**
|
||||
* 新增课程
|
||||
*/
|
||||
@PostMapping
|
||||
@RequireIdentity({UserRole.ROLE_SYS_ADMIN, UserRole.ROLE_ADMIN, UserRole.ROLE_TEACHER})
|
||||
public R<String> createCourse(@Valid @RequestBody CourseManageDTO dto) {
|
||||
String courseId = courseService.createCourse(dto);
|
||||
return R.ok(courseId, "课程创建成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑课程信息
|
||||
*/
|
||||
@PutMapping("/{courseId}")
|
||||
@RequireIdentity({UserRole.ROLE_SYS_ADMIN, UserRole.ROLE_ADMIN, UserRole.ROLE_TEACHER})
|
||||
public R<Void> updateCourse(@PathVariable(value = "courseId") String courseId, @Valid @RequestBody CourseManageDTO dto) {
|
||||
courseService.updateCourse(courseId, dto);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除课程
|
||||
*/
|
||||
@DeleteMapping("/{courseId}")
|
||||
@RequireIdentity({UserRole.ROLE_SYS_ADMIN, UserRole.ROLE_ADMIN, UserRole.ROLE_TEACHER})
|
||||
public R<Void> deleteCourse(@PathVariable(value = "courseId") String courseId) {
|
||||
courseService.deleteCourse(courseId);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 禁用课程
|
||||
*/
|
||||
@PutMapping("/{courseId}/disable")
|
||||
@RequireIdentity({UserRole.ROLE_SYS_ADMIN, UserRole.ROLE_ADMIN, UserRole.ROLE_TEACHER})
|
||||
public R<Void> disableCourse(@PathVariable(value = "courseId") String courseId) {
|
||||
courseService.disableCourse(courseId);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 启用课程
|
||||
*/
|
||||
@PutMapping("/{courseId}/enable")
|
||||
@RequireIdentity({UserRole.ROLE_SYS_ADMIN, UserRole.ROLE_ADMIN, UserRole.ROLE_TEACHER})
|
||||
public R<Void> enableCourse(@PathVariable(value = "courseId") String courseId) {
|
||||
courseService.enableCourse(courseId);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询课程列表
|
||||
*/
|
||||
@GetMapping
|
||||
@RequireIdentity({UserRole.ROLE_SYS_ADMIN, UserRole.ROLE_ADMIN, UserRole.ROLE_TEACHER})
|
||||
public R<BasePageDTO<CourseRespDTO>> queryCourses(@Valid CourseQueryReqDTO queryReq) {
|
||||
BasePageDTO<CourseRespDTO> pageDTO = courseService.queryCourses(queryReq);
|
||||
return R.ok(pageDTO);
|
||||
}
|
||||
}
|
||||
@ -1,89 +0,0 @@
|
||||
package yuxingshi.sms.server.controller;
|
||||
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import yuxingshi.sms.server.service.CourseScoreService;
|
||||
import yuxingshi.sms.server.domain.dto.score.CourseScoreManageDTO;
|
||||
import yuxingshi.sms.server.domain.dto.score.CourseScoreQueryReqDTO;
|
||||
import yuxingshi.sms.server.domain.dto.score.CourseScoreRespDTO;
|
||||
import yuxingshi.sms.common.core.domain.dto.BasePageDTO;
|
||||
import yuxingshi.sms.common.core.domain.vo.R;
|
||||
import yuxingshi.sms.common.core.domain.enums.UserRole;
|
||||
import yuxingshi.sms.common.intercepter.annotation.RequireIdentity;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/course-scores")
|
||||
public class CourseScoreController {
|
||||
|
||||
@Autowired
|
||||
private CourseScoreService courseScoreService;
|
||||
|
||||
/**
|
||||
* 为学生添加课程成绩
|
||||
*/
|
||||
@PostMapping
|
||||
@RequireIdentity({UserRole.ROLE_SYS_ADMIN, UserRole.ROLE_ADMIN, UserRole.ROLE_TEACHER})
|
||||
public R<String> addCourseScore(@Valid @RequestBody CourseScoreManageDTO dto) {
|
||||
String scoreId = courseScoreService.addCourseScore(dto);
|
||||
return R.ok(scoreId, "成绩添加成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新课程成绩
|
||||
*/
|
||||
@PutMapping("/{scoreId}")
|
||||
@RequireIdentity({UserRole.ROLE_SYS_ADMIN, UserRole.ROLE_ADMIN, UserRole.ROLE_TEACHER})
|
||||
public R<Void> updateCourseScore(@PathVariable(value = "scoreId") String scoreId, @Valid @RequestBody CourseScoreManageDTO dto) {
|
||||
courseScoreService.updateCourseScore(scoreId, dto);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除课程成绩
|
||||
*/
|
||||
@DeleteMapping("/{scoreId}")
|
||||
@RequireIdentity({UserRole.ROLE_SYS_ADMIN, UserRole.ROLE_ADMIN, UserRole.ROLE_TEACHER})
|
||||
public R<Void> deleteCourseScore(@PathVariable(value = "scoreId") String scoreId) {
|
||||
courseScoreService.deleteCourseScore(scoreId);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询课程成绩列表
|
||||
*/
|
||||
@GetMapping
|
||||
@RequireIdentity({UserRole.ROLE_SYS_ADMIN, UserRole.ROLE_ADMIN, UserRole.ROLE_TEACHER})
|
||||
public R<BasePageDTO<CourseScoreRespDTO>> queryCourseScores(@Valid CourseScoreQueryReqDTO queryReq) {
|
||||
BasePageDTO<CourseScoreRespDTO> pageDTO = courseScoreService.queryCourseScores(queryReq);
|
||||
return R.ok(pageDTO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询学生的所有课程成绩
|
||||
*/
|
||||
@GetMapping("/student/{studentId}")
|
||||
@RequireIdentity({UserRole.ROLE_SYS_ADMIN, UserRole.ROLE_ADMIN, UserRole.ROLE_TEACHER})
|
||||
public R<BasePageDTO<CourseScoreRespDTO>> queryStudentScores(
|
||||
@PathVariable(value = "studentId") String studentId,
|
||||
@RequestParam(defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize) {
|
||||
BasePageDTO<CourseScoreRespDTO> pageDTO = courseScoreService.queryStudentScores(studentId, pageNum, pageSize);
|
||||
return R.ok(pageDTO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询课程的所有学生成绩
|
||||
*/
|
||||
@GetMapping("/course/{courseId}")
|
||||
@RequireIdentity({UserRole.ROLE_SYS_ADMIN, UserRole.ROLE_ADMIN, UserRole.ROLE_TEACHER})
|
||||
public R<BasePageDTO<CourseScoreRespDTO>> queryCourseStudentScores(
|
||||
@PathVariable(value = "courseId") String courseId,
|
||||
@RequestParam(defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize) {
|
||||
BasePageDTO<CourseScoreRespDTO> pageDTO = courseScoreService.queryCourseStudentScores(courseId, pageNum, pageSize);
|
||||
return R.ok(pageDTO);
|
||||
}
|
||||
}
|
||||
@ -1,24 +0,0 @@
|
||||
package yuxingshi.sms.server.domain.dto.course;
|
||||
|
||||
import yuxingshi.sms.common.core.domain.dto.BasePageReqDTO;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 课程查询请求DTO
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class CourseQueryReqDTO extends BasePageReqDTO {
|
||||
private String teacherId;
|
||||
|
||||
private String courseName;
|
||||
|
||||
private String courseCode;
|
||||
|
||||
private Integer status;
|
||||
}
|
||||
@ -1,41 +0,0 @@
|
||||
package yuxingshi.sms.server.domain.dto.course;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 课程查询响应DTO
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class CourseRespDTO {
|
||||
private String id;
|
||||
|
||||
private String teacherId;
|
||||
|
||||
private String courseName;
|
||||
|
||||
private String courseCode;
|
||||
|
||||
private BigDecimal credit;
|
||||
|
||||
private Integer totalHours;
|
||||
|
||||
private String description;
|
||||
|
||||
private Integer status;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime createdTime;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime updatedTime;
|
||||
}
|
||||
@ -1,40 +0,0 @@
|
||||
package yuxingshi.sms.server.domain.dto.score;
|
||||
|
||||
import jakarta.validation.constraints.DecimalMax;
|
||||
import jakarta.validation.constraints.DecimalMin;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 课程成绩新增/编辑请求DTO
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class CourseScoreManageDTO {
|
||||
@NotBlank(message = "课程ID不能为空")
|
||||
private String courseId;
|
||||
|
||||
@NotBlank(message = "学生ID不能为空")
|
||||
private String studentId;
|
||||
|
||||
@DecimalMin(value = "0", message = "平时成绩不能小于0")
|
||||
@DecimalMax(value = "100", message = "平时成绩不能大于100")
|
||||
private BigDecimal usualScore;
|
||||
|
||||
@DecimalMin(value = "0", message = "期中成绩不能小于0")
|
||||
@DecimalMax(value = "100", message = "期中成绩不能大于100")
|
||||
private BigDecimal midtermScore;
|
||||
|
||||
@DecimalMin(value = "0", message = "期末成绩不能小于0")
|
||||
@DecimalMax(value = "100", message = "期末成绩不能大于100")
|
||||
private BigDecimal finalScore;
|
||||
|
||||
private String remark;
|
||||
}
|
||||
@ -1,51 +0,0 @@
|
||||
package yuxingshi.sms.server.domain.dto.score;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 课程成绩查询响应DTO
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class CourseScoreRespDTO {
|
||||
private String id;
|
||||
|
||||
private String courseId;
|
||||
|
||||
private String courseName;
|
||||
|
||||
private String courseCode;
|
||||
|
||||
private String studentId;
|
||||
|
||||
private String studentNo;
|
||||
|
||||
private String studentName;
|
||||
|
||||
private BigDecimal usualScore;
|
||||
|
||||
private BigDecimal midtermScore;
|
||||
|
||||
private BigDecimal finalScore;
|
||||
|
||||
private BigDecimal totalScore;
|
||||
|
||||
private String grade;
|
||||
|
||||
private String remark;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime createdTime;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime updatedTime;
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
package yuxingshi.sms.server.domain.dto.stu;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class StudentDetailDTO {
|
||||
private String id;
|
||||
|
||||
private String userId;
|
||||
|
||||
private String classId;
|
||||
|
||||
|
||||
private String classCode;
|
||||
|
||||
private String majorId;
|
||||
|
||||
private String studentNo;
|
||||
|
||||
private String realName;
|
||||
|
||||
private Integer gender;
|
||||
|
||||
private String phone;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
package yuxingshi.sms.server.domain.dto.stu_class;
|
||||
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 班级详情DTO
|
||||
*/
|
||||
@Builder
|
||||
@Data
|
||||
public class ClassDetailDTO {
|
||||
|
||||
private String id;
|
||||
|
||||
private String classCode;
|
||||
|
||||
private String majorId;
|
||||
|
||||
private String majorName;
|
||||
|
||||
private String majorCode;
|
||||
|
||||
private String description;
|
||||
}
|
||||
@ -1,12 +0,0 @@
|
||||
package yuxingshi.sms.server.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import yuxingshi.sms.server.domain.entity.Course;
|
||||
|
||||
/**
|
||||
* 课程Mapper接口
|
||||
*/
|
||||
@Mapper
|
||||
public interface CourseMapper extends BaseMapper<Course> {
|
||||
}
|
||||
@ -1,12 +0,0 @@
|
||||
package yuxingshi.sms.server.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import yuxingshi.sms.server.domain.entity.CourseScore;
|
||||
|
||||
/**
|
||||
* 课程成绩Mapper接口
|
||||
*/
|
||||
@Mapper
|
||||
public interface CourseScoreMapper extends BaseMapper<CourseScore> {
|
||||
}
|
||||
@ -1,332 +0,0 @@
|
||||
package yuxingshi.sms.server.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import yuxingshi.sms.server.domain.entity.Course;
|
||||
import yuxingshi.sms.server.domain.entity.CourseScore;
|
||||
import yuxingshi.sms.server.domain.entity.Student;
|
||||
import yuxingshi.sms.server.domain.dto.score.CourseScoreManageDTO;
|
||||
import yuxingshi.sms.server.domain.dto.score.CourseScoreQueryReqDTO;
|
||||
import yuxingshi.sms.server.domain.dto.score.CourseScoreRespDTO;
|
||||
import yuxingshi.sms.server.mapper.CourseScoreMapper;
|
||||
import yuxingshi.sms.server.mapper.CourseMapper;
|
||||
import yuxingshi.sms.server.mapper.StudentMapper;
|
||||
import yuxingshi.sms.server.service.CourseScoreService;
|
||||
import yuxingshi.sms.server.utils.CourseScoreUtil;
|
||||
import yuxingshi.sms.common.core.domain.dto.BasePageDTO;
|
||||
import yuxingshi.sms.common.core.exception.ServiceException;
|
||||
import yuxingshi.sms.common.core.utils.StringUtil;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class CourseScoreServiceImpl implements CourseScoreService {
|
||||
|
||||
@Autowired
|
||||
private CourseScoreMapper courseScoreMapper;
|
||||
|
||||
@Autowired
|
||||
private CourseMapper courseMapper;
|
||||
|
||||
@Autowired
|
||||
private StudentMapper studentMapper;
|
||||
|
||||
@Override
|
||||
public String addCourseScore(CourseScoreManageDTO dto) {
|
||||
// 检查课程是否存在
|
||||
Course course = courseMapper.selectById(dto.getCourseId());
|
||||
if (course == null) {
|
||||
throw new ServiceException("课程不存在");
|
||||
}
|
||||
|
||||
// 检查学生是否存在
|
||||
Student student = studentMapper.selectById(dto.getStudentId());
|
||||
if (student == null) {
|
||||
throw new ServiceException("学生不存在");
|
||||
}
|
||||
|
||||
// 检查该学生是否已有该课程的成绩
|
||||
CourseScore existing = getCourseScore(dto.getCourseId(), dto.getStudentId());
|
||||
if (existing != null) {
|
||||
throw new ServiceException("该学生已有该课程的成绩,请使用更新接口修改");
|
||||
}
|
||||
|
||||
// 计算总成绩和等级
|
||||
BigDecimal totalScore = CourseScoreUtil.calculateTotalScore(
|
||||
dto.getUsualScore(), dto.getMidtermScore(), dto.getFinalScore());
|
||||
String grade = CourseScoreUtil.calculateGrade(totalScore);
|
||||
|
||||
CourseScore courseScore = new CourseScore();
|
||||
courseScore.setCourseId(dto.getCourseId());
|
||||
courseScore.setStudentId(dto.getStudentId());
|
||||
courseScore.setUsualScore(dto.getUsualScore());
|
||||
courseScore.setMidtermScore(dto.getMidtermScore());
|
||||
courseScore.setFinalScore(dto.getFinalScore());
|
||||
courseScore.setTotalScore(totalScore);
|
||||
courseScore.setGrade(grade);
|
||||
courseScore.setRemark(dto.getRemark());
|
||||
courseScore.setStatus(1);
|
||||
courseScore.setCreatedTime(LocalDateTime.now());
|
||||
courseScore.setUpdatedTime(LocalDateTime.now());
|
||||
|
||||
courseScoreMapper.insert(courseScore);
|
||||
log.info("添加课程成绩成功: courseId={}, studentId={}, totalScore={}, grade={}",
|
||||
dto.getCourseId(), dto.getStudentId(), totalScore, grade);
|
||||
return courseScore.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateCourseScore(String scoreId, CourseScoreManageDTO dto) {
|
||||
CourseScore courseScore = getCourseScoreById(scoreId);
|
||||
if (courseScore == null) {
|
||||
throw new ServiceException("成绩不存在");
|
||||
}
|
||||
|
||||
// 检查课程是否存在
|
||||
Course course = courseMapper.selectById(dto.getCourseId());
|
||||
if (course == null) {
|
||||
throw new ServiceException("课程不存在");
|
||||
}
|
||||
|
||||
// 检查学生是否存在
|
||||
Student student = studentMapper.selectById(dto.getStudentId());
|
||||
if (student == null) {
|
||||
throw new ServiceException("学生不存在");
|
||||
}
|
||||
|
||||
// 如果更改了课程或学生,检查新的课程+学生组合是否已存在
|
||||
if (!dto.getCourseId().equals(courseScore.getCourseId()) ||
|
||||
!dto.getStudentId().equals(courseScore.getStudentId())) {
|
||||
CourseScore existing = getCourseScore(dto.getCourseId(), dto.getStudentId());
|
||||
if (existing != null) {
|
||||
throw new ServiceException("该学生已有该课程的成绩");
|
||||
}
|
||||
}
|
||||
|
||||
// 重新计算总成绩和等级
|
||||
BigDecimal totalScore = CourseScoreUtil.calculateTotalScore(
|
||||
dto.getUsualScore(), dto.getMidtermScore(), dto.getFinalScore());
|
||||
String grade = CourseScoreUtil.calculateGrade(totalScore);
|
||||
|
||||
courseScore.setCourseId(dto.getCourseId());
|
||||
courseScore.setStudentId(dto.getStudentId());
|
||||
courseScore.setUsualScore(dto.getUsualScore());
|
||||
courseScore.setMidtermScore(dto.getMidtermScore());
|
||||
courseScore.setFinalScore(dto.getFinalScore());
|
||||
courseScore.setTotalScore(totalScore);
|
||||
courseScore.setGrade(grade);
|
||||
courseScore.setRemark(dto.getRemark());
|
||||
courseScore.setUpdatedTime(LocalDateTime.now());
|
||||
|
||||
courseScoreMapper.updateById(courseScore);
|
||||
log.info("更新课程成绩成功: scoreId={}, totalScore={}, grade={}", scoreId, totalScore, grade);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteCourseScore(String scoreId) {
|
||||
CourseScore courseScore = getCourseScoreById(scoreId);
|
||||
if (courseScore == null) {
|
||||
throw new ServiceException("成绩不存在");
|
||||
}
|
||||
|
||||
courseScoreMapper.deleteById(scoreId);
|
||||
log.info("删除课程成绩成功: scoreId={}", scoreId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CourseScore getCourseScoreById(String scoreId) {
|
||||
return courseScoreMapper.selectById(scoreId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CourseScore getCourseScore(String courseId, String studentId) {
|
||||
LambdaQueryWrapper<CourseScore> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CourseScore::getCourseId, courseId)
|
||||
.eq(CourseScore::getStudentId, studentId)
|
||||
.eq(CourseScore::getStatus, 1);
|
||||
return courseScoreMapper.selectOne(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteCourseAllScores(String courseId) {
|
||||
LambdaQueryWrapper<CourseScore> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CourseScore::getCourseId, courseId);
|
||||
courseScoreMapper.delete(queryWrapper);
|
||||
log.info("删除课程所有成绩成功: courseId={}", courseId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteStudentAllScores(String studentId) {
|
||||
LambdaQueryWrapper<CourseScore> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CourseScore::getStudentId, studentId);
|
||||
courseScoreMapper.delete(queryWrapper);
|
||||
log.info("删除学生所有成绩成功: studentId={}", studentId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePageDTO<CourseScoreRespDTO> queryCourseScores(CourseScoreQueryReqDTO queryReq) {
|
||||
LambdaQueryWrapper<CourseScore> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
// 根据课程ID查询
|
||||
if (queryReq.getCourseId() != null) {
|
||||
queryWrapper.eq(CourseScore::getCourseId, queryReq.getCourseId());
|
||||
}
|
||||
|
||||
// 根据学生ID查询
|
||||
if (queryReq.getStudentId() != null) {
|
||||
queryWrapper.eq(CourseScore::getStudentId, queryReq.getStudentId());
|
||||
}
|
||||
|
||||
// 根据等级查询
|
||||
if (StringUtil.isNotEmpty(queryReq.getGrade())) {
|
||||
queryWrapper.eq(CourseScore::getGrade, queryReq.getGrade());
|
||||
}
|
||||
|
||||
// 状态过滤
|
||||
queryWrapper.eq(CourseScore::getStatus, 1);
|
||||
|
||||
// 排序
|
||||
if (StringUtil.isNotEmpty(queryReq.getSortBy())) {
|
||||
if ("total_score".equals(queryReq.getSortBy())) {
|
||||
queryWrapper.orderByDesc(CourseScore::getTotalScore);
|
||||
} else if ("grade".equals(queryReq.getSortBy())) {
|
||||
queryWrapper.orderByAsc(CourseScore::getGrade);
|
||||
} else {
|
||||
queryWrapper.orderByDesc(CourseScore::getCreatedTime);
|
||||
}
|
||||
} else {
|
||||
queryWrapper.orderByDesc(CourseScore::getCreatedTime);
|
||||
}
|
||||
|
||||
// 使用MyBatisPlus分页插件
|
||||
Page<CourseScore> page = new Page<>(queryReq.getPageNo(), queryReq.getPageSize());
|
||||
Page<CourseScore> pageResult = courseScoreMapper.selectPage(page, queryWrapper);
|
||||
|
||||
List<CourseScoreRespDTO> respList = pageResult.getRecords().stream()
|
||||
.map(score -> {
|
||||
// 查询课程信息
|
||||
Course course = courseMapper.selectById(score.getCourseId());
|
||||
// 查询学生信息
|
||||
Student student = studentMapper.selectById(score.getStudentId());
|
||||
return CourseScoreRespDTO.builder()
|
||||
.id(score.getId())
|
||||
.courseId(score.getCourseId())
|
||||
.courseName(course != null ? course.getCourseName() : "")
|
||||
.courseCode(course != null ? course.getCourseCode() : "")
|
||||
.studentId(score.getStudentId())
|
||||
.studentNo(student != null ? student.getStudentNo() : "")
|
||||
.studentName(student != null ? student.getRealName() : "")
|
||||
.usualScore(score.getUsualScore())
|
||||
.midtermScore(score.getMidtermScore())
|
||||
.finalScore(score.getFinalScore())
|
||||
.totalScore(score.getTotalScore())
|
||||
.grade(score.getGrade())
|
||||
.remark(score.getRemark())
|
||||
.createdTime(score.getCreatedTime())
|
||||
.updatedTime(score.getUpdatedTime())
|
||||
.build();
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
return BasePageDTO.<CourseScoreRespDTO>builder()
|
||||
.list(respList)
|
||||
.totals(pageResult.getTotal())
|
||||
.totalPages(BasePageDTO.calculateTotalPages(pageResult.getTotal(), queryReq.getPageSize()))
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePageDTO<CourseScoreRespDTO> queryStudentScores(String studentId, Integer pageNum, Integer pageSize) {
|
||||
LambdaQueryWrapper<CourseScore> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CourseScore::getStudentId, studentId)
|
||||
.eq(CourseScore::getStatus, 1)
|
||||
.orderByDesc(CourseScore::getCreatedTime);
|
||||
|
||||
// 使用MyBatisPlus分页插件
|
||||
Page<CourseScore> page = new Page<>(pageNum, pageSize);
|
||||
Page<CourseScore> pageResult = courseScoreMapper.selectPage(page, queryWrapper);
|
||||
|
||||
List<CourseScoreRespDTO> respList = pageResult.getRecords().stream()
|
||||
.map(score -> {
|
||||
// 查询课程信息
|
||||
Course course = courseMapper.selectById(score.getCourseId());
|
||||
// 查询学生信息
|
||||
Student student = studentMapper.selectById(score.getStudentId());
|
||||
return CourseScoreRespDTO.builder()
|
||||
.id(score.getId())
|
||||
.courseId(score.getCourseId())
|
||||
.courseName(course != null ? course.getCourseName() : "")
|
||||
.courseCode(course != null ? course.getCourseCode() : "")
|
||||
.studentId(score.getStudentId())
|
||||
.studentNo(student != null ? student.getStudentNo() : "")
|
||||
.studentName(student != null ? student.getRealName() : "")
|
||||
.usualScore(score.getUsualScore())
|
||||
.midtermScore(score.getMidtermScore())
|
||||
.finalScore(score.getFinalScore())
|
||||
.totalScore(score.getTotalScore())
|
||||
.grade(score.getGrade())
|
||||
.remark(score.getRemark())
|
||||
.createdTime(score.getCreatedTime())
|
||||
.updatedTime(score.getUpdatedTime())
|
||||
.build();
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
return BasePageDTO.<CourseScoreRespDTO>builder()
|
||||
.list(respList)
|
||||
.totals(pageResult.getTotal())
|
||||
.totalPages(BasePageDTO.calculateTotalPages(pageResult.getTotal(), pageSize))
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePageDTO<CourseScoreRespDTO> queryCourseStudentScores(String courseId, Integer pageNum, Integer pageSize) {
|
||||
LambdaQueryWrapper<CourseScore> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CourseScore::getCourseId, courseId)
|
||||
.eq(CourseScore::getStatus, 1)
|
||||
.orderByDesc(CourseScore::getTotalScore);
|
||||
|
||||
// 使用MyBatisPlus分页插件
|
||||
Page<CourseScore> page = new Page<>(pageNum, pageSize);
|
||||
Page<CourseScore> pageResult = courseScoreMapper.selectPage(page, queryWrapper);
|
||||
|
||||
List<CourseScoreRespDTO> respList = pageResult.getRecords().stream()
|
||||
.map(score -> {
|
||||
// 查询课程信息
|
||||
Course course = courseMapper.selectById(score.getCourseId());
|
||||
// 查询学生信息
|
||||
Student student = studentMapper.selectById(score.getStudentId());
|
||||
return CourseScoreRespDTO.builder()
|
||||
.id(score.getId())
|
||||
.courseId(score.getCourseId())
|
||||
.courseName(course != null ? course.getCourseName() : "")
|
||||
.courseCode(course != null ? course.getCourseCode() : "")
|
||||
.studentId(score.getStudentId())
|
||||
.studentNo(student != null ? student.getStudentNo() : "")
|
||||
.studentName(student != null ? student.getRealName() : "")
|
||||
.usualScore(score.getUsualScore())
|
||||
.midtermScore(score.getMidtermScore())
|
||||
.finalScore(score.getFinalScore())
|
||||
.totalScore(score.getTotalScore())
|
||||
.grade(score.getGrade())
|
||||
.remark(score.getRemark())
|
||||
.createdTime(score.getCreatedTime())
|
||||
.updatedTime(score.getUpdatedTime())
|
||||
.build();
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
return BasePageDTO.<CourseScoreRespDTO>builder()
|
||||
.list(respList)
|
||||
.totals(pageResult.getTotal())
|
||||
.totalPages(BasePageDTO.calculateTotalPages(pageResult.getTotal(), pageSize))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue