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.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.QUserEntity.userEntity;
|
||||
|
||||
import com.kamco.cd.kamcoback.log.dto.AuditLogDto;
|
||||
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.QMenuEntity;
|
||||
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 io.micrometer.common.util.StringUtils;
|
||||
import java.time.LocalDate;
|
||||
@@ -27,6 +31,7 @@ import org.springframework.data.jpa.repository.support.QuerydslRepositorySupport
|
||||
|
||||
public class AuditLogRepositoryImpl extends QuerydslRepositorySupport
|
||||
implements AuditLogRepositoryCustom {
|
||||
|
||||
private final JPAQueryFactory queryFactory;
|
||||
private final StringExpression NULL_STRING = Expressions.stringTemplate("cast(null as text)");
|
||||
|
||||
@@ -121,18 +126,18 @@ public class AuditLogRepositoryImpl extends QuerydslRepositorySupport
|
||||
Projections.constructor(
|
||||
AuditLogDto.UserAuditList.class,
|
||||
auditLogEntity.userUid.as("accountId"),
|
||||
userEntity.userId.as("loginId"),
|
||||
userEntity.userNm.as("username"),
|
||||
memberEntity.employeeNo.as("loginId"),
|
||||
memberEntity.name.as("username"),
|
||||
readCount().as("readCount"),
|
||||
cudCount().as("cudCount"),
|
||||
printCount().as("printCount"),
|
||||
downloadCount().as("downloadCount"),
|
||||
auditLogEntity.count().as("totalCount")))
|
||||
.from(auditLogEntity)
|
||||
.leftJoin(userEntity)
|
||||
.on(auditLogEntity.userUid.eq(userEntity.id))
|
||||
.leftJoin(memberEntity)
|
||||
.on(auditLogEntity.userUid.eq(memberEntity.id))
|
||||
.where(loginIdOrUsernameContains(searchValue))
|
||||
.groupBy(auditLogEntity.userUid, userEntity.userId, userEntity.userNm)
|
||||
.groupBy(auditLogEntity.userUid, memberEntity.employeeNo, memberEntity.name)
|
||||
.offset(pageable.getOffset())
|
||||
.limit(pageable.getPageSize())
|
||||
// .orderBy(auditLogEntity.eventEndedAt.max().desc())
|
||||
@@ -142,8 +147,8 @@ public class AuditLogRepositoryImpl extends QuerydslRepositorySupport
|
||||
queryFactory
|
||||
.select(auditLogEntity.userUid.countDistinct())
|
||||
.from(auditLogEntity)
|
||||
.leftJoin(userEntity)
|
||||
.on(auditLogEntity.userUid.eq(userEntity.id))
|
||||
.leftJoin(memberEntity)
|
||||
.on(auditLogEntity.userUid.eq(memberEntity.id))
|
||||
.where(loginIdOrUsernameContains(searchValue))
|
||||
.fetchOne();
|
||||
|
||||
@@ -175,8 +180,8 @@ public class AuditLogRepositoryImpl extends QuerydslRepositorySupport
|
||||
Projections.constructor(
|
||||
AuditLogDto.DailyDetail.class,
|
||||
auditLogEntity.id.as("logId"),
|
||||
userEntity.userNm.as("userName"),
|
||||
userEntity.userId.as("loginId"),
|
||||
memberEntity.name.as("userName"),
|
||||
memberEntity.employeeNo.as("loginId"),
|
||||
menuEntity.menuNm.as("menuName"),
|
||||
auditLogEntity.eventType.as("eventType"),
|
||||
Projections.constructor(
|
||||
@@ -192,8 +197,8 @@ public class AuditLogRepositoryImpl extends QuerydslRepositorySupport
|
||||
.leftJoin(menuEntity)
|
||||
.on(auditLogEntity.menuUid.eq(menuEntity.menuUid))
|
||||
.leftJoin(menuEntity.parent, parent)
|
||||
.leftJoin(userEntity)
|
||||
.on(auditLogEntity.userUid.eq(userEntity.id))
|
||||
.leftJoin(memberEntity)
|
||||
.on(auditLogEntity.userUid.eq(memberEntity.id))
|
||||
.where(eventEndedAtEqDate(logDate))
|
||||
.offset(pageable.getOffset())
|
||||
.limit(pageable.getPageSize())
|
||||
@@ -207,8 +212,8 @@ public class AuditLogRepositoryImpl extends QuerydslRepositorySupport
|
||||
.leftJoin(menuEntity)
|
||||
.on(auditLogEntity.menuUid.eq(menuEntity.menuUid))
|
||||
.leftJoin(menuEntity.parent, parent)
|
||||
.leftJoin(userEntity)
|
||||
.on(auditLogEntity.userUid.eq(userEntity.id))
|
||||
.leftJoin(memberEntity)
|
||||
.on(auditLogEntity.userUid.eq(memberEntity.id))
|
||||
.where(eventEndedAtEqDate(logDate))
|
||||
.fetchOne();
|
||||
|
||||
@@ -243,8 +248,8 @@ public class AuditLogRepositoryImpl extends QuerydslRepositorySupport
|
||||
Expressions.stringTemplate(
|
||||
"to_char({0}, 'YYYY-MM-DD')", auditLogEntity.createdDate)
|
||||
.as("logDateTime"), // ??
|
||||
userEntity.userNm.as("userName"),
|
||||
userEntity.userId.as("loginId"),
|
||||
memberEntity.name.as("userName"),
|
||||
memberEntity.employeeNo.as("loginId"),
|
||||
auditLogEntity.eventType.as("eventType"),
|
||||
Projections.constructor(
|
||||
AuditLogDto.LogDetail.class,
|
||||
@@ -259,8 +264,8 @@ public class AuditLogRepositoryImpl extends QuerydslRepositorySupport
|
||||
.leftJoin(menuEntity)
|
||||
.on(auditLogEntity.menuUid.eq(menuEntity.menuUid))
|
||||
.leftJoin(menuEntity.parent, parent)
|
||||
.leftJoin(userEntity)
|
||||
.on(auditLogEntity.userUid.eq(userEntity.id))
|
||||
.leftJoin(memberEntity)
|
||||
.on(auditLogEntity.userUid.eq(memberEntity.id))
|
||||
.where(menuUidEq(menuUid))
|
||||
.offset(pageable.getOffset())
|
||||
.limit(pageable.getPageSize())
|
||||
@@ -274,8 +279,8 @@ public class AuditLogRepositoryImpl extends QuerydslRepositorySupport
|
||||
.leftJoin(menuEntity)
|
||||
.on(auditLogEntity.menuUid.eq(menuEntity.menuUid))
|
||||
.leftJoin(menuEntity.parent, parent)
|
||||
.leftJoin(userEntity)
|
||||
.on(auditLogEntity.userUid.eq(userEntity.id))
|
||||
.leftJoin(memberEntity)
|
||||
.on(auditLogEntity.userUid.eq(memberEntity.id))
|
||||
.where(menuUidEq(menuUid))
|
||||
.fetchOne();
|
||||
|
||||
@@ -325,8 +330,8 @@ public class AuditLogRepositoryImpl extends QuerydslRepositorySupport
|
||||
.leftJoin(menuEntity)
|
||||
.on(auditLogEntity.menuUid.eq(menuEntity.menuUid))
|
||||
.leftJoin(menuEntity.parent, parent)
|
||||
.leftJoin(userEntity)
|
||||
.on(auditLogEntity.userUid.eq(userEntity.id))
|
||||
.leftJoin(memberEntity)
|
||||
.on(auditLogEntity.userUid.eq(memberEntity.id))
|
||||
.where(userUidEq(userUid))
|
||||
.offset(pageable.getOffset())
|
||||
.limit(pageable.getPageSize())
|
||||
@@ -340,8 +345,8 @@ public class AuditLogRepositoryImpl extends QuerydslRepositorySupport
|
||||
.leftJoin(menuEntity)
|
||||
.on(auditLogEntity.menuUid.eq(menuEntity.menuUid))
|
||||
.leftJoin(menuEntity.parent, parent)
|
||||
.leftJoin(userEntity)
|
||||
.on(auditLogEntity.userUid.eq(userEntity.id))
|
||||
.leftJoin(memberEntity)
|
||||
.on(auditLogEntity.userUid.eq(memberEntity.id))
|
||||
.where(userUidEq(userUid))
|
||||
.fetchOne();
|
||||
|
||||
@@ -371,7 +376,7 @@ public class AuditLogRepositoryImpl extends QuerydslRepositorySupport
|
||||
if (StringUtils.isBlank(searchValue)) {
|
||||
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() {
|
||||
|
||||
@@ -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.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.QUserEntity.userEntity;
|
||||
|
||||
import com.kamco.cd.kamcoback.log.dto.ErrorLogDto;
|
||||
import com.kamco.cd.kamcoback.log.dto.EventStatus;
|
||||
@@ -26,6 +26,7 @@ import org.springframework.data.jpa.repository.support.QuerydslRepositorySupport
|
||||
|
||||
public class ErrorLogRepositoryImpl extends QuerydslRepositorySupport
|
||||
implements ErrorLogRepositoryCustom {
|
||||
|
||||
private final JPAQueryFactory queryFactory;
|
||||
private final StringExpression NULL_STRING = Expressions.stringTemplate("cast(null as text)");
|
||||
|
||||
@@ -45,8 +46,8 @@ public class ErrorLogRepositoryImpl extends QuerydslRepositorySupport
|
||||
errorLogEntity.id.as("logId"),
|
||||
Expressions.stringTemplate("{0}", "한국자산관리공사"), // serviceName
|
||||
menuEntity.menuNm.as("menuName"),
|
||||
userEntity.userId.as("loginId"),
|
||||
userEntity.userNm.as("userName"),
|
||||
memberEntity.employeeNo.as("loginId"),
|
||||
memberEntity.name.as("userName"),
|
||||
errorLogEntity.errorType.as("eventType"),
|
||||
errorLogEntity.errorMessage.as(
|
||||
"errorName"), // 기존에는 errorName 값이 있었는데 신규 테이블에는 없음. 에러 메세지와 동일
|
||||
@@ -61,8 +62,8 @@ public class ErrorLogRepositoryImpl extends QuerydslRepositorySupport
|
||||
.on(errorLogEntity.id.eq(auditLogEntity.errorLogUid))
|
||||
.leftJoin(menuEntity)
|
||||
.on(auditLogEntity.menuUid.eq(menuEntity.menuUid))
|
||||
.leftJoin(userEntity)
|
||||
.on(errorLogEntity.handlerUid.eq(userEntity.id))
|
||||
.leftJoin(memberEntity)
|
||||
.on(errorLogEntity.handlerUid.eq(memberEntity.id))
|
||||
.where(
|
||||
eventStatusEqFailed(),
|
||||
eventEndedAtBetween(searchReq.getStartDate(), searchReq.getEndDate()),
|
||||
@@ -81,8 +82,8 @@ public class ErrorLogRepositoryImpl extends QuerydslRepositorySupport
|
||||
.on(errorLogEntity.id.eq(auditLogEntity.errorLogUid))
|
||||
.leftJoin(menuEntity)
|
||||
.on(auditLogEntity.menuUid.eq(menuEntity.menuUid))
|
||||
.leftJoin(userEntity)
|
||||
.on(errorLogEntity.handlerUid.eq(userEntity.id))
|
||||
.leftJoin(memberEntity)
|
||||
.on(errorLogEntity.handlerUid.eq(memberEntity.id))
|
||||
.where(
|
||||
eventStatusEqFailed(),
|
||||
eventEndedAtBetween(searchReq.getStartDate(), searchReq.getEndDate()),
|
||||
|
||||
Reference in New Issue
Block a user