Merge branch 'susu' into dev

This commit is contained in:
주수현
2025-06-16 09:37:54 +09:00
24 changed files with 473 additions and 462 deletions

View File

@@ -44,10 +44,8 @@ public class AdminCreatePostController {
bindingVO.getSeq(),
bindingVO.getId(),
bindingVO.getPassword(),
bindingVO.getEmail(),
bindingVO.getRegionMainCode(),
bindingVO.getAccountDisabled(),
bindingVO.getAccountLocked(),
bindingVO.getRoleIds());
redirectAttributes.addFlashAttribute(

View File

@@ -53,12 +53,9 @@ class AdminUpdateGetController {
output.getSeq(),
output.getId(),
null,
output.getEmail(),
output.getRegionMainCode(),
output.getPasswordUpdatedAt(),
output.getAccountDisabled(),
output.getLoginFailCnt(),
output.getAccountLocked(),
output.getRoles().stream().map(CoreRole::getId).collect(Collectors.toList()));
model.addAttribute("bindingVO", bindingVO);

View File

@@ -44,10 +44,8 @@ class AdminUpdatePostController {
bindingVO.getSeq(),
bindingVO.getId(),
bindingVO.getUpdatePassword(),
bindingVO.getEmail(),
bindingVO.getRegionMainCode(),
bindingVO.getAccountDisabled(),
bindingVO.getAccountLocked(),
bindingVO.getRoleIds());
redirectAttributes.addFlashAttribute(

View File

@@ -15,15 +15,15 @@ public class AdminCreateBindingVO {
private String id;
private String password;
@NotBlank(message = "{valid.common.required}")
/* @NotBlank(message = "{valid.common.required}")
@Pattern(
regexp =
"^[\\w!#$%&’*+/=?`{|}~^-]+(?:\\.[\\w!#$%&’*+/=?`{|}~^-]+)*@(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,6}$",
message = "{valid.common.email.wrong}")
private String email;
private String email;*/
private Boolean accountDisabled;
private Boolean accountLocked;
/* private Boolean accountLocked;*/
private List<String> roleIds;
private String regionMainCode;
}

View File

@@ -26,17 +26,17 @@ public class AdminUpdateBindingVO implements AuditOutput {
private String id;
private String updatePassword;
@NotBlank(message = "{valid.common.required}")
/* @NotBlank(message = "{valid.common.required}")
@Pattern(
regexp =
"^[\\w!#$%&’*+/=?`{|}~^-]+(?:\\.[\\w!#$%&’*+/=?`{|}~^-]+)*@(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,6}$",
message = "{valid.common.email.wrong}")
private String email;
private String email;*/
private String regionMainCode;
private LocalDateTime passwordUpdatedAt;
private Boolean accountDisabled;
private Integer loginFailCnt;
private Boolean accountLocked;
/* private Integer loginFailCnt;
private Boolean accountLocked;*/
private List<String> roleIds;
}

View File

@@ -45,4 +45,8 @@ public class GetHouseholdsStatusCmd {
// 로그인한 유저 실사 지역
private String userRegionMainCode;
public GetHouseholdsStatusCmd(String searchRegionMainCode) {
this.regionMainCode = searchRegionMainCode;
}
}

View File

@@ -0,0 +1,15 @@
package app.module.admin.usecase.researcher.persistence.model;
import lombok.Data;
@Data
public class HouseholdDto {
private Long seq;
private String id;
private String name;
private String phone;
private String regionMainCodeName;
private Integer householdCount;
private String accountDisabledFlag;
}

View File

@@ -1,8 +1,10 @@
package app.module.admin.usecase.researcher.service;
import app.module.admin.usecase.household.getHouseholdsStatus.ports.application.domain.GetHouseholdsStatus;
import app.module.admin.usecase.researcher.persistence.model.ResearchersDto;
import app.module.admin.usecase.researcher.persistence.model.ResearchersHouseholdVisitDto;
import app.module.admin.usecase.researcher.persistence.model.ResearchersMappingHouseholdDto;
import app.module.admin.usecase.researcher.web.model.MappingHouseholdListUIReqVO;
import app.module.admin.usecase.researcher.web.model.ResearchersDetailReqVO;
import app.module.admin.usecase.researcher.web.model.ResearchersListReqVO;
import org.springframework.data.domain.Page;
@@ -16,4 +18,5 @@ public interface ResearcherService {
Page<ResearchersMappingHouseholdDto> mappingHouseholdList(ResearchersDetailReqVO reqVO);
Page<ResearchersHouseholdVisitDto> visitHouseholdList(ResearchersDetailReqVO reqVO);
Integer visitHouseholdDelete(List<Integer> selectIds);
Page<GetHouseholdsStatus> reginMainCodeHouseholdList(MappingHouseholdListUIReqVO reqVO);
}

View File

@@ -1,10 +1,14 @@
package app.module.admin.usecase.researcher.service;
import app.module.admin.usecase.household.getHouseholdsStatus.adapters.persistence.GetHouseholdsStatusMapper;
import app.module.admin.usecase.household.getHouseholdsStatus.ports.application.domain.GetHouseholdsStatus;
import app.module.admin.usecase.household.getHouseholdsStatus.ports.application.domain.GetHouseholdsStatusCmd;
import app.module.admin.usecase.researcher.persistence.ResearcherMapper;
import app.module.admin.usecase.researcher.persistence.model.ResearchersDto;
import app.module.admin.usecase.researcher.persistence.model.ResearchersHouseholdVisitDto;
import app.module.admin.usecase.researcher.persistence.model.ResearchersMappingHouseholdDto;
import app.module.admin.usecase.researcher.web.model.MappingHouseholdListUIReqVO;
import app.module.admin.usecase.researcher.web.model.ResearchersDetailReqVO;
import app.module.admin.usecase.researcher.web.model.ResearchersListReqVO;
import app.module.core.config.application.util.CommonUtil;
@@ -23,6 +27,7 @@ import java.util.List;
@RequiredArgsConstructor
public class ResearcherServiceImpl implements ResearcherService {
private final ResearcherMapper researcherMapper;
private final GetHouseholdsStatusMapper householdsStatusMapper;
@Override
public Page<ResearchersDto> list(ResearchersListReqVO reqVO) {
@@ -60,4 +65,15 @@ public class ResearcherServiceImpl implements ResearcherService {
String deletedBy = CommonUtil.getLoginUsername();
return researcherMapper.visitHouseholdDelete(selectIds,deletedBy);
}
@Override
public Page<GetHouseholdsStatus> reginMainCodeHouseholdList(MappingHouseholdListUIReqVO reqVO) {
Pageable pageable = PageRequest.of(reqVO.getPage() , reqVO.getSize());
List<GetHouseholdsStatus> householdsStatus = householdsStatusMapper.getHouseholdsStatus(pageable,
new GetHouseholdsStatusCmd(reqVO.getSearchRegionMainCode()));
return new PageImpl<>(householdsStatus, pageable,
householdsStatus.isEmpty() ? 0 : householdsStatus.get(0).getTotal());
}
}

View File

@@ -2,9 +2,7 @@ package app.module.admin.usecase.researcher.web;
import app.module.admin.config.application.util.DateUiUtil;
import app.module.admin.usecase.researcher.service.ResearcherService;
import app.module.admin.usecase.researcher.web.model.ResearchersDetailReqVO;
import app.module.admin.usecase.researcher.web.model.ResearchersDetailUIReqVO;
import app.module.admin.usecase.researcher.web.model.ResearchersListReqVO;
import app.module.admin.usecase.researcher.web.model.*;
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
@@ -12,7 +10,6 @@ import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import app.module.admin.usecase.researcher.web.model.GetResearchersUIReqVO;
import java.util.List;
@@ -48,6 +45,13 @@ class ResearcherController {
return ResponseEntity.status(HttpStatus.OK).body(researcherService.mappingHouseholdList(reqVO));
}
@GetMapping(path = "/mappingHousehold/list")
String mappingHouseholdResearcherList(Model model, @ModelAttribute("reqVO") MappingHouseholdListUIReqVO reqVO) {
model.addAttribute("householdDto", researcherService.reginMainCodeHouseholdList(reqVO));
return "researcher/mappingHouserhold";
}
@GetMapping(path = "/visitHouseholdList")
ResponseEntity<?> visitHouseholdList( @ModelAttribute ResearchersDetailReqVO reqVO) {
return ResponseEntity.status(HttpStatus.OK).body(researcherService.visitHouseholdList(reqVO));

View File

@@ -0,0 +1,22 @@
package app.module.admin.usecase.researcher.web.model;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class MappingHouseholdListUIReqVO {
private Integer page;
private Integer size;
private String searchRegionMainCode;
public Integer getPage() {
// 요청 페이지 넘버 - 초기값 `0`
return page != null ? page : 0;
}
public Integer getSize() {
// 페이지 당 아이템 수 - 초기값 `10`
return size != null ? size : 10;
}
}

View File

@@ -2,147 +2,152 @@
<html layout:decorate="~{layout/layout}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
xmlns:th="http://www.thymeleaf.org">
<section class="fw-bold" layout:fragment="content">
<section layout:fragment="content">
<form
method="post"
th:action="@{/settings/admins/create}"
th:object="${bindingVO}">
<div class="row mb-3">
<label class="col-sm-2 col-form-label" for="id">ID *</label>
<div class="col-sm-4">
<input class="form-control" id="id"
th:classappend="${#fields.hasErrors('id')} ? 'is-invalid'"
th:field="*{id}"/>
<div class="invalid-feedback fw-bold" th:errors="*{id}"
th:if="${#fields.hasErrors('id')}">
에러 메세지
</div>
<table class="type-form">
<tbody>
<tr>
<th><label for="roleIds">권한<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
<td>
<div class="d-flex">
<div class="component-input">
<div class="component-select">
<select class="select-list" id="roleIds"
th:classappend="${#fields.hasErrors('roleIds')} ? 'is-invalid'"
th:field="*{roleIds}"
onchange="onRoleChange(this);">
<option value="">선택</option>
<option th:each="role : ${roles}" th:text="${role.description}"
th:value="${role.id}"></option>
</select>
</div>
<div class="invalid-feedback fw-bold" th:errors="*{roleIds}"
th:if="${#fields.hasErrors('roleIds')}">
에러 메세지
</div>
</div>
</div>
</td>
</tr>
<tr>
<th><label for="id">ID<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
<td>
<div class="component-input">
<div class="input-field">
<input id="id"
th:classappend="${#fields.hasErrors('id')} ? 'is-invalid'"
th:field="*{id}"/>
<div class="invalid-feedback fw-bold" th:errors="*{id}"
th:if="${#fields.hasErrors('id')}">
에러 메세지
</div>
</div>
</div>
</td>
<th><label for="password">Password<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
<td>
<div class="component-input">
<div class="input-field">
<input id="password" type="password"
th:classappend="${#fields.hasErrors('password')} ? 'is-invalid'"
th:field="*{password}"/>
<div class="invalid-feedback fw-bold" th:errors="*{password}"
th:if="${#fields.hasErrors('password')}">
에러 메세지
</div>
</div>
</div>
</td>
</tr>
<tr class="regionMainCodeArea"
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>
<td>
<div class="component-select">
<select class="select-list" id="regionMainCode" name="regionMainCode"
th:classappend="${#fields.hasErrors('regionMainCode')} ? 'is-invalid'"
th:field="*{regionMainCode}">
<option value="">선택</option>
<option th:each="code : ${regionMainCode}"
th:value="${code.id}"
th:text="${code.codeText}">
</option>
</select>
</div>
<div class="invalid-feedback fw-bold" th:errors="*{regionMainCode}"
th:if="${#fields.hasErrors('regionMainCode')}">
에러 메세지
</div>
</td>
</tr>
<tr>
<th><label>사용 여부<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
<td class="radio-group">
<div class="component-input">
<label for="inlineRadio1" class="radio-inner">
<input id="inlineRadio1" th:field="*{accountDisabled}" type="radio" value="true">
<span class="radio-item">
<span class="radio-txt">미사용</span>
</span>
</label>
</div>
<div class="component-input">
<label for="inlineRadio2" class="radio-inner">
<input id="inlineRadio2" th:field="*{accountDisabled}" type="radio" value="false" checked>
<span class="radio-item">
<span class="radio-txt">사용</span>
</span>
</label>
</div>
<div class="invalid-feedback fw-bold" th:errors="*{accountDisabled}"
th:if="${#fields.hasErrors('accountDisabled')}">
에러 메세지
</div>
</td>
</tr>
</tbody>
</table>
<div class="component-btns bottom-btn-group">
<div class="btns-row align-right">
<button type="button" class="btn btn-secondary" onclick="gotoList();return false;">
<span class="btn-txt">목록으로 이동</span>
</button>
<button type="submit" class="btn btn-primary">
<span class="btn-txt">저장</span>
</button>
</div>
</div>
<div class="row mb-3">
<label class="col-sm-2 col-form-label" for="password">Password *</label>
<div class="col-sm-4">
<input class="form-control" id="password"
th:classappend="${#fields.hasErrors('password')} ? 'is-invalid'"
th:field="*{password}"
type="password"/>
<div class="invalid-feedback fw-bold" th:errors="*{password}"
th:if="${#fields.hasErrors('password')}">
에러 메세지
</div>
</div>
</div>
<div class="row mb-3">
<label class="col-sm-2 col-form-label" for="email">Email *</label>
<div class="col-sm-4">
<input class="form-control" id="email"
th:classappend="${#fields.hasErrors('email')} ? 'is-invalid'"
th:field="*{email}"
type="email"/>
<div class="invalid-feedback fw-bold" th:errors="*{email}"
th:if="${#fields.hasErrors('email')}">
에러 메세지
</div>
</div>
</div>
<div class="row mb-3">
<label class="col-sm-2 col-form-label" for="roleIds">권한 *</label>
<div class="col-sm-4">
<select class="form-control" id="roleIds" multiple
th:classappend="${#fields.hasErrors('roleIds')} ? 'is-invalid'"
th:field="*{roleIds}"
onchange="onRoleChange(this);">
<option th:each="role : ${roles}" th:text="${role.id}"
th:value="${role.id}"></option>
</select>
<div class="invalid-feedback fw-bold" th:errors="*{roleIds}"
th:if="${#fields.hasErrors('roleIds')}">
에러 메세지
</div>
</div>
</div>
<div class="row mb-3 regionMainCodeArea" style="display: none;">
<label class="col-sm-2 col-form-label" for="regionMainCode">실사 *</label>
<div class="col-sm-4">
<select class="form-select" id="regionMainCode" name="regionMainCode"
th:field="*{regionMainCode}">
<option value="">선택</option>
<option th:each="code : ${regionMainCode}"
th:value="${code.id}"
th:text="${code.codeText}">
</option>
</select>
</div>
</div>
<!-- 활성화 -->
<div class="row mb-3">
<label class="col-sm-2 col-form-label" for="inlineRadio1">비활성화 여부 *</label>
<div class="col-sm-4 pt-1">
<div class="form-check form-check-inline">
<input class="form-check-input" id="inlineRadio1" name="accountDisabled"
type="radio" value="true">
<label class="form-check-label" for="inlineRadio1">비활성화</label>
</div>
<div class="form-check form-check-inline">
<input checked class="form-check-input" id="inlineRadio2"
name="accountDisabled" type="radio" value="false">
<label class="form-check-label" for="inlineRadio2">활성화</label>
</div>
<div class="invalid-feedback fw-bold" th:errors="*{roleIds}"
th:if="${#fields.hasErrors('roleIds')}">
에러 메세지
</div>
</div>
</div>
<!-- 계정잠김 -->
<div class="row mb-3">
<label class="col-sm-2 col-form-label" for="accountLocked1">계정잠김 여부*</label>
<div class="col-sm-4 pt-1">
<div class="form-check form-check-inline">
<input class="form-check-input" id="accountLocked1" name="accountLocked"
type="radio" value="true">
<label class="form-check-label" for="accountLocked1">Locked</label>
</div>
<div class="form-check form-check-inline">
<input checked class="form-check-input" id="accountLocked2"
name="accountLocked" type="radio" value="false">
<label class="form-check-label" for="accountLocked2">Unlocked</label>
</div>
<div class="invalid-feedback fw-bold" th:errors="*{roleIds}"
th:if="${#fields.hasErrors('roleIds')}">
에러 메세지
</div>
</div>
</div>
<button class="btn btn-primary float-end" type="submit">저장</button>
<button class="btn btn-light" onclick="gotoList();return false;" type="button">목록으로 이동
</button>
</form>
<script>
function gotoList() {
document.prevAdminParamForm ? document.prevAdminParamForm.submit()
: location.href = '/settings/admins';
}
</script>
<th:block layout:fragment="script">
<script th:inline="javascript">
function gotoList() {
if (document.prevAdminParamForm) {
const f = document.prevAdminParamForm;
f.submit();
} else {
location.href = '/settings/admins';
}
}
<script>
const onRoleChange = (el) => {
$('.regionMainCodeArea').toggle(el.value !== "ROLE_ADMIN");
}
</script>
$(document).ready(() => {
const roleSelect = document.getElementById('roleIds');
onRoleChange(roleSelect);
});
const onRoleChange = (el) => {
const selectedValues = Array.from(el.selectedOptions).map(option => option.value);
const isAdmin = !selectedValues.length || selectedValues.includes('ROLE_ADMIN');
$('.regionMainCodeArea').toggle(!isAdmin);
};
</script>
</th:block>
</section>
</html>
</html>

View File

@@ -13,122 +13,113 @@
<input name="sort" th:value="${listOutput.pageable.sort}" type="hidden"/>
<input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}"/>
<div class="row p-2 mb-2 border-secondary border-top border-bottom border-1">
<div class="col-5">
<label class="col-sm-2 col-form-label" for="searchField">검색필드</label>
<select class="form-select d-inline w-25" id="searchField"
th:field="*{searchField}">
<option selected value="">선택</option>
<option value="id">ID</option>
<option value="email">Email</option>
</select>
<label>
<input class="form-control d-inline" placeholder="검색어를 입력하세요."
style="width: 250px;"
th:field="*{searchValue}" type="text">
</label>
<section class="filter-wrap">
<div class="form-area">
<div class="input-group">
<div class="input-label">
<p class="label-txt"><label for="searchField">검색필드</label></p>
</div>
<div class="d-flex">
<div class="component-select">
<select class="select-list" id="searchField" th:field="*{searchField}">
<option selected value="">선택</option>
<option value="id">ID</option>
<option value="email">Email</option>
</select>
</div>
<div class="component-input">
<div class="input-field">
<input type="text" placeholder="검색어를 입력하세요."
style="width: 250px;"
th:field="*{searchValue}" >
</div>
</div>
</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="searchRole" th:field="*{searchRole}">
<option selected value="">전체</option>
<option th:each="role : ${roles}" th:text="${role.id}"
th:value="${role.id}"></option>
</select>
</div>
</div>
<div class="component-btns">
<div class="btns-row">
<button class="btn" onclick="goSearch();"
type="button">
검색
</button>
<button class="btn" onclick="goInit();"
type="button">초기화
</button>
</div>
</div>
</div>
<div class="col">
<label class="col-sm-2 col-form-label" for="searchRole">권한</label>
<select class="form-select d-inline w-50" id="searchRole" th:field="*{searchRole}">
<option selected value="">전체</option>
<option th:each="role : ${roles}" th:text="${role.id}"
th:value="${role.id}"></option>
</select>
</div>
<div class="col text-end">
<button class="btn btn-outline-secondary" onclick="goSearch();"
type="button">
<i class="bi bi-search"></i>
</button>
<button class="btn btn-outline-secondary" onclick="goInit();"
type="button">초기화
</button>
</div>
</div>
</section>
<div class="row">
<div class="col text-start">
<div class="fw-bolder text-muted">Total: <span
th:text="${listOutput.totalElements}"></span></div>
</div>
<div class="col text-end">
<i class="bi bi-list-ol"></i>
<label>
<select class="form-select form-select-sm" id="pageSize" name="pageSize"
onchange="goSearch()">
<option
th:each="item : ${pageRows}"
th:selected="${#strings.toString(listOutput.pageable.pageSize) eq item.codeValue}"
th:text="${item.codeText}"
th:value="${item.codeValue}"></option>
</select>
</label>
</div>
<section>
<table>
<thead>
<tr>
<th >#</th>
<th scope="col">
<label><input class="form-check-input" onchange="toggleCheckbox(this);"
type="checkbox"/></label>
</th>
<th scope="col"><a class="order-able" data-sort-field="id" href="#">ID</a></th>
<th class="text-secondary" scope="col">권한</th>
</th>
<th scope="col"><a class="order-able" data-sort-field="accountDisabled"
href="#">활성화</a>
</th>
<th scope="col"><a class="order-able" data-sort-field="createdAt" href="#">등록일</a>
</th>
<th scope="col"><a class="order-able" data-sort-field="updatedAt" href="#">수정일</a>
</th>
</tr>
</thead>
<tbody>
<tr th:each="item, status : ${listOutput.content}">
<th th:text="${status.count + (listOutput.pageable.pageNumber * listOutput.pageable.pageSize)}">
게시물번호
</th>
<td><label><input class="form-check-input" name="checkedIds" th:value="${item.id}"
type="checkbox"/></label>
</td>
<td class="underline"><a th:href="|javascript:goUpdate('${item.id}')|" th:text="${item.id}">아이디</a>
</td>
<td>
<span th:each="role, status : ${item.roles}"
th:text="${role.getDescription()} + ${!status.last ? ', ': ''}"></span>
</td>
<td th:text="${item.accountDisabled == null || !item.accountDisabled ? 'Y' : 'N' }"></td>
<td th:text="${#temporals.format(item.createdAt, 'yyyy-MM-dd hh:mm')}">등록일</td>
<td th:text="${#temporals.format(item.updatedAt, 'yyyy-MM-dd hh:mm')}">수정일</td>
</tr>
</tbody>
</table>
<div th:replace="common/list-components :: pagination(${listOutput})"></div>
<div class="component-btns bottom-btn-group">
<div class="btns-row align-right">
<button class="btn btn-success" onclick="goExcel();" type="button">엑셀 다운로드</button>
<button class="btn" onclick="location.href='/settings/admins/create';" type="button">등록</button>
<button class="btn" onclick="goRemove();" type="button">삭제</button>
</div>
</div>
</div>
<table class="table">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">
<label><input class="form-check-input" onchange="toggleCheckbox(this);"
type="checkbox"/></label>
</th>
<th scope="col"><a class="order-able" data-sort-field="id" href="#">ID</a></th>
<th class="text-secondary" scope="col">권한</th>
<th scope="col"><a class="order-able" data-sort-field="email" href="#">Email</a>
</th>
<th scope="col"><a class="order-able" data-sort-field="accountDisabled"
href="#">활성화</a>
</th>
<th scope="col"><a class="order-able" data-sort-field="accountLocked"
href="#">계정잠김</a></th>
<th scope="col"><a class="order-able" data-sort-field="createdAt" href="#">등록일</a>
</th>
<th scope="col"><a class="order-able" data-sort-field="updatedAt" href="#">수정일</a>
</th>
</tr>
</thead>
<tbody>
<tr th:each="item, status : ${listOutput.content}">
<th scope="row"
th:text="${status.count + (listOutput.pageable.pageNumber * listOutput.pageable.pageSize)}">
게시물번호
</th>
<td><label><input class="form-check-input" name="checkedIds" th:value="${item.id}"
type="checkbox"/></label>
</td>
<td><a th:href="|javascript:goUpdate('${item.id}')|" th:text="${item.id}">아이디</a>
</td>
<td>
<span th:each="role, status : ${item.roles}"
th:text="${role.getId()} + ${!status.last ? ', ': ''}"></span>
</td>
<td th:text="${item.email}">이메일</td>
<td th:text="${item.accountDisabled == null || !item.accountDisabled ? 'Y' : 'N' }"></td>
<td th:text="${item.accountLocked == null || !item.accountLocked ? 'N' : 'Y' }"></td>
<td th:text="${#temporals.format(item.createdAt, 'yyyy-MM-dd hh:mm')}">등록일</td>
<td th:text="${#temporals.format(item.updatedAt, 'yyyy-MM-dd hh:mm')}">수정일</td>
</tr>
</tbody>
</table>
</section>
</form>
<div th:replace="common/list-components :: pagination(${listOutput})"></div>
<div class="row">
<div class="col text-start">
<button class="btn btn-success" onclick="goExcel();" type="button">엑셀 다운로드</button>
</div>
<div class="col text-end mb-2">
<button class="btn btn-primary" onclick="location.href='/settings/admins/create';"
type="button">등록
</button>
<button class="btn btn-danger" onclick="goRemove();" type="button">삭제</button>
</div>
</div>
</section>
<section layout:fragment="script">

View File

@@ -2,7 +2,7 @@
<html layout:decorate="~{layout/layout}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
xmlns:th="http://www.thymeleaf.org">
<section class="fw-bold" layout:fragment="content">
<section layout:fragment="content">
<form
method="post"
@@ -11,171 +11,160 @@
<input type="hidden" name="seq" th:field="*{seq}"/>
<div class="row mb-3">
<label class="col-sm-2 col-form-label" for="id">ID *</label>
<div class="col-sm-4">
<input class="form-control" id="id" readonly="readonly"
th:field="*{id}"/>
<table class="type-form">
<tbody>
<tr>
<th> <label for="roleIds">권한<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
<td>
<div class="component-select">
<select class="select-list" id="roleIds"
th:classappend="${#fields.hasErrors('roleIds')} ? 'is-invalid'"
th:field="*{roleIds}"
onchange="onRoleChange(this);">
<option value="">선택</option>
<option th:each="role : ${roles}" th:text="${role.description}"
th:value="${role.id}"></option>
</select>
</div>
<div class="invalid-feedback fw-bold" th:errors="*{roleIds}"
th:if="${#fields.hasErrors('roleIds')}">
에러 메세지
</div>
</td>
</tr>
<tr>
<th><label for="id">ID<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
<td>
<div class="component-input">
<div class="input-field">
<input id="id" readonly="readonly" th:field="*{id}"/>
</div>
</div>
</td>
<th><label for="password">비밀번호<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
<td>
<div class="component-input">
<div class="input-field">
<input id="password" placeholder="암호를 변경하고 싶다면 입력하세요"
th:classappend="${#fields.hasErrors('updatePassword')} ? 'is-invalid'"
th:field="*{updatePassword}"
type="password"/>
</div>
<div class="invalid-feedback fw-bold" th:errors="*{updatePassword}"
th:if="${#fields.hasErrors('updatePassword')}">
에러 메세지
</div>
</div>
</td>
</tr>
<tr class="regionMainCodeArea"
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>
<td>
<div class="component-select">
<select class="select-list" id="regionMainCode" name="regionMainCode"
th:classappend="${#fields.hasErrors('regionMainCode')} ? 'is-invalid'"
th:field="*{regionMainCode}">
<option value="">선택</option>
<option th:each="code : ${regionMainCode}"
th:value="${code.id}"
th:text="${code.codeText}">
</option>
</select>
</div>
<div class="invalid-feedback fw-bold" th:errors="*{regionMainCode}"
th:if="${#fields.hasErrors('regionMainCode')}">
에러 메세지
</div>
</td>
</tr>
<tr>
<th> <label>사용 여부<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
<td class="radio-group">
<div class="component-input">
<label for="inlineRadio1" class="radio-inner">
<input id="inlineRadio1" th:field="*{accountDisabled}" type="radio" value="true">
<span class="radio-item">
<span class="radio-txt">미사용</span>
</span>
</label>
</div>
<div class="component-input">
<label for="inlineRadio2" class="radio-inner">
<input id="inlineRadio2" th:field="*{accountDisabled}" type="radio" value="false">
<span class="radio-item">
<span class="radio-txt">사용</span>
</span>
</label>
</div>
<div class="invalid-feedback fw-bold" th:errors="*{accountDisabled}"
th:if="${#fields.hasErrors('accountDisabled')}">
에러 메세지
</div>
</td>
</tr>
</tbody>
</table>
<!-- <div th:replace="common/components :: auditArea"></div>-->
<div class="component-btns bottom-btn-group">
<div class="btns-row align-right">
<button type="button" class="btn btn-secondary" onclick="gotoList();return false;">
<span class="btn-txt">목록</span>
</button>
<button type="submit" class="btn btn-primary">
<span class="btn-txt">저장</span>
</button>
</div>
</div>
<div class="row mb-3">
<label class="col-sm-2 col-form-label" for="password">Password *</label>
<div class="col-sm-4">
<input class="form-control" id="password" placeholder="암호를 변경하고 싶다면 입력하세요"
th:classappend="${#fields.hasErrors('updatePassword')} ? 'is-invalid'"
th:field="*{updatePassword}"
type="password"/>
<div class="invalid-feedback fw-bold" th:errors="*{updatePassword}"
th:if="${#fields.hasErrors('updatePassword')}">
에러 메세지
</div>
</div>
</div>
<div class="row mb-3">
<label class="col-sm-2 col-form-label" for="email">Email *</label>
<div class="col-sm-4">
<input class="form-control" id="email"
th:classappend="${#fields.hasErrors('email')} ? 'is-invalid'"
th:field="*{email}"
type="email"/>
<div class="invalid-feedback fw-bold" th:errors="*{email}"
th:if="${#fields.hasErrors('email')}">
에러 메세지
</div>
</div>
</div>
<div class="row mb-3">
<label class="col-sm-2 col-form-label" for="roleIds">권한 *</label>
<div class="col-sm-4">
<select class="form-control" id="roleIds" multiple
th:classappend="${#fields.hasErrors('roleIds')} ? 'is-invalid'"
th:field="*{roleIds}"
onchange="onRoleChange(this);">
<option th:each="role : ${roles}" th:text="${role.id}"
th:value="${role.id}"></option>
</select>
<div class="invalid-feedback fw-bold" th:errors="*{roleIds}"
th:if="${#fields.hasErrors('roleIds')}">
에러 메세지
</div>
</div>
</div>
<div class="row mb-3 regionMainCodeArea"
th:style="${#lists.contains(bindingVO.roleIds, 'ROLE_ADMIN')} ? 'display: none;' : 'display: flex;'">
<label class="col-sm-2 col-form-label" for="regionMainCode">실사 *</label>
<div class="col-sm-4">
<select class="form-select" id="regionMainCode" name="regionMainCode"
th:classappend="${#fields.hasErrors('regionMainCode')} ? 'is-invalid'"
th:field="*{regionMainCode}">
<option value="">선택</option>
<option th:each="code : ${regionMainCode}"
th:value="${code.id}"
th:text="${code.codeText}">
</option>
</select>
<div class="invalid-feedback fw-bold" th:errors="*{regionMainCode}"
th:if="${#fields.hasErrors('regionMainCode')}">
에러 메세지
</div>
</div>
</div>
<!-- 활성화 -->
<div class="row mb-3">
<label class="col-sm-2 col-form-label" for="inlineRadio1">비활성화 여부 *</label>
<div class="col-sm-4 pt-1">
<div class="form-check form-check-inline">
<input class="form-check-input" id="inlineRadio1" th:field="*{accountDisabled}"
type="radio" value="true">
<label class="form-check-label" for="inlineRadio1">비활성화</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" id="inlineRadio2" th:field="*{accountDisabled}"
type="radio" value="false">
<label class="form-check-label" for="inlineRadio2">활성화</label>
</div>
<div class="invalid-feedback fw-bold" th:errors="*{roleIds}"
th:if="${#fields.hasErrors('roleIds')}">
에러 메세지
</div>
</div>
</div>
<!-- 계정잠김 -->
<div class="row mb-3">
<label class="col-sm-2 col-form-label" for="accountLocked1">계정잠김 여부*</label>
<div class="col-sm-4 pt-1">
<div class="form-check form-check-inline">
<input class="form-check-input" id="accountLocked1" th:field="*{accountLocked}"
type="radio" value="true">
<label class="form-check-label" for="accountLocked1">Locked</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" id="accountLocked2" th:field="*{accountLocked}"
type="radio" value="false">
<label class="form-check-label" for="accountLocked2">Unlocked</label>
</div>
<div class="invalid-feedback fw-bold" th:errors="*{roleIds}"
th:if="${#fields.hasErrors('roleIds')}">
에러 메세지
</div>
</div>
</div>
<div class="row w-50">
<!-- audit area -->
<div th:replace="common/components :: auditArea"></div>
</div>
<button class="btn btn-primary float-end" type="submit">저장</button>
<button class="btn btn-light" onclick="gotoList();return false;" type="button">목록으로 이동
</button>
</form>
<!-- 이전 목록페이지의 검색 및 정렬조건 폼 -->
<th:block th:if="${listStatus != null}">
<form method="get" name="prevAdminParamForm"
th:action="@{/settings/admins}"
th:object="${listStatus}">
<input th:field="*{searchField}" type="hidden">
<input th:field="*{searchValue}" type="hidden">
<input th:field="*{searchRole}" type="hidden">
<th:block th:if="${pageable != null}">
<input name="page" th:value="${pageable.page}" type="hidden"/>
<input name="sort" th:value="${pageable.sort}" type="hidden"/>
</th:block>
</form>
<form method="get" name="prevAdminParamForm"
th:action="@{/settings/admins}"
th:object="${listStatus}">
<input th:field="*{searchField}" type="hidden">
<input th:field="*{searchValue}" type="hidden">
<input th:field="*{searchRole}" type="hidden">
<th:block th:if="${pageable != null}">
<input name="page" th:value="${pageable.page}" type="hidden"/>
<input name="sort" th:value="${pageable.sort}" type="hidden"/>
</th:block>
</form>
</th:block>
<script th:inline="javascript">
function gotoList() {
if (document.prevAdminParamForm) {
const f = document.prevAdminParamForm;
f.sort.value = convertToPageableSortValue(f.sort.value);
f.submit();
} else {
location.href = '/settings/admins';
<th:block layout:fragment="script">
<script th:inline="javascript">
function gotoList() {
if (document.prevAdminParamForm) {
const f = document.prevAdminParamForm;
f.submit();
} else {
location.href = '/settings/admins';
}
}
}
$(document).ready(() => {
showAudit([[${bindingVO.id}]], [[${bindingVO.createdBy}]],
[[${#temporals.format(bindingVO.createdAt, "yyyy-MM-dd'T'HH:mm:ss")}]],
[[${bindingVO.updatedBy}]],
[[${#temporals.format(bindingVO.updatedAt, "yyyy-MM-dd'T'HH:mm:ss")}]]);
});
</script>
$(document).ready(() => {
showAudit([[${bindingVO.id}]], [[${bindingVO.createdBy}]],
[[${#temporals.format(bindingVO.createdAt, "yyyy-MM-dd'T'HH:mm:ss")}]],
[[${bindingVO.updatedBy}]],
[[${#temporals.format(bindingVO.updatedAt, "yyyy-MM-dd'T'HH:mm:ss")}]]);
<script>
const onRoleChange = (el) => {
$('.regionMainCodeArea').toggle(el.value !== "ROLE_ADMIN");
}
</script>
// 초기 로드 시 roleIds에 따라 regionMainCodeArea 표시/숨김
const roleSelect = document.getElementById('roleIds');
if (roleSelect) {
onRoleChange(roleSelect);
}
});
const onRoleChange = (el) => {
const isAdmin = el.value === 'ROLE_ADMIN' || !el.value;
$('.regionMainCodeArea').toggle(!isAdmin);
};
</script>
</th:block>
</section>
</html>
</html>

View File

@@ -11,25 +11,20 @@
-->
<div th:fragment="pagination(items)">
<div class="row">
<nav aria-label="Page navigation example">
<ul class="pagination justify-content-center">
<li class="page-item" th:classappend="${!items.pageable.hasPrevious} ? 'disabled'">
<a class="page-link"
th:href="|javascript:goPageable(${items.pageable.pageNumber - 1}, ${items.pageable.pageSize}, '${items.pageable.sort}')|">이전</a>
</li>
<li class="page-item"
th:classappend="${idx == items.pageable.pageNumber} ? 'disabled'"
th:each="idx : ${#numbers.sequence(0, items.totalPages == 0 ? 0 : items.totalPages - 1)}">
<a class="page-link"
th:href="|javascript:goPageable(${idx}, ${items.pageable.pageSize}, '${items.pageable.sort}')|"
th:text="${idx+1}">페이지넘버</a>
</li>
<li class="page-item"
th:classappend="${items.pageable.pageNumber == items.totalPages - 1 or items.totalPages == 0} ? 'disabled'">
<a class="page-link"
th:href="|javascript:goPageable(${items.pageable.pageNumber + 1}, ${items.pageable.pageSize}, '${items.pageable.sort}')|">다음</a>
</li>
</ul>
<nav class="component-pagination" aria-label="페이지네이션">
<a class="pagination-item prev"
th:classappend="${!items.pageable.hasPrevious} ? 'disabled'"
th:href="${items.pageable.hasPrevious} ? 'javascript:goPageable(' + ${items.pageable.pageNumber - 1} + ', ' + ${items.pageable.pageSize} + ', \'' + ${items.pageable.sort ?: 'id,desc'} + '\')' : '#'"></a>
<a class="pagination-item"
th:classappend="${idx == items.pageable.pageNumber} ? 'disabled'"
th:each="idx : ${#numbers.sequence(0, items.totalPages == 0 ? 0 : items.totalPages - 1)}"
th:href="${idx != items.pageable.pageNumber} ? 'javascript:goPageable(' + ${idx} + ', ' + ${items.pageable.pageSize} + ', \'' + ${items.pageable.sort ?: 'id,desc'} + '\')' : '#'"
th:text="${idx + 1}">페이지넘버</a>
<a class="pagination-item next"
th:classappend="${items.pageable.pageNumber >= items.totalPages - 1 or items.totalPages == 0} ? 'disabled'"
th:href="${items.pageable.pageNumber < items.totalPages - 1 and items.totalPages > 0} ? 'javascript:goPageable(' + ${items.pageable.pageNumber + 1} + ', ' + ${items.pageable.pageSize} + ', \'' + ${items.pageable.sort ?: 'id,desc'} + '\')' : '#'"></a>
</nav>
</div>
</div>

View File

@@ -4,7 +4,6 @@
<th layout:fragment="content">
<section>
<!-- 테이블 영역 -->
<table class="type-form confirm" th:object="${researcherDto}" >
<tbody>
<tr>
@@ -63,14 +62,17 @@
TOTAL. <span id="household-totalElements"></span>
</div>
</div>
<div id="researcher-tab1" style="display: none;">
<button type="button" class="btn" onclick="location.href='/researcher/researchers'">
<span class="btn-txt">임가매핑</span>
</button>
</div>
</div>
<!-- hidden parameters -->
<input name="page" th:field="*{page}" type="hidden"/>
<input name="adminSeq" th:field="${researcherDto.seq}" type="hidden"/>
<div class="tab-body">
<div class="tab-content" data-tab-value="tab1">
<div class="content-inner">
@@ -339,8 +341,6 @@
'/researcher/visitHousehold/remove',
JSON.stringify(selectIds),
function (response) {
console.log("여기있어요");
console.log(response);
if(response > 0){
alert('선택한 임가정보가 삭제되었습니다.');
getHouseholdVisitList(document.householdReqForm.page.value);