Compare commits
9 Commits
f13a6a6c7b
...
s-ohasi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
addeaa4628 | ||
|
|
f671951fd1 | ||
|
|
341365aa81 | ||
|
|
4ee47eba72 | ||
|
|
df34f8dcc4 | ||
|
|
5a5bfd9112 | ||
|
|
85d1d3715b | ||
|
|
16f4aacf23 | ||
|
|
307f8951b3 |
@@ -1,77 +1,64 @@
|
|||||||
//package com.example.demo.controller;
|
package com.example.demo.controller;
|
||||||
//
|
|
||||||
//import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
//
|
|
||||||
//import jakarta.servlet.http.HttpSession;
|
import jakarta.servlet.http.HttpSession;
|
||||||
//
|
|
||||||
//import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
//import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
//import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
//import org.springframework.web.bind.annotation.ModelAttribute;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
//import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
//
|
|
||||||
//import com.example.demo.form.LoginInfoForm;
|
import com.example.demo.form.LoginInfoForm;
|
||||||
//import com.example.demo.form.LoginUserForm;
|
import com.example.demo.form.LoginUserForm;
|
||||||
//import com.example.demo.form.MessageForm;
|
import com.example.demo.form.MessageForm;
|
||||||
//import com.example.demo.service.impl.Login;
|
import com.example.demo.service.ReturnService;
|
||||||
//
|
|
||||||
//@Controller
|
@Controller
|
||||||
//public class LoginController {
|
public class LoginController {
|
||||||
//
|
|
||||||
// // // ログ出力用インスタンス
|
// // ログ出力用インスタンス
|
||||||
// private static final Logger LOGGER = Logger.getLogger(LoginController.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(LoginController.class.getName());
|
||||||
//
|
|
||||||
// // ログイン処理を行う
|
@Autowired
|
||||||
// private final Login login;
|
ReturnService service;
|
||||||
//
|
|
||||||
// // コンストラクタで部品を注入する(Autowired)
|
@GetMapping("/login")
|
||||||
// @Autowired
|
public String view(Model model) {
|
||||||
// public LoginController(Login login) {
|
model.addAttribute("loginInfoForm",new LoginInfoForm());
|
||||||
// this.login = login;
|
return "login";
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// // 画面で使うフォームの初期化
|
// ログインボタンが押されたときの処理
|
||||||
// @ModelAttribute
|
@PostMapping("/doLogin")
|
||||||
// public LoginUserForm loginUserForm() {
|
public String doLogin(LoginInfoForm form, HttpSession session, Model model) {
|
||||||
// return new LoginUserForm();
|
|
||||||
// }
|
// 入力チェック(メールアドレスやパスワードの形が正しいか)
|
||||||
//
|
if (!LoginUserForm.checkParameter(form)) {
|
||||||
// // ログインボタンが押されたときの処理
|
// エラーメッセージと、入力されたデータを画面に返す
|
||||||
// @PostMapping("/doLogin")
|
model.addAttribute("messageError", new MessageForm("メールアドレス、パスワードの入力内容に誤りがあります"));
|
||||||
// public String doLogin(LoginInfoForm loginInfoForm, HttpSession session, Model model) {
|
model.addAttribute("loginInfoForm", form);
|
||||||
//
|
return "login"; // login.html を表示
|
||||||
// try {
|
}
|
||||||
// // 入力チェック(メールアドレスやパスワードの形が正しいか)
|
|
||||||
// if (!LoginUserForm.checkParameter(loginInfoForm)) {
|
// 認証チェック(メールアドレスとパスワードが一致するか)
|
||||||
// // エラーメッセージと、入力されたデータを画面に返す
|
if (service.canlogin(form.getMailAddress(), form.getPassword()) == false) {
|
||||||
// model.addAttribute("messageError", new MessageForm("メールアドレス、パスワードの入力内容に誤りがあります"));
|
// 間違っている場合のメッセージを画面に返す
|
||||||
// model.addAttribute("loginInfoForm", loginInfoForm);
|
model.addAttribute("messageError", new MessageForm("IDまたはパスワードが間違っています"));
|
||||||
// return "login"; // login.html を表示
|
model.addAttribute("loginInfoForm", form);
|
||||||
// }
|
return "login"; // login.html を表示
|
||||||
//
|
}
|
||||||
// // 認証チェック(IDとパスワードが一致するか)
|
|
||||||
// if (!login.canLogin(loginInfoForm)) {
|
int userId = service.getUserID(form);
|
||||||
// // 間違っている場合のメッセージを画面に返す
|
session.setAttribute("loginUser", userId);// セッションにユーザー情報を保存 = 「ログイン中」の状態
|
||||||
// model.addAttribute("messageError", new MessageForm("IDまたはパスワードが間違っています"));
|
|
||||||
// model.addAttribute("loginInfoForm", loginInfoForm);
|
//管理者チェック
|
||||||
// return "login"; // login.html を表示
|
Character adminFlg = service.getUserFlg(form);
|
||||||
// }
|
if (adminFlg != null && adminFlg == '1') {
|
||||||
//
|
return "admin_menu";//admin_menuを表示
|
||||||
// // ログイン処理の実行
|
}
|
||||||
// LoginUser loginUser = login.doLogin(loginInfoForm);
|
// 成功したらメニュー画面へ進む
|
||||||
//
|
return "menu"; // menu.html を表示
|
||||||
// // セッション(サーバーの秘密のメモ帳)にユーザー情報を保存
|
}
|
||||||
// //「ログイン中」の状態
|
}
|
||||||
// session.setAttribute("loginUser", LoginUserForm.convertFrom(loginUser));
|
|
||||||
//
|
|
||||||
// // 成功したらメニュー画面へ進む
|
|
||||||
// return "menu"; // menu.html を表示
|
|
||||||
//
|
|
||||||
// } catch (Exception e) {
|
|
||||||
// // 予期せぬエラーが起きたら、セッションを消してエラー画面へ
|
|
||||||
// session.invalidate();
|
|
||||||
// LOGGER.error("エラーが発生しました!", e);
|
|
||||||
// return "error"; // error.html を表示
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|||||||
@@ -1,46 +1,20 @@
|
|||||||
package com.example.demo.controller;
|
package com.example.demo.controller;
|
||||||
|
|
||||||
|
import jakarta.servlet.http.HttpSession;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
public class LogoutController {
|
public class LogoutController {
|
||||||
// // ログ出力用インスタンス
|
@Autowired
|
||||||
// private final static Logger LOGGER = Logger.getLogger(LogoutController.class.getName());
|
HttpSession session;
|
||||||
// // エラーメッセージ用の定数フィールド
|
|
||||||
// private final static String SEVERE_ERROR_MESSAGE = "エラーが発生しました!";
|
@PostMapping("/doLogout")
|
||||||
//
|
public String doLogout() {
|
||||||
// HttpSession httpSession;
|
//セッションをすべて破棄
|
||||||
//
|
session.invalidate();
|
||||||
// @Autowired
|
return "login";
|
||||||
// public LogoutController(HttpSession httpSession) {
|
}
|
||||||
// this.httpSession = httpSession;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @ModelAttribute
|
|
||||||
// public LoginUserForm loginUserForm() {
|
|
||||||
// return new LoginUserForm();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @PermissionCheck
|
|
||||||
// @SessionCheck
|
|
||||||
// @RequestMapping(value = LOGOUT, method = RequestMethod.POST)
|
|
||||||
// public String doLogout(Model model) {
|
|
||||||
// try {
|
|
||||||
// // セッション情報の破棄
|
|
||||||
// httpSession.invalidate();
|
|
||||||
//
|
|
||||||
// // ログイン画面に遷移するための情報を設定
|
|
||||||
// model.addAttribute(PageReturnAttributeKeyword.LOGIN_INFO_FORM, loginUserForm());
|
|
||||||
// // login.html に遷移
|
|
||||||
// return TransitionTargetPageNameKeyword.LOGIN_HTML;
|
|
||||||
//
|
|
||||||
// } catch (Exception e) {
|
|
||||||
//
|
|
||||||
// // エラーログ出力
|
|
||||||
// LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE, e);
|
|
||||||
// // エラーページに遷移
|
|
||||||
// return TransitionTargetPageNameKeyword.ERROR_HTML;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,96 +1,94 @@
|
|||||||
//package com.example.demo.form;
|
package com.example.demo.form;
|
||||||
//
|
|
||||||
//import com.example.rhizome.app.domain.model.LoginUser;
|
import lombok.AllArgsConstructor;
|
||||||
//
|
import lombok.Data;
|
||||||
//import lombok.AllArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
//import lombok.Data;
|
|
||||||
//import lombok.NoArgsConstructor;
|
//ログインをする人
|
||||||
//
|
@Data
|
||||||
////ログインをする人
|
@AllArgsConstructor
|
||||||
//@Data
|
@NoArgsConstructor
|
||||||
//@AllArgsConstructor
|
public class LoginUserForm {
|
||||||
//@NoArgsConstructor
|
/**
|
||||||
//public class LoginUserForm {
|
* 社員ID
|
||||||
// /**
|
*/
|
||||||
// * 社員ID
|
private Integer idEmployee;
|
||||||
// */
|
/**
|
||||||
// private Integer idEmployee;
|
* 社員名
|
||||||
// /**
|
*/
|
||||||
// * 社員名
|
private String nmEmployee;
|
||||||
// */
|
/**
|
||||||
// private String nmEmployee;
|
* 社員名よみ
|
||||||
// /**
|
*/
|
||||||
// * 社員名よみ
|
private String knEmployee;
|
||||||
// */
|
/**
|
||||||
// private String knEmployee;
|
* メールアドレス
|
||||||
// /**
|
*/
|
||||||
// * メールアドレス
|
private String mailAddress;
|
||||||
// */
|
/**
|
||||||
// private String mailAddress;
|
* パスワード
|
||||||
// /**
|
*/
|
||||||
// * パスワード
|
private String password;
|
||||||
// */
|
|
||||||
// private String password;
|
/**
|
||||||
//
|
* 管理者フラグ
|
||||||
// /**
|
*/
|
||||||
// * 管理者フラグ
|
private Integer flgadmin;
|
||||||
// */
|
|
||||||
// private Integer flgadmin;
|
/**
|
||||||
//
|
* business 層の LoginUser クラスから画面用(presentation 層)の LoginUserForm に
|
||||||
// /**
|
* 変換します。
|
||||||
// * business 層の LoginUser クラスから画面用(presentation 層)の LoginUserForm に
|
*
|
||||||
// * 変換します。
|
* @param loginUser business 層の LoginUser インスタンス
|
||||||
// *
|
* @return クラスから画面用(presentation 層)の LoginUserForm
|
||||||
// * @param loginUser business 層の LoginUser インスタンス
|
*/
|
||||||
// * @return クラスから画面用(presentation 層)の LoginUserForm
|
public static LoginUserForm convertFrom(LoginUserForm loginUser) {
|
||||||
// */
|
return new LoginUserForm(
|
||||||
// public static LoginUserForm convertFrom(LoginUser loginUser) {
|
loginUser.getIdEmployee(),
|
||||||
// return new LoginUserForm(
|
loginUser.getNmEmployee(),
|
||||||
// loginUser.getIdEmployee(),
|
loginUser.getKnEmployee(),
|
||||||
// loginUser.getNmEmployee(),
|
loginUser.getMailAddress(),
|
||||||
// loginUser.getKnEmployee(),
|
loginUser.getPassword(),
|
||||||
// loginUser.getMailAddress(),
|
loginUser.getFlgadmin()
|
||||||
// loginUser.getPassword(),
|
);
|
||||||
// loginUser.getGetFlgadmin()
|
}
|
||||||
// );
|
|
||||||
// }
|
|
||||||
//
|
public static LoginUserForm convertTo(LoginUserForm loginUserForm) {
|
||||||
//
|
return new LoginUserForm(
|
||||||
// public static LoginUserForm convertTo(LoginUser loginUserForm) {
|
loginUserForm.getIdEmployee(),
|
||||||
// return new LoginUserForm(
|
loginUserForm.getNmEmployee(),
|
||||||
// loginUserForm.getIdEmployee(),
|
loginUserForm.getKnEmployee(),
|
||||||
// loginUserForm.getNmEmployee(),
|
loginUserForm.getMailAddress(),
|
||||||
// loginUserForm.getKnEmployee(),
|
loginUserForm.getPassword(),
|
||||||
// loginUserForm.getMailAddress(),
|
loginUserForm.getFlgadmin()
|
||||||
// loginUserForm.getPassword(),
|
);
|
||||||
// loginUserForm.getGetFlgadmin()
|
}
|
||||||
// );
|
|
||||||
// }
|
|
||||||
//
|
public static boolean checkParameter(LoginInfoForm loginInfoForm) {
|
||||||
//
|
if (null == loginInfoForm.getMailAddress()) {
|
||||||
// public static boolean checkParameter(LoginInfoForm loginInfoForm) {
|
return false;
|
||||||
// if (null == loginInfoForm.getMailAddress()) {
|
}
|
||||||
// return false;
|
|
||||||
// }
|
if (loginInfoForm.getMailAddress().isBlank()) {
|
||||||
//
|
return false;
|
||||||
// if (loginInfoForm.getMailAddress().isBlank()) {
|
}
|
||||||
// return false;
|
|
||||||
// }
|
if (null == loginInfoForm.getPassword()) {
|
||||||
//
|
return false;
|
||||||
// if (null == loginInfoForm.getPassword()) {
|
}
|
||||||
// return false;
|
|
||||||
// }
|
return !loginInfoForm.getPassword().isBlank();
|
||||||
//
|
|
||||||
// return !loginInfoForm.getPassword().isBlank();
|
}
|
||||||
//
|
|
||||||
// }
|
/**
|
||||||
//
|
* 管理者権限を持っているか確認
|
||||||
// /**
|
*
|
||||||
// * 管理者権限を持っているか確認
|
* @return true:管理者権限を持っている , false:管理者権限を持っていない
|
||||||
// *
|
*/
|
||||||
// * @return true:管理者権限を持っている , false:管理者権限を持っていない
|
public boolean isAdminUser() {
|
||||||
// */
|
return getFlgadmin() == 1;
|
||||||
// public boolean isAdminUser() {
|
}
|
||||||
// return getFlgadmin() == 1;
|
}
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|||||||
@@ -1,14 +1,15 @@
|
|||||||
package com.example.demo.form;
|
package com.example.demo.form;
|
||||||
|
|
||||||
//画面にエラー表示する
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 画面に表示するエラーメッセージを管理するクラスです。
|
||||||
|
*/
|
||||||
@Data
|
@Data
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class MessageForm {
|
public class MessageForm {
|
||||||
private String message;
|
private String message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.example.demo.model;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class LeadingListModel {
|
||||||
|
//データの保持
|
||||||
|
private final Integer idRequest;
|
||||||
|
private final String nmBook;
|
||||||
|
private final String nmEmployee;
|
||||||
|
private final Date dateRequest;
|
||||||
|
private final Date dateBorrow;
|
||||||
|
private final Date dateScheduledReturn;
|
||||||
|
}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.example.demo.repository;
|
package com.example.demo.repository;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
@@ -7,5 +9,5 @@ import com.example.demo.entity.Borrow_booksEntity;
|
|||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public interface Borrow_BooksRepository extends JpaRepository<Borrow_booksEntity, Integer> {
|
public interface Borrow_BooksRepository extends JpaRepository<Borrow_booksEntity, Integer> {
|
||||||
|
List<Borrow_booksEntity> findByStatus(Character status);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.example.demo.repository;
|
package com.example.demo.repository;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
@@ -8,5 +10,7 @@ import com.example.demo.entity.EmployeeEntity;
|
|||||||
@Repository
|
@Repository
|
||||||
public interface EmployeeRepository extends JpaRepository<EmployeeEntity, Integer> {
|
public interface EmployeeRepository extends JpaRepository<EmployeeEntity, Integer> {
|
||||||
|
|
||||||
|
//メールアドレスとパスワードに合致するレコード
|
||||||
|
Optional<EmployeeEntity> findByMailAddressAndPassword(String mailAddress, String password);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.example.demo.service;
|
package com.example.demo.service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
@@ -9,8 +10,11 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import com.example.demo.entity.Book_collectionEntity;
|
import com.example.demo.entity.Book_collectionEntity;
|
||||||
import com.example.demo.entity.Borrow_booksEntity;
|
import com.example.demo.entity.Borrow_booksEntity;
|
||||||
|
import com.example.demo.form.LendingForm;
|
||||||
|
import com.example.demo.form.LoginInfoForm;
|
||||||
import com.example.demo.form.ReturnForm;
|
import com.example.demo.form.ReturnForm;
|
||||||
import com.example.demo.form.SearchConditionBookForm;
|
import com.example.demo.form.SearchConditionBookForm;
|
||||||
|
import com.example.demo.model.LeadingListModel;
|
||||||
import com.example.demo.repository.Book_CollectionRepository;
|
import com.example.demo.repository.Book_CollectionRepository;
|
||||||
import com.example.demo.repository.Borrow_BooksRepository;
|
import com.example.demo.repository.Borrow_BooksRepository;
|
||||||
import com.example.demo.repository.EmployeeRepository;
|
import com.example.demo.repository.EmployeeRepository;
|
||||||
@@ -117,4 +121,79 @@ public class ReturnService {
|
|||||||
noteText);
|
noteText);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<LeadingListModel> getBorrowList() {
|
||||||
|
List<LeadingListModel> result = new ArrayList<LeadingListModel>();
|
||||||
|
|
||||||
|
List<Borrow_booksEntity> borrow = borrowRepository.findByStatus('2');
|
||||||
|
for (Borrow_booksEntity borrow_booksEntity : borrow) {
|
||||||
|
String nmEmployee = employeeRepository.findById(borrow_booksEntity.getIdApplicant()).get().getNmEmployee();
|
||||||
|
String nmBook = book_CollectionRepository.findById(borrow_booksEntity.getIdBook()).get().getNmBook();
|
||||||
|
LeadingListModel a = new LeadingListModel(borrow_booksEntity.getIdRequest(),
|
||||||
|
nmEmployee,
|
||||||
|
nmBook,
|
||||||
|
borrow_booksEntity.getDateRequest(),
|
||||||
|
borrow_booksEntity.getDateBorrow(),
|
||||||
|
borrow_booksEntity.getDateScheduledReturn());
|
||||||
|
result.add(a);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//書籍貸出申請機能
|
||||||
|
public void executeLending(LendingForm form, int idEmployee) {
|
||||||
|
var book_collection = book_CollectionRepository.findById(form.getId_book());//更新したい本のEntityを取得
|
||||||
|
book_collection.get().setFlgLending('1');//フラグだけ書き換え
|
||||||
|
book_CollectionRepository.save(book_collection.get());
|
||||||
|
|
||||||
|
Borrow_booksEntity borrow = new Borrow_booksEntity();//空の申請レコード
|
||||||
|
borrow.setIdApproval(idEmployee);//申請者ID
|
||||||
|
borrow.setIdBook(form.getId_book());//蔵書ID
|
||||||
|
borrow.setDateRequest(new Date());//申請日
|
||||||
|
borrow.setStatus('1');//ステータスを承認待ちに
|
||||||
|
borrow.setIdUpdate(idEmployee);//更新者ID
|
||||||
|
borrow.setDateUpdate(new Date());//更新日
|
||||||
|
|
||||||
|
borrowRepository.save(borrow);
|
||||||
|
}
|
||||||
|
|
||||||
|
//貸出テーブルの「ステータス」が「1:承認待」の情報を全件取得
|
||||||
|
public List<LeadingListModel> getAwaitingApprovalList() {
|
||||||
|
List<LeadingListModel> result = new ArrayList<LeadingListModel>();
|
||||||
|
|
||||||
|
List<Borrow_booksEntity> borrow = borrowRepository.findByStatus('1');
|
||||||
|
for (Borrow_booksEntity borrow_booksEntity : borrow) {
|
||||||
|
String nmEmployee = employeeRepository.findById(borrow_booksEntity.getIdApplicant()).get().getNmEmployee();
|
||||||
|
String nmBook = book_CollectionRepository.findById(borrow_booksEntity.getIdBook()).get().getNmBook();
|
||||||
|
LeadingListModel a = new LeadingListModel(borrow_booksEntity.getIdRequest(),
|
||||||
|
nmEmployee,
|
||||||
|
nmBook,
|
||||||
|
borrow_booksEntity.getDateRequest(),
|
||||||
|
borrow_booksEntity.getDateBorrow(),
|
||||||
|
borrow_booksEntity.getDateScheduledReturn());
|
||||||
|
result.add(a);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//メアドとパスワードが合っていればtureで返す
|
||||||
|
public boolean canlogin(String mail, String pass) {
|
||||||
|
if (mail == null || mail.isEmpty() || pass == null || pass.isEmpty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return employeeRepository.findByMailAddressAndPassword(mail, pass).isPresent();
|
||||||
|
}
|
||||||
|
|
||||||
|
//LoginInfoFormの情報からidEmployeeを返す
|
||||||
|
public int getUserID(LoginInfoForm form) {
|
||||||
|
return employeeRepository.findByMailAddressAndPassword(form.getMailAddress(), form.getPassword()).get()
|
||||||
|
.getIdEmployee();
|
||||||
|
}
|
||||||
|
|
||||||
|
//LoginInfoFormの情報からFlgを返す 0なら一般,1なら管理
|
||||||
|
public Character getUserFlg(LoginInfoForm form) {
|
||||||
|
return employeeRepository.findByMailAddressAndPassword(form.getMailAddress(), form.getPassword()).get()
|
||||||
|
.getFlgAdmin();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
//package com.example.demo.service.impl;
|
|
||||||
//
|
|
||||||
//import com.example.demo.form.LoginInfoForm;
|
|
||||||
//import com.example.rhizome.app.domain.model.LoginUser;
|
|
||||||
//
|
|
||||||
//public interface Login {
|
|
||||||
// LoginUser doLogin(LoginInfoForm loginInfo);
|
|
||||||
//
|
|
||||||
// boolean canLogin(LoginInfoForm loginInfo);
|
|
||||||
//
|
|
||||||
//}
|
|
||||||
|
|||||||
@@ -14,7 +14,8 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
<h1>ログイン</h1>
|
<h1>ログイン</h1>
|
||||||
<form action="doLogin"
|
<form id="loginForm"
|
||||||
|
th:action="@{/doLogin}"
|
||||||
method="post"
|
method="post"
|
||||||
th:object="${loginInfoForm}">
|
th:object="${loginInfoForm}">
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user