Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a7162f1b2e | |||
| e4cf7bed2e |
@@ -1,7 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<classpath>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
|
||||||
<classpathentry kind="src" path="src"/>
|
|
||||||
<classpathentry kind="lib" path="実行例/em_oop.jar"/>
|
|
||||||
<classpathentry kind="output" path="bin"/>
|
|
||||||
</classpath>
|
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1 +0,0 @@
|
|||||||
/bin/
|
|
||||||
23
.project
23
.project
@@ -1,23 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<projectDescription>
|
|
||||||
<name>development-empmanager</name>
|
|
||||||
<comment></comment>
|
|
||||||
<projects>
|
|
||||||
</projects>
|
|
||||||
<buildSpec>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.wst.validation.validationbuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
</buildSpec>
|
|
||||||
<natures>
|
|
||||||
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
|
|
||||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
|
||||||
</natures>
|
|
||||||
</projectDescription>
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<classpath>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
|
|
||||||
<classpathentry kind="src" path=""/>
|
|
||||||
<classpathentry kind="output" path=""/>
|
|
||||||
</classpath>
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
org.eclipse.wst.jsdt.launching.JRE_CONTAINER
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Global
|
|
||||||
@@ -16,34 +16,6 @@ public class EmployeeAccess extends BaseAccess {
|
|||||||
super(EMPDATA_FILEPATH);
|
super(EMPDATA_FILEPATH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<BaseData> allSelect() throws FileNotFoundException {
|
|
||||||
|
|
||||||
//全件データ
|
|
||||||
List<BaseData> allList = new ArrayList<>();
|
|
||||||
|
|
||||||
//取得用リスト(CSV形式)
|
|
||||||
List<String> csvList = readData();
|
|
||||||
//CSVデータを1行で出力
|
|
||||||
|
|
||||||
for (String line : csvList) {
|
|
||||||
//インスタンス生成
|
|
||||||
EmployeeData employee = new EmployeeData();
|
|
||||||
//,=空白、[5]まで行ったら終了
|
|
||||||
String[] columns = line.split(",");
|
|
||||||
employee.setIdEmployee(columns[0]);
|
|
||||||
employee.setNmEmployee(columns[1]);
|
|
||||||
employee.setKnEmployee(columns[2]);
|
|
||||||
employee.setMailAddress(columns[3]);
|
|
||||||
employee.setPassword(columns[4]);
|
|
||||||
employee.setIdDepartment(columns[5]);
|
|
||||||
allList.add(employee);
|
|
||||||
}
|
|
||||||
return allList;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<BaseData> selectById(String key) throws FileNotFoundException {
|
public List<BaseData> selectById(String key) throws FileNotFoundException {
|
||||||
//全件データ
|
//全件データ
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ public class Main {
|
|||||||
|
|
||||||
switch (ope) {
|
switch (ope) {
|
||||||
case "1": //検索
|
case "1": //検索
|
||||||
empSel();
|
empSelect();
|
||||||
break;
|
break;
|
||||||
case "2": //登録
|
case "2": //登録
|
||||||
empInsert();
|
empInsert();
|
||||||
@@ -62,61 +62,10 @@ public class Main {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 検索方法を選択する
|
* 社員ファイルから情報を検索する
|
||||||
* @Override
|
*
|
||||||
* @throws FileNotFoundException
|
* @throws FileNotFoundException
|
||||||
*/
|
*/
|
||||||
public void empSel() throws FileNotFoundException {
|
|
||||||
//検索方法の選択
|
|
||||||
System.out.println("1:全検索 2:条件検索 それ以外:戻る");
|
|
||||||
String sel = sc.nextLine();
|
|
||||||
|
|
||||||
switch (sel) {
|
|
||||||
case "1": //全検索
|
|
||||||
empList();
|
|
||||||
break;
|
|
||||||
case "2": //条件検索
|
|
||||||
empSelect();
|
|
||||||
break;
|
|
||||||
default: //それ以外:戻る
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 全検索で一覧を表示する
|
|
||||||
*
|
|
||||||
* @throws FileNotFoundException
|
|
||||||
*/
|
|
||||||
public void empList() throws FileNotFoundException {
|
|
||||||
List<BaseData> allList;
|
|
||||||
|
|
||||||
//一覧データ取得
|
|
||||||
EmployeeAccess all = new EmployeeAccess();
|
|
||||||
|
|
||||||
allList = all.allSelect();
|
|
||||||
if (allList.size() == 0) { //取得結果が0件の場合
|
|
||||||
System.out.println("入力された値で情報がみつかりませんでした");
|
|
||||||
}
|
|
||||||
//for文を10回繰り返す
|
|
||||||
for(int) {
|
|
||||||
System.out.println(employee.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
//取得結果件数分、データをタブ区切りで出力する
|
|
||||||
/*for (BaseData employee : allList) {
|
|
||||||
System.out.println(employee.toString());
|
|
||||||
}*/
|
|
||||||
|
|
||||||
System.out.println(allList);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 社員ファイルから情報を検索する
|
|
||||||
*
|
|
||||||
* @throws FileNotFoundException
|
|
||||||
*/
|
|
||||||
public void empSelect() throws FileNotFoundException {
|
public void empSelect() throws FileNotFoundException {
|
||||||
EmployeeAccess ea = new EmployeeAccess();
|
EmployeeAccess ea = new EmployeeAccess();
|
||||||
List<BaseData> list;
|
List<BaseData> list;
|
||||||
|
|||||||
Reference in New Issue
Block a user