Merge branch 'bo_suggestion' into 'dev'
[BO] 커뮤니케이션 - 건의사항 작업 See merge request korea-research/korea-research!82
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
<?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.communication.suggestion.getSuggestion.adapters.persistence.GetSuggestionMapper">
|
||||
<select id="getSuggestionById"
|
||||
resultType="app.module.admin.usecase.communication.suggestion.getSuggestion.ports.application.domain.GetSuggestion">
|
||||
/* getSuggestionById : 건의하기 상세 조회 */
|
||||
SELECT s.id,
|
||||
s.household_seq,
|
||||
h.household_num,
|
||||
h.owner_name,
|
||||
h.phone AS owner_phone,
|
||||
h.region_main_name,
|
||||
r.researcher_name,
|
||||
r.researcher_phone,
|
||||
s.content
|
||||
FROM suggestion s
|
||||
LEFT JOIN v_household_with_code h ON h.seq = s.household_seq
|
||||
LEFT JOIN v_household_researcher r ON h.seq = r.household_seq
|
||||
WHERE s.is_deleted = false
|
||||
AND s.id = #{id}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,49 @@
|
||||
<?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.communication.suggestion.getSuggestions.adapters.persistence.GetSuggestionsMapper">
|
||||
<select id="getSuggestions"
|
||||
resultType="app.module.admin.usecase.communication.suggestion.getSuggestions.ports.application.domain.GetSuggestions">
|
||||
/* getSuggestions : 건의사항 목록 조회 */
|
||||
SELECT s.id,
|
||||
s.household_seq,
|
||||
s.content,
|
||||
h.owner_name,
|
||||
h.phone,
|
||||
s.updated_by,
|
||||
TO_CHAR(s.updated_at, 'YYYY-MM-DD HH24:MI') AS updatedAt,
|
||||
COUNT(*) OVER () AS total
|
||||
FROM suggestion s
|
||||
LEFT JOIN household h
|
||||
ON h.seq = s.household_seq
|
||||
AND h.is_deleted = false
|
||||
WHERE s.is_deleted = false
|
||||
|
||||
<if test="cmd.recordMonth != null and cmd.recordMonth != ''">
|
||||
/* 날짜 검색 */
|
||||
AND TO_CHAR(s.created_at, 'YYYYMM') = #{cmd.recordMonth}
|
||||
</if>
|
||||
|
||||
<if test="cmd.ownerValue != null and cmd.ownerValue != ''">
|
||||
/* 경영주 검색 */
|
||||
<choose>
|
||||
<when test="cmd.ownerField == ''">
|
||||
AND (
|
||||
h.owner_name ILIKE '%' || #{cmd.ownerValue} || '%'
|
||||
OR h.phone ILIKE '%' || #{cmd.ownerValue} || '%'
|
||||
)
|
||||
</when>
|
||||
<when test="cmd.ownerField eq 'name'">
|
||||
AND h.owner_name ILIKE '%' || #{cmd.ownerValue} || '%'
|
||||
</when>
|
||||
<when test="cmd.ownerField eq 'phone'">
|
||||
AND h.phone ILIKE '%' || #{cmd.ownerValue} || '%'
|
||||
</when>
|
||||
</choose>
|
||||
</if>
|
||||
|
||||
ORDER BY s.id DESC
|
||||
OFFSET #{pageable.offset} ROWS FETCH NEXT #{pageable.pageSize} ROWS ONLY
|
||||
</select>
|
||||
</mapper>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -3,7 +3,166 @@
|
||||
layout:decorate="~{layout/layout}">
|
||||
|
||||
<section layout:fragment="content">
|
||||
<h1>/communication/suggestions</h1>
|
||||
<form autocomplete="off" method="get" name="reqForm" th:action="@{/communication/suggestions}"
|
||||
th:object="${reqVO}">
|
||||
|
||||
<input name="page" th:field="*{page}" type="hidden"/>
|
||||
<input name="size" th:field="*{size}" type="hidden"/>
|
||||
|
||||
<div class="content-inner">
|
||||
<!-- 필터 영역 -->
|
||||
<section class="filter-wrap">
|
||||
<div class="form-area">
|
||||
<!-- 연/월 -->
|
||||
<div class="input-group">
|
||||
<div class="input-label">
|
||||
<p class="label-txt">
|
||||
연/월
|
||||
</p>
|
||||
</div>
|
||||
<div class="component-select">
|
||||
<select class="select-list" name="recordMonth" th:field="*{recordMonth}" required>
|
||||
<option th:each="month : ${monthList}"
|
||||
th:value="${month.value}"
|
||||
th:text="${month.label}"
|
||||
th:selected="${month.value == currentMonth}">
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 경영주 -->
|
||||
<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" name="ownerField" th:field="*{ownerField}">
|
||||
<option value="">전체</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" name="ownerValue" th:field="*{ownerValue}" placeholder="이름 입력">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 버튼 그룹 -->
|
||||
<div class="component-btns">
|
||||
<div class="btns-row">
|
||||
<button type="button" class="btn" onclick="location.href = location.pathname">
|
||||
<span class="btn-txt">초기화</span>
|
||||
</button>
|
||||
<button type="submit" class="btn btn-primary">
|
||||
<span class="btn-txt">검색</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<p class="input-label" style="font-size: 16px;">총 <span id="totalElements">0</span>건</p>
|
||||
<!-- 테이블 영역 -->
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 60%">내용</th>
|
||||
<th style="width: 10%">경영주명</th>
|
||||
<th style="width: 15%">전화번호</th>
|
||||
<th style="width: 15%">최종 수정자</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="listTBody">
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
<!-- 페이지네이션 -->
|
||||
<div class="row paging"></div>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
<section layout:fragment="script">
|
||||
<script>
|
||||
// 건의사항 목록 조회
|
||||
const getSuggestions = (pageNo) => {
|
||||
const f = document.reqForm;
|
||||
f.page.value = pageNo;
|
||||
|
||||
let dataOj = $(f).serializeObject();
|
||||
|
||||
ajaxUtil._ajaxMethod(
|
||||
'/api/communication/suggestions',
|
||||
dataOj,
|
||||
function(response) { // 성공
|
||||
console.log("response", response);
|
||||
|
||||
$('#totalElements').text(response.totalElements);
|
||||
|
||||
const tbody = $('#listTBody');
|
||||
tbody.empty();
|
||||
|
||||
$(response.content).each((idx, ct) => {
|
||||
tbody.append(
|
||||
`
|
||||
<tr>
|
||||
<td class="underline"><a class="ellipsis" href="/communication/suggestions/${ct.id}">${ct.content}</a></td><!-- 내용 -->
|
||||
<td>${ct.ownerName}</td><!-- 경영주명 -->
|
||||
<td>${ct.phone}</td><!-- 전화번호 -->
|
||||
<td>${ct.updatedBy} (${ct.updatedAt})</td><!-- 최종수정자 -->
|
||||
</tr>
|
||||
`
|
||||
);
|
||||
});
|
||||
|
||||
// nodata 처리
|
||||
if (!$(response.content).length) {
|
||||
tbody.append(`
|
||||
<tr>
|
||||
<td colspan="4" 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("error : ", code);
|
||||
},
|
||||
'get',
|
||||
'json'
|
||||
);
|
||||
}
|
||||
|
||||
// 최초 리스트 로드
|
||||
getSuggestions(document.reqForm.page.value);
|
||||
</script>
|
||||
|
||||
<script th:inline="javascript">
|
||||
const goSearch = () => {
|
||||
const f = document.reqForm;
|
||||
f.method = 'GET';
|
||||
f.submit();
|
||||
}
|
||||
</script>
|
||||
</section>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,73 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:th="http://www.thymeleaf.org"
|
||||
layout:decorate="~{layout/layout}">
|
||||
|
||||
<section layout:fragment="content">
|
||||
<form autocomplete="off" method="get" name="reqForm">
|
||||
<div class="content-inner">
|
||||
<section>
|
||||
<table class="type-form confirm">
|
||||
<colgroup>
|
||||
<col width="8%" />
|
||||
<col width="25.3%" />
|
||||
<col width="8%" />
|
||||
<col width="25.3%" />
|
||||
<col width="8%" />
|
||||
<col width="25.3%" />
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>임가번호</th>
|
||||
<td>
|
||||
<span th:text="${item.householdNum}">16750</span>
|
||||
</td>
|
||||
<th>경영주</th>
|
||||
<td>
|
||||
<span th:text="${item.ownerName}">홍길동</span>
|
||||
</td>
|
||||
<th>휴대폰 번호</th>
|
||||
<td>
|
||||
<span th:text="${item.ownerPhone}">010-0000-0000</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>실사</th>
|
||||
<td>
|
||||
<span th:text="${item.regionMainName}">서울</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>조사원</th>
|
||||
<td>
|
||||
<span th:text="${item.researcherName}">김조사</span>
|
||||
</td>
|
||||
<th>조사원 연락처</th>
|
||||
<td>
|
||||
<span th:text="${item.researcherPhone}">010-0000-0000</span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<p class="input-label" style="font-size: 16px; font-weight: bold;">내용</p>
|
||||
<div class="component-input">
|
||||
<div class="input-textarea-field">
|
||||
<textarea id="memo" name="memo" class="textarea" placeholder="" th:text="${item.content}"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="component-btns bottom-btn-group">
|
||||
<div class="btns-row align-right">
|
||||
<button type="button" class="btn" onclick="location.href='/communication/suggestions'">
|
||||
<span class="btn-txt">목록</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user