멤버테이블 수정
This commit is contained in:
@@ -1,10 +1,11 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.core;
|
package com.kamco.cd.kamcoback.postgres.core;
|
||||||
|
|
||||||
import com.kamco.cd.kamcoback.config.BCryptSaltGenerator;
|
import com.kamco.cd.kamcoback.auth.BCryptSaltGenerator;
|
||||||
import com.kamco.cd.kamcoback.members.dto.MembersDto;
|
import com.kamco.cd.kamcoback.members.dto.MembersDto;
|
||||||
import com.kamco.cd.kamcoback.members.exception.MemberException;
|
import com.kamco.cd.kamcoback.members.exception.MemberException;
|
||||||
import com.kamco.cd.kamcoback.members.exception.MemberException.MemberNotFoundException;
|
import com.kamco.cd.kamcoback.members.exception.MemberException.MemberNotFoundException;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.MemberArchivedEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.MemberArchivedEntity;
|
||||||
|
import com.kamco.cd.kamcoback.postgres.entity.MemberArchivedEntityId;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.MemberEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.MemberEntity;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.MemberRoleEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.MemberRoleEntity;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.MemberRoleEntityId;
|
import com.kamco.cd.kamcoback.postgres.entity.MemberRoleEntityId;
|
||||||
@@ -161,9 +162,12 @@ public class MembersCoreService {
|
|||||||
.findByUUID(statusDto.getUuid())
|
.findByUUID(statusDto.getUuid())
|
||||||
.orElseThrow(() -> new MemberNotFoundException());
|
.orElseThrow(() -> new MemberNotFoundException());
|
||||||
|
|
||||||
|
MemberArchivedEntityId memberArchivedEntityId = new MemberArchivedEntityId();
|
||||||
|
memberArchivedEntityId.setUserId(memberEntity.getId());
|
||||||
|
memberArchivedEntityId.setUuid(memberEntity.getUuid());
|
||||||
|
|
||||||
MemberArchivedEntity memberArchivedEntity = new MemberArchivedEntity();
|
MemberArchivedEntity memberArchivedEntity = new MemberArchivedEntity();
|
||||||
memberArchivedEntity.setUuid(memberEntity.getUuid());
|
memberArchivedEntity.setId(memberArchivedEntityId);
|
||||||
memberArchivedEntity.setId(memberEntity.getId());
|
|
||||||
memberArchivedEntity.setEmployeeNo(memberEntity.getEmployeeNo());
|
memberArchivedEntity.setEmployeeNo(memberEntity.getEmployeeNo());
|
||||||
memberArchivedEntity.setName(memberEntity.getName());
|
memberArchivedEntity.setName(memberEntity.getName());
|
||||||
memberArchivedEntity.setPassword(memberEntity.getPassword());
|
memberArchivedEntity.setPassword(memberEntity.getPassword());
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.entity;
|
package com.kamco.cd.kamcoback.postgres.entity;
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.EmbeddedId;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
import jakarta.persistence.Id;
|
|
||||||
import jakarta.persistence.Table;
|
import jakarta.persistence.Table;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import jakarta.validation.constraints.Size;
|
import jakarta.validation.constraints.Size;
|
||||||
import java.time.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
import java.util.UUID;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import org.hibernate.annotations.ColumnDefault;
|
import org.hibernate.annotations.ColumnDefault;
|
||||||
@@ -18,12 +17,8 @@ import org.hibernate.annotations.ColumnDefault;
|
|||||||
@Table(name = "tb_member_archived")
|
@Table(name = "tb_member_archived")
|
||||||
public class MemberArchivedEntity {
|
public class MemberArchivedEntity {
|
||||||
|
|
||||||
@Id
|
@EmbeddedId
|
||||||
@Column(name = "uuid", nullable = false)
|
private MemberArchivedEntityId id;
|
||||||
private UUID uuid;
|
|
||||||
|
|
||||||
@Column(name = "id", nullable = false)
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
@Size(max = 50)
|
@Size(max = 50)
|
||||||
@Column(name = "employee_no", length = 50)
|
@Column(name = "employee_no", length = 50)
|
||||||
@@ -56,4 +51,5 @@ public class MemberArchivedEntity {
|
|||||||
@ColumnDefault("now()")
|
@ColumnDefault("now()")
|
||||||
@Column(name = "archived_dttm", nullable = false)
|
@Column(name = "archived_dttm", nullable = false)
|
||||||
private ZonedDateTime archivedDttm;
|
private ZonedDateTime archivedDttm;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
package com.kamco.cd.kamcoback.postgres.entity;
|
||||||
|
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Embeddable;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.UUID;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import org.hibernate.Hibernate;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Embeddable
|
||||||
|
public class MemberArchivedEntityId implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -7102800377481389036L;
|
||||||
|
@NotNull
|
||||||
|
@Column(name = "user_id", nullable = false)
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Column(name = "uuid", nullable = false)
|
||||||
|
private UUID uuid;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
MemberArchivedEntityId entity = (MemberArchivedEntityId) o;
|
||||||
|
return Objects.equals(this.userId, entity.userId) &&
|
||||||
|
Objects.equals(this.uuid, entity.uuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(userId, uuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user