로그관리 API return 구조 수정
This commit is contained in:
@@ -266,10 +266,10 @@ public class GlobalExceptionHandler {
|
||||
// TODO : 로그인 개발되면 이것도 연결해야 함
|
||||
Long userid = Long.valueOf(Optional.ofNullable(ApiLogFunction.getUserId(request)).orElse("1"));
|
||||
|
||||
// TODO : stackTrace limit 10줄? 확인 필요
|
||||
// TODO : stackTrace limit 20줄? 확인 필요
|
||||
String stackTraceStr =
|
||||
Arrays.stream(stackTrace)
|
||||
.limit(10)
|
||||
// .limit(20)
|
||||
.map(StackTraceElement::toString)
|
||||
.collect(Collectors.joining("\n"));
|
||||
|
||||
|
||||
@@ -23,15 +23,15 @@ public class AuditLogApiController {
|
||||
|
||||
@Operation(summary = "일자별 로그 조회")
|
||||
@GetMapping("/daily")
|
||||
public ApiResponseDto<Page<AuditLogDto.AuditList>> getDailyLogs(
|
||||
public ApiResponseDto<Page<AuditLogDto.DailyAuditList>> getDailyLogs(
|
||||
@RequestParam(required = false) LocalDate startDate,
|
||||
@RequestParam(required = false) LocalDate endDate,
|
||||
@RequestParam int page,
|
||||
@RequestParam(defaultValue = "20") int size) {
|
||||
AuditLogDto.DailySearchReq searchReq =
|
||||
new AuditLogDto.DailySearchReq(startDate, endDate, null, page, size, "created_dttm,desc");
|
||||
AuditLogDto.searchReq searchReq =
|
||||
new AuditLogDto.searchReq(page, size, "created_dttm,desc");
|
||||
|
||||
Page<AuditLogDto.AuditList> result =
|
||||
Page<AuditLogDto.DailyAuditList> result =
|
||||
auditLogCoreService.getLogByDaily(searchReq, startDate, endDate);
|
||||
|
||||
return ApiResponseDto.ok(result);
|
||||
@@ -39,13 +39,13 @@ public class AuditLogApiController {
|
||||
|
||||
@Operation(summary = "일자별 로그 상세")
|
||||
@GetMapping("/daily/result")
|
||||
public ApiResponseDto<Page<AuditLogDto.AuditDetail>> getDailyResultLogs(
|
||||
public ApiResponseDto<Page<AuditLogDto.DailyDetail>> getDailyResultLogs(
|
||||
@RequestParam LocalDate logDate,
|
||||
@RequestParam int page,
|
||||
@RequestParam(defaultValue = "20") int size) {
|
||||
AuditLogDto.DailySearchReq searchReq =
|
||||
new AuditLogDto.DailySearchReq(null, null, logDate, page, size, "created_dttm,desc");
|
||||
Page<AuditLogDto.AuditDetail> result =
|
||||
AuditLogDto.searchReq searchReq =
|
||||
new AuditLogDto.searchReq(page, size, "created_dttm,desc");
|
||||
Page<AuditLogDto.DailyDetail> result =
|
||||
auditLogCoreService.getLogByDailyResult(searchReq, logDate);
|
||||
|
||||
return ApiResponseDto.ok(result);
|
||||
@@ -53,26 +53,26 @@ public class AuditLogApiController {
|
||||
|
||||
@Operation(summary = "메뉴별 로그 조회")
|
||||
@GetMapping("/menu")
|
||||
public ApiResponseDto<Page<AuditLogDto.AuditList>> getMenuLogs(
|
||||
public ApiResponseDto<Page<AuditLogDto.MenuAuditList>> getMenuLogs(
|
||||
@RequestParam(required = false) String searchValue,
|
||||
@RequestParam int page,
|
||||
@RequestParam(defaultValue = "20") int size) {
|
||||
AuditLogDto.MenuUserSearchReq searchReq =
|
||||
new AuditLogDto.MenuUserSearchReq(searchValue, null, null, page, size, "created_dttm,desc");
|
||||
Page<AuditLogDto.AuditList> result = auditLogCoreService.getLogByMenu(searchReq, searchValue);
|
||||
AuditLogDto.searchReq searchReq =
|
||||
new AuditLogDto.searchReq(page, size, "created_dttm,desc");
|
||||
Page<AuditLogDto.MenuAuditList> result = auditLogCoreService.getLogByMenu(searchReq, searchValue);
|
||||
|
||||
return ApiResponseDto.ok(result);
|
||||
}
|
||||
|
||||
@Operation(summary = "메뉴별 로그 상세")
|
||||
@GetMapping("/menu/result")
|
||||
public ApiResponseDto<Page<AuditLogDto.AuditDetail>> getMenuResultLogs(
|
||||
public ApiResponseDto<Page<AuditLogDto.MenuDetail>> getMenuResultLogs(
|
||||
@RequestParam String menuId,
|
||||
@RequestParam int page,
|
||||
@RequestParam(defaultValue = "20") int size) {
|
||||
AuditLogDto.MenuUserSearchReq searchReq =
|
||||
new AuditLogDto.MenuUserSearchReq(null, menuId, null, page, size, "created_dttm,desc");
|
||||
Page<AuditLogDto.AuditDetail> result =
|
||||
AuditLogDto.searchReq searchReq =
|
||||
new AuditLogDto.searchReq(page, size, "created_dttm,desc");
|
||||
Page<AuditLogDto.MenuDetail> result =
|
||||
auditLogCoreService.getLogByMenuResult(searchReq, menuId);
|
||||
|
||||
return ApiResponseDto.ok(result);
|
||||
@@ -80,13 +80,13 @@ public class AuditLogApiController {
|
||||
|
||||
@Operation(summary = "사용자별 로그 조회")
|
||||
@GetMapping("/account")
|
||||
public ApiResponseDto<Page<AuditLogDto.AuditList>> getAccountLogs(
|
||||
public ApiResponseDto<Page<AuditLogDto.UserAuditList>> getAccountLogs(
|
||||
@RequestParam(required = false) String searchValue,
|
||||
@RequestParam int page,
|
||||
@RequestParam(defaultValue = "20") int size) {
|
||||
AuditLogDto.MenuUserSearchReq searchReq =
|
||||
new AuditLogDto.MenuUserSearchReq(searchValue, null, null, page, size, "created_dttm,desc");
|
||||
Page<AuditLogDto.AuditList> result =
|
||||
AuditLogDto.searchReq searchReq =
|
||||
new AuditLogDto.searchReq(page, size, "created_dttm,desc");
|
||||
Page<AuditLogDto.UserAuditList> result =
|
||||
auditLogCoreService.getLogByAccount(searchReq, searchValue);
|
||||
|
||||
return ApiResponseDto.ok(result);
|
||||
@@ -94,13 +94,13 @@ public class AuditLogApiController {
|
||||
|
||||
@Operation(summary = "사용자별 로그 상세")
|
||||
@GetMapping("/account/result")
|
||||
public ApiResponseDto<Page<AuditLogDto.AuditDetail>> getAccountResultLogs(
|
||||
public ApiResponseDto<Page<AuditLogDto.UserDetail>> getAccountResultLogs(
|
||||
@RequestParam Long userUid,
|
||||
@RequestParam int page,
|
||||
@RequestParam(defaultValue = "20") int size) {
|
||||
AuditLogDto.MenuUserSearchReq searchReq =
|
||||
new AuditLogDto.MenuUserSearchReq(null, null, userUid, page, size, "created_dttm,desc");
|
||||
Page<AuditLogDto.AuditDetail> result =
|
||||
AuditLogDto.searchReq searchReq =
|
||||
new AuditLogDto.searchReq(page, size, "created_dttm,desc");
|
||||
Page<AuditLogDto.UserDetail> result =
|
||||
auditLogCoreService.getLogByAccountResult(searchReq, userUid);
|
||||
|
||||
return ApiResponseDto.ok(result);
|
||||
|
||||
@@ -56,51 +56,104 @@ public class AuditLogDto {
|
||||
}
|
||||
}
|
||||
|
||||
@Schema(name = "AuditList", description = "감사 로그 목록")
|
||||
@Schema(name = "AuditCommon", description = "목록 공통")
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public static class AuditList {
|
||||
public static class AuditCommon {
|
||||
private int readCount;
|
||||
private int cudCount;
|
||||
private int printCount;
|
||||
private int downloadCount;
|
||||
private Long totalCount;
|
||||
}
|
||||
|
||||
private Long accountId;
|
||||
private String loginId;
|
||||
private String username;
|
||||
private LocalDateTime baseDate;
|
||||
private Long menuId;
|
||||
private String menuName;
|
||||
@Schema(name = "DailyAuditList", description = "일자별 목록")
|
||||
@Getter
|
||||
public static class DailyAuditList extends AuditCommon {
|
||||
private final String baseDate;
|
||||
|
||||
public AuditList(
|
||||
LocalDateTime baseDate,
|
||||
int readCount,
|
||||
int cudCount,
|
||||
int printCount,
|
||||
int downloadCount,
|
||||
Long totalCount) {
|
||||
public DailyAuditList(int readCount, int cudCount, int printCount, int downloadCount, Long totalCount, String baseDate) {
|
||||
super(readCount, cudCount, printCount, downloadCount, totalCount);
|
||||
this.baseDate = baseDate;
|
||||
this.readCount = readCount;
|
||||
this.cudCount = cudCount;
|
||||
this.printCount = printCount;
|
||||
this.downloadCount = downloadCount;
|
||||
this.totalCount = totalCount;
|
||||
}
|
||||
}
|
||||
|
||||
@Schema(name = "AuditDetail", description = "감사 로그 상세")
|
||||
@Schema(name = "MenuAuditList", description = "메뉴별 목록")
|
||||
@Getter
|
||||
public static class MenuAuditList extends AuditCommon {
|
||||
private final String menuId;
|
||||
private final String menuName;
|
||||
|
||||
public MenuAuditList(String menuId, String menuName, int readCount, int cudCount, int printCount, int downloadCount, Long totalCount) {
|
||||
super(readCount, cudCount, printCount, downloadCount, totalCount);
|
||||
this.menuId = menuId;
|
||||
this.menuName = menuName;
|
||||
}
|
||||
}
|
||||
|
||||
@Schema(name = "UserAuditList", description = "사용자별 목록")
|
||||
@Getter
|
||||
public static class UserAuditList extends AuditCommon {
|
||||
private final Long accountId;
|
||||
private final String loginId;
|
||||
private final String username;
|
||||
|
||||
public UserAuditList(Long accountId, String loginId, String username, int readCount, int cudCount, int printCount, int downloadCount, Long totalCount) {
|
||||
super(readCount, cudCount, printCount, downloadCount, totalCount);
|
||||
this.accountId = accountId;
|
||||
this.loginId = loginId;
|
||||
this.username = username;
|
||||
}
|
||||
}
|
||||
|
||||
@Schema(name = "AuditDetail", description = "감사 로그 상세 공통")
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public static class AuditDetail {
|
||||
private Long logId;
|
||||
private LocalDateTime logDateTime;
|
||||
private EventType eventType;
|
||||
private LogDetail detail;
|
||||
}
|
||||
|
||||
private String userName;
|
||||
private String loginId;
|
||||
private String menuName;
|
||||
@Schema(name = "DailyDetail", description = "일자별 로그 상세")
|
||||
@Getter
|
||||
public static class DailyDetail extends AuditDetail {
|
||||
private final String userName;
|
||||
private final String loginId;
|
||||
private final String menuName;
|
||||
|
||||
public DailyDetail(Long logId, String userName, String loginId, String menuName, EventType eventType, LogDetail detail){
|
||||
super(logId, eventType, detail);
|
||||
this.userName = userName;
|
||||
this.loginId = loginId;
|
||||
this.menuName = menuName;
|
||||
}
|
||||
}
|
||||
@Schema(name = "MenuDetail", description = "메뉴별 로그 상세")
|
||||
@Getter
|
||||
public static class MenuDetail extends AuditDetail {
|
||||
private final String logDateTime;
|
||||
private final String userName;
|
||||
private final String loginId;
|
||||
|
||||
public MenuDetail(Long logId, String logDateTime, String userName, String loginId, EventType eventType, LogDetail detail){
|
||||
super(logId, eventType, detail);
|
||||
this.logDateTime = logDateTime;
|
||||
this.userName = userName;
|
||||
this.loginId = loginId;
|
||||
}
|
||||
}
|
||||
@Schema(name = "UserDetail", description = "사용자별 로그 상세")
|
||||
@Getter
|
||||
public static class UserDetail extends AuditDetail {
|
||||
private final String logDateTime;
|
||||
private final String menuNm;
|
||||
|
||||
public UserDetail(Long logId, String logDateTime, String menuNm, EventType eventType, LogDetail detail){
|
||||
super(logId, eventType, detail);
|
||||
this.logDateTime = logDateTime;
|
||||
this.menuNm = menuNm;
|
||||
}
|
||||
}
|
||||
|
||||
@Getter
|
||||
@@ -112,22 +165,16 @@ public class AuditLogDto {
|
||||
String menuName;
|
||||
String menuUrl;
|
||||
String menuDescription;
|
||||
int sortOrder;
|
||||
Long sortOrder;
|
||||
boolean used;
|
||||
}
|
||||
|
||||
@Schema(name = "LogDailySearchReq", description = "일자별 로그 검색 요청")
|
||||
@Schema(name = "searchReq", description = "일자별 로그 검색 요청")
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class DailySearchReq {
|
||||
|
||||
private LocalDate startDate;
|
||||
private LocalDate endDate;
|
||||
|
||||
// 일자별 로그 검색 조건
|
||||
private LocalDate logDate;
|
||||
public static class searchReq {
|
||||
|
||||
// 페이징 파라미터
|
||||
private int page = 0;
|
||||
@@ -145,41 +192,4 @@ public class AuditLogDto {
|
||||
return PageRequest.of(page, size);
|
||||
}
|
||||
}
|
||||
|
||||
@Schema(name = "MenuUserSearchReq", description = "메뉴별,사용자별 로그 검색 요청")
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public static class MenuUserSearchReq {
|
||||
|
||||
// 메뉴별, 사용자별 로그 검색 조건
|
||||
private String searchValue;
|
||||
private String menuUid;
|
||||
private Long userUid; // menuId, userUid 조회
|
||||
|
||||
// 페이징 파라미터
|
||||
private int page = 0;
|
||||
private int size = 20;
|
||||
private String sort;
|
||||
|
||||
public MenuUserSearchReq(
|
||||
String searchValue, String menuUid, Long userUid, int page, int size, String sort) {
|
||||
this.searchValue = searchValue;
|
||||
this.menuUid = menuUid;
|
||||
this.page = page;
|
||||
this.size = size;
|
||||
this.sort = sort;
|
||||
}
|
||||
|
||||
public Pageable toPageable() {
|
||||
if (sort != null && !sort.isEmpty()) {
|
||||
String[] sortParams = sort.split(",");
|
||||
String property = sortParams[0];
|
||||
Sort.Direction direction =
|
||||
sortParams.length > 1 ? Sort.Direction.fromString(sortParams[1]) : Sort.Direction.ASC;
|
||||
return PageRequest.of(page, size, Sort.by(direction, property));
|
||||
}
|
||||
return PageRequest.of(page, size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
@RequiredArgsConstructor
|
||||
@Transactional(readOnly = true)
|
||||
public class AuditLogCoreService
|
||||
implements BaseCoreService<AuditLogDto.AuditList, Long, AuditLogDto.DailySearchReq> {
|
||||
implements BaseCoreService<AuditLogDto.DailyAuditList, Long, AuditLogDto.searchReq> {
|
||||
|
||||
private final AuditLogRepository auditLogRepository;
|
||||
|
||||
@@ -21,42 +21,42 @@ public class AuditLogCoreService
|
||||
public void remove(Long aLong) {}
|
||||
|
||||
@Override
|
||||
public AuditLogDto.AuditList getOneById(Long aLong) {
|
||||
public AuditLogDto.DailyAuditList getOneById(Long aLong) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<AuditLogDto.AuditList> search(AuditLogDto.DailySearchReq searchReq) {
|
||||
public Page<AuditLogDto.DailyAuditList> search(AuditLogDto.searchReq searchReq) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Page<AuditLogDto.AuditList> getLogByDaily(
|
||||
AuditLogDto.DailySearchReq searchRange, LocalDate startDate, LocalDate endDate) {
|
||||
public Page<AuditLogDto.DailyAuditList> getLogByDaily(
|
||||
AuditLogDto.searchReq searchRange, LocalDate startDate, LocalDate endDate) {
|
||||
return auditLogRepository.findLogByDaily(searchRange, startDate, endDate);
|
||||
}
|
||||
|
||||
public Page<AuditLogDto.AuditList> getLogByMenu(
|
||||
AuditLogDto.MenuUserSearchReq searchRange, String searchValue) {
|
||||
public Page<AuditLogDto.MenuAuditList> getLogByMenu(
|
||||
AuditLogDto.searchReq searchRange, String searchValue) {
|
||||
return auditLogRepository.findLogByMenu(searchRange, searchValue);
|
||||
}
|
||||
|
||||
public Page<AuditLogDto.AuditList> getLogByAccount(
|
||||
AuditLogDto.MenuUserSearchReq searchRange, String searchValue) {
|
||||
public Page<AuditLogDto.UserAuditList> getLogByAccount(
|
||||
AuditLogDto.searchReq searchRange, String searchValue) {
|
||||
return auditLogRepository.findLogByAccount(searchRange, searchValue);
|
||||
}
|
||||
|
||||
public Page<AuditLogDto.AuditDetail> getLogByDailyResult(
|
||||
AuditLogDto.DailySearchReq searchRange, LocalDate logDate) {
|
||||
public Page<AuditLogDto.DailyDetail> getLogByDailyResult(
|
||||
AuditLogDto.searchReq searchRange, LocalDate logDate) {
|
||||
return auditLogRepository.findLogByDailyResult(searchRange, logDate);
|
||||
}
|
||||
|
||||
public Page<AuditLogDto.AuditDetail> getLogByMenuResult(
|
||||
AuditLogDto.MenuUserSearchReq searchRange, String menuId) {
|
||||
public Page<AuditLogDto.MenuDetail> getLogByMenuResult(
|
||||
AuditLogDto.searchReq searchRange, String menuId) {
|
||||
return auditLogRepository.findLogByMenuResult(searchRange, menuId);
|
||||
}
|
||||
|
||||
public Page<AuditLogDto.AuditDetail> getLogByAccountResult(
|
||||
AuditLogDto.MenuUserSearchReq searchRange, Long accountId) {
|
||||
public Page<AuditLogDto.UserDetail> getLogByAccountResult(
|
||||
AuditLogDto.searchReq searchRange, Long accountId) {
|
||||
return auditLogRepository.findLogByAccountResult(searchRange, accountId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,21 +6,21 @@ import org.springframework.data.domain.Page;
|
||||
|
||||
public interface AuditLogRepositoryCustom {
|
||||
|
||||
Page<AuditLogDto.AuditList> findLogByDaily(
|
||||
AuditLogDto.DailySearchReq searchReq, LocalDate startDate, LocalDate endDate);
|
||||
Page<AuditLogDto.DailyAuditList> findLogByDaily(
|
||||
AuditLogDto.searchReq searchReq, LocalDate startDate, LocalDate endDate);
|
||||
|
||||
Page<AuditLogDto.AuditList> findLogByMenu(
|
||||
AuditLogDto.MenuUserSearchReq searchReq, String searchValue);
|
||||
Page<AuditLogDto.MenuAuditList> findLogByMenu(
|
||||
AuditLogDto.searchReq searchReq, String searchValue);
|
||||
|
||||
Page<AuditLogDto.AuditList> findLogByAccount(
|
||||
AuditLogDto.MenuUserSearchReq searchReq, String searchValue);
|
||||
Page<AuditLogDto.UserAuditList> findLogByAccount(
|
||||
AuditLogDto.searchReq searchReq, String searchValue);
|
||||
|
||||
Page<AuditLogDto.AuditDetail> findLogByDailyResult(
|
||||
AuditLogDto.DailySearchReq searchReq, LocalDate logDate);
|
||||
Page<AuditLogDto.DailyDetail> findLogByDailyResult(
|
||||
AuditLogDto.searchReq searchReq, LocalDate logDate);
|
||||
|
||||
Page<AuditLogDto.AuditDetail> findLogByMenuResult(
|
||||
AuditLogDto.MenuUserSearchReq searchReq, String menuId);
|
||||
Page<AuditLogDto.MenuDetail> findLogByMenuResult(
|
||||
AuditLogDto.searchReq searchReq, String menuId);
|
||||
|
||||
Page<AuditLogDto.AuditDetail> findLogByAccountResult(
|
||||
AuditLogDto.MenuUserSearchReq searchReq, Long accountId);
|
||||
Page<AuditLogDto.UserDetail> findLogByAccountResult(
|
||||
AuditLogDto.searchReq searchReq, Long accountId);
|
||||
}
|
||||
|
||||
@@ -36,24 +36,25 @@ public class AuditLogRepositoryImpl extends QuerydslRepositorySupport
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<AuditLogDto.AuditList> findLogByDaily(
|
||||
AuditLogDto.DailySearchReq searchReq, LocalDate startDate, LocalDate endDate) {
|
||||
DateTimeExpression<LocalDateTime> groupDateTime =
|
||||
Expressions.dateTimeTemplate(
|
||||
LocalDateTime.class, "date_trunc('day', {0})", auditLogEntity.createdDate);
|
||||
public Page<AuditLogDto.DailyAuditList> findLogByDaily(
|
||||
AuditLogDto.searchReq searchReq, LocalDate startDate, LocalDate endDate) {
|
||||
StringExpression groupDateTime =
|
||||
Expressions.stringTemplate("to_char({0}, 'YYYY-MM-DD')", auditLogEntity.createdDate);
|
||||
|
||||
Pageable pageable = searchReq.toPageable();
|
||||
List<AuditLogDto.AuditList> foundContent =
|
||||
List<AuditLogDto.DailyAuditList> foundContent =
|
||||
queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
AuditLogDto.AuditList.class,
|
||||
groupDateTime.as("baseDate"),
|
||||
AuditLogDto.DailyAuditList.class,
|
||||
readCount().as("readCount"),
|
||||
cudCount().as("cudCount"),
|
||||
printCount().as("printCount"),
|
||||
downloadCount().as("downloadCount"),
|
||||
auditLogEntity.count().as("totalCount")))
|
||||
auditLogEntity.count().as("totalCount"),
|
||||
groupDateTime.as("baseDate")
|
||||
)
|
||||
)
|
||||
.from(auditLogEntity)
|
||||
.where(eventEndedAtBetween(startDate, endDate))
|
||||
.groupBy(groupDateTime)
|
||||
@@ -73,14 +74,14 @@ public class AuditLogRepositoryImpl extends QuerydslRepositorySupport
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<AuditLogDto.AuditList> findLogByMenu(
|
||||
AuditLogDto.MenuUserSearchReq searchReq, String searchValue) {
|
||||
public Page<AuditLogDto.MenuAuditList> findLogByMenu(
|
||||
AuditLogDto.searchReq searchReq, String searchValue) {
|
||||
Pageable pageable = searchReq.toPageable();
|
||||
List<AuditLogDto.AuditList> foundContent =
|
||||
List<AuditLogDto.MenuAuditList> foundContent =
|
||||
queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
AuditLogDto.AuditList.class,
|
||||
AuditLogDto.MenuAuditList.class,
|
||||
auditLogEntity.menuUid.as("menuId"),
|
||||
menuEntity.menuNm.max().as("menuName"),
|
||||
readCount().as("readCount"),
|
||||
@@ -113,14 +114,14 @@ public class AuditLogRepositoryImpl extends QuerydslRepositorySupport
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<AuditLogDto.AuditList> findLogByAccount(
|
||||
AuditLogDto.MenuUserSearchReq searchReq, String searchValue) {
|
||||
public Page<AuditLogDto.UserAuditList> findLogByAccount(
|
||||
AuditLogDto.searchReq searchReq, String searchValue) {
|
||||
Pageable pageable = searchReq.toPageable();
|
||||
List<AuditLogDto.AuditList> foundContent =
|
||||
List<AuditLogDto.UserAuditList> foundContent =
|
||||
queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
AuditLogDto.AuditList.class,
|
||||
AuditLogDto.UserAuditList.class,
|
||||
auditLogEntity.userUid.as("accountId"),
|
||||
userEntity.userId.as("loginId"),
|
||||
userEntity.userNm.as("username"),
|
||||
@@ -152,8 +153,8 @@ public class AuditLogRepositoryImpl extends QuerydslRepositorySupport
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<AuditLogDto.AuditDetail> findLogByDailyResult(
|
||||
AuditLogDto.DailySearchReq searchReq, LocalDate logDate) {
|
||||
public Page<AuditLogDto.DailyDetail> findLogByDailyResult(
|
||||
AuditLogDto.searchReq searchReq, LocalDate logDate) {
|
||||
Pageable pageable = searchReq.toPageable();
|
||||
QMenuEntity parent = new QMenuEntity("parent");
|
||||
// 1depth menu name
|
||||
@@ -170,11 +171,11 @@ public class AuditLogRepositoryImpl extends QuerydslRepositorySupport
|
||||
.then(NULL_STRING)
|
||||
.otherwise(menuEntity.menuNm);
|
||||
|
||||
List<AuditLogDto.AuditDetail> foundContent =
|
||||
List<AuditLogDto.DailyDetail> foundContent =
|
||||
queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
AuditLogDto.AuditDetail.class,
|
||||
AuditLogDto.DailyDetail.class,
|
||||
auditLogEntity.id.as("logId"),
|
||||
userEntity.userNm.as("userName"),
|
||||
userEntity.userId.as("loginId"),
|
||||
@@ -217,8 +218,8 @@ public class AuditLogRepositoryImpl extends QuerydslRepositorySupport
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<AuditLogDto.AuditDetail> findLogByMenuResult(
|
||||
AuditLogDto.MenuUserSearchReq searchReq, String menuUid) {
|
||||
public Page<AuditLogDto.MenuDetail> findLogByMenuResult(
|
||||
AuditLogDto.searchReq searchReq, String menuUid) {
|
||||
Pageable pageable = searchReq.toPageable();
|
||||
QMenuEntity parent = new QMenuEntity("parent");
|
||||
// 1depth menu name
|
||||
@@ -235,13 +236,13 @@ public class AuditLogRepositoryImpl extends QuerydslRepositorySupport
|
||||
.then(NULL_STRING)
|
||||
.otherwise(menuEntity.menuNm);
|
||||
|
||||
List<AuditLogDto.AuditDetail> foundContent =
|
||||
List<AuditLogDto.MenuDetail> foundContent =
|
||||
queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
AuditLogDto.AuditDetail.class,
|
||||
AuditLogDto.MenuDetail.class,
|
||||
auditLogEntity.id.as("logId"),
|
||||
auditLogEntity.createdDate.as("logDateTime"),
|
||||
Expressions.stringTemplate("to_char({0}, 'YYYY-MM-DD')", auditLogEntity.createdDate).as("logDateTime"), //??
|
||||
userEntity.userNm.as("userName"),
|
||||
userEntity.userId.as("loginId"),
|
||||
auditLogEntity.eventType.as("eventType"),
|
||||
@@ -282,8 +283,8 @@ public class AuditLogRepositoryImpl extends QuerydslRepositorySupport
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<AuditLogDto.AuditDetail> findLogByAccountResult(
|
||||
AuditLogDto.MenuUserSearchReq searchReq, Long userUid) {
|
||||
public Page<AuditLogDto.UserDetail> findLogByAccountResult(
|
||||
AuditLogDto.searchReq searchReq, Long userUid) {
|
||||
Pageable pageable = searchReq.toPageable();
|
||||
QMenuEntity parent = new QMenuEntity("parent");
|
||||
// 1depth menu name
|
||||
@@ -300,13 +301,13 @@ public class AuditLogRepositoryImpl extends QuerydslRepositorySupport
|
||||
.then(NULL_STRING)
|
||||
.otherwise(menuEntity.menuNm);
|
||||
|
||||
List<AuditLogDto.AuditDetail> foundContent =
|
||||
List<AuditLogDto.UserDetail> foundContent =
|
||||
queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
AuditLogDto.AuditDetail.class,
|
||||
AuditLogDto.UserDetail.class,
|
||||
auditLogEntity.id.as("logId"),
|
||||
auditLogEntity.createdDate.as("logDateTime"),
|
||||
Expressions.stringTemplate("to_char({0}, 'YYYY-MM-DD')", auditLogEntity.createdDate).as("logDateTime"),
|
||||
menuEntity.menuNm.as("menuName"),
|
||||
auditLogEntity.eventType.as("eventType"),
|
||||
Projections.constructor(
|
||||
@@ -390,12 +391,11 @@ public class AuditLogRepositoryImpl extends QuerydslRepositorySupport
|
||||
}
|
||||
|
||||
private BooleanExpression eventEndedAtEqDate(LocalDate logDate) {
|
||||
DateTimeExpression<LocalDateTime> eventEndedDate =
|
||||
Expressions.dateTimeTemplate(
|
||||
LocalDateTime.class, "date_trunc('day', {0})", auditLogEntity.createdDate);
|
||||
StringExpression eventEndedDate =
|
||||
Expressions.stringTemplate("to_char({0}, 'YYYY-MM-DD')", auditLogEntity.createdDate);
|
||||
LocalDateTime comparisonDate = logDate.atStartOfDay();
|
||||
|
||||
return eventEndedDate.eq(comparisonDate);
|
||||
return eventEndedDate.eq(comparisonDate.toString());
|
||||
}
|
||||
|
||||
private BooleanExpression menuUidEq(String menuUid) {
|
||||
|
||||
Reference in New Issue
Block a user