일단 커밋

This commit is contained in:
주수현
2025-06-13 17:30:33 +09:00
parent 4c1f6de57d
commit 693638e1a3
5 changed files with 457 additions and 121 deletions

View File

@@ -0,0 +1,92 @@
<?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.admin.usecase.researcher.persistence.ResearcherMapper">
<select id="list" parameterType="app.module.admin.usecase.researcher.web.model.ResearchersListReqVO">
select
a.id,
COUNT(rhh.id) AS household_count,
a.name,
a.phone,
max(u.code_text) AS region_main_code_name,
case a.account_disabled when false then '활성화' when true then '비활성화' end account_disabled_flag
from admin a
join admin_has_role ahr ON a.seq = ahr.admin_seq
left join uicode u ON u.parent_id = 'code.region.main' AND u.id = a.region_main_code
left join researcher_has_household rhh ON rhh.admin_seq = a.seq
left join household h ON h.seq = rhh.household_seq AND h.is_panel IS true
where
ahr.role_id = 'ROLE_RESEARCHER' and ahr.is_deleted = false
<if test="searchField == 'name' and searchValue != null and searchValue != ''">
and a.name LIKE CONCAT('%', #{searchValue}, '%')
</if>
<if test="searchField == 'phone' and searchValue != null and searchValue != ''">
and a.phone LIKE CONCAT('%', #{searchValue}, '%')
</if>
<if test="searchAccountDisabled != null and searchAccountDisabled != ''">
and a.account_disabled = #{searchAccountDisabled}
</if>
group by a.seq
LIMIT #{size} OFFSET #{page}*#{size}
</select>
<select id="countAll" parameterType="app.module.admin.usecase.researcher.web.model.ResearchersListReqVO" resultType="long">
select COUNT(a.seq)
from admin a
join admin_has_role ahr ON a.seq = ahr.admin_seq
where
ahr.role_id = 'ROLE_RESEARCHER' and ahr.is_deleted = false
<if test="searchField == 'name' and searchValue != null and searchValue != ''">
and a.name LIKE CONCAT('%', #{searchValue}, '%')
</if>
<if test="searchField == 'phone' and searchValue != null and searchValue != ''">
and a.phone LIKE CONCAT('%', #{searchValue}, '%')
</if>
<if test="searchAccountDisabled != null and searchAccountDisabled != ''">
and a.account_disabled = #{searchAccountDisabled}
</if>
</select>
<select id="detail">
select
a.id,
a.name,
a.phone,
u.code_text AS region_main_code_name,
case a.account_disabled when false then '활성화' when true then '비활성화' end account_disabled_flag
from admin a
join admin_has_role ahr ON a.seq = ahr.admin_seq
left join uicode u ON u.parent_id = 'code.region.main' AND u.id = a.region_main_code
where ahr.role_id = 'ROLE_RESEARCHER' and ahr.is_deleted = false
<if test="adminSeq > 0">
and a.seq = #{adminSeq}
</if>
</select>
<select id="mappingHouseholdList">
select
h.seq,
h.household_num,
h.name,
h.phone,
rm.code_text AS region_main_code_name,
rs.code_text AS region_sub_code_name,
rd.code_text AS region_detail_code_name,
il.code_text AS industry_large_code_name,
im.code_text AS industry_middle_code_name,
case h.is_panel when false then '유지' when true then '탈락' end panel_flag
from household h
join admin_has_role ahr ON h.seq = ahr.admin_seq
left join uicode rm ON u.parent_id = 'code.region.main' AND u.id = h.region_main_code
left join uicode rs ON u.parent_id = 'code.region.sub' AND u.id = h.region_sub_code
left join uicode rd ON u.parent_id = 'code.region.detail' AND u.id = h.region_detail_code
left join uicode il ON u.parent_id = 'code.industry.large' AND u.id = h.industry_large_code
left join uicode im ON u.parent_id = 'code.industry.middle' AND u.id = h.industry_middle_code
where ahr.role_id = 'ROLE_RESEARCHER' and ahr.is_deleted = false
<if test="adminSeq > 0">
and a.seq = #{adminSeq}
</if>
</select>
</mapper>

View File

@@ -37,6 +37,12 @@
<script th:src="@{/static/library/bootstrap-treeview/bootstrap-treeview.min.js}"
type="text/javascript"></script>
<link rel="shortcut icon" type="image/x-icon" th:href="@{/favicon.ico}" />
<link rel="stylesheet" th:href="@{/static/assets/styles/style.css}" />
<script th:src="@{/static/assets/scripts/common.ui.plugin.js}" ></script>
<script th:src="@{/static/assets/scripts/common.ui.js}" ></script>
<script th:src="@{/static/assets/scripts/common.js}"></script>
<link rel="stylesheet" th:href="@{/static/library/flatpickr/flatpickr.min.css}">
<link rel="stylesheet" th:href="@{/static/library/flatpickr/flatpickr.dark.css}">
<script th:src="@{/static/library/flatpickr/flatpickr.min.js}"></script>
@@ -49,6 +55,7 @@
<script th:src="@{/static/library/bootstrap/bootstrap.min.js}"></script>
<script th:src="@{/static/ui/uiUtil.js}"></script>
<script th:src="@{/static/library/jquery/jquery-serializeObject.min.js}"></script>
<script th:src="@{/static/scripts/ajaxUtils.js}"></script>
<script th:each="flashMsg : ${session.flashAlertMessages}" th:if="${session.flashAlertMessages != null}"
th:inline="javascript">
@@ -79,81 +86,54 @@
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ████ ██ ██ ████ ██ ██ ██ ███████ ██ ██ ██████ ███████ ██ ██
-->
<nav class="navbar navbar-dark bg-dark navbar-expand-lg mb-3" th:fragment="header">
<div class="container-fluid">
<a class="navbar-brand" href="#"><i class="bi bi-server fs-4"></i></a>
<button aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"
class="navbar-toggler" data-bs-target="#navbarSupportedContent"
data-bs-toggle="collapse"
type="button">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0" th:if="${topNode != null}">
<li class="nav-item">
<a aria-current="page" class="nav-link active" th:href="${topNode.uri}" th:text="#{uri}">Home</a>
</li>
<nav class="header" th:fragment="header">
<div class="inner">
<div class="header-left">
<a aria-current="page" th:href="${topNode.uri}" >
<img class="logo" th:src="@{/static/assets/images/common/ico_logo.svg}" alt="로고 이미지">
</a>
<p class="logo-tit">임가경제조사 일계부 관리자모드</p>
</div>
<ul class="main-menu" th:if="${topNode != null}">
<li class="menu-item" th:each="menu : ${topNode.children}"
th:if="${menu.showOnNavi}" th:classappend="${@coreUtil.containsCurrentURI(menuHierarchy, menu.id)}? 'active'">
<!-- 자식 children 가 없는 경우 -->
<a th:classappend="${currentURI.id == menu.id}? 'active'"
th:href="${menu.uri}" th:if="${#lists.size(menu.children) == 0}"
th:text="${#messages.msg(menu.id)}">메뉴명</a>
<li class="nav-item" th:classappend="${#lists.size(menu.children) > 0} ? 'dropdown'" th:each="menu : ${topNode.children}"
th:if="${menu.showOnNavi}">
<!-- 자식 children 가 없는 경우 -->
<a class="nav-link" th:classappend="${currentURI.id == menu.id}? 'active'"
th:href="${menu.uri}" th:if="${#lists.size(menu.children) == 0}"
th:text="${#messages.msg(menu.id)}">메뉴명</a>
<!-- 자식 children 가 있는 경우 -->
<th:block th:if="${#lists.size(menu.children) > 0}">
<a aria-expanded="false"
class="nav-link dropdown-toggle"
data-bs-toggle="dropdown" roleDto="button"
th:classappend="${@coreUtil.containsCurrentURI(menuHierarchy, menu.id)}? 'active'"
th:href="${menu.uri}" th:text="${#messages.msg(menu.id)}">메뉴명</a>
<!-- 자식 children 가 있는 경우 -->
<th:block th:if="${#lists.size(menu.children) > 0}">
<a th:href="${menu.uri}" th:text="${#messages.msg(menu.id)}">메뉴명</a>
<th:block th:insert="~{this :: subMenuFrag}"
th:with="subMenus = ${menu.children}, addSubMenuClass = false">
</th:block>
</th:block>
</li>
<!-- submenu fragment -->
<th:block th:fragment="subMenuFrag">
<ul class="sub-menu"
th:classappend="${addSubMenuClass ? 'submenu' : ''}" th:if="${@adminUtil.shouldDisplaySubNodes(subMenus)}">
<li th:each="child : ${subMenus}" th:if="${child.showOnNavi}" class="sub-menu-item">
<a th:classappend="${@coreUtil.containsCurrentURI(menuHierarchy, child.id)}? 'active'"
th:href="${@adminUtil.shouldDisplaySubNodes(child.children) ? 'javascript:void(0)' : child.uri}">
[[${#messages.msg(child.id)}]]
<p>
<i class="bi bi-arrow-right-circle-fill"
th:if="${@adminUtil.shouldDisplaySubNodes(child.children)}"></i></p>
</a>
<th:block th:insert="~{this :: subMenuFrag}"
th:with="subMenus = ${menu.children}, addSubMenuClass = false">
th:with="subMenus = ${child.children}, addSubMenuClass = true">
</th:block>
</th:block>
</li>
<!-- submenu fragment -->
<th:block th:fragment="subMenuFrag">
<ul aria-labelledby="navbarDropdown" class="dropdown-menu"
th:classappend="${addSubMenuClass ? 'submenu' : ''}" th:if="${@adminUtil.shouldDisplaySubNodes(subMenus)}">
<li th:each="child : ${subMenus}" th:if="${child.showOnNavi}">
<a class="dropdown-item"
th:classappend="${@coreUtil.containsCurrentURI(menuHierarchy, child.id)}? 'active'"
th:href="${@adminUtil.shouldDisplaySubNodes(child.children) ? 'javascript:void(0)' : child.uri}">
[[${#messages.msg(child.id)}]]
<i class="bi bi-arrow-right-circle-fill"
th:if="${@adminUtil.shouldDisplaySubNodes(child.children)}"></i>
</a>
<th:block th:insert="~{this :: subMenuFrag}"
th:with="subMenus = ${child.children}, addSubMenuClass = true">
</th:block>
</li>
</ul>
</th:block>
</ul>
<div class="d-flex">
<span class="text-white me-1" th:text="#{greeting} + ','">안녕하세요</span>
<a aria-expanded="false"
class="d-flex align-items-center text-white link-dark text-decoration-none dropdown-toggle"
data-bs-toggle="dropdown" href="#" id="dropdownUser2">
<strong sec:authentication="name">로그인 사용자명</strong>
</a>
<ul aria-labelledby="dropdownUser2" class="dropdown-menu text-small shadow"
style="left:auto;right:0;">
<li th:each="authority : ${#authentication.getAuthorities()}">
<span class="dropdown-item text-muted" th:text="${authority}"></span>
</li>
<li>
<hr class="dropdown-divider">
</li>
<li><a class="dropdown-item" href="/logout">Sign out</a></li>
</ul>
</div>
</th:block>
</ul>
<div class="header-right">
<p class="user"><strong sec:authentication="name">로그인 사용자명</strong>님 안녕하세요</p>
<span class="user-ip">111.11.111.111</span>
<button class="btn-logout" href="/logout">로그아웃</button>
</div>
</div>
</nav>
@@ -165,25 +145,14 @@
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██████ ██ ██ ███████ ██ ██ ██████ ██████ ██ ██ ██████ ██ ██ ██████
-->
<div class="row" th:fragment="breadcrumb">
<div class="col">
<nav aria-label="breadcrumb" class="float-end" style="--bs-breadcrumb-divider: '>';">
<ol class="breadcrumb">
<li class="breadcrumb-item" th:classappend="${item.id == currentURI.id}? 'active'"
th:each="item, status : ${menuHierarchy}">
<a class="text-decoration-none" th:href="${item.uri}" th:if="${item.id != currentURI.id}">
<span th:if="${status.first}" th:remove="tag"><i class="bi bi-house-fill"></i></span>
<span th:if="${!status.first}" th:remove="tag"
th:text="${@coreUtil.getUriTitle(item)}"></span>
</a>
<span th:if="${item.id == currentURI.id}" th:remove="tag"
th:text="${@coreUtil.getUriTitle(item)}"></span>
</li>
</ol>
</nav>
</div>
</div>
<div class="location" th:fragment="breadcrumb">
<a th:href="${item.uri}" th:if="${item.id != currentURI.id}" th:each="item, status : ${menuHierarchy}">
<span th:if="${status.first}" th:remove="tag">홈</span>
<span th:if="${!status.first}" th:remove="tag"
th:text="${@coreUtil.getUriTitle(item)}"></span>
</a>
</div>
<!--
██████ █████ ██████ ███████ ██ ██ ███████ █████ ██████ ██ ███ ██ ██████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██
@@ -191,10 +160,16 @@
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ██ ██████ ███████ ██ ██ ███████ ██ ██ ██████ ██ ██ ████ ██████
-->
<div class="bd-title mb-3 row fs-3" th:fragment="pageHeading">
<div class="col"><i class="bi bi-list"></i> <span
th:text="${#messages.msg(currentURI.id)}"></span></div>
</div>
<hgroup class="page-tit-group" th:fragment="pageHeading">
<h2 class="page-tit" th:text="${#messages.msg(currentURI.id)}"></h2>
<div class="location" >
<a th:href="${item.uri}" th:if="${item.id != currentURI.id}" th:each="item, status : ${menuHierarchy}">
<span th:if="${status.first}" th:remove="tag">홈</span>
<span th:if="${!status.first}" th:remove="tag"
th:text="${@coreUtil.getUriTitle(item)}"></span>
</a>
</div>
</hgroup>
<!--
██████ ██████ ███████ ██████ █████ ████████ ██ ██████ ███ ██ ███ ███ ███████ ██████
@@ -215,11 +190,11 @@
██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██████ ██████ ██ ███████ ██ ██
-->
<div class="container" th:fragment="footer">
<footer class="py-3 my-4 border-top">
<div class="text-center">
<span class="text-muted">&copy; 2022 All rights reserved</span>
</div>
<div th:fragment="footer">
<footer id="footer" class="footer">
<p class="footer-info">
ⓒ COPYRIGHT 2025 KRI 임가경제조사 ALL RIGHTS RESERVED.
</p>
</footer>
</div>

View File

@@ -5,15 +5,22 @@
<body>
<header th:replace="~{common/components :: header}"></header>
<div class="container">
<div th:replace="~{common/components :: operationMessage}"></div>
<section class="container" layout:fragment="content">
page content
</section>
<div id="wrap">
<div id="container">
<div id="content" role="main">
<div class="inner">
<div class="content-inner">
<div th:replace="~{common/components :: operationMessage}"></div>
<div style="display: flex; justify-content: space-evenly;align-items: center; width:100%; background: #DEE2E6; height: 500px; font-size: 16px;">
<section class="container" layout:fragment="content">
page content
</section>
</div>
</div>
</div>
</div>
</div>
<div th:replace="~{common/components :: footer}"></div>
</div>
<div th:replace="~{common/components :: footer}"></div>
</body>
</html>

View File

@@ -5,21 +5,27 @@
<head th:replace="~{common/components :: head}"></head>
<body>
<header th:replace="~{common/components :: header}"></header>
<div id="wrap">
<header th:replace="~{common/components :: header}"></header>
<div class="container">
<div th:replace="~{common/components :: breadcrumb}"></div>
<div th:replace="~{common/components :: pageHeading}"></div>
<div th:replace="~{common/components :: operationMessage}"></div>
<div id="container">
<div id="content" role="main">
<div class="inner">
<!-- <div th:replace="~{common/components :: breadcrumb}"></div>-->
<div th:replace="~{common/components :: pageHeading}"></div>
<div th:replace="~{common/components :: operationMessage}"></div>
<div class="content-inner">
<section layout:fragment="content">
page content
</section>
</div>
</div>
</div>
</div>
<section class="container" layout:fragment="content">
page content
</section>
<div th:replace="~{common/components :: footer}"></div>
<section layout:fragment="script"></section>
</div>
<div th:replace="~{common/components :: footer}"></div>
<section layout:fragment="script"></section>
</body>
</html>

View File

@@ -1,9 +1,265 @@
<!DOCTYPE html>
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:th="http://www.thymeleaf.org"
layout:decorate="~{layout/layout}">
<html layout:decorate="~{layout/layout}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
xmlns:th="http://www.thymeleaf.org">
<section layout:fragment="content">
<h1>/researcher/researchers</h1>
<form autocomplete="off" method="get" name="reqForm" th:action="@{/researcher/researchers}" th:object="${reqVO}">
<section class="filter-wrap">
<div class="form-area">
<!-- hidden parameters -->
<input name="sort" th:field="*{sort}" type="hidden"/>
<input name="page" th:field="*{page}" type="hidden"/>
<div class="input-group">
<div class="input-label">
<p class="label-txt">
조사원
</p>
</div>
<div class="d-flex">
<div class="component-select">
<select class="select-list" required th:field="*{searchField}">
<option value="" selected>전체</option>
<option value="name">이름</option>
<option value="phone">전화번호</option>
</select>
</div>
<div class="component-input">
<div class="input-field">
<input type="text" id="temp_input_0001" th:field="*{searchValue}" placeholder="검색어를 입력하세요.">
</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" required th:field="*{searchArea}">
<option selected value="">전체</option>
<option
th:each="item : ${inspectionArea}"
th:text="${item.codeText}" th:value="${item.codeValue}"></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" required th:field="*{searchAccountDisabled}">
<option selected value="">전체</option>
<option value="0">사용</option>
<option value="1">미사용</option>
</select>
</div>
</div>
</div>
<div class="component-btns">
<div class="btns-row">
<button type="button" class="btn" onclick="goInit();">
<span class="btn-txt">초기화</span>
</button>
<button type="button" class="btn btn-primary" onclick="goSearch();" >
<i class="bi bi-search"></i>
</button>
</div>
</div>
</section>
</form>
<div class="row">
<div class="col text-start">
<div class="fw-bolder text-muted">
TOTAL. <span id="totalElements"></span>
</div>
</div>
</div>
<section>
<table>
<thead>
<tr>
<th>이름</th>
<th>전화번호</th>
<th>실사지역</th>
<th>임가수</th>
<th>사용여부</th>
</tr>
</thead>
<tbody id="listTBody">
</tbody>
</table>
</section>
<div class="row paging"></div>
<div class="component-btns bottom-btn-group">
<div class="btns-row align-right">
<button type="button" class="btn" onclick="goExcel();">
<span class="btn-txt">엑셀 다운로드 <i class="ico-download ico-small" aria-hidden="true"></i></span>
</button>
<button type="button" class="btn" onclick="goSave();">
<span class="btn-txt">등록</span>
</button>
<button type="button" class="btn" >
<span class="btn-txt">조사원 매핑</span>
</button>
<button type="button" class="btn" onclick="goRemove();">
<span class="btn-txt">비활성화</span>
</button>
</div>
</div>
</section>
<section layout:fragment="script">
<script>
const getResearchers = (pageNo) => {
const f = document.reqForm;
f.page.value = pageNo;
let dataOj = $(f).serializeObject();
ajaxUtil._ajaxMethod(
'/researcher/list',
dataOj,
function (response) {
$('#totalElements').text(response.totalElements);
// List 구성하기
const tbody = $('#listTBody');
tbody.empty();
$(response.content).each((idx, ct) => {
tbody.append(
`
<tr data-order-no="${ct.orderNo}"
data-id="${ct.id}">
<td><a href="javascript:goUpdate(${ct.id})">${ct.name}</a></td>
<td>${ct.phone}</td>
<td>${ct.regionMainCodeName}</td>
<td>${ct.householdCount}</td>
<td>${ct.accountDisabledFlag}</td>
</tr>
`
);
});
if (!$(response.content).length) {
tbody.append(`
<tr>
<td colspan="10" class="text-center text-muted">조사원이 존재하지 않습니다.</td>
</tr>
`);
}
// Pagination 구성하기
const paging = $('.paging');
paging.empty();
paging.append(
uiUtil.getPagingUI(pageNo, f.size.value, response.totalPages,
(movePageNo) => {
f.page.value = movePageNo;
goSearch();
}));
},
function (code, rstData) {
console.log("왜지 ");
},
'get',
'json',
null
);
}
// 최초 리스트 로드
getResearchers(document.reqForm.page.value);
</script>
<script th:inline="javascript">
const goSearch = () => {
const f = document.reqForm;
f.method = 'GET';
f.submit();
}
// 초기화
function goInit() {
const f = document.reqForm;
f.searchField.value = '';
f.searchValue.value = '';
f.searchArea.value = '';
f.searchAccountDisabled.value = '';
}
// 저장페이지 이동
function goSave() {
location.href = '/board/articles/create';
}
// 수정페이지 이동
function goUpdate(itemId) {
location.href = '/board/articles/' + itemId;
}
// 상세페이지 이동
function goDetail(seq) {
location.href = '/researcher/researchers/' + seq;
}
function goExcel() {
const f = document.reqForm;
const data = $(f).serializeObject();
// size 를 제거하면 전체 목록을 가져온다.
delete data.size;
location.href = '/admin/researchers/excel?' + new URLSearchParams(data).toString();
}
// 체크박스 선택/해제
function toggleCheckbox(oj) {
$('input[name=selectIds]').prop("checked", oj.checked);
}
function goRemove() {
if (!$('input[name=selectIds]').is(':checked')) {
alert(/*[[#{operation.common.remove.choose}]]*/);
return;
}
if (confirm(/*[[#{operation.common.remove.ask}]]*/)) {
const f = document.reqForm;
const data = $(f).serializeObject();
$.ajax({
'method': 'DELETE',
'url': '/researchers/remove',
'data': {
'selectIds': data.selectIds
},
beforeSend: function (xhr) {
xhr.setRequestHeader(
$("meta[name='_csrf_header']").attr("content"),
$("meta[name='_csrf']").attr("content"));
},
success(res) {
alert('선택한 아이템이 삭제되었습니다.');
f.method = 'GET';
f.submit();
}
});
}
}
</script>
</section>
</html>