Compare commits
2 Commits
85e95d5104
...
647829924d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
647829924d | ||
|
|
c7eb251d1f |
@@ -1,6 +1,5 @@
|
||||
package com.example.demo.application;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
||||
import com.example.demo.logic.Q3Logic;
|
||||
@@ -8,10 +7,13 @@ import com.example.demo.service.Q3Service;
|
||||
|
||||
@Controller
|
||||
public class Q3Controller {
|
||||
@Autowired
|
||||
Q3Service ser;
|
||||
@Autowired
|
||||
Q3Logic log;
|
||||
private final Q3Service ser;
|
||||
private final Q3Logic log;
|
||||
|
||||
public Q3Controller(Q3Service ser, Q3Logic log) {
|
||||
this.ser = ser;
|
||||
this.log = log;
|
||||
}
|
||||
|
||||
public String usernameSearch(String mail, String pass) {
|
||||
if (mail.length() > 256) {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.example.demo.persistence;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@@ -8,4 +10,5 @@ import com.example.demo.domain.Employee;
|
||||
@Repository
|
||||
public interface EmployeeRepository extends JpaRepository<Employee, Integer> {
|
||||
|
||||
public List<Employee> findAll();
|
||||
}
|
||||
|
||||
@@ -2,15 +2,19 @@ package com.example.demo.presentation;
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.example.demo.application.Q3Controller;
|
||||
|
||||
@Component
|
||||
public class Q3View {
|
||||
@Autowired
|
||||
Q3Controller con;
|
||||
|
||||
private final Q3Controller con;
|
||||
|
||||
public Q3View(Q3Controller con) {
|
||||
this.con = con;
|
||||
}
|
||||
|
||||
Scanner scan = new Scanner(System.in);
|
||||
|
||||
public void usernameSearch() {
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.example.demo.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.example.demo.domain.Employee;
|
||||
@@ -10,9 +9,12 @@ import com.example.demo.persistence.EmployeeRepository;
|
||||
|
||||
@Service
|
||||
public class Q3Service {
|
||||
@Autowired
|
||||
EmployeeRepository empre;
|
||||
|
||||
public Q3Service(EmployeeRepository empre) {
|
||||
this.empre = empre;
|
||||
}
|
||||
|
||||
public List<Employee> allDateGet() {
|
||||
return empre.findAll();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.example.demo.controllers;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
|
||||
@Controller
|
||||
public class InitialController {
|
||||
@RequestMapping(value = "/", method = RequestMethod.GET)
|
||||
public String index() {
|
||||
return "login";// login+html
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/doLogout", method = RequestMethod.POST)
|
||||
public String doLogout() {
|
||||
return "login";
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/doLogin", method = RequestMethod.POST)
|
||||
public String doLogin() {
|
||||
return "menu";
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/doSelect", method = RequestMethod.POST)
|
||||
public String doSelect() {
|
||||
return "select";
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/doInsert", method = RequestMethod.POST)
|
||||
public String doInsert() {
|
||||
return "insert";
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/doUpdate", method = RequestMethod.POST)
|
||||
public String doUpdate() {
|
||||
return "update";
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/doDelete", method = RequestMethod.POST)
|
||||
public String doDelete() {
|
||||
return "delete";
|
||||
}
|
||||
}
|
||||
16
spring/spring-html/src/main/resources/templates/delete.html
Normal file
16
spring/spring-html/src/main/resources/templates/delete.html
Normal file
@@ -0,0 +1,16 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>デリートページ</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>デリートページ</h1>
|
||||
<form action="doLogin" method="POST">
|
||||
<input type="submit" value="戻る">
|
||||
</form>
|
||||
<form action="doLogout" method="POST">
|
||||
<input type="submit" value="ログアウト">
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
16
spring/spring-html/src/main/resources/templates/insert.html
Normal file
16
spring/spring-html/src/main/resources/templates/insert.html
Normal file
@@ -0,0 +1,16 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>インサートページ</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>インサートページ</h1>
|
||||
<form action="doLogin" method="POST">
|
||||
<input type="submit" value="戻る">
|
||||
</form>
|
||||
<form action="doLogout" method="POST">
|
||||
<input type="submit" value="ログアウト">
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
13
spring/spring-html/src/main/resources/templates/login.html
Normal file
13
spring/spring-html/src/main/resources/templates/login.html
Normal file
@@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>ログインページ</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>ログインページ</h1>
|
||||
<form action="doLogin" method="POST">
|
||||
<input type="submit" value="ログイン">
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
26
spring/spring-html/src/main/resources/templates/menu.html
Normal file
26
spring/spring-html/src/main/resources/templates/menu.html
Normal file
@@ -0,0 +1,26 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>メニューページ</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>メニューページ</h1>
|
||||
|
||||
<form action="doSelect" method="POST">
|
||||
<input type="submit" value="検索">
|
||||
</form>
|
||||
<form action="doInsert" method="POST">
|
||||
<input type="submit" value="登録">
|
||||
</form>
|
||||
<form action="doUpdate" method="POST">
|
||||
<input type="submit" value="更新">
|
||||
</form>
|
||||
<form action="doDelete" method="POST">
|
||||
<input type="submit" value="削除">
|
||||
</form>
|
||||
<form action="doLogout" method="POST">
|
||||
<input type="submit" value="ログアウト">
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
16
spring/spring-html/src/main/resources/templates/select.html
Normal file
16
spring/spring-html/src/main/resources/templates/select.html
Normal file
@@ -0,0 +1,16 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>セレクトページ</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>セレクトページ</h1>
|
||||
<form action="doLogin" method="POST">
|
||||
<input type="submit" value="戻る">
|
||||
</form>
|
||||
<form action="doLogout" method="POST">
|
||||
<input type="submit" value="ログアウト">
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
16
spring/spring-html/src/main/resources/templates/update.html
Normal file
16
spring/spring-html/src/main/resources/templates/update.html
Normal file
@@ -0,0 +1,16 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>アップデートページ</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>アップデートページ</h1>
|
||||
<form action="doLogin" method="POST">
|
||||
<input type="submit" value="戻る">
|
||||
</form>
|
||||
<form action="doLogout" method="POST">
|
||||
<input type="submit" value="ログアウト">
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user