관리자 목록 검색 수정
This commit is contained in:
@@ -45,7 +45,9 @@ class AdminExcelController {
|
|||||||
new GetAdminsCmd(
|
new GetAdminsCmd(
|
||||||
adminListFilterVO.getSearchField(),
|
adminListFilterVO.getSearchField(),
|
||||||
adminListFilterVO.getSearchValue(),
|
adminListFilterVO.getSearchValue(),
|
||||||
adminListFilterVO.getSearchRole()));
|
adminListFilterVO.getSearchRole(),
|
||||||
|
adminListFilterVO.getSearchArea(),
|
||||||
|
adminListFilterVO.getSearchDisabled()));
|
||||||
|
|
||||||
if (CollectionUtils.isNotEmpty(listOutput.getContent())) {
|
if (CollectionUtils.isNotEmpty(listOutput.getContent())) {
|
||||||
// Header
|
// Header
|
||||||
|
|||||||
@@ -37,7 +37,9 @@ class AdminListController {
|
|||||||
new GetAdminsCmd(
|
new GetAdminsCmd(
|
||||||
adminListFilterVO.getSearchField(),
|
adminListFilterVO.getSearchField(),
|
||||||
adminListFilterVO.getSearchValue(),
|
adminListFilterVO.getSearchValue(),
|
||||||
adminListFilterVO.getSearchRole()));
|
adminListFilterVO.getSearchRole(),
|
||||||
|
adminListFilterVO.getSearchArea(),
|
||||||
|
adminListFilterVO.getSearchDisabled()));
|
||||||
|
|
||||||
model.addAttribute("listOutput", listOutput);
|
model.addAttribute("listOutput", listOutput);
|
||||||
model.addAttribute("roles", roleListPortIn.connect(AppType.ADMIN));
|
model.addAttribute("roles", roleListPortIn.connect(AppType.ADMIN));
|
||||||
|
|||||||
@@ -12,4 +12,6 @@ public class AdminListFilterVO {
|
|||||||
private String searchField;
|
private String searchField;
|
||||||
private String searchValue;
|
private String searchValue;
|
||||||
private String searchRole;
|
private String searchRole;
|
||||||
|
private String searchArea;
|
||||||
|
private String searchDisabled;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,7 @@
|
|||||||
<p class="label-txt">실사</p>
|
<p class="label-txt">실사</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="component-select">
|
<div class="component-select">
|
||||||
<select class="select-list" id="searchArea" th:field="*{searchRole}">
|
<select class="select-list" id="searchArea" th:field="*{searchArea}">
|
||||||
<option selected value="">전체</option>
|
<option selected value="">전체</option>
|
||||||
<option th:each="region : ${regionMainCode}" th:text="${region.codeText}"
|
<option th:each="region : ${regionMainCode}" th:text="${region.codeText}"
|
||||||
th:value="${region.id}"></option>
|
th:value="${region.id}"></option>
|
||||||
@@ -65,7 +65,7 @@
|
|||||||
<p class="label-txt">계정사용여부</p>
|
<p class="label-txt">계정사용여부</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="component-select">
|
<div class="component-select">
|
||||||
<select class="select-list" id="searchDisabled" th:field="*{searchRole}">
|
<select class="select-list" id="searchDisabled" th:field="*{searchDisabled}">
|
||||||
<option selected value="">전체</option>
|
<option selected value="">전체</option>
|
||||||
<option value="false">사용</option>
|
<option value="false">사용</option>
|
||||||
<option value="true">미사용</option>
|
<option value="true">미사용</option>
|
||||||
@@ -147,11 +147,11 @@
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section layout:fragment="script">
|
<section layout:fragment="script">
|
||||||
<script th:inline="javascript">
|
<!-- <script th:inline="javascript">
|
||||||
// 목록 정렬 표기 및 갱신 기능 적용
|
// 목록 정렬 표기 및 갱신 기능 적용
|
||||||
uiUtil.applyListSortNotation([[${listOutput.pageable.pageSize}]],
|
uiUtil.applyListSortNotation([[${listOutput.pageable.pageSize}]],
|
||||||
[[${listOutput.pageable.sort.toString()}]]);
|
[[${listOutput.pageable.sort.toString()}]]);
|
||||||
</script>
|
</script>-->
|
||||||
|
|
||||||
<script th:inline="javascript">
|
<script th:inline="javascript">
|
||||||
// 검색
|
// 검색
|
||||||
|
|||||||
@@ -29,10 +29,14 @@ class GetAdminsDao implements GetAdminsPortOut {
|
|||||||
public Page<GetAdmins> connect(Pageable pageable, GetAdminsCmd filterCommand) {
|
public Page<GetAdmins> connect(Pageable pageable, GetAdminsCmd filterCommand) {
|
||||||
// 관리자 목록 조회
|
// 관리자 목록 조회
|
||||||
List<GetAdminsDto> admins = getAdminsMapper.findAll(filterCommand, pageable);
|
List<GetAdminsDto> admins = getAdminsMapper.findAll(filterCommand, pageable);
|
||||||
|
List<GetAdminsRole> roles;
|
||||||
// 관리자의 역할 목록 조회
|
if(!admins.isEmpty()){
|
||||||
List<GetAdminsRole> roles = getAdminsMapper.findRolesWithPrivilegesByAdminIds(
|
roles = getAdminsMapper.findRolesWithPrivilegesByAdminIds(
|
||||||
admins.stream().map(GetAdminsDto::getSeq).toList());
|
admins.stream().map(GetAdminsDto::getSeq).toList());
|
||||||
|
} else {
|
||||||
|
roles = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return new PageImpl<>(
|
return new PageImpl<>(
|
||||||
admins.stream()
|
admins.stream()
|
||||||
@@ -46,9 +50,9 @@ class GetAdminsDao implements GetAdminsPortOut {
|
|||||||
admin.getAccountDisabled(),
|
admin.getAccountDisabled(),
|
||||||
admin.getAccountLocked(),
|
admin.getAccountLocked(),
|
||||||
admin.getTotal(),
|
admin.getTotal(),
|
||||||
roles.stream()
|
roles != null ? roles.stream()
|
||||||
.filter(r -> r.getAdminSeq().equals(admin.getSeq()))
|
.filter(r -> r.getAdminSeq().equals(admin.getSeq()))
|
||||||
.collect(Collectors.toList())
|
.collect(Collectors.toList()):null
|
||||||
)).toList(),
|
)).toList(),
|
||||||
pageable,
|
pageable,
|
||||||
admins.isEmpty() ? 0 : admins.get(0).getTotal());
|
admins.isEmpty() ? 0 : admins.get(0).getTotal());
|
||||||
|
|||||||
@@ -9,6 +9,9 @@ import lombok.Setter;
|
|||||||
public class GetAdminsDto {
|
public class GetAdminsDto {
|
||||||
private Long seq;
|
private Long seq;
|
||||||
private String id;
|
private String id;
|
||||||
|
private String name;
|
||||||
|
private String phone;
|
||||||
|
private String regionMainCodeName;
|
||||||
private String createdBy;
|
private String createdBy;
|
||||||
private LocalDateTime createdAt;
|
private LocalDateTime createdAt;
|
||||||
private String updatedBy;
|
private String updatedBy;
|
||||||
|
|||||||
@@ -10,4 +10,6 @@ public class GetAdminsCmd {
|
|||||||
private final String searchField;
|
private final String searchField;
|
||||||
private final String searchValue;
|
private final String searchValue;
|
||||||
private final String searchRole;
|
private final String searchRole;
|
||||||
|
private final String searchArea;
|
||||||
|
private final String searchDisabled;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,10 @@
|
|||||||
SELECT
|
SELECT
|
||||||
a.seq,
|
a.seq,
|
||||||
a.id AS id,
|
a.id AS id,
|
||||||
|
a.name,
|
||||||
|
a.region_main_code,
|
||||||
|
u.code_text as region_main_code_name,
|
||||||
|
a.phone,
|
||||||
a.created_by,
|
a.created_by,
|
||||||
a.created_at,
|
a.created_at,
|
||||||
a.updated_by,
|
a.updated_by,
|
||||||
@@ -16,15 +20,24 @@
|
|||||||
a.account_locked,
|
a.account_locked,
|
||||||
COUNT(*) OVER() AS total
|
COUNT(*) OVER() AS total
|
||||||
FROM admin a
|
FROM admin a
|
||||||
|
LEFT JOIN uicode u ON u.parent_id = 'code.region.main' AND u.id = a.region_main_code
|
||||||
WHERE a.is_deleted = false
|
WHERE a.is_deleted = false
|
||||||
|
|
||||||
<if test="cmd.searchField != null and cmd.searchValue != null and cmd.searchValue != ''">
|
<if test="cmd.searchField != null and cmd.searchValue != null and cmd.searchValue != ''">
|
||||||
<choose>
|
<choose>
|
||||||
<when test="cmd.searchField == 'email'">AND a.email ILIKE '%' || #{cmd.searchValue} || '%'</when>
|
<when test="cmd.searchField == 'name'">AND a.name LIKE '%' || #{cmd.searchValue} || '%'</when>
|
||||||
<when test="cmd.searchField == 'id'">AND a.id ILIKE '%' || #{cmd.searchValue} || '%'</when>
|
<when test="cmd.searchField == 'id'">AND a.id LIKE '%' || #{cmd.searchValue} || '%'</when>
|
||||||
</choose>
|
</choose>
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
|
<if test="cmd.searchArea != null and cmd.searchArea != '' ">
|
||||||
|
AND a.region_main_code = #{cmd.searchArea}
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="cmd.searchDisabled != null and cmd.searchDisabled != '' ">
|
||||||
|
AND a.account_disabled = #{cmd.searchDisabled}
|
||||||
|
</if>
|
||||||
|
|
||||||
<if test="cmd.searchRole != null and cmd.searchRole != ''">
|
<if test="cmd.searchRole != null and cmd.searchRole != ''">
|
||||||
AND EXISTS (
|
AND EXISTS (
|
||||||
SELECT 1
|
SELECT 1
|
||||||
|
|||||||
Reference in New Issue
Block a user