Merge branch 'bo_suggestion' into 'dev'
[BO] 커뮤니케이션 - 건의사항 작업 See merge request korea-research/korea-research!82
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
package app.module.admin.usecase.communication.suggestion.getSuggestion.adapters.persistence;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import app.module.admin.usecase.communication.suggestion.getSuggestion.ports.application.domain.GetSuggestion;
|
||||
import app.module.admin.usecase.communication.suggestion.getSuggestion.ports.application.domain.GetSuggestionCmd;
|
||||
import app.module.admin.usecase.communication.suggestion.getSuggestion.ports.GetSuggestionPortOut;
|
||||
import java.util.Optional;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
class GetSuggestionDao implements GetSuggestionPortOut {
|
||||
private final GetSuggestionMapper mapper;
|
||||
|
||||
@Override
|
||||
public Optional<GetSuggestion> operate(GetSuggestionCmd cmd) {
|
||||
return mapper.getSuggestionById(cmd);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package app.module.admin.usecase.communication.suggestion.getSuggestion.adapters.persistence;
|
||||
|
||||
import app.module.admin.usecase.communication.suggestion.getSuggestion.ports.application.domain.GetSuggestion;
|
||||
import app.module.admin.usecase.communication.suggestion.getSuggestion.ports.application.domain.GetSuggestionCmd;
|
||||
import java.util.Optional;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface GetSuggestionMapper {
|
||||
Optional<GetSuggestion> getSuggestionById(GetSuggestionCmd cmd);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package app.module.admin.usecase.communication.suggestion.getSuggestion.ports;
|
||||
|
||||
import java.util.Optional;
|
||||
import app.module.admin.usecase.communication.suggestion.getSuggestion.ports.application.domain.GetSuggestion;
|
||||
import app.module.admin.usecase.communication.suggestion.getSuggestion.ports.application.domain.GetSuggestionCmd;
|
||||
|
||||
public interface GetSuggestionPortIn {
|
||||
Optional<GetSuggestion> operate(GetSuggestionCmd cmd);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package app.module.admin.usecase.communication.suggestion.getSuggestion.ports;
|
||||
|
||||
import java.util.Optional;
|
||||
import app.module.admin.usecase.communication.suggestion.getSuggestion.ports.application.domain.GetSuggestion;
|
||||
import app.module.admin.usecase.communication.suggestion.getSuggestion.ports.application.domain.GetSuggestionCmd;
|
||||
|
||||
public interface GetSuggestionPortOut {
|
||||
Optional<GetSuggestion> operate(GetSuggestionCmd cmd);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package app.module.admin.usecase.communication.suggestion.getSuggestion.ports.application;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import app.module.admin.usecase.communication.suggestion.getSuggestion.ports.application.domain.GetSuggestion;
|
||||
import app.module.admin.usecase.communication.suggestion.getSuggestion.ports.application.domain.GetSuggestionCmd;
|
||||
import app.module.admin.usecase.communication.suggestion.getSuggestion.ports.GetSuggestionPortIn;
|
||||
import app.module.admin.usecase.communication.suggestion.getSuggestion.ports.GetSuggestionPortOut;
|
||||
import java.util.Optional;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
class GetSuggestionService implements GetSuggestionPortIn {
|
||||
private final GetSuggestionPortOut portOut;
|
||||
|
||||
@Override
|
||||
public Optional<GetSuggestion> operate(GetSuggestionCmd cmd) {
|
||||
return portOut.operate(cmd);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package app.module.admin.usecase.communication.suggestion.getSuggestion.ports.application.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetSuggestion {
|
||||
private Long id;
|
||||
private Long householdSeq;
|
||||
private String householdNum;
|
||||
private String ownerName;
|
||||
private String ownerPhone;
|
||||
private String regionMainName;
|
||||
private String researcherName;
|
||||
private String researcherPhone;
|
||||
private String content;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package app.module.admin.usecase.communication.suggestion.getSuggestion.ports.application.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetSuggestionCmd {
|
||||
private Long id;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package app.module.admin.usecase.communication.suggestion.getSuggestionUI;
|
||||
|
||||
import app.module.admin.usecase.communication.suggestion.getSuggestion.ports.GetSuggestionPortIn;
|
||||
import app.module.admin.usecase.communication.suggestion.getSuggestion.ports.application.domain.GetSuggestionCmd;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import app.module.admin.usecase.communication.suggestion.getSuggestionUI.model.GetSuggestionUIReqVO;
|
||||
|
||||
@Controller
|
||||
@RequiredArgsConstructor
|
||||
class GetSuggestionUIController {
|
||||
|
||||
private final GetSuggestionPortIn portIn;
|
||||
|
||||
@GetMapping(path = "/communication/suggestions/{id}")
|
||||
String operate(@PathVariable Long id, Model model,
|
||||
@ModelAttribute("reqVO") GetSuggestionUIReqVO reqVO) {
|
||||
model.addAttribute("item",
|
||||
portIn.operate(new GetSuggestionCmd(id)).orElse(null));
|
||||
return "communication/suggestions/{id}";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package app.module.admin.usecase.communication.suggestion.getSuggestionUI.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetSuggestionUIReqVO {
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package app.module.admin.usecase.communication.suggestion.getSuggestions.adapters.persistence;
|
||||
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import app.module.admin.usecase.communication.suggestion.getSuggestions.ports.application.domain.GetSuggestions;
|
||||
import app.module.admin.usecase.communication.suggestion.getSuggestions.ports.application.domain.GetSuggestionsCmd;
|
||||
import app.module.admin.usecase.communication.suggestion.getSuggestions.ports.GetSuggestionsPortOut;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
class GetSuggestionsDao implements GetSuggestionsPortOut {
|
||||
private final GetSuggestionsMapper mapper;
|
||||
|
||||
@Override
|
||||
public Page<GetSuggestions> operate(Pageable pageable, GetSuggestionsCmd cmd) {
|
||||
|
||||
List<GetSuggestions> result = mapper.getSuggestions(pageable, cmd);
|
||||
|
||||
return new PageImpl<>(result, pageable, result.isEmpty() ? 0 : result.get(0).getTotal());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package app.module.admin.usecase.communication.suggestion.getSuggestions.adapters.persistence;
|
||||
|
||||
import app.module.admin.usecase.communication.suggestion.getSuggestions.ports.application.domain.GetSuggestions;
|
||||
import app.module.admin.usecase.communication.suggestion.getSuggestions.ports.application.domain.GetSuggestionsCmd;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
@Mapper
|
||||
public interface GetSuggestionsMapper {
|
||||
List<GetSuggestions> getSuggestions(@Param("pageable") Pageable pageable,
|
||||
@Param("cmd")GetSuggestionsCmd cmd);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package app.module.admin.usecase.communication.suggestion.getSuggestions.adapters.web;
|
||||
|
||||
import app.module.admin.usecase.communication.suggestion.getSuggestions.ports.GetSuggestionsPortIn;
|
||||
import app.module.admin.usecase.communication.suggestion.getSuggestions.ports.application.domain.GetSuggestionsCmd;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.web.PageableDefault;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import app.module.admin.usecase.communication.suggestion.getSuggestions.adapters.web.model.GetSuggestionsReqVO;
|
||||
import app.module.admin.usecase.communication.suggestion.getSuggestions.adapters.web.model.GetSuggestionsResVO;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
class GetSuggestionsController {
|
||||
private final GetSuggestionsPortIn portIn;
|
||||
|
||||
@GetMapping(path = "/api/communication/suggestions")
|
||||
ResponseEntity<?> operate(@PageableDefault(size = 10) Pageable pageable,
|
||||
GetSuggestionsReqVO reqVO) {
|
||||
return ResponseEntity.status(HttpStatus.OK).body(portIn.operate(pageable,
|
||||
new GetSuggestionsCmd(
|
||||
reqVO.getRecordMonth(),
|
||||
reqVO.getOwnerField(),
|
||||
reqVO.getOwnerValue())));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package app.module.admin.usecase.communication.suggestion.getSuggestions.adapters.web.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetSuggestionsReqVO {
|
||||
private String recordMonth;
|
||||
private String ownerField;
|
||||
private String ownerValue;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package app.module.admin.usecase.communication.suggestion.getSuggestions.adapters.web.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetSuggestionsResVO {
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package app.module.admin.usecase.communication.suggestion.getSuggestions.ports;
|
||||
|
||||
import app.module.admin.usecase.communication.suggestion.getSuggestions.ports.application.domain.GetSuggestions;
|
||||
import app.module.admin.usecase.communication.suggestion.getSuggestions.ports.application.domain.GetSuggestionsCmd;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
public interface GetSuggestionsPortIn {
|
||||
Page<GetSuggestions> operate(Pageable pageable, GetSuggestionsCmd cmd);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package app.module.admin.usecase.communication.suggestion.getSuggestions.ports;
|
||||
|
||||
import app.module.admin.usecase.communication.suggestion.getSuggestions.ports.application.domain.GetSuggestions;
|
||||
import app.module.admin.usecase.communication.suggestion.getSuggestions.ports.application.domain.GetSuggestionsCmd;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
public interface GetSuggestionsPortOut {
|
||||
Page<GetSuggestions> operate(Pageable pageable, GetSuggestionsCmd cmd);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package app.module.admin.usecase.communication.suggestion.getSuggestions.ports.application;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import app.module.admin.usecase.communication.suggestion.getSuggestions.ports.application.domain.GetSuggestions;
|
||||
import app.module.admin.usecase.communication.suggestion.getSuggestions.ports.application.domain.GetSuggestionsCmd;
|
||||
import app.module.admin.usecase.communication.suggestion.getSuggestions.ports.GetSuggestionsPortIn;
|
||||
import app.module.admin.usecase.communication.suggestion.getSuggestions.ports.GetSuggestionsPortOut;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
class GetSuggestionsService implements GetSuggestionsPortIn {
|
||||
private final GetSuggestionsPortOut portOut;
|
||||
|
||||
@Override
|
||||
public Page<GetSuggestions> operate(Pageable pageable, GetSuggestionsCmd cmd) {
|
||||
return portOut.operate(pageable, cmd);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package app.module.admin.usecase.communication.suggestion.getSuggestions.ports.application.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetSuggestions {
|
||||
private Long id;
|
||||
private Long householdSeq;
|
||||
private String content;
|
||||
private String ownerName;
|
||||
private String phone;
|
||||
private String updatedBy;
|
||||
private String updatedAt;
|
||||
private Integer total;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package app.module.admin.usecase.communication.suggestion.getSuggestions.ports.application.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetSuggestionsCmd {
|
||||
private String recordMonth;
|
||||
private String ownerField;
|
||||
private String ownerValue;
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package app.module.admin.usecase.communication.suggestion.getSuggestionsUI;
|
||||
|
||||
import app.module.admin.config.application.util.DateUiUtil;
|
||||
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
@@ -11,11 +13,12 @@ import app.module.admin.usecase.communication.suggestion.getSuggestionsUI.model.
|
||||
@RequiredArgsConstructor
|
||||
class GetSuggestionsUIController {
|
||||
|
||||
@GetMapping(path = "/communication/suggestions")
|
||||
String operate(
|
||||
Model model,
|
||||
@ModelAttribute("reqVO") GetSuggestionsUIReqVO reqVO) {
|
||||
@GetMapping(path = "/communication/suggestions")
|
||||
String operate(Model model, @ModelAttribute("reqVO") GetSuggestionsUIReqVO reqVO) {
|
||||
|
||||
return "communication/suggestions";
|
||||
}
|
||||
model.addAttribute("monthList", DateUiUtil.getRecentMonths(13));
|
||||
model.addAttribute("currentMonth", DateUiUtil.getCurrentMonthValue());
|
||||
|
||||
return "communication/suggestions";
|
||||
}
|
||||
}
|
||||
@@ -10,4 +10,20 @@ import lombok.Setter;
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetSuggestionsUIReqVO {
|
||||
private Integer page;
|
||||
private String sort;
|
||||
private Integer size;
|
||||
private String recordMonth;
|
||||
private String ownerField;
|
||||
private String ownerValue;
|
||||
|
||||
public Integer getPage() {
|
||||
// 요청 페이지 넘버 - 초기값 `0`
|
||||
return page != null ? page : 0;
|
||||
}
|
||||
|
||||
public Integer getSize() {
|
||||
// 페이지 당 아이템 수 - 초기값 `10`
|
||||
return size != null ? size : 10;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
@@ -292,7 +292,7 @@ public class InitUriAdminData implements ApplicationRunner {
|
||||
ADMIN_COMMUNICATION,
|
||||
ADMIN_COMMUNICATION_SUGGESTION_VIEW,
|
||||
"건의사항 상세",
|
||||
"/communication/suggestions/view/{{pathVar}}",
|
||||
"/communication/suggestions/{{pathVar}}",
|
||||
false,
|
||||
Set.of("ROLE_ADMIN"));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user