You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
//package service;
import dao.ScoreDAO ;
import entity.Score ;
/**
* ScoreService: 处理成绩相关业务逻辑
*/
public class ScoreService {
private ScoreDAO scoreDAO = new ScoreDAO ( ) ;
// 添加成绩
public boolean addScore ( Score score ) {
// 检查是否已有成绩记录
if ( scoreDAO . getScore ( score . getStudentId ( ) , score . getCourseId ( ) ) ! = null ) {
return false ;
}
return scoreDAO . addScore ( score ) ;
}
// 更新成绩
public boolean updateScore ( Score score ) {
return scoreDAO . updateScore ( score ) ;
}
// 删除成绩记录
public boolean deleteScore ( String studentId , String courseId ) {
return scoreDAO . deleteScore ( studentId , courseId ) ;
}
// 按学号和课程号获取成绩
public Score getScore ( String studentId , String courseId ) {
return scoreDAO . getScore ( studentId , courseId ) ;
}
// 获取某学生的所有成绩
public java . util . List < Score > getScoresByStudent ( String studentId ) {
return scoreDAO . getScoresByStudent ( studentId ) ;
}
// 获取所有成绩
public java . util . List < Score > getAllScores ( ) {
return scoreDAO . getAllScores ( ) ;
}
}