個人開発
This commit is contained in:
7
.classpath
Normal file
7
.classpath
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<?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
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/bin/
|
||||||
23
.project
Normal file
23
.project
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<?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>
|
||||||
7
.settings/.jsdtscope
Normal file
7
.settings/.jsdtscope
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<?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
.settings/org.eclipse.wst.jsdt.ui.superType.container
Normal file
1
.settings/org.eclipse.wst.jsdt.ui.superType.container
Normal file
@@ -0,0 +1 @@
|
|||||||
|
org.eclipse.wst.jsdt.launching.JRE_CONTAINER
|
||||||
1
.settings/org.eclipse.wst.jsdt.ui.superType.name
Normal file
1
.settings/org.eclipse.wst.jsdt.ui.superType.name
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Global
|
||||||
@@ -16,6 +16,34 @@ 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": //検索
|
||||||
empSelect();
|
empSel();
|
||||||
break;
|
break;
|
||||||
case "2": //登録
|
case "2": //登録
|
||||||
empInsert();
|
empInsert();
|
||||||
@@ -61,6 +61,57 @@ public class Main {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 検索方法を選択する
|
||||||
|
* @Override
|
||||||
|
* @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);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 社員ファイルから情報を検索する
|
* 社員ファイルから情報を検索する
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user