Merge branch 'susu' into dev
This commit is contained in:
@@ -0,0 +1,13 @@
|
|||||||
|
package app.module.admin.config.application.util.model;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class EnumDto {
|
||||||
|
private String id;
|
||||||
|
private String codeText;
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package app.module.admin.usecase.admin.checkAdminId.adapters.web;
|
||||||
|
|
||||||
|
import app.module.core.usecase.admin.checkAdminId.ports.CheckAdminIdPortIn;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
class AdminIdDuplicateCheckPostController {
|
||||||
|
|
||||||
|
private final CheckAdminIdPortIn checkAdminIdPortIn;
|
||||||
|
|
||||||
|
@GetMapping("/api/settings/admin/idCheck")
|
||||||
|
ResponseEntity<?> updateMappingHousehold(@RequestParam String id ) {
|
||||||
|
return ResponseEntity.status(HttpStatus.OK).body(checkAdminIdPortIn.connect(id));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -45,7 +45,9 @@ class AdminExcelController {
|
|||||||
new GetAdminsCmd(
|
new GetAdminsCmd(
|
||||||
adminListFilterVO.getSearchField(),
|
adminListFilterVO.getSearchField(),
|
||||||
adminListFilterVO.getSearchValue(),
|
adminListFilterVO.getSearchValue(),
|
||||||
adminListFilterVO.getSearchRole()));
|
adminListFilterVO.getSearchRole(),
|
||||||
|
adminListFilterVO.getSearchArea(),
|
||||||
|
adminListFilterVO.getSearchDisabled()));
|
||||||
|
|
||||||
if (CollectionUtils.isNotEmpty(listOutput.getContent())) {
|
if (CollectionUtils.isNotEmpty(listOutput.getContent())) {
|
||||||
// Header
|
// Header
|
||||||
|
|||||||
@@ -37,11 +37,14 @@ class AdminListController {
|
|||||||
new GetAdminsCmd(
|
new GetAdminsCmd(
|
||||||
adminListFilterVO.getSearchField(),
|
adminListFilterVO.getSearchField(),
|
||||||
adminListFilterVO.getSearchValue(),
|
adminListFilterVO.getSearchValue(),
|
||||||
adminListFilterVO.getSearchRole()));
|
adminListFilterVO.getSearchRole(),
|
||||||
|
adminListFilterVO.getSearchArea(),
|
||||||
|
adminListFilterVO.getSearchDisabled()));
|
||||||
|
|
||||||
model.addAttribute("listOutput", listOutput);
|
model.addAttribute("listOutput", listOutput);
|
||||||
model.addAttribute("roles", roleListPortIn.connect(AppType.ADMIN));
|
model.addAttribute("roles", roleListPortIn.connect(AppType.ADMIN));
|
||||||
model.addAttribute("pageRows", uiCodeListPortIn.connect("code.pageable.rows"));
|
model.addAttribute("pageRows", uiCodeListPortIn.connect("code.pageable.rows"));
|
||||||
|
model.addAttribute("regionMainCode", uiCodeListPortIn.connect("code.region.main"));
|
||||||
|
|
||||||
return "admin/adminList";
|
return "admin/adminList";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,4 +12,6 @@ public class AdminListFilterVO {
|
|||||||
private String searchField;
|
private String searchField;
|
||||||
private String searchValue;
|
private String searchValue;
|
||||||
private String searchRole;
|
private String searchRole;
|
||||||
|
private String searchArea;
|
||||||
|
private String searchDisabled;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,8 +18,10 @@ public class AdminCreateGetController {
|
|||||||
private final UICodeListPortIn uiCodeListPortIn;
|
private final UICodeListPortIn uiCodeListPortIn;
|
||||||
|
|
||||||
@GetMapping(path = "/settings/admins/create")
|
@GetMapping(path = "/settings/admins/create")
|
||||||
String operate(Model model, @ModelAttribute("bindingVO") AdminCreateBindingVO bindingVO) {
|
String operate(Model model) {
|
||||||
|
|
||||||
|
AdminCreateBindingVO bindingVO = new AdminCreateBindingVO();
|
||||||
|
model.addAttribute("bindingVO", bindingVO);
|
||||||
model.addAttribute("roles", roleListPortIn.connect(AppType.ADMIN));
|
model.addAttribute("roles", roleListPortIn.connect(AppType.ADMIN));
|
||||||
model.addAttribute("regionMainCode", uiCodeListPortIn.connect("code.region.main"));
|
model.addAttribute("regionMainCode", uiCodeListPortIn.connect("code.region.main"));
|
||||||
|
|
||||||
|
|||||||
@@ -9,49 +9,42 @@ import app.module.core.usecase.role.list.ports.RoleListPortIn;
|
|||||||
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.validation.BindingResult;
|
import org.springframework.validation.BindingResult;
|
||||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
import org.springframework.validation.ObjectError;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||||
|
|
||||||
@Controller
|
@Slf4j
|
||||||
|
@RestController
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class AdminCreatePostController {
|
public class AdminCreatePostController {
|
||||||
|
|
||||||
private final RoleListPortIn roleListPortIn;
|
|
||||||
private final MessageUtil messageUtil;
|
|
||||||
private final SaveAdminPortIn savePortIn;
|
private final SaveAdminPortIn savePortIn;
|
||||||
private final UICodeListPortIn uiCodeListPortIn;
|
|
||||||
private final AdminCreateValidator adminCreateValidator;
|
private final AdminCreateValidator adminCreateValidator;
|
||||||
|
|
||||||
@PostMapping(path = "/settings/admins/create")
|
@PostMapping(path = "/api/settings/admin/create")
|
||||||
String operate(
|
ResponseEntity<?> operate(@RequestBody AdminCreateBindingVO bindingVO, BindingResult bindingResult ) {
|
||||||
RedirectAttributes redirectAttributes,
|
|
||||||
Model model,
|
|
||||||
@Valid @ModelAttribute("bindingVO") AdminCreateBindingVO bindingVO,
|
|
||||||
BindingResult bindingResult) {
|
|
||||||
|
|
||||||
adminCreateValidator.validate(bindingVO, bindingResult);
|
adminCreateValidator.validate(bindingVO, bindingResult);
|
||||||
|
|
||||||
if (bindingResult.hasErrors()) {
|
if (bindingResult.hasErrors()) {
|
||||||
model.addAttribute("roles", roleListPortIn.connect(AppType.ADMIN));
|
|
||||||
model.addAttribute("regionMainCode", uiCodeListPortIn.connect("code.region.main"));
|
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY)
|
||||||
return "admin/adminCreateForm";
|
.body(bindingResult.getAllErrors().get(0).getDefaultMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
savePortIn.connect(
|
return ResponseEntity.status(HttpStatus.OK).body(
|
||||||
bindingVO.getSeq(),
|
savePortIn.apiConnect(bindingVO.getSeq(),
|
||||||
bindingVO.getId(),
|
bindingVO.getId(),
|
||||||
bindingVO.getPassword(),
|
bindingVO.getPassword(),
|
||||||
bindingVO.getRegionMainCode(),
|
bindingVO.getName(),
|
||||||
bindingVO.getAccountDisabled(),
|
"010"+bindingVO.getPhone1()+bindingVO.getPhone2(),
|
||||||
bindingVO.getRoleIds());
|
bindingVO.getRegionMainCode(),
|
||||||
|
bindingVO.getAccountDisabled(),
|
||||||
redirectAttributes.addFlashAttribute(
|
bindingVO.getRoleId()));
|
||||||
"operationMessage",
|
|
||||||
messageUtil.getMessage("operation.settings.admin.created", bindingVO.getId()));
|
|
||||||
|
|
||||||
return "redirect:/settings/admins";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,6 +53,8 @@ class AdminUpdateGetController {
|
|||||||
output.getSeq(),
|
output.getSeq(),
|
||||||
output.getId(),
|
output.getId(),
|
||||||
null,
|
null,
|
||||||
|
output.getName(),
|
||||||
|
output.getPhone(),
|
||||||
output.getRegionMainCode(),
|
output.getRegionMainCode(),
|
||||||
output.getPasswordUpdatedAt(),
|
output.getPasswordUpdatedAt(),
|
||||||
output.getAccountDisabled(),
|
output.getAccountDisabled(),
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ import org.springframework.web.bind.annotation.ModelAttribute;
|
|||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||||
|
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
class AdminUpdatePostController {
|
class AdminUpdatePostController {
|
||||||
@@ -40,13 +42,15 @@ class AdminUpdatePostController {
|
|||||||
return "admin/adminUpdateForm";
|
return "admin/adminUpdateForm";
|
||||||
}
|
}
|
||||||
|
|
||||||
saveAdminPortIn.connect(
|
saveAdminPortIn.apiConnect(
|
||||||
bindingVO.getSeq(),
|
bindingVO.getSeq(),
|
||||||
bindingVO.getId(),
|
bindingVO.getId(),
|
||||||
bindingVO.getUpdatePassword(),
|
bindingVO.getUpdatePassword(),
|
||||||
|
bindingVO.getName(),
|
||||||
|
bindingVO.getPhone(),
|
||||||
bindingVO.getRegionMainCode(),
|
bindingVO.getRegionMainCode(),
|
||||||
bindingVO.getAccountDisabled(),
|
bindingVO.getAccountDisabled(),
|
||||||
bindingVO.getRoleIds());
|
bindingVO.getRoleIds().stream().collect(Collectors.joining()));
|
||||||
|
|
||||||
redirectAttributes.addFlashAttribute(
|
redirectAttributes.addFlashAttribute(
|
||||||
"operationMessage",
|
"operationMessage",
|
||||||
|
|||||||
@@ -1,20 +1,23 @@
|
|||||||
package app.module.admin.usecase.admin.saveAdmin.adapters.web.model;
|
package app.module.admin.usecase.admin.saveAdmin.adapters.web.model;
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotBlank;
|
|
||||||
import jakarta.validation.constraints.Pattern;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
public class AdminCreateBindingVO {
|
public class AdminCreateBindingVO {
|
||||||
private Long seq;
|
private Long seq;
|
||||||
private String id;
|
private String id;
|
||||||
private String password;
|
private String password;
|
||||||
|
private String name;
|
||||||
|
private String phone1;
|
||||||
|
private String phone2;
|
||||||
|
private String regionMainCode;
|
||||||
/* @NotBlank(message = "{valid.common.required}")
|
/* @NotBlank(message = "{valid.common.required}")
|
||||||
@Pattern(
|
@Pattern(
|
||||||
regexp =
|
regexp =
|
||||||
@@ -24,6 +27,5 @@ public class AdminCreateBindingVO {
|
|||||||
|
|
||||||
private Boolean accountDisabled;
|
private Boolean accountDisabled;
|
||||||
/* private Boolean accountLocked;*/
|
/* private Boolean accountLocked;*/
|
||||||
private List<String> roleIds;
|
private String roleId;
|
||||||
private String regionMainCode;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ public class AdminUpdateBindingVO implements AuditOutput {
|
|||||||
"^[\\w!#$%&’*+/=?`{|}~^-]+(?:\\.[\\w!#$%&’*+/=?`{|}~^-]+)*@(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,6}$",
|
"^[\\w!#$%&’*+/=?`{|}~^-]+(?:\\.[\\w!#$%&’*+/=?`{|}~^-]+)*@(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,6}$",
|
||||||
message = "{valid.common.email.wrong}")
|
message = "{valid.common.email.wrong}")
|
||||||
private String email;*/
|
private String email;*/
|
||||||
|
private String name;
|
||||||
|
private String phone;
|
||||||
private String regionMainCode;
|
private String regionMainCode;
|
||||||
|
|
||||||
private LocalDateTime passwordUpdatedAt;
|
private LocalDateTime passwordUpdatedAt;
|
||||||
|
|||||||
@@ -10,7 +10,10 @@ import org.springframework.validation.Validator;
|
|||||||
@Component
|
@Component
|
||||||
public class AdminCreateValidator implements Validator {
|
public class AdminCreateValidator implements Validator {
|
||||||
|
|
||||||
private final String PASSWORD_REGEX = "^((?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%_\\-])\\S{6,15})$";
|
// 아이디: 4~15자, 영문/숫자/한글/특수문자(_,-) 허용
|
||||||
|
private final String ID_REGEX = "^[a-zA-Z0-9가-힣_-]{4,15}$";
|
||||||
|
// 비밀번호: 5자, 숫자 + 특수문자(!@#$%_-) 1개 이상
|
||||||
|
private final String PASSWORD_REGEX = "^(?=.*[0-9])(?=.*[!@#$%_\\-]).{5}$";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean supports(Class<?> clazz) {
|
public boolean supports(Class<?> clazz) {
|
||||||
@@ -21,25 +24,50 @@ public class AdminCreateValidator implements Validator {
|
|||||||
public void validate(Object target, Errors errors) {
|
public void validate(Object target, Errors errors) {
|
||||||
AdminCreateBindingVO vo = (AdminCreateBindingVO) target;
|
AdminCreateBindingVO vo = (AdminCreateBindingVO) target;
|
||||||
|
|
||||||
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "password", "valid.common.required");
|
if (vo.getRoleId() == null || vo.getRoleId().isEmpty()) {
|
||||||
|
errors.rejectValue("roleId", "error.roleId", "권한을 선택해주세요.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (vo.getAccountDisabled() == null ) {
|
||||||
|
errors.rejectValue("accountDisabled", "error.accountDisabled", "사용여부를 선택해주세요.");
|
||||||
|
}
|
||||||
|
|
||||||
|
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "id", "valid.common.required","아이디는 필수입력값입니다.");
|
||||||
|
Optional.ofNullable(vo.getId())
|
||||||
|
.filter(id -> !id.matches(ID_REGEX))
|
||||||
|
.ifPresent(id -> errors.rejectValue("id", "valid.common.id.wrong","아이디를 4~15자, 영문/숫자/한글/특수문자(_,-) 입니다."));
|
||||||
|
|
||||||
|
// 비밀번호 유효성 검사
|
||||||
|
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "password", "valid.common.required","비밀번호는 필수입력값입니다.");
|
||||||
|
|
||||||
Optional.ofNullable(vo.getPassword())
|
Optional.ofNullable(vo.getPassword())
|
||||||
.filter(password -> !password.matches(PASSWORD_REGEX))
|
.filter(password -> !password.matches(PASSWORD_REGEX))
|
||||||
.ifPresent(password -> errors.rejectValue("password", "valid.common.password.wrong"));
|
.ifPresent(password -> errors.rejectValue("password", "valid.common.password.wrong","비밀번호는 5자, 숫자 + 특수문자(!@#$%_-) 1개 이상입니다."));
|
||||||
|
|
||||||
Optional.ofNullable(vo.getRoleIds())
|
|
||||||
.filter(ids -> ids.size() < 1)
|
|
||||||
.ifPresent(
|
|
||||||
ids ->
|
|
||||||
errors.rejectValue(
|
|
||||||
"roleIds", "valid.common.required.size.min", new Object[]{1}, ""));
|
|
||||||
|
|
||||||
|
if (vo.getRoleId() != null && "ROLE_RESEARCHER".equals(vo.getRoleId())) {
|
||||||
|
if (vo.getName() == null || vo.getName().isBlank()) {
|
||||||
|
errors.rejectValue("name", "error.name", "이름을 입력해주세요.");
|
||||||
|
}
|
||||||
|
if (vo.getName().length() > 4) {
|
||||||
|
errors.rejectValue("name", "error.name", "이름은 4자리까지 입력가능합니다.");
|
||||||
|
}
|
||||||
|
if (vo.getPhone1() == null || vo.getPhone1().isBlank()) {
|
||||||
|
errors.rejectValue("phone1", "error.phone1", "전화번호 앞자리를 입력해주세요.");
|
||||||
|
} else if (!vo.getPhone1().matches("^\\d{4}$")) {
|
||||||
|
errors.rejectValue("phone1", "error.phone1", "전화번호 앞자리는 4자리 숫자여야 합니다.");
|
||||||
|
}
|
||||||
|
if (vo.getPhone2() == null || vo.getPhone2().isBlank()) {
|
||||||
|
errors.rejectValue("phone2", "error.phone2", "전화번호 뒷자리를 입력해주세요.");
|
||||||
|
} else if (!vo.getPhone2().matches("^\\d{4}$")) {
|
||||||
|
errors.rejectValue("phone2", "error.phone2", "전화번호 뒷자리는 4자리 숫자여야 합니다.");
|
||||||
|
}
|
||||||
|
}
|
||||||
// ROLE_ADMIN이 아닌 경우 regionMainCode null체크
|
// ROLE_ADMIN이 아닌 경우 regionMainCode null체크
|
||||||
Optional.ofNullable(vo.getRoleIds())
|
Optional.ofNullable(vo.getRoleId())
|
||||||
.filter(ids -> ids.stream().noneMatch(role -> role.equals("ROLE_ADMIN")))
|
.filter(id -> !id.equals("ROLE_ADMIN"))
|
||||||
.ifPresent(nonAdmins -> {
|
.ifPresent(nonAdmins -> {
|
||||||
if (vo.getRegionMainCode() == null || vo.getRegionMainCode().isBlank()) {
|
if (vo.getRegionMainCode() == null || vo.getRegionMainCode().isBlank()) {
|
||||||
errors.rejectValue("regionMainCode", "valid.common.required");
|
errors.rejectValue("regionMainCode", "valid.common.required","실사지역은 필수입력값입니다.");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
package app.module.admin.usecase.researcher.adpaters.persistence;
|
package app.module.admin.usecase.researcher.adpaters.persistence;
|
||||||
|
|
||||||
|
import app.module.admin.config.application.enums.ManagementType;
|
||||||
|
import app.module.admin.config.application.util.model.EnumDto;
|
||||||
|
import app.module.admin.usecase.researcher.adpaters.persistence.model.ResearchersHouseholdVisitPopUpDto;
|
||||||
|
import app.module.admin.usecase.researcher.adpaters.web.model.*;
|
||||||
import app.module.admin.usecase.researcher.getPopupHouseholds.adapters.persistence.GetPopupHouseholdsMapper;
|
import app.module.admin.usecase.researcher.getPopupHouseholds.adapters.persistence.GetPopupHouseholdsMapper;
|
||||||
import app.module.admin.usecase.researcher.getPopupHouseholds.ports.application.domain.GetPopupHouseholds;
|
import app.module.admin.usecase.researcher.getPopupHouseholds.ports.application.domain.GetPopupHouseholds;
|
||||||
import app.module.admin.usecase.researcher.getPopupHouseholds.ports.application.domain.GetPopupHouseholdsCmd;
|
import app.module.admin.usecase.researcher.getPopupHouseholds.ports.application.domain.GetPopupHouseholdsCmd;
|
||||||
@@ -8,10 +12,7 @@ import app.module.admin.usecase.researcher.adpaters.persistence.model.Researcher
|
|||||||
import app.module.admin.usecase.researcher.adpaters.persistence.model.ResearchersHouseholdVisitDto;
|
import app.module.admin.usecase.researcher.adpaters.persistence.model.ResearchersHouseholdVisitDto;
|
||||||
import app.module.admin.usecase.researcher.adpaters.persistence.model.ResearchersMappingHouseholdDto;
|
import app.module.admin.usecase.researcher.adpaters.persistence.model.ResearchersMappingHouseholdDto;
|
||||||
import app.module.admin.usecase.researcher.ports.ResearcherPortOut;
|
import app.module.admin.usecase.researcher.ports.ResearcherPortOut;
|
||||||
import app.module.admin.usecase.researcher.adpaters.web.model.HouseholdSearchReqVO;
|
import app.module.core.config.application.annotation.UpdateCommand;
|
||||||
import app.module.admin.usecase.researcher.adpaters.web.model.MappingHouseholdListReqVO;
|
|
||||||
import app.module.admin.usecase.researcher.adpaters.web.model.ResearchersDetailReqVO;
|
|
||||||
import app.module.admin.usecase.researcher.adpaters.web.model.ResearchersListReqVO;
|
|
||||||
import app.module.core.config.application.util.CommonUtil;
|
import app.module.core.config.application.util.CommonUtil;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -21,6 +22,7 @@ import org.springframework.data.domain.PageRequest;
|
|||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@@ -28,7 +30,6 @@ import java.util.List;
|
|||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class ResearcherDao implements ResearcherPortOut {
|
public class ResearcherDao implements ResearcherPortOut {
|
||||||
private final ResearcherMapper researcherMapper;
|
private final ResearcherMapper researcherMapper;
|
||||||
private final GetPopupHouseholdsMapper getPopupHouseholdsMapper;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<ResearchersDto> list(ResearchersListReqVO reqVO) {
|
public Page<ResearchersDto> list(ResearchersListReqVO reqVO) {
|
||||||
@@ -61,6 +62,21 @@ public class ResearcherDao implements ResearcherPortOut {
|
|||||||
return new PageImpl<>(result, pageable, total);
|
return new PageImpl<>(result, pageable, total);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@UpdateCommand
|
||||||
|
public Integer updateVisitHousehold(ResearchersVisitDetailReqVO reqVO) {
|
||||||
|
return researcherMapper.updateVisitHousehold(reqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResearchersHouseholdVisitPopUpDto visitHouseholdDetail(Integer id) {
|
||||||
|
ResearchersHouseholdVisitDto result = researcherMapper.visitHouseholdDetail(id);
|
||||||
|
List<EnumDto> managementTypeList = Arrays.stream(ManagementType.values())
|
||||||
|
.map(type -> new EnumDto(type.name(), type.getDesc()))
|
||||||
|
.toList();
|
||||||
|
return new ResearchersHouseholdVisitPopUpDto(result, managementTypeList);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer visitHouseholdDelete(List<Integer> selectIds) {
|
public Integer visitHouseholdDelete(List<Integer> selectIds) {
|
||||||
String deletedBy = CommonUtil.getLoginUsername();
|
String deletedBy = CommonUtil.getLoginUsername();
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import app.module.admin.usecase.researcher.adpaters.persistence.model.Researcher
|
|||||||
import app.module.admin.usecase.researcher.adpaters.persistence.model.ResearchersMappingHouseholdDto;
|
import app.module.admin.usecase.researcher.adpaters.persistence.model.ResearchersMappingHouseholdDto;
|
||||||
import app.module.admin.usecase.researcher.adpaters.web.model.ResearchersDetailReqVO;
|
import app.module.admin.usecase.researcher.adpaters.web.model.ResearchersDetailReqVO;
|
||||||
import app.module.admin.usecase.researcher.adpaters.web.model.ResearchersListReqVO;
|
import app.module.admin.usecase.researcher.adpaters.web.model.ResearchersListReqVO;
|
||||||
|
import app.module.admin.usecase.researcher.adpaters.web.model.ResearchersVisitDetailReqVO;
|
||||||
import app.module.admin.usecase.researcher.getPopupHouseholds.ports.application.domain.GetPopupHouseholds;
|
import app.module.admin.usecase.researcher.getPopupHouseholds.ports.application.domain.GetPopupHouseholds;
|
||||||
import app.module.admin.usecase.researcher.getPopupHouseholds.ports.application.domain.GetPopupHouseholdsCmd;
|
import app.module.admin.usecase.researcher.getPopupHouseholds.ports.application.domain.GetPopupHouseholdsCmd;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
@@ -22,9 +23,12 @@ public interface ResearcherMapper {
|
|||||||
List<ResearchersMappingHouseholdDto> mappingHouseholdList(ResearchersDetailReqVO reqVO);
|
List<ResearchersMappingHouseholdDto> mappingHouseholdList(ResearchersDetailReqVO reqVO);
|
||||||
Long mappingHouseholdListCountAll(ResearchersDetailReqVO reqVO);
|
Long mappingHouseholdListCountAll(ResearchersDetailReqVO reqVO);
|
||||||
List<ResearchersHouseholdVisitDto> visitHouseholdList(ResearchersDetailReqVO reqVO);
|
List<ResearchersHouseholdVisitDto> visitHouseholdList(ResearchersDetailReqVO reqVO);
|
||||||
|
ResearchersHouseholdVisitDto visitHouseholdDetail(Integer id);
|
||||||
Long visitHouseholdListCountAll(ResearchersDetailReqVO reqVO);
|
Long visitHouseholdListCountAll(ResearchersDetailReqVO reqVO);
|
||||||
|
Integer updateVisitHousehold(ResearchersVisitDetailReqVO reqVO);
|
||||||
Integer visitHouseholdDelete(@Param("selectIds") List<Integer> selectIds,@Param("deletedBy") String deletedBy);
|
Integer visitHouseholdDelete(@Param("selectIds") List<Integer> selectIds,@Param("deletedBy") String deletedBy);
|
||||||
void deleteHouseholdResearcherMapping(@Param("researcherSeq") Integer researcherSeq, @Param("householdSeq") Integer householdSeq, @Param("deletedBy") String deletedBy);
|
void deleteHouseholdResearcherMapping(@Param("researcherSeq") Integer researcherSeq, @Param("householdSeq") Integer householdSeq, @Param("deletedBy") String deletedBy);
|
||||||
Integer insertHouseholdResearcherMapping(@Param("researcherSeq") Integer researcherSeq, @Param("householdSeq") Integer householdSeq, @Param("createdBy") String createdBy);
|
Integer insertHouseholdResearcherMapping(@Param("researcherSeq") Integer researcherSeq, @Param("householdSeq") Integer householdSeq, @Param("createdBy") String createdBy);
|
||||||
List<GetPopupHouseholds> getPopupHouseholds(@Param("pageable") Pageable pageable, @Param("cmd") GetPopupHouseholdsCmd cmd);
|
List<GetPopupHouseholds> getPopupHouseholds(@Param("pageable") Pageable pageable, @Param("cmd") GetPopupHouseholdsCmd cmd);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package app.module.admin.usecase.researcher.adpaters.persistence.model;
|
||||||
|
|
||||||
|
import app.module.admin.config.application.util.model.EnumDto;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class ResearchersHouseholdVisitPopUpDto {
|
||||||
|
private ResearchersHouseholdVisitDto researchersHouseholdVisitDto;
|
||||||
|
private List<EnumDto> managementTypeList;
|
||||||
|
}
|
||||||
@@ -1,9 +1,6 @@
|
|||||||
package app.module.admin.usecase.researcher.adpaters.web;
|
package app.module.admin.usecase.researcher.adpaters.web;
|
||||||
|
|
||||||
import app.module.admin.usecase.researcher.adpaters.web.model.HouseholdSearchReqVO;
|
import app.module.admin.usecase.researcher.adpaters.web.model.*;
|
||||||
import app.module.admin.usecase.researcher.adpaters.web.model.MappingHouseholdListReqVO;
|
|
||||||
import app.module.admin.usecase.researcher.adpaters.web.model.ResearchersDetailReqVO;
|
|
||||||
import app.module.admin.usecase.researcher.adpaters.web.model.ResearchersListReqVO;
|
|
||||||
import app.module.admin.usecase.researcher.ports.ResearcherPortIn;
|
import app.module.admin.usecase.researcher.ports.ResearcherPortIn;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -30,11 +27,21 @@ class ResearcherApiController {
|
|||||||
return ResponseEntity.status(HttpStatus.OK).body(researcherPortIn.mappingHouseholdList(reqVO));
|
return ResponseEntity.status(HttpStatus.OK).body(researcherPortIn.mappingHouseholdList(reqVO));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping(path = "/visitHouseholdList")
|
@GetMapping(path = "/visitHousehold/list")
|
||||||
ResponseEntity<?> visitHouseholdList( @ModelAttribute ResearchersDetailReqVO reqVO) {
|
ResponseEntity<?> visitHouseholdList( @ModelAttribute ResearchersDetailReqVO reqVO) {
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(researcherPortIn.visitHouseholdList(reqVO));
|
return ResponseEntity.status(HttpStatus.OK).body(researcherPortIn.visitHouseholdList(reqVO));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping(path = "/visitHousehold")
|
||||||
|
ResponseEntity<?> updateVisitHousehold(@RequestBody ResearchersVisitDetailReqVO reqVO) {
|
||||||
|
return ResponseEntity.status(HttpStatus.OK).body(researcherPortIn.updateVisitHousehold(reqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping(path = "/visitHousehold/{id}")
|
||||||
|
ResponseEntity<?> visitHouseholdDetail( @PathVariable Integer id) {
|
||||||
|
return ResponseEntity.status(HttpStatus.OK).body(researcherPortIn.visitHouseholdDetail(id));
|
||||||
|
}
|
||||||
|
|
||||||
@DeleteMapping(path = "/visitHousehold/remove")
|
@DeleteMapping(path = "/visitHousehold/remove")
|
||||||
ResponseEntity<?> visitHouseholdDelete( @RequestBody List<Integer> selectIds) {
|
ResponseEntity<?> visitHouseholdDelete( @RequestBody List<Integer> selectIds) {
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(researcherPortIn.visitHouseholdDelete(selectIds));
|
return ResponseEntity.status(HttpStatus.OK).body(researcherPortIn.visitHouseholdDelete(selectIds));
|
||||||
|
|||||||
@@ -40,4 +40,6 @@ class ResearcherController {
|
|||||||
return "researcher/detail";
|
return "researcher/detail";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package app.module.admin.usecase.researcher.adpaters.web.model;
|
||||||
|
|
||||||
|
import app.module.admin.config.application.enums.ManagementType;
|
||||||
|
import app.module.core.config.adapters.persistence.component.AuditCommand;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class ResearchersVisitDetailReqVO {
|
||||||
|
private String id;
|
||||||
|
private String visitDate;
|
||||||
|
private ManagementType managementType;
|
||||||
|
private String content;
|
||||||
|
private String isGiftSentFlag;
|
||||||
|
}
|
||||||
@@ -2,11 +2,9 @@ package app.module.admin.usecase.researcher.ports;
|
|||||||
|
|
||||||
import app.module.admin.usecase.researcher.adpaters.persistence.model.ResearchersDto;
|
import app.module.admin.usecase.researcher.adpaters.persistence.model.ResearchersDto;
|
||||||
import app.module.admin.usecase.researcher.adpaters.persistence.model.ResearchersHouseholdVisitDto;
|
import app.module.admin.usecase.researcher.adpaters.persistence.model.ResearchersHouseholdVisitDto;
|
||||||
|
import app.module.admin.usecase.researcher.adpaters.persistence.model.ResearchersHouseholdVisitPopUpDto;
|
||||||
import app.module.admin.usecase.researcher.adpaters.persistence.model.ResearchersMappingHouseholdDto;
|
import app.module.admin.usecase.researcher.adpaters.persistence.model.ResearchersMappingHouseholdDto;
|
||||||
import app.module.admin.usecase.researcher.adpaters.web.model.HouseholdSearchReqVO;
|
import app.module.admin.usecase.researcher.adpaters.web.model.*;
|
||||||
import app.module.admin.usecase.researcher.adpaters.web.model.MappingHouseholdListReqVO;
|
|
||||||
import app.module.admin.usecase.researcher.adpaters.web.model.ResearchersDetailReqVO;
|
|
||||||
import app.module.admin.usecase.researcher.adpaters.web.model.ResearchersListReqVO;
|
|
||||||
import app.module.admin.usecase.researcher.getPopupHouseholds.ports.application.domain.GetPopupHouseholds;
|
import app.module.admin.usecase.researcher.getPopupHouseholds.ports.application.domain.GetPopupHouseholds;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
|
|
||||||
@@ -17,6 +15,8 @@ public interface ResearcherPortIn {
|
|||||||
ResearchersDto detail(Integer adminSeq);
|
ResearchersDto detail(Integer adminSeq);
|
||||||
Page<ResearchersMappingHouseholdDto> mappingHouseholdList(ResearchersDetailReqVO reqVO);
|
Page<ResearchersMappingHouseholdDto> mappingHouseholdList(ResearchersDetailReqVO reqVO);
|
||||||
Page<ResearchersHouseholdVisitDto> visitHouseholdList(ResearchersDetailReqVO reqVO);
|
Page<ResearchersHouseholdVisitDto> visitHouseholdList(ResearchersDetailReqVO reqVO);
|
||||||
|
Integer updateVisitHousehold(ResearchersVisitDetailReqVO reqVO);
|
||||||
|
ResearchersHouseholdVisitPopUpDto visitHouseholdDetail(Integer id);
|
||||||
Integer visitHouseholdDelete(List<Integer> selectIds);
|
Integer visitHouseholdDelete(List<Integer> selectIds);
|
||||||
Page<GetPopupHouseholds> searchMappingHousehold(HouseholdSearchReqVO reqVO);
|
Page<GetPopupHouseholds> searchMappingHousehold(HouseholdSearchReqVO reqVO);
|
||||||
Integer updateMappingHousehold(MappingHouseholdListReqVO reqVO);
|
Integer updateMappingHousehold(MappingHouseholdListReqVO reqVO);
|
||||||
|
|||||||
@@ -2,11 +2,9 @@ package app.module.admin.usecase.researcher.ports;
|
|||||||
|
|
||||||
import app.module.admin.usecase.researcher.adpaters.persistence.model.ResearchersDto;
|
import app.module.admin.usecase.researcher.adpaters.persistence.model.ResearchersDto;
|
||||||
import app.module.admin.usecase.researcher.adpaters.persistence.model.ResearchersHouseholdVisitDto;
|
import app.module.admin.usecase.researcher.adpaters.persistence.model.ResearchersHouseholdVisitDto;
|
||||||
|
import app.module.admin.usecase.researcher.adpaters.persistence.model.ResearchersHouseholdVisitPopUpDto;
|
||||||
import app.module.admin.usecase.researcher.adpaters.persistence.model.ResearchersMappingHouseholdDto;
|
import app.module.admin.usecase.researcher.adpaters.persistence.model.ResearchersMappingHouseholdDto;
|
||||||
import app.module.admin.usecase.researcher.adpaters.web.model.HouseholdSearchReqVO;
|
import app.module.admin.usecase.researcher.adpaters.web.model.*;
|
||||||
import app.module.admin.usecase.researcher.adpaters.web.model.MappingHouseholdListReqVO;
|
|
||||||
import app.module.admin.usecase.researcher.adpaters.web.model.ResearchersDetailReqVO;
|
|
||||||
import app.module.admin.usecase.researcher.adpaters.web.model.ResearchersListReqVO;
|
|
||||||
import app.module.admin.usecase.researcher.getPopupHouseholds.ports.application.domain.GetPopupHouseholds;
|
import app.module.admin.usecase.researcher.getPopupHouseholds.ports.application.domain.GetPopupHouseholds;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
|
|
||||||
@@ -17,6 +15,8 @@ public interface ResearcherPortOut {
|
|||||||
ResearchersDto detail(Integer adminSeq);
|
ResearchersDto detail(Integer adminSeq);
|
||||||
Page<ResearchersMappingHouseholdDto> mappingHouseholdList(ResearchersDetailReqVO reqVO);
|
Page<ResearchersMappingHouseholdDto> mappingHouseholdList(ResearchersDetailReqVO reqVO);
|
||||||
Page<ResearchersHouseholdVisitDto> visitHouseholdList(ResearchersDetailReqVO reqVO);
|
Page<ResearchersHouseholdVisitDto> visitHouseholdList(ResearchersDetailReqVO reqVO);
|
||||||
|
Integer updateVisitHousehold(ResearchersVisitDetailReqVO reqVO);
|
||||||
|
ResearchersHouseholdVisitPopUpDto visitHouseholdDetail(Integer id);
|
||||||
Integer visitHouseholdDelete(List<Integer> selectIds);
|
Integer visitHouseholdDelete(List<Integer> selectIds);
|
||||||
Page<GetPopupHouseholds> searchMappingHousehold(HouseholdSearchReqVO reqVO);
|
Page<GetPopupHouseholds> searchMappingHousehold(HouseholdSearchReqVO reqVO);
|
||||||
Integer updateMappingHousehold(MappingHouseholdListReqVO reqVO);
|
Integer updateMappingHousehold(MappingHouseholdListReqVO reqVO);
|
||||||
|
|||||||
@@ -1,13 +1,11 @@
|
|||||||
package app.module.admin.usecase.researcher.ports.application;
|
package app.module.admin.usecase.researcher.ports.application;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.researcher.adpaters.persistence.model.ResearchersHouseholdVisitPopUpDto;
|
||||||
|
import app.module.admin.usecase.researcher.adpaters.web.model.*;
|
||||||
import app.module.admin.usecase.researcher.getPopupHouseholds.ports.application.domain.GetPopupHouseholds;
|
import app.module.admin.usecase.researcher.getPopupHouseholds.ports.application.domain.GetPopupHouseholds;
|
||||||
import app.module.admin.usecase.researcher.adpaters.persistence.model.ResearchersDto;
|
import app.module.admin.usecase.researcher.adpaters.persistence.model.ResearchersDto;
|
||||||
import app.module.admin.usecase.researcher.adpaters.persistence.model.ResearchersHouseholdVisitDto;
|
import app.module.admin.usecase.researcher.adpaters.persistence.model.ResearchersHouseholdVisitDto;
|
||||||
import app.module.admin.usecase.researcher.adpaters.persistence.model.ResearchersMappingHouseholdDto;
|
import app.module.admin.usecase.researcher.adpaters.persistence.model.ResearchersMappingHouseholdDto;
|
||||||
import app.module.admin.usecase.researcher.adpaters.web.model.HouseholdSearchReqVO;
|
|
||||||
import app.module.admin.usecase.researcher.adpaters.web.model.MappingHouseholdListReqVO;
|
|
||||||
import app.module.admin.usecase.researcher.adpaters.web.model.ResearchersDetailReqVO;
|
|
||||||
import app.module.admin.usecase.researcher.adpaters.web.model.ResearchersListReqVO;
|
|
||||||
import app.module.admin.usecase.researcher.ports.ResearcherPortIn;
|
import app.module.admin.usecase.researcher.ports.ResearcherPortIn;
|
||||||
import app.module.admin.usecase.researcher.ports.ResearcherPortOut;
|
import app.module.admin.usecase.researcher.ports.ResearcherPortOut;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -25,26 +23,42 @@ class ResearcherService implements ResearcherPortIn {
|
|||||||
public Page<ResearchersDto> list(ResearchersListReqVO reqVO){
|
public Page<ResearchersDto> list(ResearchersListReqVO reqVO){
|
||||||
return portOut.list(reqVO);
|
return portOut.list(reqVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResearchersDto detail(Integer adminSeq){
|
public ResearchersDto detail(Integer adminSeq){
|
||||||
return portOut.detail(adminSeq);
|
return portOut.detail(adminSeq);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<ResearchersMappingHouseholdDto> mappingHouseholdList(ResearchersDetailReqVO reqVO){
|
public Page<ResearchersMappingHouseholdDto> mappingHouseholdList(ResearchersDetailReqVO reqVO){
|
||||||
return portOut.mappingHouseholdList(reqVO);
|
return portOut.mappingHouseholdList(reqVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<ResearchersHouseholdVisitDto> visitHouseholdList(ResearchersDetailReqVO reqVO){
|
public Page<ResearchersHouseholdVisitDto> visitHouseholdList(ResearchersDetailReqVO reqVO){
|
||||||
return portOut.visitHouseholdList(reqVO);
|
return portOut.visitHouseholdList(reqVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer updateVisitHousehold(ResearchersVisitDetailReqVO reqVO) {
|
||||||
|
return portOut.updateVisitHousehold(reqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResearchersHouseholdVisitPopUpDto visitHouseholdDetail(Integer id) {
|
||||||
|
return portOut.visitHouseholdDetail(id);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer visitHouseholdDelete(List<Integer> selectIds){
|
public Integer visitHouseholdDelete(List<Integer> selectIds){
|
||||||
return portOut.visitHouseholdDelete(selectIds);
|
return portOut.visitHouseholdDelete(selectIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<GetPopupHouseholds> searchMappingHousehold(HouseholdSearchReqVO reqVO){
|
public Page<GetPopupHouseholds> searchMappingHousehold(HouseholdSearchReqVO reqVO){
|
||||||
return portOut.searchMappingHousehold(reqVO);
|
return portOut.searchMappingHousehold(reqVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer updateMappingHousehold(MappingHouseholdListReqVO reqVO){
|
public Integer updateMappingHousehold(MappingHouseholdListReqVO reqVO){
|
||||||
return portOut.updateMappingHousehold(reqVO);
|
return portOut.updateMappingHousehold(reqVO);
|
||||||
|
|||||||
@@ -148,8 +148,31 @@
|
|||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="visitHouseholdDetail">
|
||||||
|
select
|
||||||
|
rhv.id,
|
||||||
|
rhv.household_seq,
|
||||||
|
rhv.visit_date,
|
||||||
|
rhv.content,
|
||||||
|
rhv.management_type,
|
||||||
|
rhv.is_gift_sent as is_gift_sent_flag,
|
||||||
|
rhv.created_at
|
||||||
|
from household_visit rhv
|
||||||
|
where rhv.is_deleted = false and rhv.id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<update id="updateVisitHousehold">
|
||||||
|
update household_visit
|
||||||
|
set visit_date = #{visitDate},
|
||||||
|
content = #{content},
|
||||||
|
management_type = #{managementType},
|
||||||
|
is_gift_sent = #{isGiftSent},
|
||||||
|
<include refid="common.fields.UpdateBaseSet" />
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
<update id="visitHouseholdDelete">
|
<update id="visitHouseholdDelete">
|
||||||
update researcher_household_visit
|
update household_visit
|
||||||
set is_deleted = true,
|
set is_deleted = true,
|
||||||
deleted_at = NOW(),
|
deleted_at = NOW(),
|
||||||
deleted_by = #{deletedBy}
|
deleted_by = #{deletedBy}
|
||||||
|
|||||||
@@ -7,27 +7,28 @@
|
|||||||
<form
|
<form
|
||||||
method="post"
|
method="post"
|
||||||
th:action="@{/settings/admins/create}"
|
th:action="@{/settings/admins/create}"
|
||||||
th:object="${bindingVO}">
|
th:object="${bindingVO}"
|
||||||
|
name="adminCreateForm">
|
||||||
|
|
||||||
<table class="type-form">
|
<table class="type-form">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<th><label for="roleIds">권한<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
|
<th><label for="roleId">권한<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
|
||||||
<td>
|
<td>
|
||||||
<div class="d-flex">
|
<div class="d-flex">
|
||||||
<div class="component-input">
|
<div class="component-input">
|
||||||
<div class="component-select">
|
<div class="component-select">
|
||||||
<select class="select-list" id="roleIds"
|
<select class="select-list" id="roleId"
|
||||||
th:classappend="${#fields.hasErrors('roleIds')} ? 'is-invalid'"
|
th:classappend="${#fields.hasErrors('roleId')} ? 'is-invalid'"
|
||||||
th:field="*{roleIds}"
|
th:field="*{roleId}"
|
||||||
onchange="onRoleChange(this);">
|
onchange="onRoleChange(this);">
|
||||||
<option value="">선택</option>
|
<option value="">선택</option>
|
||||||
<option th:each="role : ${roles}" th:text="${role.description}"
|
<option th:each="role : ${roles}" th:text="${role.description}"
|
||||||
th:value="${role.id}"></option>
|
th:value="${role.id}"></option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="invalid-feedback fw-bold" th:errors="*{roleIds}"
|
<div class="invalid-feedback fw-bold" th:errors="*{roleId}"
|
||||||
th:if="${#fields.hasErrors('roleIds')}">
|
th:if="${#fields.hasErrors('roleId')}">
|
||||||
에러 메세지
|
에러 메세지
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -40,13 +41,18 @@
|
|||||||
<div class="component-input">
|
<div class="component-input">
|
||||||
<div class="input-field">
|
<div class="input-field">
|
||||||
<input id="id"
|
<input id="id"
|
||||||
|
name="id"
|
||||||
th:classappend="${#fields.hasErrors('id')} ? 'is-invalid'"
|
th:classappend="${#fields.hasErrors('id')} ? 'is-invalid'"
|
||||||
th:field="*{id}"/>
|
th:field="*{id}"/>
|
||||||
|
<button type="button" class="btn btn-primary" onclick="adminIdCheckDuplicate();">
|
||||||
|
<span class="btn-txt">중복확인</span>
|
||||||
|
</button>
|
||||||
<div class="invalid-feedback fw-bold" th:errors="*{id}"
|
<div class="invalid-feedback fw-bold" th:errors="*{id}"
|
||||||
th:if="${#fields.hasErrors('id')}">
|
th:if="${#fields.hasErrors('id')}">
|
||||||
에러 메세지
|
에러 메세지
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<span>4~15자 / 영문,숫자,한글 가능/ 특수문자 _,- 사용가능</span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<th><label for="password">Password<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
|
<th><label for="password">Password<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
|
||||||
@@ -61,11 +67,51 @@
|
|||||||
에러 메세지
|
에러 메세지
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<span>총 5자 / 숫자 + 특수문자 1개 이상 (!,@,#,$,%,_,-)</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="researcherArea"
|
||||||
|
th:classappend="${bindingVO.roleId == 'ROLE_LOCAL_INSPECTOR'} ? 'd-none'">
|
||||||
|
<th><label for="name">이름<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
|
||||||
|
<td>
|
||||||
|
<div class="component-input">
|
||||||
|
<div class="input-field">
|
||||||
|
<input id="name" type="text" name="name"
|
||||||
|
th:classappend="${#fields.hasErrors('name')} ? 'is-invalid'"
|
||||||
|
th:field="*{name}"/>
|
||||||
|
<div class="invalid-feedback fw-bold"
|
||||||
|
th:if="${#fields.hasErrors('name')}">
|
||||||
|
에러 메세지
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<th><label for="name">전화번호<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
|
||||||
|
<td>
|
||||||
|
010-
|
||||||
|
<div class="component-input">
|
||||||
|
<div class="input-field">
|
||||||
|
<input id="phone1" name="phone1" type="number" maxlength="4" th:field="*{phone1}"
|
||||||
|
th:classappend="${#fields.hasErrors('name')} ? 'is-invalid'"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="component-input">
|
||||||
|
<div class="input-field">
|
||||||
|
<input id="phone2" name="phone2" type="number" maxlength="4" th:field="*{phone2}"
|
||||||
|
th:classappend="${#fields.hasErrors('name')} ? 'is-invalid'"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="invalid-feedback fw-bold"
|
||||||
|
th:if="${#fields.hasErrors('phone1')}">
|
||||||
|
에러 메세지
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="regionMainCodeArea"
|
<tr class="regionMainCodeArea"
|
||||||
th:classappend="${#lists.isEmpty(bindingVO.roleIds) or #lists.contains(bindingVO.roleIds, 'ROLE_ADMIN')} ? 'd-none'">
|
th:classappend="${bindingVO.roleId != 'ROLE_ADMIN'} ? 'd-none'">
|
||||||
<th><label for="regionMainCode">실사<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
|
<th><label for="regionMainCode">실사<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
|
||||||
<td>
|
<td>
|
||||||
<div class="component-select">
|
<div class="component-select">
|
||||||
@@ -118,7 +164,7 @@
|
|||||||
<button type="button" class="btn btn-secondary" onclick="gotoList();return false;">
|
<button type="button" class="btn btn-secondary" onclick="gotoList();return false;">
|
||||||
<span class="btn-txt">목록으로 이동</span>
|
<span class="btn-txt">목록으로 이동</span>
|
||||||
</button>
|
</button>
|
||||||
<button type="submit" class="btn btn-primary">
|
<button type="button" class="btn btn-primary" onclick="createAdmin();">
|
||||||
<span class="btn-txt">저장</span>
|
<span class="btn-txt">저장</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -137,14 +183,71 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(() => {
|
$(document).ready(() => {
|
||||||
const roleSelect = document.getElementById('roleIds');
|
const roleSelect = document.getElementById('roleId');
|
||||||
onRoleChange(roleSelect);
|
onRoleChange(roleSelect);
|
||||||
|
|
||||||
});
|
});
|
||||||
const onRoleChange = (el) => {
|
const onRoleChange = (el) => {
|
||||||
const selectedValues = Array.from(el.selectedOptions).map(option => option.value);
|
const selectedValues = Array.from(el.selectedOptions).map(option => option.value);
|
||||||
const isAdmin = !selectedValues.length || selectedValues.includes('ROLE_ADMIN');
|
const isAdmin = !selectedValues.length || selectedValues.includes('ROLE_ADMIN');
|
||||||
|
const idResearcher = !selectedValues.length || selectedValues.includes('ROLE_RESEARCHER');
|
||||||
$('.regionMainCodeArea').toggle(!isAdmin);
|
$('.regionMainCodeArea').toggle(!isAdmin);
|
||||||
|
$('.researcherArea').toggle(idResearcher);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let checkDuplicate = false;
|
||||||
|
|
||||||
|
const adminIdCheckDuplicate = () => {
|
||||||
|
const f = document.adminCreateForm;
|
||||||
|
if (!f.id.value) {
|
||||||
|
alert("아이디를 입력해주세요.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ajaxUtil._ajaxMethod(
|
||||||
|
'/api/settings/admin/idCheck',
|
||||||
|
{ id : f.id.value },
|
||||||
|
function(response) { // 성공
|
||||||
|
const message = response > 0
|
||||||
|
? "이미 사용하고 있는 아이디 입니다. 아이디를 입력해주세요."
|
||||||
|
: "사용 가능한 아이디입니다.";
|
||||||
|
alert(message);
|
||||||
|
checkDuplicate = response <= 0;
|
||||||
|
},
|
||||||
|
function (code, rstData) {
|
||||||
|
console.log("error : ", code);
|
||||||
|
if(code == 400) alert("아이디를 입력해주세요.");
|
||||||
|
},
|
||||||
|
'get',
|
||||||
|
'json'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
const createAdmin = () => {
|
||||||
|
if (!checkDuplicate) {
|
||||||
|
alert("아이디 중복 확인을 해주세요.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const f = document.adminCreateForm;
|
||||||
|
let dataOj = $(f).serializeObject();
|
||||||
|
|
||||||
|
ajaxUtil._ajaxMethod(
|
||||||
|
'/api/settings/admin/create',
|
||||||
|
JSON.stringify(dataOj),
|
||||||
|
function(response) { // 성공
|
||||||
|
alert("등록이 완료되었습니다.");
|
||||||
|
location.href = '/settings/admins';
|
||||||
|
},
|
||||||
|
function (code, rstData) {
|
||||||
|
if(code == 422) alert(rstData.responseText);
|
||||||
|
if(code == 200 ){
|
||||||
|
alert("등록이 완료되었습니다.");
|
||||||
|
location.href = '/settings/admins';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'post',
|
||||||
|
'json'
|
||||||
|
);
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
</th:block>
|
</th:block>
|
||||||
|
|
||||||
|
|||||||
@@ -17,14 +17,26 @@
|
|||||||
<div class="form-area">
|
<div class="form-area">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<div class="input-label">
|
<div class="input-label">
|
||||||
<p class="label-txt"><label for="searchField">검색필드</label></p>
|
<p class="label-txt">권한</p>
|
||||||
|
</div>
|
||||||
|
<div class="component-select">
|
||||||
|
<select class="select-list" id="searchRole" th:field="*{searchRole}">
|
||||||
|
<option selected value="">전체</option>
|
||||||
|
<option th:each="role : ${roles}" th:text="${role.description}"
|
||||||
|
th:value="${role.id}"></option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-label">
|
||||||
|
<p class="label-txt"><label for="searchField">정보</label></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex">
|
<div class="d-flex">
|
||||||
<div class="component-select">
|
<div class="component-select">
|
||||||
<select class="select-list" id="searchField" th:field="*{searchField}">
|
<select class="select-list" id="searchField" th:field="*{searchField}">
|
||||||
<option selected value="">선택</option>
|
<option selected value="">전체</option>
|
||||||
<option value="id">ID</option>
|
<option value="id">ID</option>
|
||||||
<option value="email">Email</option>
|
<option value="name">이름</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="component-input">
|
<div class="component-input">
|
||||||
@@ -38,13 +50,25 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<div class="input-label">
|
<div class="input-label">
|
||||||
<p class="label-txt">권한</p>
|
<p class="label-txt">실사</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="component-select">
|
<div class="component-select">
|
||||||
<select class="select-list" id="searchRole" th:field="*{searchRole}">
|
<select class="select-list" id="searchArea" th:field="*{searchArea}">
|
||||||
<option selected value="">전체</option>
|
<option selected value="">전체</option>
|
||||||
<option th:each="role : ${roles}" th:text="${role.id}"
|
<option th:each="region : ${regionMainCode}" th:text="${region.codeText}"
|
||||||
th:value="${role.id}"></option>
|
th:value="${region.id}"></option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-label">
|
||||||
|
<p class="label-txt">계정사용여부</p>
|
||||||
|
</div>
|
||||||
|
<div class="component-select">
|
||||||
|
<select class="select-list" id="searchDisabled" th:field="*{searchDisabled}">
|
||||||
|
<option selected value="">전체</option>
|
||||||
|
<option value="false">사용</option>
|
||||||
|
<option value="true">미사용</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -123,11 +147,11 @@
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section layout:fragment="script">
|
<section layout:fragment="script">
|
||||||
<script th:inline="javascript">
|
<!-- <script th:inline="javascript">
|
||||||
// 목록 정렬 표기 및 갱신 기능 적용
|
// 목록 정렬 표기 및 갱신 기능 적용
|
||||||
uiUtil.applyListSortNotation([[${listOutput.pageable.pageSize}]],
|
uiUtil.applyListSortNotation([[${listOutput.pageable.pageSize}]],
|
||||||
[[${listOutput.pageable.sort.toString()}]]);
|
[[${listOutput.pageable.sort.toString()}]]);
|
||||||
</script>
|
</script>-->
|
||||||
|
|
||||||
<script th:inline="javascript">
|
<script th:inline="javascript">
|
||||||
// 검색
|
// 검색
|
||||||
@@ -146,6 +170,8 @@
|
|||||||
f.searchField.value = '';
|
f.searchField.value = '';
|
||||||
f.searchValue.value = '';
|
f.searchValue.value = '';
|
||||||
f.searchRole.value = '';
|
f.searchRole.value = '';
|
||||||
|
f.searchArea.value = '';
|
||||||
|
f.searchDisabled.value = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// 수정페이지 이동
|
// 수정페이지 이동
|
||||||
|
|||||||
@@ -57,6 +57,47 @@
|
|||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr class="researcherArea"
|
||||||
|
th:classappend="${#lists.isEmpty(bindingVO.roleIds) or #lists.contains(bindingVO.roleIds, 'ROLE_LOCAL_INSPECTOR')} ? 'd-none'">
|
||||||
|
<th><label for="name">이름<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
|
||||||
|
<td>
|
||||||
|
<div class="component-input">
|
||||||
|
<div class="input-field">
|
||||||
|
<input id="name" type="text" name="name"
|
||||||
|
th:classappend="${#fields.hasErrors('name')} ? 'is-invalid'"
|
||||||
|
th:field="*{name}"/>
|
||||||
|
<div class="invalid-feedback fw-bold"
|
||||||
|
th:if="${#fields.hasErrors('name')}">
|
||||||
|
에러 메세지
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<th><label for="name">전화번호<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
|
||||||
|
<td>
|
||||||
|
010-
|
||||||
|
<div class="component-input">
|
||||||
|
<div class="input-field">
|
||||||
|
<input id="phone1" name="phone1" type="number" maxlength="4"
|
||||||
|
th:value="${bindingVO.phone != null ? bindingVO.phone.substring(3, 7) : ''}"
|
||||||
|
th:classappend="${#fields.hasErrors('phone')} ? 'is-invalid'"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
-
|
||||||
|
<div class="component-input">
|
||||||
|
<div class="input-field">
|
||||||
|
<input id="phone2" name="phone2" type="number" maxlength="4"
|
||||||
|
th:value="${bindingVO.phone != null ? bindingVO.phone.substring(7, 11) : ''}"
|
||||||
|
th:classappend="${#fields.hasErrors('phone')} ? 'is-invalid'"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="invalid-feedback fw-bold"
|
||||||
|
th:if="${#fields.hasErrors('phone')}">
|
||||||
|
에러 메세지
|
||||||
|
</div>
|
||||||
|
<input type="hidden" name="phone" id="phone" th:field="*{phone}"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr class="regionMainCodeArea"
|
<tr class="regionMainCodeArea"
|
||||||
th:classappend="${#lists.isEmpty(bindingVO.roleIds) or #lists.contains(bindingVO.roleIds, 'ROLE_ADMIN')} ? 'd-none'">
|
th:classappend="${#lists.isEmpty(bindingVO.roleIds) or #lists.contains(bindingVO.roleIds, 'ROLE_ADMIN')} ? 'd-none'">
|
||||||
<th><label for="regionMainCode">실사<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
|
<th><label for="regionMainCode">실사<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
|
||||||
@@ -137,12 +178,7 @@
|
|||||||
<th:block layout:fragment="script">
|
<th:block layout:fragment="script">
|
||||||
<script th:inline="javascript">
|
<script th:inline="javascript">
|
||||||
function gotoList() {
|
function gotoList() {
|
||||||
if (document.prevAdminParamForm) {
|
location.href = '/settings/admins';
|
||||||
const f = document.prevAdminParamForm;
|
|
||||||
f.submit();
|
|
||||||
} else {
|
|
||||||
location.href = '/settings/admins';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(() => {
|
$(document).ready(() => {
|
||||||
@@ -156,12 +192,26 @@
|
|||||||
if (roleSelect) {
|
if (roleSelect) {
|
||||||
onRoleChange(roleSelect);
|
onRoleChange(roleSelect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$('form').on('submit', function() {
|
||||||
|
const phone1 = $('#phone1').val();
|
||||||
|
const phone2 = $('#phone2').val();
|
||||||
|
if (phone1 && phone2) {
|
||||||
|
$('#phone').val('010' + phone1 + phone2);
|
||||||
|
} else {
|
||||||
|
$('#phone').val('');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const onRoleChange = (el) => {
|
const onRoleChange = (el) => {
|
||||||
const isAdmin = el.value === 'ROLE_ADMIN' || !el.value;
|
const isAdmin = el.value === 'ROLE_ADMIN' || !el.value;
|
||||||
|
const idResearcher = el.value === 'ROLE_RESEARCHER' || !el.value;
|
||||||
$('.regionMainCodeArea').toggle(!isAdmin);
|
$('.regionMainCodeArea').toggle(!isAdmin);
|
||||||
|
$('.researcherArea').toggle(idResearcher);
|
||||||
};
|
};
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</th:block>
|
</th:block>
|
||||||
|
|
||||||
|
|||||||
@@ -253,7 +253,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
ajaxUtil._ajaxMethod(
|
ajaxUtil._ajaxMethod(
|
||||||
'/api/researcher/visitHouseholdList',
|
'/api/researcher/visitHousehold/list',
|
||||||
dataObj,
|
dataObj,
|
||||||
function (response) {
|
function (response) {
|
||||||
$('#household-visit-totalElements').text(response.totalElements);
|
$('#household-visit-totalElements').text(response.totalElements);
|
||||||
@@ -268,10 +268,10 @@
|
|||||||
<tr data-id="${ct.id}">
|
<tr data-id="${ct.id}">
|
||||||
<td>
|
<td>
|
||||||
<label>
|
<label>
|
||||||
<input class="form-check-input" name="selectIds" type="checkbox" value="${ct.seq}"/>
|
<input class="form-check-input" name="selectIds" type="checkbox" value="${ct.id}"/>
|
||||||
</label>
|
</label>
|
||||||
</td>
|
</td>
|
||||||
<td class="underline"><a href="#" onclick="showHouseholdModal2(${ct.seq});">${ct.householdNum}</a></td>
|
<td class="underline"><a href="#" onclick="showHouseholdModal2(${ct.id});">${ct.householdNum}</a></td>
|
||||||
<td>${ct.ownerName}</td>
|
<td>${ct.ownerName}</td>
|
||||||
<td>${ct.visitDate}</td>
|
<td>${ct.visitDate}</td>
|
||||||
<td>${ct.managementType}</td>
|
<td>${ct.managementType}</td>
|
||||||
|
|||||||
@@ -13,56 +13,63 @@
|
|||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-content-inner">
|
<div class="modal-content-inner">
|
||||||
<section>
|
<section>
|
||||||
<table class="type-form confirm" th:object="${researcherDto}" >
|
<form autocomplete="off" method="get" name="householdVisitReqForm" >
|
||||||
<tbody>
|
<input type="hidden" name="id" id="id" />
|
||||||
<tr>
|
<table class="type-form confirm" >
|
||||||
<th>방문일</th>
|
<tbody id="household-visit-detail">
|
||||||
<td>
|
<tr>
|
||||||
<span th:text="*{id}"></span>
|
<th>방문일</th>
|
||||||
</td>
|
<td>
|
||||||
<th>관리분야</th>
|
<input id="visitDate" class="flatpickr" name="visitDate" type="text" placeholder="방문일을 선택하세요"/>
|
||||||
<td>
|
</td>
|
||||||
<span th:text="*{name}"></span>
|
<th>관리분야</th>
|
||||||
</td>
|
<td>
|
||||||
</tr>
|
<select id="managementType" name="managementType">
|
||||||
<tr>
|
<option value="">선택하세요</option>
|
||||||
<th>내용</th>
|
</select>
|
||||||
<td>
|
</td>
|
||||||
<span th:text="*{regionMainCodeName}"></span>
|
</tr>
|
||||||
</td>
|
<tr>
|
||||||
</tr>
|
<th>내용</th>
|
||||||
<tr>
|
<td>
|
||||||
<th>답례품 전달</th>
|
<div class="component-input">
|
||||||
<td>
|
<div class="input-textarea-field">
|
||||||
<div class="component-input">
|
<textarea id="content" name="content" class="textarea" placeholder=""></textarea>
|
||||||
<label class="radio-inner">
|
</div>
|
||||||
<input type="radio" id="radio_status_keep" name="survey_status">
|
</div>
|
||||||
<span class="radio-item">
|
</td>
|
||||||
<span class="radio-txt">전달</span>
|
</tr>
|
||||||
</span>
|
<tr>
|
||||||
</label>
|
<th>답례품 전달</th>
|
||||||
</div>
|
<td>
|
||||||
<div class="component-input">
|
<div class="component-input">
|
||||||
<label class="radio-inner">
|
<label class="radio-inner">
|
||||||
<input type="radio" id="radio_status_drop" name="survey_status">
|
<input type="radio" id="is_gift_sent_y" name="isGiftSent">
|
||||||
<span class="radio-item">
|
<span class="radio-item">
|
||||||
<span class="radio-txt">미전달</span>
|
<span class="radio-txt">전달</span>
|
||||||
</span>
|
</span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
<div class="component-input">
|
||||||
</tr>
|
<label class="radio-inner">
|
||||||
|
<input type="radio" id="is_gift_sent_n" name="isGiftSent">
|
||||||
|
<span class="radio-item">
|
||||||
|
<span class="radio-txt">미전달</span>
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<!-- 등록 버튼 -->
|
|
||||||
<div class="component-btns bottom-btn-group" th:fragment="modalButtons">
|
<div class="component-btns bottom-btn-group" th:fragment="modalButtons">
|
||||||
<div class="btns-row align-right">
|
<div class="btns-row align-right">
|
||||||
<button type="button" class="btn btn-primary" onclick="registerHouseholds()">
|
<button type="button" class="btn btn-primary" onclick="updateHouseholdVisit()">
|
||||||
<span class="btn-txt">등록</span>
|
<span class="btn-txt">수정</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</form>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
<button class="modal-close" onclick="closeModal()"></button>
|
<button class="modal-close" onclick="closeModal()"></button>
|
||||||
@@ -70,17 +77,131 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<section layout:fragment="script">
|
||||||
|
<script th:inline="javascript">
|
||||||
|
let visitDatePicker;
|
||||||
|
|
||||||
<script th:inline="javascript">
|
document.getElementById('visitDate').addEventListener('change', function (e) {
|
||||||
const showHouseholdModal2 = (seq) => {
|
console.log("날짜 변경됨:", e.target.value);
|
||||||
console.log(seq);
|
});
|
||||||
document.querySelector(".modal02").ui.open();
|
|
||||||
|
|
||||||
|
const showHouseholdModal2 = (seq) => {
|
||||||
|
document.querySelector(".modal02").ui.open();
|
||||||
|
initFlatpickr();
|
||||||
|
|
||||||
};
|
ajaxUtil._ajaxMethod(
|
||||||
|
'/api/researcher/visitHousehold/'+seq,
|
||||||
|
null,
|
||||||
|
function (response) {
|
||||||
|
const managementTypeList =response.managementTypeList;
|
||||||
|
if (managementTypeList.length > 0) {
|
||||||
|
// select 박스에 managementTypeList 옵션 추가
|
||||||
|
populateManagementType(managementTypeList);
|
||||||
|
}
|
||||||
|
const data = response.researchersHouseholdVisitDto;
|
||||||
|
setFormData(data);
|
||||||
|
},
|
||||||
|
function (code, rstData) {
|
||||||
|
},
|
||||||
|
'get',
|
||||||
|
'json',
|
||||||
|
null
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const setFormData = (data) => {
|
||||||
|
// 폼 필드에 데이터 세팅
|
||||||
|
const f = document.householdVisitReqForm;
|
||||||
|
if (data.visitDate) {
|
||||||
|
const visitDate = data.visitDate.substring(0, 10); // 'YYYY-MM-DD' 형식
|
||||||
|
if (visitDatePicker) {
|
||||||
|
f.visitDate.value = visitDate; // 입력 필드 먼저 설정
|
||||||
|
visitDatePicker.setDate(visitDate); // Flatpickr 동기화
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (data.managementType) {
|
||||||
|
f.managementType.value= data.managementType;
|
||||||
|
}
|
||||||
|
f.content.value = data.content;
|
||||||
|
f.id.value = data.id;
|
||||||
|
const isGift = data.isGiftSentFlag;
|
||||||
|
if (isGift === "t") {
|
||||||
|
document.getElementById('is_gift_sent_y').checked = true;
|
||||||
|
} else if (isGift === "f") {
|
||||||
|
document.getElementById('is_gift_sent_n').checked = true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const populateManagementType = (managementTypeList) => {
|
||||||
|
const select = document.getElementById('managementType');
|
||||||
|
select.innerHTML = '<option value="">선택하세요</option>'; // 초기화
|
||||||
|
managementTypeList.forEach(item => {
|
||||||
|
const option = document.createElement('option');
|
||||||
|
option.value = item.id;
|
||||||
|
option.textContent = item.codeText;
|
||||||
|
select.appendChild(option);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
</script>
|
const initFlatpickr = () => {
|
||||||
|
// 기존 Flatpickr 인스턴스 제거
|
||||||
|
if (visitDatePicker) {
|
||||||
|
visitDatePicker.destroy();
|
||||||
|
visitDatePicker = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 1. input 요소가 실제로 존재하는지 확인
|
||||||
|
const input = document.getElementById('visitDate');
|
||||||
|
if (!input) {
|
||||||
|
console.warn('#visitDate input not found!');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. input에 값이 있으면 flatpickr와 동기화
|
||||||
|
const currentVal = input.value;
|
||||||
|
|
||||||
|
// 3. flatpickr 초기화
|
||||||
|
visitDatePicker = flatpickr(input, {
|
||||||
|
dateFormat: 'Y-m-d',
|
||||||
|
defaultDate: currentVal || null, // 현재 값으로 초기 선택 날짜 설정
|
||||||
|
enableTime: false,
|
||||||
|
clickOpens: true,
|
||||||
|
onChange: function (selectedDates, dateStr, instance) {
|
||||||
|
console.log('날짜 선택됨:', dateStr);
|
||||||
|
input.value = dateStr; // 수동으로 input 값 동기화
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const updateHouseholdVisit = () => {
|
||||||
|
const form = document.forms['householdVisitReqForm'];
|
||||||
|
const formData = new FormData(form);
|
||||||
|
const data = Object.fromEntries(formData);
|
||||||
|
|
||||||
|
ajaxUtil._ajaxMethod(
|
||||||
|
'/api/researcher/visitHousehold',
|
||||||
|
JSON.stringify(data),
|
||||||
|
function (response) {
|
||||||
|
alert('수정 완료되었습니다.');
|
||||||
|
closeModal();
|
||||||
|
},
|
||||||
|
function (code, rstData) {
|
||||||
|
console.error('Error updating data:', code, rstData);
|
||||||
|
alert('수정에 실패했습니다.');
|
||||||
|
},
|
||||||
|
'post',
|
||||||
|
'json',
|
||||||
|
{'Content-Type': 'application/json'}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
const closeModal = () => {
|
||||||
|
document.querySelector(".modal02").ui.close();
|
||||||
|
if (visitDatePicker) {
|
||||||
|
visitDatePicker.destroy();
|
||||||
|
visitDatePicker = null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
</section>
|
||||||
</div>
|
</div>
|
||||||
</html>
|
</html>
|
||||||
@@ -43,13 +43,13 @@ class AdminAuthFailHandlerTest {
|
|||||||
|
|
||||||
@BeforeAll
|
@BeforeAll
|
||||||
public void beforeAll() {
|
public void beforeAll() {
|
||||||
saveAdminPortIn.connect(
|
/* saveAdminPortIn.connect(
|
||||||
1L,
|
1L,
|
||||||
testUsername,
|
testUsername,
|
||||||
"test.1@#$",
|
"test.1@#$",
|
||||||
null,
|
null,
|
||||||
false,
|
false,
|
||||||
Arrays.asList("ROLE_SUPER", "ROLE_STAFF"));
|
Arrays.asList("ROLE_SUPER", "ROLE_STAFF"));*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -38,13 +38,13 @@ class AdminDetailsServiceTest {
|
|||||||
|
|
||||||
@BeforeAll
|
@BeforeAll
|
||||||
public void beforeAll() {
|
public void beforeAll() {
|
||||||
saveAdminPortIn.connect(
|
/* saveAdminPortIn.connect(
|
||||||
1L,
|
1L,
|
||||||
username,
|
username,
|
||||||
password,
|
password,
|
||||||
null,
|
null,
|
||||||
false,
|
false,
|
||||||
Arrays.asList("ROLE_SUPER", "ROLE_STAFF"));
|
Arrays.asList("ROLE_SUPER", "ROLE_STAFF"));*/
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ class AdminCreateUpdateDaoTest {
|
|||||||
@DisplayName("operate - AdminCreateDao")
|
@DisplayName("operate - AdminCreateDao")
|
||||||
void operate() {
|
void operate() {
|
||||||
|
|
||||||
saveAdminPortIn.connect(
|
/* saveAdminPortIn.connect(
|
||||||
1L,
|
1L,
|
||||||
"admin_for_createDao_test",
|
"admin_for_createDao_test",
|
||||||
"test.1@#$",
|
"test.1@#$",
|
||||||
@@ -60,6 +60,6 @@ class AdminCreateUpdateDaoTest {
|
|||||||
assertEquals(
|
assertEquals(
|
||||||
1,
|
1,
|
||||||
adminViewPortIn.connect("admin_for_createDao_test").orElseThrow().getRoles().size(),
|
adminViewPortIn.connect("admin_for_createDao_test").orElseThrow().getRoles().size(),
|
||||||
"기존 권한들을 (내부적으로) 삭제하고 새로이 추가 등록되기에 withRoles 의 size 는 1이다.");
|
"기존 권한들을 (내부적으로) 삭제하고 새로이 추가 등록되기에 withRoles 의 size 는 1이다.");*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ valid.common.required.size.min={0} \uAC1C \uC774\uC0C1 \uD56D\uBAA9\uC774 \uD544
|
|||||||
valid.common.required.remove.item=\uC0AD\uC81C\uD560 \uC544\uC774\uD15C\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.
|
valid.common.required.remove.item=\uC0AD\uC81C\uD560 \uC544\uC774\uD15C\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.
|
||||||
valid.common.email.wrong=\uC774\uBA54\uC77C \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.
|
valid.common.email.wrong=\uC774\uBA54\uC77C \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.
|
||||||
valid.common.nickname.wrong=\uB2C9\uB124\uC784(2-10\uAE00\uC790)\uC740 \uD55C\uAE00,\uC601\uC5B4 \uB300\uC18C\uBB38\uC790, -, _ \uB9CC \uC785\uB825\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4.
|
valid.common.nickname.wrong=\uB2C9\uB124\uC784(2-10\uAE00\uC790)\uC740 \uD55C\uAE00,\uC601\uC5B4 \uB300\uC18C\uBB38\uC790, -, _ \uB9CC \uC785\uB825\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4.
|
||||||
valid.common.password.wrong=6\uC790 \uC774\uC0C1 15\uC790 \uC774\uD558 \uB300,\uC18C,\uD2B9\uC218\uBB38\uC790\uAC00 \uD3EC\uD568 \uB418\uC5B4\uC57C \uD569\uB2C8\uB2E4.
|
valid.common.password.wrong=\uCD1D 5\uC790 / \uC22B\uC790 + \uD2B9\uC218\uBB38\uC790 1\uAC1C \uC774\uC0C1 (!,@,#,$,%,_,-)\uD3EC\uD568\uB418\uC5B4\uC57C \uD569\uB2C8\uB2E4.
|
||||||
valid.common.already.exists=\uC774\uBBF8 \uB4F1\uB85D\uB41C {0} \uC785\uB2C8\uB2E4.
|
valid.common.already.exists=\uC774\uBBF8 \uB4F1\uB85D\uB41C {0} \uC785\uB2C8\uB2E4.
|
||||||
valid.common.endWith.not=\uB9C8\uC9C0\uB9C9\uC774 "{0}"\uC73C\uB85C \uB05D\uB098\uC11C\uB294 \uC548\uB429\uB2C8\uB2E4.
|
valid.common.endWith.not=\uB9C8\uC9C0\uB9C9\uC774 "{0}"\uC73C\uB85C \uB05D\uB098\uC11C\uB294 \uC548\uB429\uB2C8\uB2E4.
|
||||||
valid.common.date.invalid=\uAC8C\uC2DC\uC77C\uC744 \uD655\uC778\uD574 \uC8FC\uC138\uC694.
|
valid.common.date.invalid=\uAC8C\uC2DC\uC77C\uC744 \uD655\uC778\uD574 \uC8FC\uC138\uC694.
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ public class InitAdminData implements ApplicationRunner {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 관리자
|
/* // 관리자
|
||||||
saveAdminPortIn.connect(
|
saveAdminPortIn.connect(
|
||||||
null,
|
null,
|
||||||
"test-admin",
|
"test-admin",
|
||||||
@@ -52,6 +52,6 @@ public class InitAdminData implements ApplicationRunner {
|
|||||||
"researcher1@#$",
|
"researcher1@#$",
|
||||||
"code.region.main.1",
|
"code.region.main.1",
|
||||||
false,
|
false,
|
||||||
List.of("ROLE_RESEARCHER"));
|
List.of("ROLE_RESEARCHER"));*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package app.module.core.usecase.admin.checkAdminId.persistence;
|
||||||
|
|
||||||
|
import app.module.core.usecase.admin.checkAdminId.ports.CheckAdminIdPortOut;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
class CheckAdminIdDao implements CheckAdminIdPortOut {
|
||||||
|
|
||||||
|
private final CheckAdminIdMapper mapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public Integer connect(String id) {
|
||||||
|
return mapper.checkAdminId(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package app.module.core.usecase.admin.checkAdminId.persistence;
|
||||||
|
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface CheckAdminIdMapper {
|
||||||
|
Integer checkAdminId(String id);
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package app.module.core.usecase.admin.checkAdminId.persistence.model;
|
||||||
|
|
||||||
|
import app.module.core.config.adapters.persistence.component.AuditCommand;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class DeleteAdminHasRoleParam extends AuditCommand {
|
||||||
|
private Long adminSeq;
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package app.module.core.usecase.admin.checkAdminId.persistence.model;
|
||||||
|
|
||||||
|
import app.module.core.config.adapters.persistence.component.AuditCommand;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class SaveAdminHasRoleParam extends AuditCommand {
|
||||||
|
private Long adminSeq;
|
||||||
|
private List<String> roleIds;
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package app.module.core.usecase.admin.checkAdminId.ports;
|
||||||
|
|
||||||
|
|
||||||
|
public interface CheckAdminIdPortIn {
|
||||||
|
|
||||||
|
Integer connect(String id);
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package app.module.core.usecase.admin.checkAdminId.ports;
|
||||||
|
|
||||||
|
public interface CheckAdminIdPortOut {
|
||||||
|
Integer connect(String id);
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package app.module.core.usecase.admin.checkAdminId.ports.application;
|
||||||
|
|
||||||
|
import app.module.core.usecase.admin.checkAdminId.ports.CheckAdminIdPortIn;
|
||||||
|
import app.module.core.usecase.admin.checkAdminId.ports.CheckAdminIdPortOut;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class CheckAdminIdService implements CheckAdminIdPortIn {
|
||||||
|
|
||||||
|
private final CheckAdminIdPortOut checkAdminIdPortOut;
|
||||||
|
@Override
|
||||||
|
public Integer connect(String id) {
|
||||||
|
return checkAdminIdPortOut.connect(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -29,10 +29,14 @@ class GetAdminsDao implements GetAdminsPortOut {
|
|||||||
public Page<GetAdmins> connect(Pageable pageable, GetAdminsCmd filterCommand) {
|
public Page<GetAdmins> connect(Pageable pageable, GetAdminsCmd filterCommand) {
|
||||||
// 관리자 목록 조회
|
// 관리자 목록 조회
|
||||||
List<GetAdminsDto> admins = getAdminsMapper.findAll(filterCommand, pageable);
|
List<GetAdminsDto> admins = getAdminsMapper.findAll(filterCommand, pageable);
|
||||||
|
List<GetAdminsRole> roles;
|
||||||
|
if(!admins.isEmpty()){
|
||||||
|
roles = getAdminsMapper.findRolesWithPrivilegesByAdminIds(
|
||||||
|
admins.stream().map(GetAdminsDto::getSeq).toList());
|
||||||
|
} else {
|
||||||
|
roles = null;
|
||||||
|
}
|
||||||
|
|
||||||
// 관리자의 역할 목록 조회
|
|
||||||
List<GetAdminsRole> roles = getAdminsMapper.findRolesWithPrivilegesByAdminIds(
|
|
||||||
admins.stream().map(GetAdminsDto::getSeq).toList());
|
|
||||||
|
|
||||||
return new PageImpl<>(
|
return new PageImpl<>(
|
||||||
admins.stream()
|
admins.stream()
|
||||||
@@ -46,9 +50,9 @@ class GetAdminsDao implements GetAdminsPortOut {
|
|||||||
admin.getAccountDisabled(),
|
admin.getAccountDisabled(),
|
||||||
admin.getAccountLocked(),
|
admin.getAccountLocked(),
|
||||||
admin.getTotal(),
|
admin.getTotal(),
|
||||||
roles.stream()
|
roles != null ? roles.stream()
|
||||||
.filter(r -> r.getAdminSeq().equals(admin.getSeq()))
|
.filter(r -> r.getAdminSeq().equals(admin.getSeq()))
|
||||||
.collect(Collectors.toList())
|
.collect(Collectors.toList()):null
|
||||||
)).toList(),
|
)).toList(),
|
||||||
pageable,
|
pageable,
|
||||||
admins.isEmpty() ? 0 : admins.get(0).getTotal());
|
admins.isEmpty() ? 0 : admins.get(0).getTotal());
|
||||||
|
|||||||
@@ -9,6 +9,9 @@ import lombok.Setter;
|
|||||||
public class GetAdminsDto {
|
public class GetAdminsDto {
|
||||||
private Long seq;
|
private Long seq;
|
||||||
private String id;
|
private String id;
|
||||||
|
private String name;
|
||||||
|
private String phone;
|
||||||
|
private String regionMainCodeName;
|
||||||
private String createdBy;
|
private String createdBy;
|
||||||
private LocalDateTime createdAt;
|
private LocalDateTime createdAt;
|
||||||
private String updatedBy;
|
private String updatedBy;
|
||||||
|
|||||||
@@ -10,4 +10,6 @@ public class GetAdminsCmd {
|
|||||||
private final String searchField;
|
private final String searchField;
|
||||||
private final String searchValue;
|
private final String searchValue;
|
||||||
private final String searchRole;
|
private final String searchRole;
|
||||||
|
private final String searchArea;
|
||||||
|
private final String searchDisabled;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,17 +28,17 @@ class SaveAdminDao implements SaveAdminPortOut {
|
|||||||
mapper.deleteAdminRolesByAdminId(
|
mapper.deleteAdminRolesByAdminId(
|
||||||
AuditUtil.delete(new DeleteAdminHasRoleParam(cmd.getSeq())));
|
AuditUtil.delete(new DeleteAdminHasRoleParam(cmd.getSeq())));
|
||||||
|
|
||||||
if (CollectionUtils.isNotEmpty(cmd.getRoleIds())) {
|
if (!cmd.getRoleId().isEmpty()) {
|
||||||
mapper.insertAdminHasRoles(
|
mapper.insertAdminHasRoles(
|
||||||
AuditUtil.create(new SaveAdminHasRoleParam(cmd.getSeq(), cmd.getRoleIds())));
|
AuditUtil.create(new SaveAdminHasRoleParam(cmd.getSeq(), cmd.getRoleId())));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// create
|
// create
|
||||||
mapper.insertAdmin(AuditUtil.create(cmd));
|
mapper.insertAdmin(AuditUtil.create(cmd));
|
||||||
|
|
||||||
if (CollectionUtils.isNotEmpty(cmd.getRoleIds())) {
|
if (!cmd.getRoleId().isEmpty()) {
|
||||||
mapper.insertAdminHasRoles(
|
mapper.insertAdminHasRoles(
|
||||||
AuditUtil.create(new SaveAdminHasRoleParam(cmd.getSeq(), cmd.getRoleIds())));
|
AuditUtil.create(new SaveAdminHasRoleParam(cmd.getSeq(), cmd.getRoleId())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,5 +12,5 @@ import lombok.Setter;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class SaveAdminHasRoleParam extends AuditCommand {
|
public class SaveAdminHasRoleParam extends AuditCommand {
|
||||||
private Long adminSeq;
|
private Long adminSeq;
|
||||||
private List<String> roleIds;
|
private String roleId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
package app.module.core.usecase.admin.saveAdmin.ports;
|
package app.module.core.usecase.admin.saveAdmin.ports;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface SaveAdminPortIn {
|
public interface SaveAdminPortIn {
|
||||||
|
|
||||||
String connect(
|
String apiConnect(
|
||||||
Long seq,
|
Long seq,
|
||||||
String id,
|
String id,
|
||||||
String password,
|
String password,
|
||||||
String regionMainCode,
|
String name,
|
||||||
Boolean accountDisabled,
|
String phone,
|
||||||
List<String> roleIds);
|
String regionMainCode,
|
||||||
|
Boolean accountDisabled,
|
||||||
|
String roleId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import app.module.core.usecase.admin.saveAdmin.ports.application.domain.SaveAdmi
|
|||||||
import app.module.core.usecase.admin.view.ports.AdminViewPortIn;
|
import app.module.core.usecase.admin.view.ports.AdminViewPortIn;
|
||||||
import app.module.core.usecase.admin.view.ports.application.domain.AdminView;
|
import app.module.core.usecase.admin.view.ports.application.domain.AdminView;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -20,14 +19,10 @@ public class SaveAdminService implements SaveAdminPortIn {
|
|||||||
private final BCryptPasswordEncoder passwordEncoder;
|
private final BCryptPasswordEncoder passwordEncoder;
|
||||||
private final AdminViewPortIn adminViewPortIn;
|
private final AdminViewPortIn adminViewPortIn;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String connect(
|
public String apiConnect(Long seq, String id, String password, String name, String phone, String regionMainCode, Boolean accountDisabled, String roleId) {
|
||||||
Long seq,
|
|
||||||
String id,
|
|
||||||
String password,
|
|
||||||
String regionMainCode,
|
|
||||||
Boolean accountDisabled,
|
|
||||||
List<String> roleIds) {
|
|
||||||
|
|
||||||
LocalDateTime passwordUpdatedAt;
|
LocalDateTime passwordUpdatedAt;
|
||||||
Integer loginFailCnt;
|
Integer loginFailCnt;
|
||||||
@@ -51,15 +46,19 @@ public class SaveAdminService implements SaveAdminPortIn {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return saveAdminPortOut.connect(
|
return saveAdminPortOut.connect(
|
||||||
new SaveAdminCmd(
|
new SaveAdminCmd(
|
||||||
seq,
|
seq,
|
||||||
id,
|
id,
|
||||||
password,
|
password,
|
||||||
passwordUpdatedAt,
|
passwordUpdatedAt,
|
||||||
regionMainCode,
|
name,
|
||||||
accountDisabled,
|
phone,
|
||||||
loginFailCnt,
|
regionMainCode,
|
||||||
roleIds
|
accountDisabled,
|
||||||
));
|
loginFailCnt,
|
||||||
|
roleId
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,9 +16,11 @@ public class SaveAdminCmd extends AuditCommand {
|
|||||||
private String encodedPassword;
|
private String encodedPassword;
|
||||||
private LocalDateTime passwordUpdatedAt;
|
private LocalDateTime passwordUpdatedAt;
|
||||||
/* private String email;*/
|
/* private String email;*/
|
||||||
|
private String name;
|
||||||
|
private String phone;
|
||||||
private String regionMainCode;
|
private String regionMainCode;
|
||||||
private Boolean accountDisabled;
|
private Boolean accountDisabled;
|
||||||
private Integer loginFailCnt;
|
private Integer loginFailCnt;
|
||||||
/* private Boolean accountLocked;*/
|
/* private Boolean accountLocked;*/
|
||||||
private List<String> roleIds;
|
private String roleId;
|
||||||
}
|
}
|
||||||
|
|||||||
13
core/src/main/resources/mappers/admin/CheckAdminIdMapper.xml
Normal file
13
core/src/main/resources/mappers/admin/CheckAdminIdMapper.xml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||||
|
<mapper namespace="app.module.core.usecase.admin.checkAdminId.persistence.CheckAdminIdMapper">
|
||||||
|
|
||||||
|
<select id="checkAdminId" >
|
||||||
|
select count(*)
|
||||||
|
from admin
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -7,6 +7,10 @@
|
|||||||
SELECT
|
SELECT
|
||||||
a.seq,
|
a.seq,
|
||||||
a.id AS id,
|
a.id AS id,
|
||||||
|
a.name,
|
||||||
|
a.region_main_code,
|
||||||
|
u.code_text as region_main_code_name,
|
||||||
|
a.phone,
|
||||||
a.created_by,
|
a.created_by,
|
||||||
a.created_at,
|
a.created_at,
|
||||||
a.updated_by,
|
a.updated_by,
|
||||||
@@ -16,15 +20,24 @@
|
|||||||
a.account_locked,
|
a.account_locked,
|
||||||
COUNT(*) OVER() AS total
|
COUNT(*) OVER() AS total
|
||||||
FROM admin a
|
FROM admin a
|
||||||
|
LEFT JOIN uicode u ON u.parent_id = 'code.region.main' AND u.id = a.region_main_code
|
||||||
WHERE a.is_deleted = false
|
WHERE a.is_deleted = false
|
||||||
|
|
||||||
<if test="cmd.searchField != null and cmd.searchValue != null and cmd.searchValue != ''">
|
<if test="cmd.searchField != null and cmd.searchValue != null and cmd.searchValue != ''">
|
||||||
<choose>
|
<choose>
|
||||||
<when test="cmd.searchField == 'email'">AND a.email ILIKE '%' || #{cmd.searchValue} || '%'</when>
|
<when test="cmd.searchField == 'name'">AND a.name LIKE '%' || #{cmd.searchValue} || '%'</when>
|
||||||
<when test="cmd.searchField == 'id'">AND a.id ILIKE '%' || #{cmd.searchValue} || '%'</when>
|
<when test="cmd.searchField == 'id'">AND a.id LIKE '%' || #{cmd.searchValue} || '%'</when>
|
||||||
</choose>
|
</choose>
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
|
<if test="cmd.searchArea != null and cmd.searchArea != '' ">
|
||||||
|
AND a.region_main_code = #{cmd.searchArea}
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="cmd.searchDisabled != null and cmd.searchDisabled != '' ">
|
||||||
|
AND a.account_disabled = CAST(#{cmd.searchDisabled} AS BOOLEAN)
|
||||||
|
</if>
|
||||||
|
|
||||||
<if test="cmd.searchRole != null and cmd.searchRole != ''">
|
<if test="cmd.searchRole != null and cmd.searchRole != ''">
|
||||||
AND EXISTS (
|
AND EXISTS (
|
||||||
SELECT 1
|
SELECT 1
|
||||||
|
|||||||
@@ -12,6 +12,8 @@
|
|||||||
INSERT INTO admin (seq,
|
INSERT INTO admin (seq,
|
||||||
id,
|
id,
|
||||||
password,
|
password,
|
||||||
|
name,
|
||||||
|
phone,
|
||||||
region_main_code,
|
region_main_code,
|
||||||
password_updated_at,
|
password_updated_at,
|
||||||
account_disabled,
|
account_disabled,
|
||||||
@@ -20,6 +22,8 @@
|
|||||||
VALUES (#{seq},
|
VALUES (#{seq},
|
||||||
#{id},
|
#{id},
|
||||||
#{encodedPassword},
|
#{encodedPassword},
|
||||||
|
#{name},
|
||||||
|
#{phone},
|
||||||
#{regionMainCode},
|
#{regionMainCode},
|
||||||
#{passwordUpdatedAt},
|
#{passwordUpdatedAt},
|
||||||
#{accountDisabled},
|
#{accountDisabled},
|
||||||
@@ -32,6 +36,8 @@
|
|||||||
UPDATE admin
|
UPDATE admin
|
||||||
SET
|
SET
|
||||||
password = #{encodedPassword},
|
password = #{encodedPassword},
|
||||||
|
name = #{name},
|
||||||
|
phone = #{phone},
|
||||||
region_main_code = #{regionMainCode},
|
region_main_code = #{regionMainCode},
|
||||||
password_updated_at = #{passwordUpdatedAt},
|
password_updated_at = #{passwordUpdatedAt},
|
||||||
account_disabled = #{accountDisabled},
|
account_disabled = #{accountDisabled},
|
||||||
@@ -48,14 +54,12 @@
|
|||||||
role_id,
|
role_id,
|
||||||
<include refid="common.fields.CreateUpdateBaseColumns"/>
|
<include refid="common.fields.CreateUpdateBaseColumns"/>
|
||||||
) VALUES
|
) VALUES
|
||||||
<foreach collection="roleIds" item="roleId" separator=",">
|
|
||||||
(
|
(
|
||||||
nextval('admin_has_role_seq'),
|
nextval('admin_has_role_seq'),
|
||||||
#{adminSeq},
|
#{adminSeq},
|
||||||
#{roleId},
|
#{roleId},
|
||||||
<include refid="common.fields.CreateUpdateBaseValues"/>
|
<include refid="common.fields.CreateUpdateBaseValues"/>
|
||||||
)
|
)
|
||||||
</foreach>
|
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<update id="deleteAdminRolesByAdminId">
|
<update id="deleteAdminRolesByAdminId">
|
||||||
|
|||||||
Reference in New Issue
Block a user