2日目の8段階目終了

This commit is contained in:
2026-09-18 10:00:12 +09:00
parent 5358280624
commit 60da179895
2 changed files with 38 additions and 26 deletions

View File

@@ -49,6 +49,11 @@ public class EmployeeData extends BaseData {
public void setNmEmployee(String nmEmployee) {
this.nmEmployee = nmEmployee;
if (nmEmployee == null || nmEmployee.strip().isEmpty()) {
System.out.println("社員名が空のため設定できませんでした");
return;
}
}
public String getKnEmployee() {
@@ -100,13 +105,13 @@ public class EmployeeData extends BaseData {
public String getPrimaryKeyValue() {
return getIdEmployee();
}
public boolean isMatchId(String id) {
if (id == null || this.idEmployee == null) {
return false;
}
return this.idEmployee.equals(id);
}
}

View File

@@ -6,7 +6,7 @@ public class Main {
// System.out.println("検索したい社員IDを入力してください(終了する場合は0)");
// String input = scanner.nextLine();
// BaseData[] employees = new BaseData[5];
BaseData[] employees = new BaseData[5];
// BaseData employee = new EmployeeData("10000", "山田龍也", "ヤマダタツヤ", "yamada@hoge.jp", "aaa", "10");
BaseData[] allData = new BaseData[11];
//
@@ -23,28 +23,28 @@ public class Main {
allData[9] = new DepartmentData("14", "教育事業部");
allData[10] = new DepartmentData("15", "営業企画部");
String targetDeptId = "";
for (int i = 0; i < allData.length; i++) {
if (allData[i] instanceof DepartmentData) {
DepartmentData dept = (DepartmentData) allData[i];
if (dept.getNmDepartment().equals("システム開発事業部")) {
targetDeptId = dept.getIdDepartment();
break;
}
}
}
for (int i = 0; i < allData.length; i++) {
if (allData[i] instanceof EmployeeData) {
EmployeeData emp = (EmployeeData) allData[i];
if (emp.getIdDepartment().equals(targetDeptId)) {
System.out.println(emp.getNmEmployee() + "\t" + emp.getMailAddress());
}
}
}
// String targetDeptId = "";
//
// for (int i = 0; i < allData.length; i++) {
//
// if (allData[i] instanceof DepartmentData) {
// DepartmentData dept = (DepartmentData) allData[i];
//
// if (dept.getNmDepartment().equals("システム開発事業部")) {
// targetDeptId = dept.getIdDepartment();
// break;
// }
// }
// }
//
// for (int i = 0; i < allData.length; i++) {
// if (allData[i] instanceof EmployeeData) {
// EmployeeData emp = (EmployeeData) allData[i];
// if (emp.getIdDepartment().equals(targetDeptId)) {
// System.out.println(emp.getNmEmployee() + "\t" + emp.getMailAddress());
// }
// }
// }
// int count = 0;
// int countt = 0;
@@ -71,9 +71,16 @@ public class Main {
// employees[4] = new EmployeeData("10004", "三宅武", "ミタケタケシ", "miya@hoge.jp", "eee", "13");
// //
//
// for (int i = 0; i < employees.length; i++) {
// System.out.println(allData[i]);
// }
// System.out.println("現在の社員データ件数:" + EmployeeData.getEmpCount() + "件");
if (allData[0] instanceof EmployeeData) {
EmployeeData sampleEmp = (EmployeeData) allData[0];
sampleEmp.setNmEmployee("");
}
// String serchId1 = "10002";
// System.out.println(serchId1 + "を検索します");
// boolean bo = false;