[edit] Contorollerを編集
This commit is contained in:
@@ -18,6 +18,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
|||||||
import com.example.rhizome.aop.aspect.PermissionCheck;
|
import com.example.rhizome.aop.aspect.PermissionCheck;
|
||||||
import com.example.rhizome.aop.aspect.SessionCheck;
|
import com.example.rhizome.aop.aspect.SessionCheck;
|
||||||
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.service.SearchDepartment;
|
import com.example.rhizome.app.domain.service.SearchDepartment;
|
||||||
import com.example.rhizome.app.domain.service.impl.SearchDepartmentImpl;
|
import com.example.rhizome.app.domain.service.impl.SearchDepartmentImpl;
|
||||||
import com.example.rhizome.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
import com.example.rhizome.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
||||||
@@ -82,7 +83,7 @@ public class InsertDepartmentConfirmController {
|
|||||||
final String DUPLICATION = "既に登録済みの部署名です。";
|
final String DUPLICATION = "既に登録済みの部署名です。";
|
||||||
|
|
||||||
// 登録対象の部署名を元に検索
|
// 登録対象の部署名を元に検索
|
||||||
List<Department> departmentList = searchDepartment.searchDepartment(insertDepartmentForm.getNmDepartment());
|
List<Department> departmentList = searchDepartment.searchBy(new SearchConditionDepartment(null, insertDepartmentForm.getNmDepartment()));
|
||||||
|
|
||||||
// 検索結果があるか
|
// 検索結果があるか
|
||||||
if (!departmentList.isEmpty()) {
|
if (!departmentList.isEmpty()) {
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ class SelectDepartmentController {
|
|||||||
*/
|
*/
|
||||||
@PermissionCheck
|
@PermissionCheck
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
@RequestMapping(value = TransitionTargetPageNameKeyword.SELECT_DEPARTMENT_INFO, method = RequestMethod.POST)
|
@RequestMapping(value = TransitionTargetPageNameKeyword.SELECT_DEPARTMENT, method = RequestMethod.POST)
|
||||||
public String select(SearchConditionDepartmentForm searchConditionDepartmentForm, Model model) {
|
public String select(SearchConditionDepartmentForm searchConditionDepartmentForm, Model model) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -63,18 +63,17 @@ public class UpdateDepartmentController {
|
|||||||
final String UPDATE_TARGET_ID_NOT_FOUND = "更新対象のデータが見つかりません。";
|
final String UPDATE_TARGET_ID_NOT_FOUND = "更新対象のデータが見つかりません。";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
List<Department> departmentList = searchDepartment.searchBy(
|
List<Department> departmentList = searchDepartment.searchBy(new SearchConditionDepartment(idDepartment, null));
|
||||||
new SearchConditionDepartment(idDepartment, null)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (departmentList.isEmpty()) {
|
if (departmentList.isEmpty()) {
|
||||||
model.addAttribute(PageReturnAttributeKeyword.MESSAGE_ERROR, new MessageForm(UPDATE_TARGET_ID_NOT_FOUND));
|
model.addAttribute(PageReturnAttributeKeyword.MESSAGE_ERROR, new MessageForm(UPDATE_TARGET_ID_NOT_FOUND));
|
||||||
return "forward:" + TransitionTargetPageNameKeyword.SELECT_DEPARTMENT_INFO;
|
return "forward:" + TransitionTargetPageNameKeyword.SELECT_DEPARTMENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.UPDATE_DEPARTMENT_FORM, UpdateDepartmentForm.convertFrom(departmentList.get(0)));
|
model.addAttribute(PageReturnAttributeKeyword.UPDATE_DEPARTMENT_FORM, UpdateDepartmentForm.convertFrom(departmentList.get(0)));
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.UPDATE_DEPARTMENT_INPUT_HTML;
|
return TransitionTargetPageNameKeyword.UPDATE_DEPARTMENT_INPUT_HTML;
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
httpSession.invalidate();
|
httpSession.invalidate();
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
|||||||
import com.example.rhizome.aop.aspect.PermissionCheck;
|
import com.example.rhizome.aop.aspect.PermissionCheck;
|
||||||
import com.example.rhizome.aop.aspect.SessionCheck;
|
import com.example.rhizome.aop.aspect.SessionCheck;
|
||||||
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.service.SearchDepartment;
|
import com.example.rhizome.app.domain.service.SearchDepartment;
|
||||||
import com.example.rhizome.app.domain.service.UpdateDepartment;
|
import com.example.rhizome.app.domain.service.UpdateDepartment;
|
||||||
import com.example.rhizome.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
import com.example.rhizome.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
||||||
@@ -61,7 +62,7 @@ public class UpdateDepartmentResultController {
|
|||||||
final String UPDATE_COMPLETE = "更新が完了しました。";
|
final String UPDATE_COMPLETE = "更新が完了しました。";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
List<Department> departmentList = searchDepartment.searchDepartment(updateDepartmentForm.getNmDepartment());
|
List<Department> departmentList = searchDepartment.searchBy(new SearchConditionDepartment(null, updateDepartmentForm.getNmDepartment()));
|
||||||
|
|
||||||
if (!checkDuplicateNmDepartment(departmentList, updateDepartmentForm)) {
|
if (!checkDuplicateNmDepartment(departmentList, updateDepartmentForm)) {
|
||||||
model.addAttribute(PageReturnAttributeKeyword.MESSAGE_ERROR, new MessageForm(DUPLICATION));
|
model.addAttribute(PageReturnAttributeKeyword.MESSAGE_ERROR, new MessageForm(DUPLICATION));
|
||||||
@@ -77,7 +78,7 @@ public class UpdateDepartmentResultController {
|
|||||||
return TransitionTargetPageNameKeyword.UPDATE_DEPARTMENT_INPUT_HTML;
|
return TransitionTargetPageNameKeyword.UPDATE_DEPARTMENT_INPUT_HTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
Department beforeDepartment = searchDepartment.searchDepartmentById(updateDepartmentForm.getIdDepartment()).get(0);
|
Department beforeDepartment = searchDepartment.searchDepartmentById(updateDepartmentForm.getIdDepartment());
|
||||||
if (beforeDepartment.getIdDepartment() == null) {
|
if (beforeDepartment.getIdDepartment() == null) {
|
||||||
model.addAttribute(PageReturnAttributeKeyword.MESSAGE_ERROR, new MessageForm(NO_TARGET));
|
model.addAttribute(PageReturnAttributeKeyword.MESSAGE_ERROR, new MessageForm(NO_TARGET));
|
||||||
model.addAttribute(PageReturnAttributeKeyword.UPDATE_DEPARTMENT_FORM, updateDepartmentForm);
|
model.addAttribute(PageReturnAttributeKeyword.UPDATE_DEPARTMENT_FORM, updateDepartmentForm);
|
||||||
|
|||||||
Reference in New Issue
Block a user