Skip to content

Commit

Permalink
#24 [feat/koo] 관리자서비스 - 학생, 강사, 강의 (관리) 스캐너 분리
Browse files Browse the repository at this point in the history
  • Loading branch information
Koo-Tae-Ho committed Mar 25, 2024
1 parent c82c24b commit 89db985
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 20 deletions.
3 changes: 2 additions & 1 deletion src/src/domain/Student.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ public void editStudentInformation(){

//학생이름, 학생아이디 출력
public void printStudentInformation(){
System.out.println("이름: " + name + ", 아이디: " + id);
System.out.println("이름: " + name + ", 아이디: " + id );
System.out.println("***********************");
}

public void printDetailStudentInformation(){
Expand Down
89 changes: 70 additions & 19 deletions src/src/service/AdminService.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ public void bankSystem() throws IOException {
System.out.println("* " + name + " *");
System.out.println("*********************");
}

}

//수정할 수 있는 수정메뉴 출력
Expand Down Expand Up @@ -111,18 +110,27 @@ public boolean showTeacherInformation(String teacherId) throws IOException {
public void showStudentList() throws IOException {
List<Student> StudentList = studentRepository.findAll();

System.out.println(" [학생리스트] ");
System.out.println("***********************");
for (Student student : StudentList) {
student.printStudentInformation();
}
}

//1. 학생상세정보출력
public void showDetailStudentList() throws IOException {
List<Student> StudentList = studentRepository.findAll();
//학생아이디가 존재하는지 확인
public boolean isExistStudent(String studentId) {
return studentRepository.isExist(studentId);
}

for (Student student : StudentList) {
student.printDetailStudentInformation();
//1. (입력받은 아이디의 학생)상세정보출력
public boolean detailStudentInformation(String studentId) throws IOException {
Student student = studentRepository.findById(studentId);
if(student == null) {
System.out.println("입력 아이디에 해당하는 학생정보가 없습니다.");
return false;
}
student.printDetailStudentInformation();
return true;
}

//2. 학생정보 수정
Expand Down Expand Up @@ -154,16 +162,17 @@ public void newEditStudentInformation(String studentId, int option, String value
}

//학생정보 삭제
public void deleteStudentInformation() throws IOException {
Scanner sc = new Scanner(System.in);
System.out.println("삭제하실 학생의 아이디를 입력해주세요: ");

String StudentId = sc.nextLine();//삭제할 학생의 아이디 입력
Student targetDeleteStudent = studentRepository.findById(StudentId);
studentRepository.delete(targetDeleteStudent);
public boolean newDeleteStudentInformation(String studentId) throws IOException {
Student student = studentRepository.findById(studentId);
if(student == null) {
System.out.println("입력 아이디에 해당하는 학생정보가 없습니다.");
return false;
}
studentRepository.delete(student);
System.out.println("입력하신 학생의정보가 삭제되었습니다.");

studentRepository.save();
return true;
}

//첫번째화면 - 강사정보출력(기능은 아님) - 이름, 아이디만
Expand All @@ -175,13 +184,15 @@ public void showTeacherList() throws IOException {
}
}

//1. 강사상세정보 출력
public void showDetailTeacherList() throws IOException {
List<Teacher> TeacherList = teacherRepository.findAll();

for (Teacher teacher : TeacherList) {
teacher.printDetailTeacherInformation();
//1. (입력받은 아이디의 강사)상세정보출력
public boolean detailTeacherInformation(String teacherId) throws IOException {
Teacher teacher = teacherRepository.findById(teacherId);
if(teacher == null) {
System.out.println("입력 아이디에 해당하는 강사정보가 없습니다.");
return false;
}
teacher.printDetailTeacherInformation();
return true;
}

//2. 강사정보 수정
Expand Down Expand Up @@ -212,6 +223,20 @@ public void newEditTeacherInformation(String teacherId, int option, String value
}
}

//강사정보 삭제
public boolean newDeleteTeacherInformation(String teacherId) throws IOException {
Teacher teacher = teacherRepository.findById(teacherId);
if(teacher == null) {
System.out.println("입력 아이디에 해당하는 강사정보가 없습니다.");
return false;
}
teacherRepository.delete(teacher);
System.out.println("입력하신 강사의정보가 삭제되었습니다.");

teacherRepository.save();
return true;
}

//첫번째화면 - 강의정보출력(기능은 아님)
public void showLectureList() throws IOException {
List<Lecture> LectureList = lectureRepository.findAll();
Expand All @@ -230,6 +255,17 @@ public void showDetailLectureList() throws IOException {
}
}

//1. (입력받은 아이디의 학생)상세정보출력
public boolean detailLectureInformation(String lectureId) throws IOException {
Lecture lecture = lectureRepository.findById(lectureId);
if(lecture == null) {
System.out.println("입력 아이디에 해당하는 학생정보가 없습니다.");
return false;
}
lecture.printDetailLectureInformation();
return true;
}


//2.새로운 강의 등록
public void registerLecture(String name,int day,int time, String teacherName, String teacherId) throws IOException {
Expand All @@ -256,6 +292,7 @@ public boolean isExistTeacher(String teacherId) {

//강사 아이디로 강사 이름반환
public String getTeacherName(String teacherId) throws IOException {

return teacherRepository.findById(teacherId).getName();
}

Expand All @@ -270,4 +307,18 @@ public void deleteLectureInformation() throws IOException {
System.out.println("입력하신 강의정보가 삭제되었습니다.");
lectureRepository.save();
}

//강의정보 삭제
public boolean newDeleteLectureInformation(String lectureId) throws IOException {
Lecture lecture = lectureRepository.findById(lectureId);
if(lecture == null) {
System.out.println("입력 아이디에 해당하는 강의정보가 없습니다.");
return false;
}
lectureRepository.delete(lecture);
System.out.println("입력하신 강사의정보가 삭제되었습니다.");

lectureRepository.save();
return true;
}
}

0 comments on commit 89db985

Please sign in to comment.