删除:未使用的代码
This commit is contained in:
parent
b58803f6b0
commit
7b5dffa6a7
@ -9,8 +9,6 @@ import javax.swing.*;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
import javax.swing.table.TableColumnModel;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.text.SimpleDateFormat;
|
||||
@ -23,7 +21,6 @@ public class TeacherMainFrame extends JFrame {
|
||||
private JTextField searchField;
|
||||
private JComboBox<String> statusFilter;
|
||||
private int currentPage = 1;
|
||||
private static final int PAGE_SIZE = 10;
|
||||
|
||||
public TeacherMainFrame() {
|
||||
leaveRequestService = ServiceFactory.getLeaveRequestService();
|
||||
|
@ -3,7 +3,6 @@ package service;
|
||||
import dao.DAOFactory;
|
||||
import dao.StudentDAO;
|
||||
import model.Student;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 学生信息服务类
|
||||
@ -11,25 +10,6 @@ import java.util.List;
|
||||
public class StudentService {
|
||||
private final StudentDAO studentDAO = DAOFactory.getStudentDAO();
|
||||
|
||||
/**
|
||||
* 更新学生信息
|
||||
* @param student 学生信息
|
||||
* @return 是否更新成功
|
||||
*/
|
||||
public boolean updateStudent(Student student) {
|
||||
// 检查是否存在
|
||||
Student existingStudent = studentDAO.findById(student.getId());
|
||||
if (existingStudent == null) {
|
||||
return false;
|
||||
}
|
||||
// 检查学号是否被其他学生使用
|
||||
Student studentWithSameId = studentDAO.findByStudentId(student.getStudentId());
|
||||
if (studentWithSameId != null && studentWithSameId.getId() != student.getId()) {
|
||||
return false;
|
||||
}
|
||||
return studentDAO.update(student) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID查询学生
|
||||
* @param id 学生ID
|
||||
@ -39,32 +19,6 @@ public class StudentService {
|
||||
return studentDAO.findById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据学号查询学生
|
||||
* @param studentId 学号
|
||||
* @return 学生信息
|
||||
*/
|
||||
public Student getStudentByStudentId(String studentId) {
|
||||
return studentDAO.findByStudentId(studentId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有学生
|
||||
* @return 学生列表
|
||||
*/
|
||||
public List<Student> getAllStudents() {
|
||||
return studentDAO.findAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据姓名模糊查询学生
|
||||
* @param name 学生姓名
|
||||
* @return 学生列表
|
||||
*/
|
||||
public List<Student> searchStudentsByName(String name) {
|
||||
return studentDAO.findByNameLike(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* 学生登录
|
||||
* @param studentId 学号
|
||||
|
@ -11,51 +11,6 @@ import java.util.List;
|
||||
public class TeacherService {
|
||||
private final TeacherDAO teacherDAO = DAOFactory.getTeacherDAO();
|
||||
|
||||
/**
|
||||
* 更新教师信息
|
||||
* @param teacher 教师信息
|
||||
* @return 是否更新成功
|
||||
*/
|
||||
public boolean updateTeacher(Teacher teacher) {
|
||||
// 检查是否存在
|
||||
Teacher existingTeacher = teacherDAO.findById(teacher.getId());
|
||||
if (existingTeacher == null) {
|
||||
return false;
|
||||
}
|
||||
// 检查工号是否被其他教师使用
|
||||
Teacher teacherWithSameId = teacherDAO.findByTeacherId(teacher.getTeacherId());
|
||||
if (teacherWithSameId != null && teacherWithSameId.getId() != teacher.getId()) {
|
||||
return false;
|
||||
}
|
||||
return teacherDAO.update(teacher) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID查询教师
|
||||
* @param id 教师ID
|
||||
* @return 教师信息
|
||||
*/
|
||||
public Teacher getTeacherById(int id) {
|
||||
return teacherDAO.findById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据工号查询教师
|
||||
* @param teacherId 工号
|
||||
* @return 教师信息
|
||||
*/
|
||||
public Teacher getTeacherByTeacherId(String teacherId) {
|
||||
return teacherDAO.findByTeacherId(teacherId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有教师
|
||||
* @return 教师列表
|
||||
*/
|
||||
public List<Teacher> getAllTeachers() {
|
||||
return teacherDAO.findAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* 教师登录
|
||||
* @param teacherId 教师工号
|
||||
|
Loading…
x
Reference in New Issue
Block a user