tb_user 제거
This commit is contained in:
@@ -1,106 +0,0 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.entity;
|
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
|
||||||
import jakarta.persistence.Entity;
|
|
||||||
import jakarta.persistence.GeneratedValue;
|
|
||||||
import jakarta.persistence.GenerationType;
|
|
||||||
import jakarta.persistence.Id;
|
|
||||||
import jakarta.persistence.SequenceGenerator;
|
|
||||||
import jakarta.persistence.Table;
|
|
||||||
import jakarta.persistence.UniqueConstraint;
|
|
||||||
import jakarta.validation.constraints.NotNull;
|
|
||||||
import jakarta.validation.constraints.Size;
|
|
||||||
import java.time.ZonedDateTime;
|
|
||||||
import lombok.AccessLevel;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import lombok.Setter;
|
|
||||||
import org.hibernate.annotations.ColumnDefault;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@Entity
|
|
||||||
@NoArgsConstructor(access = AccessLevel.PROTECTED)
|
|
||||||
@Table(
|
|
||||||
name = "tb_user",
|
|
||||||
uniqueConstraints = {@UniqueConstraint(name = "ux_tb_user_user_id", columnNames = "user_id")})
|
|
||||||
public class UserEntity {
|
|
||||||
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "tb_user_id_gen")
|
|
||||||
@SequenceGenerator(
|
|
||||||
name = "tb_user_id_gen",
|
|
||||||
sequenceName = "tb_user_user_uid_seq",
|
|
||||||
allocationSize = 1)
|
|
||||||
@Column(name = "user_uid", nullable = false)
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
@Size(max = 255)
|
|
||||||
@NotNull
|
|
||||||
@Column(name = "user_nm", nullable = false)
|
|
||||||
private String userNm;
|
|
||||||
|
|
||||||
@Size(max = 255)
|
|
||||||
@NotNull
|
|
||||||
@Column(name = "user_id", nullable = false)
|
|
||||||
private String userId;
|
|
||||||
|
|
||||||
@Size(max = 255)
|
|
||||||
@NotNull
|
|
||||||
@Column(name = "user_pw", nullable = false)
|
|
||||||
private String userPw;
|
|
||||||
|
|
||||||
@Size(max = 255)
|
|
||||||
@NotNull
|
|
||||||
@ColumnDefault("'ACTIVE'")
|
|
||||||
@Column(name = "state", nullable = false)
|
|
||||||
private String state = "ACTIVE";
|
|
||||||
|
|
||||||
@Column(name = "date_withdrawal")
|
|
||||||
private ZonedDateTime dateWithdrawal;
|
|
||||||
|
|
||||||
@ColumnDefault("now()")
|
|
||||||
@Column(name = "created_dttm")
|
|
||||||
private ZonedDateTime createdDttm;
|
|
||||||
|
|
||||||
@ColumnDefault("now()")
|
|
||||||
@Column(name = "updated_dttm")
|
|
||||||
private ZonedDateTime updatedDttm;
|
|
||||||
|
|
||||||
@Column(name = "created_uid")
|
|
||||||
private Long createdUid;
|
|
||||||
|
|
||||||
@Column(name = "updated_uid")
|
|
||||||
private Long updatedUid;
|
|
||||||
|
|
||||||
@Size(max = 255)
|
|
||||||
@Column(name = "user_email")
|
|
||||||
private String userEmail;
|
|
||||||
|
|
||||||
@Size(max = 20)
|
|
||||||
@NotNull
|
|
||||||
@Column(name = "user_auth", nullable = false, length = 20)
|
|
||||||
private String userAuth;
|
|
||||||
|
|
||||||
@Size(max = 255)
|
|
||||||
@NotNull
|
|
||||||
@Column(name = "emp_id", nullable = false)
|
|
||||||
private String empId;
|
|
||||||
|
|
||||||
public UserEntity(
|
|
||||||
Long id,
|
|
||||||
String userAuth,
|
|
||||||
String userNm,
|
|
||||||
String userId,
|
|
||||||
String empId,
|
|
||||||
String userEmail,
|
|
||||||
String userPw) {
|
|
||||||
this.id = id;
|
|
||||||
this.userAuth = userAuth;
|
|
||||||
this.userNm = userNm;
|
|
||||||
this.userId = userId;
|
|
||||||
this.empId = empId;
|
|
||||||
this.userEmail = userEmail;
|
|
||||||
this.userPw = userPw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -2,8 +2,8 @@ package com.kamco.cd.kamcoback.postgres.repository.log;
|
|||||||
|
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QAuditLogEntity.auditLogEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QAuditLogEntity.auditLogEntity;
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QErrorLogEntity.errorLogEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QErrorLogEntity.errorLogEntity;
|
||||||
|
import static com.kamco.cd.kamcoback.postgres.entity.QMemberEntity.memberEntity;
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QMenuEntity.menuEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QMenuEntity.menuEntity;
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QUserEntity.userEntity;
|
|
||||||
|
|
||||||
import com.kamco.cd.kamcoback.log.dto.AuditLogDto;
|
import com.kamco.cd.kamcoback.log.dto.AuditLogDto;
|
||||||
import com.kamco.cd.kamcoback.log.dto.ErrorLogDto;
|
import com.kamco.cd.kamcoback.log.dto.ErrorLogDto;
|
||||||
@@ -12,7 +12,11 @@ import com.kamco.cd.kamcoback.log.dto.EventType;
|
|||||||
import com.kamco.cd.kamcoback.postgres.entity.AuditLogEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.AuditLogEntity;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.QMenuEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.QMenuEntity;
|
||||||
import com.querydsl.core.types.Projections;
|
import com.querydsl.core.types.Projections;
|
||||||
import com.querydsl.core.types.dsl.*;
|
import com.querydsl.core.types.dsl.BooleanExpression;
|
||||||
|
import com.querydsl.core.types.dsl.CaseBuilder;
|
||||||
|
import com.querydsl.core.types.dsl.Expressions;
|
||||||
|
import com.querydsl.core.types.dsl.NumberExpression;
|
||||||
|
import com.querydsl.core.types.dsl.StringExpression;
|
||||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||||
import io.micrometer.common.util.StringUtils;
|
import io.micrometer.common.util.StringUtils;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
@@ -26,7 +30,8 @@ import org.springframework.data.domain.Pageable;
|
|||||||
import org.springframework.data.jpa.repository.support.QuerydslRepositorySupport;
|
import org.springframework.data.jpa.repository.support.QuerydslRepositorySupport;
|
||||||
|
|
||||||
public class AuditLogRepositoryImpl extends QuerydslRepositorySupport
|
public class AuditLogRepositoryImpl extends QuerydslRepositorySupport
|
||||||
implements AuditLogRepositoryCustom {
|
implements AuditLogRepositoryCustom {
|
||||||
|
|
||||||
private final JPAQueryFactory queryFactory;
|
private final JPAQueryFactory queryFactory;
|
||||||
private final StringExpression NULL_STRING = Expressions.stringTemplate("cast(null as text)");
|
private final StringExpression NULL_STRING = Expressions.stringTemplate("cast(null as text)");
|
||||||
|
|
||||||
@@ -37,313 +42,313 @@ public class AuditLogRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<AuditLogDto.DailyAuditList> findLogByDaily(
|
public Page<AuditLogDto.DailyAuditList> findLogByDaily(
|
||||||
AuditLogDto.searchReq searchReq, LocalDate startDate, LocalDate endDate) {
|
AuditLogDto.searchReq searchReq, LocalDate startDate, LocalDate endDate) {
|
||||||
StringExpression groupDateTime =
|
StringExpression groupDateTime =
|
||||||
Expressions.stringTemplate("to_char({0}, 'YYYY-MM-DD')", auditLogEntity.createdDate);
|
Expressions.stringTemplate("to_char({0}, 'YYYY-MM-DD')", auditLogEntity.createdDate);
|
||||||
|
|
||||||
Pageable pageable = searchReq.toPageable();
|
Pageable pageable = searchReq.toPageable();
|
||||||
List<AuditLogDto.DailyAuditList> foundContent =
|
List<AuditLogDto.DailyAuditList> foundContent =
|
||||||
queryFactory
|
queryFactory
|
||||||
.select(
|
.select(
|
||||||
Projections.constructor(
|
Projections.constructor(
|
||||||
AuditLogDto.DailyAuditList.class,
|
AuditLogDto.DailyAuditList.class,
|
||||||
readCount().as("readCount"),
|
readCount().as("readCount"),
|
||||||
cudCount().as("cudCount"),
|
cudCount().as("cudCount"),
|
||||||
printCount().as("printCount"),
|
printCount().as("printCount"),
|
||||||
downloadCount().as("downloadCount"),
|
downloadCount().as("downloadCount"),
|
||||||
auditLogEntity.count().as("totalCount"),
|
auditLogEntity.count().as("totalCount"),
|
||||||
groupDateTime.as("baseDate")))
|
groupDateTime.as("baseDate")))
|
||||||
.from(auditLogEntity)
|
.from(auditLogEntity)
|
||||||
.where(eventEndedAtBetween(startDate, endDate))
|
.where(eventEndedAtBetween(startDate, endDate))
|
||||||
.groupBy(groupDateTime)
|
.groupBy(groupDateTime)
|
||||||
.offset(pageable.getOffset())
|
.offset(pageable.getOffset())
|
||||||
.limit(pageable.getPageSize())
|
.limit(pageable.getPageSize())
|
||||||
.orderBy(groupDateTime.desc())
|
.orderBy(groupDateTime.desc())
|
||||||
.fetch();
|
.fetch();
|
||||||
|
|
||||||
Long countQuery =
|
Long countQuery =
|
||||||
queryFactory
|
queryFactory
|
||||||
.select(groupDateTime.countDistinct())
|
.select(groupDateTime.countDistinct())
|
||||||
.from(auditLogEntity)
|
.from(auditLogEntity)
|
||||||
.where(eventEndedAtBetween(startDate, endDate))
|
.where(eventEndedAtBetween(startDate, endDate))
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
|
|
||||||
return new PageImpl<>(foundContent, pageable, countQuery);
|
return new PageImpl<>(foundContent, pageable, countQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<AuditLogDto.MenuAuditList> findLogByMenu(
|
public Page<AuditLogDto.MenuAuditList> findLogByMenu(
|
||||||
AuditLogDto.searchReq searchReq, String searchValue) {
|
AuditLogDto.searchReq searchReq, String searchValue) {
|
||||||
Pageable pageable = searchReq.toPageable();
|
Pageable pageable = searchReq.toPageable();
|
||||||
List<AuditLogDto.MenuAuditList> foundContent =
|
List<AuditLogDto.MenuAuditList> foundContent =
|
||||||
queryFactory
|
queryFactory
|
||||||
.select(
|
.select(
|
||||||
Projections.constructor(
|
Projections.constructor(
|
||||||
AuditLogDto.MenuAuditList.class,
|
AuditLogDto.MenuAuditList.class,
|
||||||
auditLogEntity.menuUid.as("menuId"),
|
auditLogEntity.menuUid.as("menuId"),
|
||||||
menuEntity.menuNm.max().as("menuName"),
|
menuEntity.menuNm.max().as("menuName"),
|
||||||
readCount().as("readCount"),
|
readCount().as("readCount"),
|
||||||
cudCount().as("cudCount"),
|
cudCount().as("cudCount"),
|
||||||
printCount().as("printCount"),
|
printCount().as("printCount"),
|
||||||
downloadCount().as("downloadCount"),
|
downloadCount().as("downloadCount"),
|
||||||
auditLogEntity.count().as("totalCount")))
|
auditLogEntity.count().as("totalCount")))
|
||||||
.from(auditLogEntity)
|
.from(auditLogEntity)
|
||||||
.leftJoin(menuEntity)
|
.leftJoin(menuEntity)
|
||||||
.on(auditLogEntity.menuUid.eq(menuEntity.menuUid))
|
.on(auditLogEntity.menuUid.eq(menuEntity.menuUid))
|
||||||
.where(menuNameEquals(searchValue))
|
.where(menuNameEquals(searchValue))
|
||||||
.groupBy(auditLogEntity.menuUid)
|
.groupBy(auditLogEntity.menuUid)
|
||||||
.offset(pageable.getOffset())
|
.offset(pageable.getOffset())
|
||||||
.limit(pageable.getPageSize())
|
.limit(pageable.getPageSize())
|
||||||
.orderBy(auditLogEntity.createdDate.max().desc())
|
.orderBy(auditLogEntity.createdDate.max().desc())
|
||||||
.fetch();
|
.fetch();
|
||||||
|
|
||||||
// count query group by 를 지정하면 하나의 row 가 아니라 그룹핑된 여러 row 가 나올 수 있다.
|
// count query group by 를 지정하면 하나의 row 가 아니라 그룹핑된 여러 row 가 나올 수 있다.
|
||||||
// select query 의 group by 대상의 컬럼을 count query 에선 select distinct 로 처리 한다.
|
// select query 의 group by 대상의 컬럼을 count query 에선 select distinct 로 처리 한다.
|
||||||
Long countQuery =
|
Long countQuery =
|
||||||
queryFactory
|
queryFactory
|
||||||
.select(auditLogEntity.menuUid.countDistinct())
|
.select(auditLogEntity.menuUid.countDistinct())
|
||||||
.from(auditLogEntity)
|
.from(auditLogEntity)
|
||||||
.leftJoin(menuEntity)
|
.leftJoin(menuEntity)
|
||||||
.on(auditLogEntity.menuUid.eq(menuEntity.menuUid))
|
.on(auditLogEntity.menuUid.eq(menuEntity.menuUid))
|
||||||
.where(menuNameEquals(searchValue))
|
.where(menuNameEquals(searchValue))
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
|
|
||||||
return new PageImpl<>(foundContent, pageable, countQuery);
|
return new PageImpl<>(foundContent, pageable, countQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<AuditLogDto.UserAuditList> findLogByAccount(
|
public Page<AuditLogDto.UserAuditList> findLogByAccount(
|
||||||
AuditLogDto.searchReq searchReq, String searchValue) {
|
AuditLogDto.searchReq searchReq, String searchValue) {
|
||||||
Pageable pageable = searchReq.toPageable();
|
Pageable pageable = searchReq.toPageable();
|
||||||
List<AuditLogDto.UserAuditList> foundContent =
|
List<AuditLogDto.UserAuditList> foundContent =
|
||||||
queryFactory
|
queryFactory
|
||||||
.select(
|
.select(
|
||||||
Projections.constructor(
|
Projections.constructor(
|
||||||
AuditLogDto.UserAuditList.class,
|
AuditLogDto.UserAuditList.class,
|
||||||
auditLogEntity.userUid.as("accountId"),
|
auditLogEntity.userUid.as("accountId"),
|
||||||
userEntity.userId.as("loginId"),
|
memberEntity.employeeNo.as("loginId"),
|
||||||
userEntity.userNm.as("username"),
|
memberEntity.name.as("username"),
|
||||||
readCount().as("readCount"),
|
readCount().as("readCount"),
|
||||||
cudCount().as("cudCount"),
|
cudCount().as("cudCount"),
|
||||||
printCount().as("printCount"),
|
printCount().as("printCount"),
|
||||||
downloadCount().as("downloadCount"),
|
downloadCount().as("downloadCount"),
|
||||||
auditLogEntity.count().as("totalCount")))
|
auditLogEntity.count().as("totalCount")))
|
||||||
.from(auditLogEntity)
|
.from(auditLogEntity)
|
||||||
.leftJoin(userEntity)
|
.leftJoin(memberEntity)
|
||||||
.on(auditLogEntity.userUid.eq(userEntity.id))
|
.on(auditLogEntity.userUid.eq(memberEntity.id))
|
||||||
.where(loginIdOrUsernameContains(searchValue))
|
.where(loginIdOrUsernameContains(searchValue))
|
||||||
.groupBy(auditLogEntity.userUid, userEntity.userId, userEntity.userNm)
|
.groupBy(auditLogEntity.userUid, memberEntity.employeeNo, memberEntity.name)
|
||||||
.offset(pageable.getOffset())
|
.offset(pageable.getOffset())
|
||||||
.limit(pageable.getPageSize())
|
.limit(pageable.getPageSize())
|
||||||
// .orderBy(auditLogEntity.eventEndedAt.max().desc())
|
// .orderBy(auditLogEntity.eventEndedAt.max().desc())
|
||||||
.fetch();
|
.fetch();
|
||||||
|
|
||||||
Long countQuery =
|
Long countQuery =
|
||||||
queryFactory
|
queryFactory
|
||||||
.select(auditLogEntity.userUid.countDistinct())
|
.select(auditLogEntity.userUid.countDistinct())
|
||||||
.from(auditLogEntity)
|
.from(auditLogEntity)
|
||||||
.leftJoin(userEntity)
|
.leftJoin(memberEntity)
|
||||||
.on(auditLogEntity.userUid.eq(userEntity.id))
|
.on(auditLogEntity.userUid.eq(memberEntity.id))
|
||||||
.where(loginIdOrUsernameContains(searchValue))
|
.where(loginIdOrUsernameContains(searchValue))
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
|
|
||||||
return new PageImpl<>(foundContent, pageable, countQuery);
|
return new PageImpl<>(foundContent, pageable, countQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<AuditLogDto.DailyDetail> findLogByDailyResult(
|
public Page<AuditLogDto.DailyDetail> findLogByDailyResult(
|
||||||
AuditLogDto.searchReq searchReq, LocalDate logDate) {
|
AuditLogDto.searchReq searchReq, LocalDate logDate) {
|
||||||
Pageable pageable = searchReq.toPageable();
|
Pageable pageable = searchReq.toPageable();
|
||||||
QMenuEntity parent = new QMenuEntity("parent");
|
QMenuEntity parent = new QMenuEntity("parent");
|
||||||
// 1depth menu name
|
// 1depth menu name
|
||||||
StringExpression parentMenuName =
|
StringExpression parentMenuName =
|
||||||
new CaseBuilder()
|
new CaseBuilder()
|
||||||
.when(parent.menuUid.isNull())
|
.when(parent.menuUid.isNull())
|
||||||
.then(menuEntity.menuNm)
|
.then(menuEntity.menuNm)
|
||||||
.otherwise(parent.menuNm);
|
.otherwise(parent.menuNm);
|
||||||
|
|
||||||
// 2depth menu name
|
// 2depth menu name
|
||||||
StringExpression menuName =
|
StringExpression menuName =
|
||||||
new CaseBuilder()
|
new CaseBuilder()
|
||||||
.when(parent.menuUid.isNull())
|
.when(parent.menuUid.isNull())
|
||||||
.then(NULL_STRING)
|
.then(NULL_STRING)
|
||||||
.otherwise(menuEntity.menuNm);
|
.otherwise(menuEntity.menuNm);
|
||||||
|
|
||||||
List<AuditLogDto.DailyDetail> foundContent =
|
List<AuditLogDto.DailyDetail> foundContent =
|
||||||
queryFactory
|
queryFactory
|
||||||
.select(
|
.select(
|
||||||
Projections.constructor(
|
Projections.constructor(
|
||||||
AuditLogDto.DailyDetail.class,
|
AuditLogDto.DailyDetail.class,
|
||||||
auditLogEntity.id.as("logId"),
|
auditLogEntity.id.as("logId"),
|
||||||
userEntity.userNm.as("userName"),
|
memberEntity.name.as("userName"),
|
||||||
userEntity.userId.as("loginId"),
|
memberEntity.employeeNo.as("loginId"),
|
||||||
menuEntity.menuNm.as("menuName"),
|
menuEntity.menuNm.as("menuName"),
|
||||||
auditLogEntity.eventType.as("eventType"),
|
auditLogEntity.eventType.as("eventType"),
|
||||||
Projections.constructor(
|
Projections.constructor(
|
||||||
AuditLogDto.LogDetail.class,
|
AuditLogDto.LogDetail.class,
|
||||||
Expressions.constant("한국자산관리공사"), // serviceName
|
Expressions.constant("한국자산관리공사"), // serviceName
|
||||||
parentMenuName.as("parentMenuName"),
|
parentMenuName.as("parentMenuName"),
|
||||||
menuName,
|
menuName,
|
||||||
menuEntity.menuUrl.as("menuUrl"),
|
menuEntity.menuUrl.as("menuUrl"),
|
||||||
menuEntity.description.as("menuDescription"),
|
menuEntity.description.as("menuDescription"),
|
||||||
menuEntity.menuOrder.as("sortOrder"),
|
menuEntity.menuOrder.as("sortOrder"),
|
||||||
menuEntity.isUse.as("used"))))
|
menuEntity.isUse.as("used"))))
|
||||||
.from(auditLogEntity)
|
.from(auditLogEntity)
|
||||||
.leftJoin(menuEntity)
|
.leftJoin(menuEntity)
|
||||||
.on(auditLogEntity.menuUid.eq(menuEntity.menuUid))
|
.on(auditLogEntity.menuUid.eq(menuEntity.menuUid))
|
||||||
.leftJoin(menuEntity.parent, parent)
|
.leftJoin(menuEntity.parent, parent)
|
||||||
.leftJoin(userEntity)
|
.leftJoin(memberEntity)
|
||||||
.on(auditLogEntity.userUid.eq(userEntity.id))
|
.on(auditLogEntity.userUid.eq(memberEntity.id))
|
||||||
.where(eventEndedAtEqDate(logDate))
|
.where(eventEndedAtEqDate(logDate))
|
||||||
.offset(pageable.getOffset())
|
.offset(pageable.getOffset())
|
||||||
.limit(pageable.getPageSize())
|
.limit(pageable.getPageSize())
|
||||||
.orderBy(auditLogEntity.createdDate.desc())
|
.orderBy(auditLogEntity.createdDate.desc())
|
||||||
.fetch();
|
.fetch();
|
||||||
|
|
||||||
Long countQuery =
|
Long countQuery =
|
||||||
queryFactory
|
queryFactory
|
||||||
.select(auditLogEntity.id.countDistinct())
|
.select(auditLogEntity.id.countDistinct())
|
||||||
.from(auditLogEntity)
|
.from(auditLogEntity)
|
||||||
.leftJoin(menuEntity)
|
.leftJoin(menuEntity)
|
||||||
.on(auditLogEntity.menuUid.eq(menuEntity.menuUid))
|
.on(auditLogEntity.menuUid.eq(menuEntity.menuUid))
|
||||||
.leftJoin(menuEntity.parent, parent)
|
.leftJoin(menuEntity.parent, parent)
|
||||||
.leftJoin(userEntity)
|
.leftJoin(memberEntity)
|
||||||
.on(auditLogEntity.userUid.eq(userEntity.id))
|
.on(auditLogEntity.userUid.eq(memberEntity.id))
|
||||||
.where(eventEndedAtEqDate(logDate))
|
.where(eventEndedAtEqDate(logDate))
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
|
|
||||||
return new PageImpl<>(foundContent, pageable, countQuery);
|
return new PageImpl<>(foundContent, pageable, countQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<AuditLogDto.MenuDetail> findLogByMenuResult(
|
public Page<AuditLogDto.MenuDetail> findLogByMenuResult(
|
||||||
AuditLogDto.searchReq searchReq, String menuUid) {
|
AuditLogDto.searchReq searchReq, String menuUid) {
|
||||||
Pageable pageable = searchReq.toPageable();
|
Pageable pageable = searchReq.toPageable();
|
||||||
QMenuEntity parent = new QMenuEntity("parent");
|
QMenuEntity parent = new QMenuEntity("parent");
|
||||||
// 1depth menu name
|
// 1depth menu name
|
||||||
StringExpression parentMenuName =
|
StringExpression parentMenuName =
|
||||||
new CaseBuilder()
|
new CaseBuilder()
|
||||||
.when(parent.menuUid.isNull())
|
.when(parent.menuUid.isNull())
|
||||||
.then(menuEntity.menuNm)
|
.then(menuEntity.menuNm)
|
||||||
.otherwise(parent.menuNm);
|
.otherwise(parent.menuNm);
|
||||||
|
|
||||||
// 2depth menu name
|
// 2depth menu name
|
||||||
StringExpression menuName =
|
StringExpression menuName =
|
||||||
new CaseBuilder()
|
new CaseBuilder()
|
||||||
.when(parent.menuUid.isNull())
|
.when(parent.menuUid.isNull())
|
||||||
.then(NULL_STRING)
|
.then(NULL_STRING)
|
||||||
.otherwise(menuEntity.menuNm);
|
.otherwise(menuEntity.menuNm);
|
||||||
|
|
||||||
List<AuditLogDto.MenuDetail> foundContent =
|
List<AuditLogDto.MenuDetail> foundContent =
|
||||||
queryFactory
|
queryFactory
|
||||||
.select(
|
.select(
|
||||||
Projections.constructor(
|
Projections.constructor(
|
||||||
AuditLogDto.MenuDetail.class,
|
AuditLogDto.MenuDetail.class,
|
||||||
auditLogEntity.id.as("logId"),
|
auditLogEntity.id.as("logId"),
|
||||||
Expressions.stringTemplate(
|
Expressions.stringTemplate(
|
||||||
"to_char({0}, 'YYYY-MM-DD')", auditLogEntity.createdDate)
|
"to_char({0}, 'YYYY-MM-DD')", auditLogEntity.createdDate)
|
||||||
.as("logDateTime"), // ??
|
.as("logDateTime"), // ??
|
||||||
userEntity.userNm.as("userName"),
|
memberEntity.name.as("userName"),
|
||||||
userEntity.userId.as("loginId"),
|
memberEntity.employeeNo.as("loginId"),
|
||||||
auditLogEntity.eventType.as("eventType"),
|
auditLogEntity.eventType.as("eventType"),
|
||||||
Projections.constructor(
|
Projections.constructor(
|
||||||
AuditLogDto.LogDetail.class,
|
AuditLogDto.LogDetail.class,
|
||||||
Expressions.constant("한국자산관리공사"), // serviceName
|
Expressions.constant("한국자산관리공사"), // serviceName
|
||||||
parentMenuName.as("parentMenuName"),
|
parentMenuName.as("parentMenuName"),
|
||||||
menuName,
|
menuName,
|
||||||
menuEntity.menuUrl.as("menuUrl"),
|
menuEntity.menuUrl.as("menuUrl"),
|
||||||
menuEntity.description.as("menuDescription"),
|
menuEntity.description.as("menuDescription"),
|
||||||
menuEntity.menuOrder.as("sortOrder"),
|
menuEntity.menuOrder.as("sortOrder"),
|
||||||
menuEntity.isUse.as("used"))))
|
menuEntity.isUse.as("used"))))
|
||||||
.from(auditLogEntity)
|
.from(auditLogEntity)
|
||||||
.leftJoin(menuEntity)
|
.leftJoin(menuEntity)
|
||||||
.on(auditLogEntity.menuUid.eq(menuEntity.menuUid))
|
.on(auditLogEntity.menuUid.eq(menuEntity.menuUid))
|
||||||
.leftJoin(menuEntity.parent, parent)
|
.leftJoin(menuEntity.parent, parent)
|
||||||
.leftJoin(userEntity)
|
.leftJoin(memberEntity)
|
||||||
.on(auditLogEntity.userUid.eq(userEntity.id))
|
.on(auditLogEntity.userUid.eq(memberEntity.id))
|
||||||
.where(menuUidEq(menuUid))
|
.where(menuUidEq(menuUid))
|
||||||
.offset(pageable.getOffset())
|
.offset(pageable.getOffset())
|
||||||
.limit(pageable.getPageSize())
|
.limit(pageable.getPageSize())
|
||||||
.orderBy(auditLogEntity.createdDate.desc())
|
.orderBy(auditLogEntity.createdDate.desc())
|
||||||
.fetch();
|
.fetch();
|
||||||
|
|
||||||
Long countQuery =
|
Long countQuery =
|
||||||
queryFactory
|
queryFactory
|
||||||
.select(auditLogEntity.id.countDistinct())
|
.select(auditLogEntity.id.countDistinct())
|
||||||
.from(auditLogEntity)
|
.from(auditLogEntity)
|
||||||
.leftJoin(menuEntity)
|
.leftJoin(menuEntity)
|
||||||
.on(auditLogEntity.menuUid.eq(menuEntity.menuUid))
|
.on(auditLogEntity.menuUid.eq(menuEntity.menuUid))
|
||||||
.leftJoin(menuEntity.parent, parent)
|
.leftJoin(menuEntity.parent, parent)
|
||||||
.leftJoin(userEntity)
|
.leftJoin(memberEntity)
|
||||||
.on(auditLogEntity.userUid.eq(userEntity.id))
|
.on(auditLogEntity.userUid.eq(memberEntity.id))
|
||||||
.where(menuUidEq(menuUid))
|
.where(menuUidEq(menuUid))
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
|
|
||||||
return new PageImpl<>(foundContent, pageable, countQuery);
|
return new PageImpl<>(foundContent, pageable, countQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<AuditLogDto.UserDetail> findLogByAccountResult(
|
public Page<AuditLogDto.UserDetail> findLogByAccountResult(
|
||||||
AuditLogDto.searchReq searchReq, Long userUid) {
|
AuditLogDto.searchReq searchReq, Long userUid) {
|
||||||
Pageable pageable = searchReq.toPageable();
|
Pageable pageable = searchReq.toPageable();
|
||||||
QMenuEntity parent = new QMenuEntity("parent");
|
QMenuEntity parent = new QMenuEntity("parent");
|
||||||
// 1depth menu name
|
// 1depth menu name
|
||||||
StringExpression parentMenuName =
|
StringExpression parentMenuName =
|
||||||
new CaseBuilder()
|
new CaseBuilder()
|
||||||
.when(parent.menuUid.isNull())
|
.when(parent.menuUid.isNull())
|
||||||
.then(menuEntity.menuNm)
|
.then(menuEntity.menuNm)
|
||||||
.otherwise(parent.menuNm);
|
.otherwise(parent.menuNm);
|
||||||
|
|
||||||
// 2depth menu name
|
// 2depth menu name
|
||||||
StringExpression menuName =
|
StringExpression menuName =
|
||||||
new CaseBuilder()
|
new CaseBuilder()
|
||||||
.when(parent.menuUid.isNull())
|
.when(parent.menuUid.isNull())
|
||||||
.then(NULL_STRING)
|
.then(NULL_STRING)
|
||||||
.otherwise(menuEntity.menuNm);
|
.otherwise(menuEntity.menuNm);
|
||||||
|
|
||||||
List<AuditLogDto.UserDetail> foundContent =
|
List<AuditLogDto.UserDetail> foundContent =
|
||||||
queryFactory
|
queryFactory
|
||||||
.select(
|
.select(
|
||||||
Projections.constructor(
|
Projections.constructor(
|
||||||
AuditLogDto.UserDetail.class,
|
AuditLogDto.UserDetail.class,
|
||||||
auditLogEntity.id.as("logId"),
|
auditLogEntity.id.as("logId"),
|
||||||
Expressions.stringTemplate(
|
Expressions.stringTemplate(
|
||||||
"to_char({0}, 'YYYY-MM-DD')", auditLogEntity.createdDate)
|
"to_char({0}, 'YYYY-MM-DD')", auditLogEntity.createdDate)
|
||||||
.as("logDateTime"),
|
.as("logDateTime"),
|
||||||
menuEntity.menuNm.as("menuName"),
|
menuEntity.menuNm.as("menuName"),
|
||||||
auditLogEntity.eventType.as("eventType"),
|
auditLogEntity.eventType.as("eventType"),
|
||||||
Projections.constructor(
|
Projections.constructor(
|
||||||
AuditLogDto.LogDetail.class,
|
AuditLogDto.LogDetail.class,
|
||||||
Expressions.constant("한국자산관리공사"), // serviceName
|
Expressions.constant("한국자산관리공사"), // serviceName
|
||||||
parentMenuName.as("parentMenuName"),
|
parentMenuName.as("parentMenuName"),
|
||||||
menuName,
|
menuName,
|
||||||
menuEntity.menuUrl.as("menuUrl"),
|
menuEntity.menuUrl.as("menuUrl"),
|
||||||
menuEntity.description.as("menuDescription"),
|
menuEntity.description.as("menuDescription"),
|
||||||
menuEntity.menuOrder.as("sortOrder"),
|
menuEntity.menuOrder.as("sortOrder"),
|
||||||
menuEntity.isUse.as("used"))))
|
menuEntity.isUse.as("used"))))
|
||||||
.from(auditLogEntity)
|
.from(auditLogEntity)
|
||||||
.leftJoin(menuEntity)
|
.leftJoin(menuEntity)
|
||||||
.on(auditLogEntity.menuUid.eq(menuEntity.menuUid))
|
.on(auditLogEntity.menuUid.eq(menuEntity.menuUid))
|
||||||
.leftJoin(menuEntity.parent, parent)
|
.leftJoin(menuEntity.parent, parent)
|
||||||
.leftJoin(userEntity)
|
.leftJoin(memberEntity)
|
||||||
.on(auditLogEntity.userUid.eq(userEntity.id))
|
.on(auditLogEntity.userUid.eq(memberEntity.id))
|
||||||
.where(userUidEq(userUid))
|
.where(userUidEq(userUid))
|
||||||
.offset(pageable.getOffset())
|
.offset(pageable.getOffset())
|
||||||
.limit(pageable.getPageSize())
|
.limit(pageable.getPageSize())
|
||||||
.orderBy(auditLogEntity.createdDate.desc())
|
.orderBy(auditLogEntity.createdDate.desc())
|
||||||
.fetch();
|
.fetch();
|
||||||
|
|
||||||
Long countQuery =
|
Long countQuery =
|
||||||
queryFactory
|
queryFactory
|
||||||
.select(auditLogEntity.id.countDistinct())
|
.select(auditLogEntity.id.countDistinct())
|
||||||
.from(auditLogEntity)
|
.from(auditLogEntity)
|
||||||
.leftJoin(menuEntity)
|
.leftJoin(menuEntity)
|
||||||
.on(auditLogEntity.menuUid.eq(menuEntity.menuUid))
|
.on(auditLogEntity.menuUid.eq(menuEntity.menuUid))
|
||||||
.leftJoin(menuEntity.parent, parent)
|
.leftJoin(menuEntity.parent, parent)
|
||||||
.leftJoin(userEntity)
|
.leftJoin(memberEntity)
|
||||||
.on(auditLogEntity.userUid.eq(userEntity.id))
|
.on(auditLogEntity.userUid.eq(memberEntity.id))
|
||||||
.where(userUidEq(userUid))
|
.where(userUidEq(userUid))
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
|
|
||||||
return new PageImpl<>(foundContent, pageable, countQuery);
|
return new PageImpl<>(foundContent, pageable, countQuery);
|
||||||
}
|
}
|
||||||
@@ -355,9 +360,9 @@ public class AuditLogRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
LocalDateTime startDateTime = startDate.atStartOfDay();
|
LocalDateTime startDateTime = startDate.atStartOfDay();
|
||||||
LocalDateTime endDateTime = endDate.plusDays(1).atStartOfDay();
|
LocalDateTime endDateTime = endDate.plusDays(1).atStartOfDay();
|
||||||
return auditLogEntity
|
return auditLogEntity
|
||||||
.createdDate
|
.createdDate
|
||||||
.goe(ZonedDateTime.from(startDateTime))
|
.goe(ZonedDateTime.from(startDateTime))
|
||||||
.and(auditLogEntity.createdDate.lt(ZonedDateTime.from(endDateTime)));
|
.and(auditLogEntity.createdDate.lt(ZonedDateTime.from(endDateTime)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private BooleanExpression menuNameEquals(String searchValue) {
|
private BooleanExpression menuNameEquals(String searchValue) {
|
||||||
@@ -371,7 +376,7 @@ public class AuditLogRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
if (StringUtils.isBlank(searchValue)) {
|
if (StringUtils.isBlank(searchValue)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return userEntity.userId.contains(searchValue).or(userEntity.userNm.contains(searchValue));
|
return memberEntity.employeeNo.contains(searchValue).or(memberEntity.name.contains(searchValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
private BooleanExpression eventStatusEqFailed() {
|
private BooleanExpression eventStatusEqFailed() {
|
||||||
@@ -394,7 +399,7 @@ public class AuditLogRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
|
|
||||||
private BooleanExpression eventEndedAtEqDate(LocalDate logDate) {
|
private BooleanExpression eventEndedAtEqDate(LocalDate logDate) {
|
||||||
StringExpression eventEndedDate =
|
StringExpression eventEndedDate =
|
||||||
Expressions.stringTemplate("to_char({0}, 'YYYY-MM-DD')", auditLogEntity.createdDate);
|
Expressions.stringTemplate("to_char({0}, 'YYYY-MM-DD')", auditLogEntity.createdDate);
|
||||||
LocalDateTime comparisonDate = logDate.atStartOfDay();
|
LocalDateTime comparisonDate = logDate.atStartOfDay();
|
||||||
|
|
||||||
return eventEndedDate.eq(comparisonDate.toString());
|
return eventEndedDate.eq(comparisonDate.toString());
|
||||||
@@ -410,33 +415,33 @@ public class AuditLogRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
|
|
||||||
private NumberExpression<Integer> readCount() {
|
private NumberExpression<Integer> readCount() {
|
||||||
return new CaseBuilder()
|
return new CaseBuilder()
|
||||||
.when(auditLogEntity.eventType.eq(EventType.READ))
|
.when(auditLogEntity.eventType.eq(EventType.READ))
|
||||||
.then(1)
|
.then(1)
|
||||||
.otherwise(0)
|
.otherwise(0)
|
||||||
.sum();
|
.sum();
|
||||||
}
|
}
|
||||||
|
|
||||||
private NumberExpression<Integer> cudCount() {
|
private NumberExpression<Integer> cudCount() {
|
||||||
return new CaseBuilder()
|
return new CaseBuilder()
|
||||||
.when(auditLogEntity.eventType.in(EventType.CREATE, EventType.UPDATE, EventType.DELETE))
|
.when(auditLogEntity.eventType.in(EventType.CREATE, EventType.UPDATE, EventType.DELETE))
|
||||||
.then(1)
|
.then(1)
|
||||||
.otherwise(0)
|
.otherwise(0)
|
||||||
.sum();
|
.sum();
|
||||||
}
|
}
|
||||||
|
|
||||||
private NumberExpression<Integer> printCount() {
|
private NumberExpression<Integer> printCount() {
|
||||||
return new CaseBuilder()
|
return new CaseBuilder()
|
||||||
.when(auditLogEntity.eventType.eq(EventType.PRINT))
|
.when(auditLogEntity.eventType.eq(EventType.PRINT))
|
||||||
.then(1)
|
.then(1)
|
||||||
.otherwise(0)
|
.otherwise(0)
|
||||||
.sum();
|
.sum();
|
||||||
}
|
}
|
||||||
|
|
||||||
private NumberExpression<Integer> downloadCount() {
|
private NumberExpression<Integer> downloadCount() {
|
||||||
return new CaseBuilder()
|
return new CaseBuilder()
|
||||||
.when(auditLogEntity.eventType.eq(EventType.DOWNLOAD))
|
.when(auditLogEntity.eventType.eq(EventType.DOWNLOAD))
|
||||||
.then(1)
|
.then(1)
|
||||||
.otherwise(0)
|
.otherwise(0)
|
||||||
.sum();
|
.sum();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ package com.kamco.cd.kamcoback.postgres.repository.log;
|
|||||||
|
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QAuditLogEntity.auditLogEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QAuditLogEntity.auditLogEntity;
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QErrorLogEntity.errorLogEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QErrorLogEntity.errorLogEntity;
|
||||||
|
import static com.kamco.cd.kamcoback.postgres.entity.QMemberEntity.memberEntity;
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QMenuEntity.menuEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QMenuEntity.menuEntity;
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QUserEntity.userEntity;
|
|
||||||
|
|
||||||
import com.kamco.cd.kamcoback.log.dto.ErrorLogDto;
|
import com.kamco.cd.kamcoback.log.dto.ErrorLogDto;
|
||||||
import com.kamco.cd.kamcoback.log.dto.EventStatus;
|
import com.kamco.cd.kamcoback.log.dto.EventStatus;
|
||||||
@@ -25,7 +25,8 @@ import org.springframework.data.domain.Pageable;
|
|||||||
import org.springframework.data.jpa.repository.support.QuerydslRepositorySupport;
|
import org.springframework.data.jpa.repository.support.QuerydslRepositorySupport;
|
||||||
|
|
||||||
public class ErrorLogRepositoryImpl extends QuerydslRepositorySupport
|
public class ErrorLogRepositoryImpl extends QuerydslRepositorySupport
|
||||||
implements ErrorLogRepositoryCustom {
|
implements ErrorLogRepositoryCustom {
|
||||||
|
|
||||||
private final JPAQueryFactory queryFactory;
|
private final JPAQueryFactory queryFactory;
|
||||||
private final StringExpression NULL_STRING = Expressions.stringTemplate("cast(null as text)");
|
private final StringExpression NULL_STRING = Expressions.stringTemplate("cast(null as text)");
|
||||||
|
|
||||||
@@ -38,57 +39,57 @@ public class ErrorLogRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
public Page<ErrorLogDto.Basic> findLogByError(ErrorLogDto.ErrorSearchReq searchReq) {
|
public Page<ErrorLogDto.Basic> findLogByError(ErrorLogDto.ErrorSearchReq searchReq) {
|
||||||
Pageable pageable = searchReq.toPageable();
|
Pageable pageable = searchReq.toPageable();
|
||||||
List<ErrorLogDto.Basic> foundContent =
|
List<ErrorLogDto.Basic> foundContent =
|
||||||
queryFactory
|
queryFactory
|
||||||
.select(
|
.select(
|
||||||
Projections.constructor(
|
Projections.constructor(
|
||||||
ErrorLogDto.Basic.class,
|
ErrorLogDto.Basic.class,
|
||||||
errorLogEntity.id.as("logId"),
|
errorLogEntity.id.as("logId"),
|
||||||
Expressions.stringTemplate("{0}", "한국자산관리공사"), // serviceName
|
Expressions.stringTemplate("{0}", "한국자산관리공사"), // serviceName
|
||||||
menuEntity.menuNm.as("menuName"),
|
menuEntity.menuNm.as("menuName"),
|
||||||
userEntity.userId.as("loginId"),
|
memberEntity.employeeNo.as("loginId"),
|
||||||
userEntity.userNm.as("userName"),
|
memberEntity.name.as("userName"),
|
||||||
errorLogEntity.errorType.as("eventType"),
|
errorLogEntity.errorType.as("eventType"),
|
||||||
errorLogEntity.errorMessage.as(
|
errorLogEntity.errorMessage.as(
|
||||||
"errorName"), // 기존에는 errorName 값이 있었는데 신규 테이블에는 없음. 에러 메세지와 동일
|
"errorName"), // 기존에는 errorName 값이 있었는데 신규 테이블에는 없음. 에러 메세지와 동일
|
||||||
errorLogEntity.errorLevel.as("errorLevel"),
|
errorLogEntity.errorLevel.as("errorLevel"),
|
||||||
errorLogEntity.errorCode.as("errorCode"),
|
errorLogEntity.errorCode.as("errorCode"),
|
||||||
errorLogEntity.errorMessage.as("errorMessage"),
|
errorLogEntity.errorMessage.as("errorMessage"),
|
||||||
errorLogEntity.stackTrace.as("errorDetail"),
|
errorLogEntity.stackTrace.as("errorDetail"),
|
||||||
Expressions.stringTemplate(
|
Expressions.stringTemplate(
|
||||||
"to_char({0}, 'YYYY-MM-DD')", errorLogEntity.createdDate)))
|
"to_char({0}, 'YYYY-MM-DD')", errorLogEntity.createdDate)))
|
||||||
.from(errorLogEntity)
|
.from(errorLogEntity)
|
||||||
.leftJoin(auditLogEntity)
|
.leftJoin(auditLogEntity)
|
||||||
.on(errorLogEntity.id.eq(auditLogEntity.errorLogUid))
|
.on(errorLogEntity.id.eq(auditLogEntity.errorLogUid))
|
||||||
.leftJoin(menuEntity)
|
.leftJoin(menuEntity)
|
||||||
.on(auditLogEntity.menuUid.eq(menuEntity.menuUid))
|
.on(auditLogEntity.menuUid.eq(menuEntity.menuUid))
|
||||||
.leftJoin(userEntity)
|
.leftJoin(memberEntity)
|
||||||
.on(errorLogEntity.handlerUid.eq(userEntity.id))
|
.on(errorLogEntity.handlerUid.eq(memberEntity.id))
|
||||||
.where(
|
.where(
|
||||||
eventStatusEqFailed(),
|
eventStatusEqFailed(),
|
||||||
eventEndedAtBetween(searchReq.getStartDate(), searchReq.getEndDate()),
|
eventEndedAtBetween(searchReq.getStartDate(), searchReq.getEndDate()),
|
||||||
eventTypeEq(searchReq.getEventType()),
|
eventTypeEq(searchReq.getEventType()),
|
||||||
errorLevelEq(searchReq.getErrorLevel()))
|
errorLevelEq(searchReq.getErrorLevel()))
|
||||||
.offset(pageable.getOffset())
|
.offset(pageable.getOffset())
|
||||||
.limit(pageable.getPageSize())
|
.limit(pageable.getPageSize())
|
||||||
.orderBy(errorLogEntity.createdDate.desc())
|
.orderBy(errorLogEntity.createdDate.desc())
|
||||||
.fetch();
|
.fetch();
|
||||||
|
|
||||||
Long countQuery =
|
Long countQuery =
|
||||||
queryFactory
|
queryFactory
|
||||||
.select(errorLogEntity.id.countDistinct())
|
.select(errorLogEntity.id.countDistinct())
|
||||||
.from(errorLogEntity)
|
.from(errorLogEntity)
|
||||||
.leftJoin(auditLogEntity)
|
.leftJoin(auditLogEntity)
|
||||||
.on(errorLogEntity.id.eq(auditLogEntity.errorLogUid))
|
.on(errorLogEntity.id.eq(auditLogEntity.errorLogUid))
|
||||||
.leftJoin(menuEntity)
|
.leftJoin(menuEntity)
|
||||||
.on(auditLogEntity.menuUid.eq(menuEntity.menuUid))
|
.on(auditLogEntity.menuUid.eq(menuEntity.menuUid))
|
||||||
.leftJoin(userEntity)
|
.leftJoin(memberEntity)
|
||||||
.on(errorLogEntity.handlerUid.eq(userEntity.id))
|
.on(errorLogEntity.handlerUid.eq(memberEntity.id))
|
||||||
.where(
|
.where(
|
||||||
eventStatusEqFailed(),
|
eventStatusEqFailed(),
|
||||||
eventEndedAtBetween(searchReq.getStartDate(), searchReq.getEndDate()),
|
eventEndedAtBetween(searchReq.getStartDate(), searchReq.getEndDate()),
|
||||||
eventTypeEq(searchReq.getEventType()),
|
eventTypeEq(searchReq.getEventType()),
|
||||||
errorLevelEq(searchReq.getErrorLevel()))
|
errorLevelEq(searchReq.getErrorLevel()))
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
|
|
||||||
return new PageImpl<>(foundContent, pageable, countQuery);
|
return new PageImpl<>(foundContent, pageable, countQuery);
|
||||||
}
|
}
|
||||||
@@ -100,9 +101,9 @@ public class ErrorLogRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
LocalDateTime startDateTime = startDate.atStartOfDay();
|
LocalDateTime startDateTime = startDate.atStartOfDay();
|
||||||
LocalDateTime endDateTime = endDate.plusDays(1).atStartOfDay();
|
LocalDateTime endDateTime = endDate.plusDays(1).atStartOfDay();
|
||||||
return auditLogEntity
|
return auditLogEntity
|
||||||
.createdDate
|
.createdDate
|
||||||
.goe(ZonedDateTime.from(startDateTime))
|
.goe(ZonedDateTime.from(startDateTime))
|
||||||
.and(auditLogEntity.createdDate.lt(ZonedDateTime.from(endDateTime)));
|
.and(auditLogEntity.createdDate.lt(ZonedDateTime.from(endDateTime)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private BooleanExpression eventStatusEqFailed() {
|
private BooleanExpression eventStatusEqFailed() {
|
||||||
|
|||||||
Reference in New Issue
Block a user