Compare commits
8 Commits
95e1bbb06c
...
c2d108194c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c2d108194c | ||
|
|
ced8c9d154 | ||
|
|
378e446ae2 | ||
|
|
c4acd83194 | ||
|
|
9500eac50f | ||
|
|
fc84fc3fda | ||
|
|
71b8503c07 | ||
|
|
c743d3dfde |
@@ -5,9 +5,9 @@ import org.springframework.boot.web.servlet.support.SpringBootServletInitializer
|
|||||||
|
|
||||||
public class ServletInitializer extends SpringBootServletInitializer {
|
public class ServletInitializer extends SpringBootServletInitializer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
|
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
|
||||||
return application.sources(EmSpringApplication.class);
|
return application.sources(EmSpringApplication.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,111 +1,77 @@
|
|||||||
package com.example.rhizome.aop.Handler;
|
package com.example.rhizome.aop.Handler;
|
||||||
|
|
||||||
import com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
import static com.example.rhizome.app.presentation.controller.pageproperty.PageReturnAttributeKeyword.*;
|
||||||
import com.example.rhizome.app.presentation.form.LoginInfoForm;
|
|
||||||
import com.example.rhizome.app.presentation.form.MessageForm;
|
import java.util.logging.Level;
|
||||||
import com.example.rhizome.exception.InsufficientPermissionException;
|
import java.util.logging.Logger;
|
||||||
import com.example.rhizome.exception.NoSessionException;
|
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.web.HttpRequestMethodNotSupportedException;
|
import org.springframework.web.HttpRequestMethodNotSupportedException;
|
||||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||||
|
|
||||||
import java.util.logging.Level;
|
import com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
||||||
import java.util.logging.Logger;
|
import com.example.rhizome.app.presentation.form.LoginInfoForm;
|
||||||
|
import com.example.rhizome.app.presentation.form.MessageForm;
|
||||||
|
import com.example.rhizome.exception.InsufficientPermissionException;
|
||||||
|
import com.example.rhizome.exception.NoSessionException;
|
||||||
|
|
||||||
import static com.example.rhizome.app.presentation.controller.pageproperty.PageReturnAttributeKeyword.LOGIN_INFO_FORM;
|
|
||||||
import static com.example.rhizome.app.presentation.controller.pageproperty.PageReturnAttributeKeyword.MESSAGE_ERROR;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 例外処理用のコントローラ
|
|
||||||
*/
|
|
||||||
@ControllerAdvice
|
@ControllerAdvice
|
||||||
public class GlobalExceptionHandler {
|
public class GlobalExceptionHandler {
|
||||||
|
|
||||||
private final static Logger LOGGER = Logger.getLogger(GlobalExceptionHandler.class.getName());
|
private final static Logger LOGGER = Logger.getLogger(GlobalExceptionHandler.class.getName());
|
||||||
|
|
||||||
private final String SEVERE_ERROR_MESSAGE_ILLEGAL_TRANSITION = "不正な遷移です。";
|
private final String SEVERE_ERROR_MESSAGE_ILLEGAL_TRANSITION = "不正な遷移です。";
|
||||||
private final String SEVERE_ERROR_MESSAGE_BAD_REQUEST = "不正なリクエストです。";
|
private final String SEVERE_ERROR_MESSAGE_BAD_REQUEST = "不正なリクエストです。";
|
||||||
|
|
||||||
/**
|
@ExceptionHandler(NoSessionException.class)
|
||||||
* セッションが切れている場合の例外処理
|
public String handleNoSessionException(Model model, Exception e) {
|
||||||
*
|
|
||||||
* @param model ビューにデータを渡すためのコンテナ
|
|
||||||
* @return 遷移先の画面
|
|
||||||
*/
|
|
||||||
@ExceptionHandler(NoSessionException.class)
|
|
||||||
public String handleNoSessionException(Model model, Exception e) {
|
|
||||||
|
|
||||||
model.addAttribute(MESSAGE_ERROR, new MessageForm(SEVERE_ERROR_MESSAGE_ILLEGAL_TRANSITION));
|
model.addAttribute(MESSAGE_ERROR, new MessageForm(SEVERE_ERROR_MESSAGE_ILLEGAL_TRANSITION));
|
||||||
model.addAttribute(LOGIN_INFO_FORM, new LoginInfoForm());
|
model.addAttribute(LOGIN_INFO_FORM, new LoginInfoForm());
|
||||||
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
||||||
// エラーログ出力
|
LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE_ILLEGAL_TRANSITION, e);
|
||||||
LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE_ILLEGAL_TRANSITION, e);
|
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.LOGIN_HTML;
|
return TransitionTargetPageNameKeyword.LOGIN_HTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@ExceptionHandler(InsufficientPermissionException.class)
|
||||||
* 権限がない場合の例外処理
|
public String handleInsufficientPermissionException(Model model, Exception e) {
|
||||||
*
|
|
||||||
* @param model ビューにデータを渡すためのコンテナ
|
|
||||||
* @return 遷移先の画面
|
|
||||||
*/
|
|
||||||
@ExceptionHandler(InsufficientPermissionException.class)
|
|
||||||
public String handleInsufficientPermissionException(Model model, Exception e) {
|
|
||||||
|
|
||||||
model.addAttribute(MESSAGE_ERROR, new MessageForm(SEVERE_ERROR_MESSAGE_ILLEGAL_TRANSITION));
|
model.addAttribute(MESSAGE_ERROR, new MessageForm(SEVERE_ERROR_MESSAGE_ILLEGAL_TRANSITION));
|
||||||
model.addAttribute(LOGIN_INFO_FORM, new LoginInfoForm());
|
model.addAttribute(LOGIN_INFO_FORM, new LoginInfoForm());
|
||||||
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
||||||
// エラーログ出力
|
LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE_ILLEGAL_TRANSITION, e);
|
||||||
LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE_ILLEGAL_TRANSITION, e);
|
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.LOGIN_HTML;
|
return TransitionTargetPageNameKeyword.ERROR_HTML;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@ExceptionHandler(HttpRequestMethodNotSupportedException.class)
|
||||||
* リクエストメソッドが不正な場合の例外処理
|
public String handleBadRequestException(Model model, Exception e) {
|
||||||
*
|
model.addAttribute("error", SEVERE_ERROR_MESSAGE_BAD_REQUEST);
|
||||||
* @param model ビューにデータを渡すためのコンテナ
|
model.addAttribute("status", HttpStatus.BAD_REQUEST.value());
|
||||||
* @return 遷移先の画面
|
|
||||||
*/
|
|
||||||
@ExceptionHandler(HttpRequestMethodNotSupportedException.class)
|
|
||||||
public String handleBadRequestException(Model model, Exception e) {
|
|
||||||
// エラーメッセージやその他の情報をモデルに追加する
|
|
||||||
model.addAttribute("error", SEVERE_ERROR_MESSAGE_BAD_REQUEST);
|
|
||||||
model.addAttribute("status", HttpStatus.BAD_REQUEST.value());
|
|
||||||
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
||||||
// エラーログ出力
|
LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE_ILLEGAL_TRANSITION, e);
|
||||||
LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE_ILLEGAL_TRANSITION, e);
|
|
||||||
|
|
||||||
// カスタムエラーページにリダイレクト
|
return TransitionTargetPageNameKeyword.ERROR_HTML;
|
||||||
return TransitionTargetPageNameKeyword.ERROR_HTML;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
@ExceptionHandler(Exception.class)
|
||||||
* その他の例外処理
|
public String AllException(Model model, Exception e) {
|
||||||
*
|
model.addAttribute("error", SEVERE_ERROR_MESSAGE_BAD_REQUEST);
|
||||||
* @param model ビューにデータを渡すためのコンテナ
|
|
||||||
* @return 遷移先の画面
|
|
||||||
*/
|
|
||||||
@ExceptionHandler(Exception.class)
|
|
||||||
public String AllException(Model model, Exception e) {
|
|
||||||
// エラーメッセージやその他の情報をモデルに追加する
|
|
||||||
model.addAttribute("error", SEVERE_ERROR_MESSAGE_BAD_REQUEST);
|
|
||||||
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
||||||
LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE_ILLEGAL_TRANSITION, e);
|
LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE_ILLEGAL_TRANSITION, e);
|
||||||
|
|
||||||
// カスタムエラーページにリダイレクト
|
return TransitionTargetPageNameKeyword.ERROR_HTML;
|
||||||
return TransitionTargetPageNameKeyword.ERROR_HTML;
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,10 +5,6 @@ import java.lang.annotation.Retention;
|
|||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
||||||
import java.lang.annotation.Target;
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
/**
|
|
||||||
* SessionCheckアノテーション
|
|
||||||
* セッションチェックを行うメソッドに付与する
|
|
||||||
*/
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
@Target(ElementType.METHOD)
|
@Target(ElementType.METHOD)
|
||||||
public @interface PermissionCheck {
|
public @interface PermissionCheck {
|
||||||
|
|||||||
@@ -1,114 +1,76 @@
|
|||||||
package com.example.rhizome.aop.aspect;
|
package com.example.rhizome.aop.aspect;
|
||||||
|
|
||||||
import com.example.rhizome.app.presentation.controller.pageproperty.SessionKeyword;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
|
||||||
import com.example.rhizome.app.presentation.form.LoginUserForm;
|
|
||||||
import com.example.rhizome.exception.InsufficientPermissionException;
|
|
||||||
import org.aspectj.lang.annotation.Aspect;
|
import org.aspectj.lang.annotation.Aspect;
|
||||||
import org.aspectj.lang.annotation.Before;
|
import org.aspectj.lang.annotation.Before;
|
||||||
import org.aspectj.lang.annotation.Pointcut;
|
import org.aspectj.lang.annotation.Pointcut;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import com.example.rhizome.app.presentation.controller.pageproperty.SessionKeyword;
|
||||||
|
import com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
||||||
|
import com.example.rhizome.app.presentation.form.LoginUserForm;
|
||||||
|
import com.example.rhizome.exception.InsufficientPermissionException;
|
||||||
|
|
||||||
/**
|
|
||||||
* 権限チェック用のAOP
|
|
||||||
*/
|
|
||||||
@Aspect
|
@Aspect
|
||||||
@Component
|
@Component
|
||||||
public class PermissionCheckAspect {
|
public class PermissionCheckAspect {
|
||||||
|
|
||||||
HttpServletRequest request;
|
HttpServletRequest request;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public PermissionCheckAspect(HttpServletRequest request) {
|
public PermissionCheckAspect(HttpServletRequest request) {
|
||||||
this.request = request;
|
this.request = request;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Aspectのフックを定義(今回はPermissionCheckアノテーションが定義されているメソッドが動作するタイミング)
|
@Pointcut("@annotation(com.example.rhizome.aop.aspect.PermissionCheck)")
|
||||||
@Pointcut("@annotation(com.example.rhizome.aop.aspect.PermissionCheck)")
|
public void permissionCheckMethod() {
|
||||||
public void permissionCheckMethod() {
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
@Before("permissionCheckMethod()")
|
||||||
* 権限チェック
|
public void checkPermission() {
|
||||||
*/
|
LoginUserForm loginUserForm = (LoginUserForm) request.getSession().getAttribute(SessionKeyword.LOGIN_USER);
|
||||||
@Before("permissionCheckMethod()")
|
|
||||||
public void checkPermission() {
|
|
||||||
// ログインユーザの取得
|
|
||||||
LoginUserForm loginUserForm = (LoginUserForm) request.getSession().getAttribute(SessionKeyword.LOGIN_USER);
|
|
||||||
|
|
||||||
// ログインユーザが取得できない場合、または権限がない場合はエラー画面に遷移
|
if (loginUserForm == null || !hasRequiredPermission(request.getRequestURI(), loginUserForm)) {
|
||||||
if (loginUserForm == null || !hasRequiredPermission(request.getRequestURI(), loginUserForm)) {
|
throw new InsufficientPermissionException("不正な遷移です");
|
||||||
throw new InsufficientPermissionException("不正な遷移です");
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private boolean hasRequiredPermission(String targetURL, LoginUserForm loginUserForm) {
|
||||||
* 遷移先のURLとログインユーザの権限から、遷移可否を判定する
|
|
||||||
*
|
|
||||||
* @param targetURL 遷移したいURL
|
|
||||||
* @param loginUserForm リクエスト元のユーザ
|
|
||||||
* @return true:遷移可 false:遷移不可
|
|
||||||
*/
|
|
||||||
private boolean hasRequiredPermission(String targetURL, LoginUserForm loginUserForm) {
|
|
||||||
|
|
||||||
// 管理者権限
|
if (isAdminTransition(targetURL, loginUserForm)) {
|
||||||
if (isAdminTransition(targetURL, loginUserForm)) {
|
return true;
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// 一般権限
|
if (isUserTransition(targetURL, loginUserForm)) {
|
||||||
if (isUserTransition(targetURL, loginUserForm)) {
|
return true;
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// アクセス不許可の場合の処理(不正アクセス画面に遷移)
|
return false;
|
||||||
return false;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private boolean isAdminTransition(String targetURL, LoginUserForm loginUserForm) {
|
||||||
* 管理者用のアカウントで管理者向けのページアクセスか
|
|
||||||
*
|
|
||||||
* @param targetURL 遷移したいURL
|
|
||||||
* @param loginUserForm リクエスト元のユーザ
|
|
||||||
* @return true:遷移可 false:遷移不可
|
|
||||||
*/
|
|
||||||
private boolean isAdminTransition(String targetURL, LoginUserForm loginUserForm) {
|
|
||||||
|
|
||||||
// 管理者か
|
if (!loginUserForm.isAdminUser()) {
|
||||||
if (!loginUserForm.isAdminUser()) {
|
return false;
|
||||||
return false;
|
}
|
||||||
}
|
if (!TransitionTargetPageNameKeyword.getAdminPageList().contains(targetURL)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// 管理者向けのページ遷移か
|
return true;
|
||||||
if (!TransitionTargetPageNameKeyword.getAdminPageList().contains(targetURL)) {
|
}
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
private boolean isUserTransition(String targetURL, LoginUserForm loginUserForm) {
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
if (loginUserForm.isAdminUser()) {
|
||||||
* 一般ユーザ用のアカウントで一般ユーザ向けのページアクセスか
|
return false;
|
||||||
*
|
}
|
||||||
* @param targetURL 遷移したいURL
|
|
||||||
* @param loginUserForm リクエスト元のユーザ
|
|
||||||
* @return true:遷移可 false:遷移不可
|
|
||||||
*/
|
|
||||||
private boolean isUserTransition(String targetURL, LoginUserForm loginUserForm) {
|
|
||||||
|
|
||||||
// 管理者か
|
return TransitionTargetPageNameKeyword.getUserPageList().contains(targetURL);
|
||||||
if (loginUserForm.isAdminUser()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 一般ユーザ向けのページ遷移か
|
}
|
||||||
return TransitionTargetPageNameKeyword.getUserPageList().contains(targetURL);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,10 +5,6 @@ import java.lang.annotation.Retention;
|
|||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
||||||
import java.lang.annotation.Target;
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
/**
|
|
||||||
* SessionCheckアノテーション
|
|
||||||
* セッションチェックを行うメソッドに付与する
|
|
||||||
*/
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
@Target(ElementType.METHOD)
|
@Target(ElementType.METHOD)
|
||||||
public @interface SessionCheck {
|
public @interface SessionCheck {
|
||||||
|
|||||||
@@ -1,47 +1,40 @@
|
|||||||
package com.example.rhizome.aop.aspect;
|
package com.example.rhizome.aop.aspect;
|
||||||
|
|
||||||
import com.example.rhizome.app.presentation.controller.pageproperty.SessionKeyword;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import com.example.rhizome.exception.NoSessionException;
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
import org.aspectj.lang.annotation.Aspect;
|
import org.aspectj.lang.annotation.Aspect;
|
||||||
import org.aspectj.lang.annotation.Before;
|
import org.aspectj.lang.annotation.Before;
|
||||||
import org.aspectj.lang.annotation.Pointcut;
|
import org.aspectj.lang.annotation.Pointcut;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import com.example.rhizome.app.presentation.controller.pageproperty.SessionKeyword;
|
||||||
import javax.servlet.http.HttpSession;
|
import com.example.rhizome.exception.NoSessionException;
|
||||||
|
|
||||||
/**
|
|
||||||
* セッションチェック用のAOP
|
|
||||||
*/
|
|
||||||
@Aspect
|
@Aspect
|
||||||
@Component
|
@Component
|
||||||
public class SessionCheckAspect {
|
public class SessionCheckAspect {
|
||||||
|
|
||||||
HttpServletRequest request;
|
HttpServletRequest request;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public SessionCheckAspect(HttpServletRequest request) {
|
public SessionCheckAspect(HttpServletRequest request) {
|
||||||
this.request = request;
|
this.request = request;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Pointcut("@annotation(com.example.rhizome.aop.aspect.SessionCheck)")
|
@Pointcut("@annotation(com.example.rhizome.aop.aspect.SessionCheck)")
|
||||||
public void sessionCheckMethod() {
|
public void sessionCheckMethod() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Before("sessionCheckMethod()")
|
||||||
* セッションチェック
|
public void checkSession() {
|
||||||
*/
|
HttpSession session = request.getSession(false);
|
||||||
@Before("sessionCheckMethod()")
|
|
||||||
public void checkSession() {
|
|
||||||
// セッションの取得
|
|
||||||
HttpSession session = request.getSession(false);
|
|
||||||
|
|
||||||
// セッションが取得できない場合はエラー画面に遷移
|
if (session == null || session.getAttribute(SessionKeyword.LOGIN_USER) == null) {
|
||||||
if (session == null || session.getAttribute(SessionKeyword.LOGIN_USER) == null) {
|
throw new NoSessionException("不正なログインです");
|
||||||
throw new NoSessionException("不正なログインです");
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,19 @@
|
|||||||
package com.example.rhizome.app.domain.service;
|
package com.example.rhizome.app.domain.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.example.rhizome.app.domain.model.Department;
|
import com.example.rhizome.app.domain.model.Department;
|
||||||
import com.example.rhizome.app.domain.model.SearchConditionDepartment;
|
import com.example.rhizome.app.domain.model.SearchConditionDepartment;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface SearchDepartment {
|
public interface SearchDepartment {
|
||||||
List<Department> selectAll();
|
List<Department> selectAll();
|
||||||
|
|
||||||
List<Department> searchBy(SearchConditionDepartment searchConditionDepartment);
|
List<Department> searchBy(SearchConditionDepartment searchConditionDepartment);
|
||||||
|
|
||||||
|
List<Department> searchByWithLike(SearchConditionDepartment searchConditionDepartment);
|
||||||
|
|
||||||
|
List<Department> searchByDepartmentName(SearchConditionDepartment searchConditionDepartment);
|
||||||
|
|
||||||
|
List<Department> searchByDepartmentId(SearchConditionDepartment searchConditionDepartment);
|
||||||
|
|
||||||
List<Department> searchByWithLike(SearchConditionDepartment searchConditionDepartment);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,11 +6,11 @@ import com.example.rhizome.app.domain.model.LoginUser;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface SearchEmployee {
|
public interface SearchEmployee {
|
||||||
List<Employee> searchEmployee(String mailAddress);
|
List<Employee> searchEmployee(String mailAddress);
|
||||||
|
|
||||||
List<Employee> searchEmployeeByIdDepartment(Integer idDepartment);
|
List<Employee> searchEmployeeByIdDepartment(Integer idDepartment);
|
||||||
|
|
||||||
LoginUser searchLoginUser(String mailAddress);
|
LoginUser searchLoginUser(String mailAddress);
|
||||||
|
|
||||||
Employee searchEmployeeByIdEmployee(Integer idEmployee);
|
Employee searchEmployeeByIdEmployee(Integer idEmployee);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,82 @@
|
|||||||
|
package com.example.rhizome.app.presentation.controller;
|
||||||
|
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.Model;
|
||||||
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
|
|
||||||
|
import com.example.rhizome.aop.aspect.PermissionCheck;
|
||||||
|
import com.example.rhizome.aop.aspect.SessionCheck;
|
||||||
|
import com.example.rhizome.app.domain.service.SearchDepartment;
|
||||||
|
import com.example.rhizome.app.domain.service.SearchEmployeeInfo;
|
||||||
|
import com.example.rhizome.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
||||||
|
import com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
||||||
|
import com.example.rhizome.app.presentation.form.DepartmentForm;
|
||||||
|
import com.example.rhizome.app.presentation.form.SearchConditionDepartmentForm;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
public class SelectDepartmentController {
|
||||||
|
|
||||||
|
private final static Logger LOGGER = Logger.getLogger(SelectDepartmentController.class.getName());
|
||||||
|
|
||||||
|
private final static String SEVERE_ERROR_MESSAGE = "エラーが発生しました!";
|
||||||
|
|
||||||
|
HttpSession httpSession;
|
||||||
|
SearchDepartment searchDepartment;
|
||||||
|
SearchEmployeeInfo searchEmployeeInfo;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public SelectDepartmentController(HttpSession httpSession, SearchDepartment searchDepartment,
|
||||||
|
SearchEmployeeInfo searchEmployeeInfo) {
|
||||||
|
this.httpSession = httpSession;
|
||||||
|
this.searchDepartment = searchDepartment;
|
||||||
|
this.searchEmployeeInfo = searchEmployeeInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ModelAttribute
|
||||||
|
public SearchConditionDepartmentForm searchConditionDepartmentForm() {
|
||||||
|
return new SearchConditionDepartmentForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SessionCheck
|
||||||
|
@PermissionCheck
|
||||||
|
@RequestMapping(value = TransitionTargetPageNameKeyword.SELECT_DEPARTMENT, method = RequestMethod.POST)
|
||||||
|
public String select(SearchConditionDepartmentForm searchConditionDepartmentForm, Model model) {
|
||||||
|
try {
|
||||||
|
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.DEPARTMENT_FORM_LIST, DepartmentForm.convertFrom(
|
||||||
|
searchDepartment
|
||||||
|
.searchByWithLike(SearchConditionDepartmentForm.convertTo(searchConditionDepartmentForm))));
|
||||||
|
|
||||||
|
return TransitionTargetPageNameKeyword.SELECT_DEPARTMENT_HTML;
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
httpSession.invalidate();
|
||||||
|
|
||||||
|
e.printStackTrace();
|
||||||
|
|
||||||
|
LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE, e);
|
||||||
|
return TransitionTargetPageNameKeyword.ERROR_HTML;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@SessionCheck
|
||||||
|
@PermissionCheck
|
||||||
|
@RequestMapping(value = TransitionTargetPageNameKeyword.SELECT_DEPARTMENT_INFO_FORM_EMPTY, method = RequestMethod.POST)
|
||||||
|
public String select(Model model) {
|
||||||
|
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.DEPARTMENT_FORM_LIST, DepartmentForm.convertFrom(
|
||||||
|
searchDepartment.searchBy(SearchConditionDepartmentForm.convertTo(searchConditionDepartmentForm()))));
|
||||||
|
|
||||||
|
return TransitionTargetPageNameKeyword.SELECT_DEPARTMENT_HTML;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,18 +1,17 @@
|
|||||||
package com.example.rhizome.app.presentation.controller.pageproperty;
|
package com.example.rhizome.app.presentation.controller.pageproperty;
|
||||||
|
|
||||||
/**
|
|
||||||
* Servlet から Servlet に返却する際に使用する文字列を管理するクラス
|
|
||||||
*/
|
|
||||||
public class PageReturnAttributeKeyword {
|
public class PageReturnAttributeKeyword {
|
||||||
|
|
||||||
public static final String MESSAGE_ERROR = "messageError";
|
public static final String MESSAGE_ERROR = "messageError";
|
||||||
public static final String MESSAGE_INFO = "messageInfo";
|
public static final String MESSAGE_INFO = "messageInfo";
|
||||||
|
|
||||||
public static final String DEPARTMENT_FORM_LIST = "departmentFormList";
|
public static final String UPDATE_EMPLOYEE_INFO_FORM = "updateEmployeeInfoForm";
|
||||||
public static final String UPDATE_EMPLOYEE_INFO_FORM = "updateEmployeeInfoForm";
|
public static final String INSERT_EMPLOYEE_FORM = "insertEmployeeForm";
|
||||||
public static final String INSERT_EMPLOYEE_FORM = "insertEmployeeForm";
|
public static final String LOGIN_INFO_FORM = "loginInfoForm";
|
||||||
public static final String LOGIN_INFO_FORM = "loginInfoForm";
|
public static final String UPDATE_PERSONAL_EMPLOYEE_USER_FORM = "updatePersonalEmployeeUserForm";
|
||||||
public static final String UPDATE_PERSONAL_EMPLOYEE_USER_FORM = "updatePersonalEmployeeUserForm";
|
public static final String EMPLOYEE_INFO_FORM_LIST = "employeeInfoFormList";
|
||||||
public static final String EMPLOYEE_INFO_FORM_LIST = "employeeInfoFormList";
|
|
||||||
|
|
||||||
|
public static final String DEPARTMENT_FORM_LIST = "departmentFormList";
|
||||||
|
public static final String INSERT_DEPARTMENT_FORM = "insertDepartmentForm";
|
||||||
|
public static final String UPDATE_DEPARTMENT_FORM = "updateDepartmentForm";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,92 +2,92 @@ package com.example.rhizome.app.presentation.controller.pageproperty;
|
|||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
|
||||||
* システムで利用しているJSPのリスト
|
|
||||||
*/
|
|
||||||
public class TransitionTargetPageNameKeyword {
|
public class TransitionTargetPageNameKeyword {
|
||||||
|
|
||||||
// 共通
|
public static final String LOGIN_HTML = "login";
|
||||||
public static final String LOGIN_HTML = "login";
|
|
||||||
|
|
||||||
// 一般向け
|
public static final String UPDATE_PERSONAL_EMPLOYEE_INPUT_HTML = "updatePersonalEmployeeInput";
|
||||||
public static final String UPDATE_PERSONAL_EMPLOYEE_INPUT_HTML = "updatePersonalEmployeeInput";
|
public static final String UPDATE_PERSONAL_RESULT_HTML = "updatePersonalEmployeeResult";
|
||||||
public static final String UPDATE_PERSONAL_RESULT_HTML = "updatePersonalEmployeeResult";
|
|
||||||
|
|
||||||
// 管理者向け
|
public static final String MENU_HTML = "menu";
|
||||||
public static final String MENU_HTML = "menu";
|
public static final String SELECT_EMPLOYEE_HTML = "selectEmployee";
|
||||||
public static final String SELECT_EMPLOYEE_HTML = "selectEmployee";
|
public static final String INSERT_EMPLOYEE_INPUT_HTML = "insertEmployeeInput";
|
||||||
public static final String INSERT_EMPLOYEE_INPUT_HTML = "insertEmployeeInput";
|
public static final String INSERT_EMPLOYEE_CONFIRM_HTML = "insertEmployeeConfirm";
|
||||||
public static final String INSERT_EMPLOYEE_CONFIRM_HTML = "insertEmployeeConfirm";
|
public static final String INSERT_EMPLOYEE_RESULT_HTML = "insertEmployeeResult";
|
||||||
public static final String INSERT_EMPLOYEE_RESULT_HTML = "insertEmployeeResult";
|
public static final String UPDATE_EMPLOYEE_INPUT_HTML = "updateEmployeeInput";
|
||||||
public static final String UPDATE_EMPLOYEE_INPUT_HTML = "updateEmployeeInput";
|
|
||||||
|
|
||||||
public static final String ERROR_HTML = "error";
|
public static final String SELECT_DEPARTMENT_HTML = "selectDepartment";
|
||||||
|
|
||||||
// 共通(Controller)
|
public static final String ERROR_HTML = "error";
|
||||||
public static final String INDEX_BLANK = "";
|
|
||||||
public static final String INDEX_SLASH = "/";
|
|
||||||
public static final String INDEX_LOGIN = "/login";
|
|
||||||
public static final String LOGOUT = "/logout";
|
|
||||||
public static final String DO_LOGIN = "/doLogin";
|
|
||||||
|
|
||||||
// 一般向け(Controller)
|
public static final String INDEX_BLANK = "";
|
||||||
public static final String PERSONAL_UPDATE_RESULT = "/updatePersonalEmployeeResult";
|
public static final String INDEX_SLASH = "/";
|
||||||
|
public static final String INDEX_LOGIN = "/login";
|
||||||
|
public static final String LOGOUT = "/logout";
|
||||||
|
public static final String DO_LOGIN = "/doLogin";
|
||||||
|
|
||||||
// 管理者向け(Controller)
|
public static final String PERSONAL_UPDATE_RESULT = "/updatePersonalEmployeeResult";
|
||||||
public static final String DELETE_EMPLOYEE = "/deleteEmployee";
|
|
||||||
public static final String INSERT_EMPLOYEE_INPUT = "/insertEmployeeInput";
|
|
||||||
public static final String INSERT_EMPLOYEE_CONFIRM = "/insertEmployeeConfirm";
|
|
||||||
public static final String INSERT_EMPLOYEE = "/insertEmployee";
|
|
||||||
public static final String SHOW_MENU = "/showMenu";
|
|
||||||
public static final String SELECT_EMPLOYEE_INFO = "/selectEmployeeInfo";
|
|
||||||
public static final String SELECT_EMPLOYEE_INFO_FORM_EMPTY = "/selectAll";
|
|
||||||
public static final String SHOW_UPDATE_EMPLOYEE = "/showUpdateEmployee";
|
|
||||||
public static final String UPDATE_EMPLOYEE_RESULT = "/updateEmployeeResult";
|
|
||||||
|
|
||||||
// Department
|
public static final String DELETE_EMPLOYEE = "/deleteEmployee";
|
||||||
// HTML
|
public static final String INSERT_EMPLOYEE_INPUT = "/insertEmployeeInput";
|
||||||
// Controller
|
public static final String INSERT_EMPLOYEE_CONFIRM = "/insertEmployeeConfirm";
|
||||||
|
public static final String INSERT_EMPLOYEE = "/insertEmployee";
|
||||||
|
public static final String SHOW_MENU = "/showMenu";
|
||||||
|
public static final String SELECT_EMPLOYEE_INFO = "/selectEmployeeInfo";
|
||||||
|
public static final String SELECT_EMPLOYEE_INFO_FORM_EMPTY = "/selectAll";
|
||||||
|
public static final String SHOW_UPDATE_EMPLOYEE = "/showUpdateEmployee";
|
||||||
|
public static final String UPDATE_EMPLOYEE_RESULT = "/updateEmployeeResult";
|
||||||
|
|
||||||
/**
|
public static final String SELECT_DEPARTMENT = "/selectDepartment";
|
||||||
* 管理者向けのページリストを返す
|
public static final String SELECT_DEPARTMENT_INFO_FORM_EMPTY = "/selectDepartmentAll";
|
||||||
*
|
public static final String INSERT_DEPARTMENT_INPUT = "/insertDepartmentInput";
|
||||||
* @return 管理者向けのページリスト
|
public static final String INSERT_DEPARTMENT_CONFIRM = "/insertDepartmentConfirm";
|
||||||
*/
|
public static final String INSERT_DEPARTMENT = "/insertDepartment";
|
||||||
public static Set<String> getAdminPageList() {
|
public static final String DELETE_DEPARTMENT = "/deleteDepartment";
|
||||||
|
public static final String SHOW_UPDATE_DEPARTMENT = "/showUpdateDepartment";
|
||||||
|
public static final String UPDATE_DEPARTMENT_RESULT = "/updateDepartmentResult";
|
||||||
|
|
||||||
return Set.of(
|
public static final String INSERT_DEPARTMENT_INPUT_HTML = "insertDepartmentInput";
|
||||||
INDEX_BLANK,
|
public static final String INSERT_DEPARTMENT_CONFIRM_HTML = "insertDepartmentConfirm";
|
||||||
INDEX_SLASH,
|
public static final String INSERT_DEPARTMENT_RESULT_HTML = "insertDepartmentResult";
|
||||||
INDEX_LOGIN,
|
|
||||||
LOGOUT,
|
|
||||||
DO_LOGIN,
|
|
||||||
DELETE_EMPLOYEE,
|
|
||||||
INSERT_EMPLOYEE_INPUT,
|
|
||||||
INSERT_EMPLOYEE_CONFIRM,
|
|
||||||
INSERT_EMPLOYEE,
|
|
||||||
SHOW_MENU,
|
|
||||||
SELECT_EMPLOYEE_INFO,
|
|
||||||
SELECT_EMPLOYEE_INFO_FORM_EMPTY,
|
|
||||||
SHOW_UPDATE_EMPLOYEE,
|
|
||||||
UPDATE_EMPLOYEE_RESULT
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public static final String UPDATE_DEPARTMENT_INPUT_HTML = "updateDepartmentInput";
|
||||||
* 一般向けのページリストを返す
|
|
||||||
*
|
public static Set<String> getAdminPageList() {
|
||||||
* @return 一般向けのページリスト
|
|
||||||
*/
|
return Set.of(
|
||||||
public static Set<String> getUserPageList() {
|
INDEX_BLANK,
|
||||||
return Set.of(
|
INDEX_SLASH,
|
||||||
INDEX_BLANK,
|
INDEX_LOGIN,
|
||||||
INDEX_SLASH,
|
LOGOUT,
|
||||||
INDEX_LOGIN,
|
DO_LOGIN,
|
||||||
LOGOUT,
|
DELETE_EMPLOYEE,
|
||||||
DO_LOGIN,
|
INSERT_EMPLOYEE_INPUT,
|
||||||
PERSONAL_UPDATE_RESULT
|
INSERT_EMPLOYEE_CONFIRM,
|
||||||
);
|
INSERT_EMPLOYEE,
|
||||||
}
|
SHOW_MENU,
|
||||||
|
SELECT_EMPLOYEE_INFO,
|
||||||
|
SELECT_EMPLOYEE_INFO_FORM_EMPTY,
|
||||||
|
SHOW_UPDATE_EMPLOYEE,
|
||||||
|
UPDATE_EMPLOYEE_RESULT,
|
||||||
|
SELECT_DEPARTMENT,
|
||||||
|
SELECT_DEPARTMENT_INFO_FORM_EMPTY,
|
||||||
|
INSERT_DEPARTMENT_INPUT,
|
||||||
|
INSERT_DEPARTMENT_CONFIRM,
|
||||||
|
INSERT_DEPARTMENT,
|
||||||
|
DELETE_DEPARTMENT,
|
||||||
|
SHOW_UPDATE_DEPARTMENT,
|
||||||
|
UPDATE_DEPARTMENT_RESULT);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Set<String> getUserPageList() {
|
||||||
|
return Set.of(
|
||||||
|
INDEX_BLANK,
|
||||||
|
INDEX_SLASH,
|
||||||
|
INDEX_LOGIN,
|
||||||
|
LOGOUT,
|
||||||
|
DO_LOGIN,
|
||||||
|
PERSONAL_UPDATE_RESULT);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package com.example.rhizome.app.presentation.form;
|
||||||
|
|
||||||
|
import com.example.rhizome.app.domain.model.SearchConditionDepartment;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class SearchConditionDepartmentForm {
|
||||||
|
|
||||||
|
private Integer idDepartment;
|
||||||
|
private String nmDepartment;
|
||||||
|
|
||||||
|
public static SearchConditionDepartmentForm convertFrom(SearchConditionDepartment searchConditionDepartment) {
|
||||||
|
return new SearchConditionDepartmentForm(
|
||||||
|
searchConditionDepartment.getIdDepartment(),
|
||||||
|
searchConditionDepartment.getNmDepartment());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static SearchConditionDepartment convertTo(SearchConditionDepartmentForm searchConditionDepartmentForm) {
|
||||||
|
return new SearchConditionDepartment(
|
||||||
|
searchConditionDepartmentForm.getIdDepartment(),
|
||||||
|
searchConditionDepartmentForm.getNmDepartment());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,12 +1,9 @@
|
|||||||
package com.example.rhizome.exception;
|
package com.example.rhizome.exception;
|
||||||
|
|
||||||
/**
|
|
||||||
* 権限不足の例外を表現するクラスです。
|
|
||||||
*/
|
|
||||||
public class InsufficientPermissionException extends RuntimeException {
|
public class InsufficientPermissionException extends RuntimeException {
|
||||||
|
|
||||||
public InsufficientPermissionException(String message) {
|
public InsufficientPermissionException(String message) {
|
||||||
super(message);
|
super(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,9 @@
|
|||||||
package com.example.rhizome.exception;
|
package com.example.rhizome.exception;
|
||||||
|
|
||||||
/**
|
|
||||||
* 権限不足の例外を表現するクラスです。
|
|
||||||
*/
|
|
||||||
public class NoSessionException extends RuntimeException {
|
public class NoSessionException extends RuntimeException {
|
||||||
|
|
||||||
public NoSessionException(String message) {
|
public NoSessionException(String message) {
|
||||||
super(message);
|
super(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
115
src/main/resources/templates/selectDepartment.html
Normal file
115
src/main/resources/templates/selectDepartment.html
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html xmlns:th="http://www.thymeleaf.org">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
|
||||||
|
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
||||||
|
<!-- 外部のスクリプトファイルを読み込む -->
|
||||||
|
<script th:src="@{/js/common.js}"></script>
|
||||||
|
<!-- CSSの読み込み -->
|
||||||
|
<link rel="stylesheet" th:href="@{/css/all.css}">
|
||||||
|
<link rel=stylesheet th:href="@{/css/style.css}" type="text/css">
|
||||||
|
<title>検索</title>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>
|
||||||
|
検索条件入力
|
||||||
|
<div class="rightSection">
|
||||||
|
<span class="loginInfo">ログイン者名:<span th:text="${session.loginUser.nmEmployee}"></span></span>
|
||||||
|
<button class="logoutButton" onclick="logoutSubmit()">ログアウト</button>
|
||||||
|
</div>
|
||||||
|
</h1>
|
||||||
|
<form action="selectDepartment"
|
||||||
|
method="post"
|
||||||
|
th:object="${searchConditionDepartmentForm}">
|
||||||
|
|
||||||
|
<div class="msgBox error" th:if="${messageError} != null">
|
||||||
|
<span class="error" th:text="${messageError.message}"></span>
|
||||||
|
</div>
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th class="header">部署ID</th>
|
||||||
|
<td>
|
||||||
|
<input placeholder="部署ID"
|
||||||
|
th:field="*{idDepartment}"
|
||||||
|
type="number"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="header">部署名</th>
|
||||||
|
<td>
|
||||||
|
<input placeholder="部署名"
|
||||||
|
th:field="*{nmDepartment}"
|
||||||
|
type="text"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="btnArea" colspan="2">
|
||||||
|
<input type="submit" value="検索"/>
|
||||||
|
</td>
|
||||||
|
<td class="btnArea" colspan="2">
|
||||||
|
<button onclick="clearInput()">クリア</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
<div class="header-spacing"></div>
|
||||||
|
<a href="showMenu">メニューに戻る</a>
|
||||||
|
<div class="header-spacing"></div>
|
||||||
|
<h1><span>検索結果</span></h1>
|
||||||
|
<div class="header-spacing"></div>
|
||||||
|
<th:block th:if="${messageInfo != null}">
|
||||||
|
<script th:inline="javascript">
|
||||||
|
alert([[${messageInfo.message}]]);
|
||||||
|
</script>
|
||||||
|
</th:block>
|
||||||
|
<div class="header-spacing"></div>
|
||||||
|
<th:block th:if="${departmentFormList != null and departmentFormList.size() > 0}">
|
||||||
|
<!-- 検索結果が1件以上ある場合 -->
|
||||||
|
<table class="table-grid table-striped table-hover">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th style="width: 100px;">部署ID</th>
|
||||||
|
<th style="width: 150px;">部署名</th>
|
||||||
|
<th style="width: 150px;">操作</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr th:each="departmentForm : ${departmentFormList}">
|
||||||
|
<td th:text="${departmentForm.idDepartment}"></td>
|
||||||
|
<td th:text="${departmentForm.nmDepartment}"></td>
|
||||||
|
<td>
|
||||||
|
<!-- 更新フォーム -->
|
||||||
|
<form action="showUpdateDepartment" method="post" style="display: inline;">
|
||||||
|
<input name="idDepartment" th:value="${departmentForm.idDepartment}" type="hidden">
|
||||||
|
<input type="submit" value="更新">
|
||||||
|
</form>
|
||||||
|
<!-- 削除フォーム -->
|
||||||
|
<form action="deleteDepartment" method="post" onsubmit="return confirm('本当に削除しますか?');"
|
||||||
|
style="display: inline;">
|
||||||
|
<input name="idDepartment" th:value="${departmentForm.idDepartment}" type="hidden">
|
||||||
|
<input type="submit" value="削除">
|
||||||
|
</form>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</th:block>
|
||||||
|
<th:block th:if="${departmentFormList == null or departmentFormList.size() == 0}">
|
||||||
|
<!-- 検索結果が0件の場合 -->
|
||||||
|
検索結果はありません。
|
||||||
|
</th:block>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
function clearInput() {
|
||||||
|
document.getElementById('idDepartment').value = '';
|
||||||
|
document.getElementById('nmDepartment').value = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user