init
This commit is contained in:
@@ -0,0 +1,101 @@
|
||||
package com.kamco.cd.training.postgres.entity;
|
||||
|
||||
import com.kamco.cd.training.log.dto.AuditLogDto;
|
||||
import com.kamco.cd.training.log.dto.EventStatus;
|
||||
import com.kamco.cd.training.log.dto.EventType;
|
||||
import com.kamco.cd.training.postgres.CommonCreateEntity;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@NoArgsConstructor(access = AccessLevel.PROTECTED)
|
||||
@Table(name = "tb_audit_log")
|
||||
public class AuditLogEntity extends CommonCreateEntity {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "audit_log_uid", nullable = false)
|
||||
private Long id;
|
||||
|
||||
@Column(name = "user_uid")
|
||||
private Long userUid;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
private EventType eventType;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
private EventStatus eventStatus;
|
||||
|
||||
@Column(name = "menu_uid")
|
||||
private String menuUid;
|
||||
|
||||
@Column(name = "ip_address")
|
||||
private String ipAddress;
|
||||
|
||||
@Column(name = "request_uri")
|
||||
private String requestUri;
|
||||
|
||||
@Column(name = "request_body", columnDefinition = "TEXT")
|
||||
private String requestBody;
|
||||
|
||||
@Column(name = "error_log_uid")
|
||||
private Long errorLogUid;
|
||||
|
||||
public AuditLogEntity(
|
||||
Long userUid,
|
||||
EventType eventType,
|
||||
EventStatus eventStatus,
|
||||
String menuUid,
|
||||
String ipAddress,
|
||||
String requestUri,
|
||||
String requestBody,
|
||||
Long errorLogUid) {
|
||||
this.userUid = userUid;
|
||||
this.eventType = eventType;
|
||||
this.eventStatus = eventStatus;
|
||||
this.menuUid = menuUid;
|
||||
this.ipAddress = ipAddress;
|
||||
this.requestUri = requestUri;
|
||||
this.requestBody = requestBody;
|
||||
this.errorLogUid = errorLogUid;
|
||||
}
|
||||
|
||||
public AuditLogDto.Basic toDto() {
|
||||
return new AuditLogDto.Basic(
|
||||
this.id,
|
||||
this.userUid,
|
||||
this.eventType,
|
||||
this.eventStatus,
|
||||
this.menuUid,
|
||||
this.ipAddress,
|
||||
this.requestUri,
|
||||
this.requestBody,
|
||||
this.errorLogUid,
|
||||
super.getCreatedDate());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(this.id)
|
||||
.append("\n")
|
||||
.append(this.userUid)
|
||||
.append("\n")
|
||||
.append(this.eventType)
|
||||
.append("\n")
|
||||
.append(this.eventStatus)
|
||||
.append("\n")
|
||||
.append(this.menuUid)
|
||||
.append("\n")
|
||||
.append(this.ipAddress)
|
||||
.append("\n")
|
||||
.append(this.requestUri)
|
||||
.append("\n")
|
||||
.append(this.requestBody)
|
||||
.append("\n")
|
||||
.append(this.errorLogUid);
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.kamco.cd.training.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.Table;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import java.time.ZonedDateTime;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.CreationTimestamp;
|
||||
import org.hibernate.annotations.UpdateTimestamp;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@Table(name = "auth_refresh_token")
|
||||
@NoArgsConstructor
|
||||
public class AuthRefreshTokenEntity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id", nullable = false)
|
||||
private Long id;
|
||||
|
||||
@Size(max = 255)
|
||||
@NotNull
|
||||
@Column(name = "subject", nullable = false)
|
||||
private String subject;
|
||||
|
||||
@NotNull
|
||||
@Column(name = "token", nullable = false, length = Integer.MAX_VALUE)
|
||||
private String token;
|
||||
|
||||
@NotNull
|
||||
@Column(name = "expires_dttm", nullable = false)
|
||||
private ZonedDateTime expiresDttm;
|
||||
|
||||
@Column(name = "revoked_dttm")
|
||||
private ZonedDateTime revokedDttm;
|
||||
|
||||
@CreationTimestamp
|
||||
@Column(updatable = false)
|
||||
private ZonedDateTime createdDttm;
|
||||
|
||||
@UpdateTimestamp private ZonedDateTime updatedDttm;
|
||||
|
||||
public AuthRefreshTokenEntity(String subject, String token, ZonedDateTime expiresDttm) {
|
||||
this.subject = subject;
|
||||
this.token = token;
|
||||
this.expiresDttm = expiresDttm;
|
||||
}
|
||||
|
||||
public void rotate(String token, ZonedDateTime expiresDttm) {
|
||||
this.token = token;
|
||||
this.expiresDttm = expiresDttm;
|
||||
this.revokedDttm = null;
|
||||
}
|
||||
|
||||
public void revoke() {
|
||||
this.revokedDttm = ZonedDateTime.now();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
package com.kamco.cd.training.postgres.entity;
|
||||
|
||||
import com.kamco.cd.training.code.dto.CommonCodeDto;
|
||||
import com.kamco.cd.training.postgres.CommonDateEntity;
|
||||
import jakarta.persistence.*;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@NoArgsConstructor(access = AccessLevel.PROTECTED)
|
||||
@Table(name = "tb_cm_cd")
|
||||
public class CommonCodeEntity extends CommonDateEntity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "code_id", nullable = false, updatable = false)
|
||||
private Long id;
|
||||
|
||||
@Size(max = 255)
|
||||
@Column(name = "code_cd", updatable = false)
|
||||
private String code;
|
||||
|
||||
@Size(max = 255)
|
||||
@Column(name = "cd_ct")
|
||||
private String description;
|
||||
|
||||
@Size(max = 255)
|
||||
@Column(name = "cd_nm")
|
||||
private String name;
|
||||
|
||||
@Column(name = "cd_odr")
|
||||
private Integer order;
|
||||
|
||||
@Column(name = "used")
|
||||
private Boolean used;
|
||||
|
||||
@NotNull
|
||||
@Column(name = "deleted", nullable = false)
|
||||
private Boolean deleted = false;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "parent_id", updatable = false)
|
||||
private CommonCodeEntity parent;
|
||||
|
||||
@OneToMany(mappedBy = "parent", fetch = FetchType.LAZY, cascade = CascadeType.ALL)
|
||||
@Where(clause = "deleted = false or deleted is null")
|
||||
private List<CommonCodeEntity> children = new ArrayList<>();
|
||||
|
||||
@Size(max = 255)
|
||||
@Column(name = "props1")
|
||||
private String props1;
|
||||
|
||||
@Size(max = 255)
|
||||
@Column(name = "props2")
|
||||
private String props2;
|
||||
|
||||
@Size(max = 255)
|
||||
@Column(name = "props3")
|
||||
private String props3;
|
||||
|
||||
@Column(name = "deleted_dttm")
|
||||
private ZonedDateTime deletedDttm;
|
||||
|
||||
public CommonCodeEntity(
|
||||
String code,
|
||||
String name,
|
||||
String description,
|
||||
Integer order,
|
||||
Boolean used,
|
||||
String props1,
|
||||
String props2,
|
||||
String props3) {
|
||||
this.code = code;
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.order = order;
|
||||
this.used = used;
|
||||
this.props1 = props1;
|
||||
this.props2 = props2;
|
||||
this.props3 = props3;
|
||||
}
|
||||
|
||||
public CommonCodeDto.Basic toDto() {
|
||||
return new CommonCodeDto.Basic(
|
||||
this.id,
|
||||
this.code,
|
||||
this.description,
|
||||
this.name,
|
||||
this.order,
|
||||
this.used,
|
||||
this.deleted,
|
||||
this.children.stream().map(CommonCodeEntity::toDto).toList(),
|
||||
super.getCreatedDate(),
|
||||
super.getModifiedDate(),
|
||||
this.props1,
|
||||
this.props2,
|
||||
this.props3,
|
||||
this.deletedDttm);
|
||||
}
|
||||
|
||||
public void addParent(CommonCodeEntity parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public boolean isDeleted() {
|
||||
return deleted;
|
||||
}
|
||||
|
||||
public void deleted() {
|
||||
this.deleted = true;
|
||||
this.deletedDttm = ZonedDateTime.now();
|
||||
}
|
||||
|
||||
public void updateOrder(int order) {
|
||||
this.order = order;
|
||||
}
|
||||
|
||||
public void update(
|
||||
String name, String description, boolean used, String props1, String props2, String props3) {
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.used = used;
|
||||
this.props1 = props1;
|
||||
this.props2 = props2;
|
||||
this.props3 = props3;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
package com.kamco.cd.training.postgres.entity;
|
||||
|
||||
import com.kamco.cd.training.dataset.dto.DatasetDto;
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Table;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import java.time.Instant;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.ColumnDefault;
|
||||
import org.hibernate.annotations.JdbcTypeCode;
|
||||
import org.hibernate.type.SqlTypes;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@Table(name = "tb_dataset")
|
||||
public class DatasetEntity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "dataset_uid", nullable = false)
|
||||
private Long id;
|
||||
|
||||
@Column(name = "uuid", nullable = false)
|
||||
private UUID uuid;
|
||||
|
||||
@Size(max = 200)
|
||||
@Column(name = "group_title", length = 200)
|
||||
private String groupTitle;
|
||||
|
||||
@Size(max = 10)
|
||||
@Column(name = "data_year", length = 10)
|
||||
private String dataYear;
|
||||
|
||||
@Size(max = 50)
|
||||
@ColumnDefault("'CREATE'")
|
||||
@Column(name = "data_type", length = 50)
|
||||
private String dataType;
|
||||
|
||||
@ColumnDefault("1")
|
||||
@Column(name = "round_no")
|
||||
private Long roundNo;
|
||||
|
||||
@ColumnDefault("0")
|
||||
@Column(name = "total_size")
|
||||
private Long totalSize;
|
||||
|
||||
@ColumnDefault("0")
|
||||
@Column(name = "item_count")
|
||||
private Long itemCount;
|
||||
|
||||
@Column(name = "memo", length = Integer.MAX_VALUE)
|
||||
private String memo;
|
||||
|
||||
@Size(max = 20)
|
||||
@ColumnDefault("'READY'")
|
||||
@Column(name = "status", length = 20)
|
||||
private String status;
|
||||
|
||||
@Size(max = 50)
|
||||
@Column(name = "reg_user_id", length = 50)
|
||||
private String regUserId;
|
||||
|
||||
@ColumnDefault("now()")
|
||||
@Column(name = "reg_dttm")
|
||||
private Instant regDttm;
|
||||
|
||||
@Column(name = "mod_dttm")
|
||||
private Instant modDttm;
|
||||
|
||||
@Column(name = "id")
|
||||
private Long id1;
|
||||
|
||||
@Size(max = 50)
|
||||
@Column(name = "created_by", length = 50)
|
||||
private String createdBy;
|
||||
|
||||
@NotNull
|
||||
@ColumnDefault("now()")
|
||||
@Column(name = "created_dttm", nullable = false)
|
||||
private ZonedDateTime createdDttm;
|
||||
|
||||
@NotNull
|
||||
@ColumnDefault("false")
|
||||
@Column(name = "deleted", nullable = false)
|
||||
private Boolean deleted = false;
|
||||
|
||||
@Size(max = 200)
|
||||
@Column(name = "title", length = 200)
|
||||
private String title;
|
||||
|
||||
@Column(name = "total_items")
|
||||
private Long totalItems;
|
||||
|
||||
@Size(max = 50)
|
||||
@Column(name = "updated_by", length = 50)
|
||||
private String updatedBy;
|
||||
|
||||
@Column(name = "updated_dttm")
|
||||
private ZonedDateTime updatedDttm;
|
||||
|
||||
@Size(max = 4)
|
||||
@Column(name = "year", length = 4)
|
||||
private String year;
|
||||
|
||||
@Column(name = "class_counts", columnDefinition = "jsonb")
|
||||
@JdbcTypeCode(SqlTypes.JSON)
|
||||
private Map<String, Integer> classCounts;
|
||||
|
||||
public DatasetDto.Basic toDto() {
|
||||
return new DatasetDto.Basic(
|
||||
this.id,
|
||||
this.uuid,
|
||||
this.groupTitle,
|
||||
this.title,
|
||||
this.roundNo,
|
||||
this.totalSize,
|
||||
this.memo,
|
||||
this.createdDttm,
|
||||
this.status,
|
||||
this.deleted);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.kamco.cd.training.postgres.entity;
|
||||
|
||||
import com.kamco.cd.training.log.dto.ErrorLogDto;
|
||||
import com.kamco.cd.training.log.dto.EventType;
|
||||
import com.kamco.cd.training.postgres.CommonCreateEntity;
|
||||
import jakarta.persistence.*;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import java.time.ZonedDateTime;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@NoArgsConstructor(access = AccessLevel.PROTECTED)
|
||||
@Table(name = "tb_error_log")
|
||||
public class ErrorLogEntity extends CommonCreateEntity {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "error_log_uid", nullable = false)
|
||||
private Long id;
|
||||
|
||||
@Column(name = "request_id")
|
||||
private String requestId;
|
||||
|
||||
@Column(name = "error_type")
|
||||
@Enumerated(EnumType.STRING)
|
||||
private EventType errorType;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
private ErrorLogDto.LogErrorLevel errorLevel;
|
||||
|
||||
private String errorCode;
|
||||
private String errorMessage;
|
||||
|
||||
@Size(max = 255)
|
||||
@Column(name = "stack_trace")
|
||||
private String stackTrace;
|
||||
|
||||
private Long handlerUid;
|
||||
private ZonedDateTime handledDttm;
|
||||
|
||||
public ErrorLogEntity(
|
||||
String requestId,
|
||||
EventType errorType,
|
||||
ErrorLogDto.LogErrorLevel errorLevel,
|
||||
String errorCode,
|
||||
String errorMessage,
|
||||
String stackTrace,
|
||||
Long handlerUid,
|
||||
ZonedDateTime handledDttm) {
|
||||
this.requestId = requestId;
|
||||
this.errorType = errorType;
|
||||
this.errorLevel = errorLevel;
|
||||
this.errorCode = errorCode;
|
||||
this.errorMessage = errorMessage;
|
||||
this.stackTrace = stackTrace;
|
||||
this.handlerUid = handlerUid;
|
||||
this.handledDttm = handledDttm;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package com.kamco.cd.training.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.PrePersist;
|
||||
import jakarta.persistence.PreUpdate;
|
||||
import jakarta.persistence.Table;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import java.time.ZonedDateTime;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.ColumnDefault;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@Table(name = "tb_learn_data")
|
||||
public class LearnDataEntity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id", nullable = false)
|
||||
private Long id;
|
||||
|
||||
@Size(max = 50)
|
||||
@NotNull
|
||||
@Column(name = "category", nullable = false, length = 50)
|
||||
private String category;
|
||||
|
||||
@Size(max = 200)
|
||||
@Column(name = "title", length = 200)
|
||||
private String title;
|
||||
|
||||
@Column(name = "episode")
|
||||
private Long episode;
|
||||
|
||||
@Size(max = 20)
|
||||
@Column(name = "capacity", length = 20)
|
||||
private String capacity;
|
||||
|
||||
@Column(name = "memo", columnDefinition = "text")
|
||||
private String memo;
|
||||
|
||||
@Size(max = 20)
|
||||
@NotNull
|
||||
@Column(name = "status", nullable = false, length = 20)
|
||||
private String status;
|
||||
|
||||
@NotNull
|
||||
@ColumnDefault("false")
|
||||
@Column(name = "deleted", nullable = false)
|
||||
private Boolean deleted = false;
|
||||
|
||||
@NotNull
|
||||
@ColumnDefault("now()")
|
||||
@Column(name = "created_dttm", nullable = false)
|
||||
private ZonedDateTime createdDttm = ZonedDateTime.now();
|
||||
|
||||
@Column(name = "updated_dttm")
|
||||
private ZonedDateTime updatedDttm;
|
||||
|
||||
@PrePersist
|
||||
protected void onPersist() {
|
||||
if (this.createdDttm == null) {
|
||||
this.createdDttm = ZonedDateTime.now();
|
||||
}
|
||||
if (this.deleted == null) {
|
||||
this.deleted = false;
|
||||
}
|
||||
}
|
||||
|
||||
@PreUpdate
|
||||
protected void onUpdate() {
|
||||
this.updatedDttm = ZonedDateTime.now();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package com.kamco.cd.training.postgres.entity;
|
||||
|
||||
import com.kamco.cd.training.dataset.dto.MapSheetDto;
|
||||
import jakarta.persistence.*;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import java.time.ZonedDateTime;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.ColumnDefault;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@Table(name = "tb_map_sheet")
|
||||
public class MapSheetEntity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id", nullable = false)
|
||||
private Long id;
|
||||
|
||||
@NotNull
|
||||
@Column(name = "object_id", nullable = false)
|
||||
private Long objectId;
|
||||
|
||||
@NotNull
|
||||
@Column(name = "dataset_id", nullable = false)
|
||||
private Long datasetId;
|
||||
|
||||
@NotNull
|
||||
@Size(max = 20)
|
||||
@Column(name = "sheet_num", nullable = false, length = 20)
|
||||
private String sheetNum;
|
||||
|
||||
@Size(max = 255)
|
||||
@Column(name = "file_name", length = 255)
|
||||
private String fileName;
|
||||
|
||||
@Column(name = "file_size")
|
||||
private Long fileSize;
|
||||
|
||||
@Size(max = 500)
|
||||
@Column(name = "file_path", length = 500)
|
||||
private String filePath;
|
||||
|
||||
@Size(max = 20)
|
||||
@Column(name = "status", length = 20)
|
||||
private String status;
|
||||
|
||||
@Column(name = "memo", columnDefinition = "TEXT")
|
||||
private String memo;
|
||||
|
||||
@NotNull
|
||||
@ColumnDefault("false")
|
||||
@Column(name = "deleted", nullable = false)
|
||||
private Boolean deleted = false;
|
||||
|
||||
@NotNull
|
||||
@ColumnDefault("now()")
|
||||
@Column(name = "created_dttm", nullable = false)
|
||||
private ZonedDateTime createdDttm;
|
||||
|
||||
@Column(name = "updated_dttm")
|
||||
private ZonedDateTime updatedDttm;
|
||||
|
||||
@Column(name = "map_id_cd_no")
|
||||
private Long mapIdCdNo;
|
||||
|
||||
@Size(max = 128)
|
||||
@Column(name = "map_id_nm", length = 128)
|
||||
private String mapIdNm;
|
||||
|
||||
@Size(max = 128)
|
||||
@Column(name = "shape_leng", length = 128)
|
||||
private String shapeLeng;
|
||||
|
||||
@Column(name = "shape_area")
|
||||
private Double shapeArea;
|
||||
|
||||
@Column(name = "scale_ratio")
|
||||
private Long scaleRatio;
|
||||
|
||||
@Column(name = "wkt_geom", columnDefinition = "TEXT")
|
||||
private String wktGeom;
|
||||
|
||||
@Column(name = "ref_map_id_cd_no")
|
||||
private Long refMapIdCdNo;
|
||||
|
||||
public MapSheetDto.Basic toDto() {
|
||||
MapSheetDto.Basic dto = new MapSheetDto.Basic();
|
||||
dto.setId(this.id);
|
||||
dto.setDatasetId(this.datasetId);
|
||||
dto.setSheetNum(this.sheetNum);
|
||||
dto.setFileName(this.fileName);
|
||||
dto.setFileSize(this.fileSize);
|
||||
dto.setFilePath(this.filePath);
|
||||
dto.setStatus(this.status);
|
||||
dto.setMemo(this.memo);
|
||||
dto.setDeleted(this.deleted);
|
||||
dto.setCreatedDttm(this.createdDttm);
|
||||
dto.setUpdatedDttm(this.updatedDttm);
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
package com.kamco.cd.training.postgres.entity;
|
||||
|
||||
import com.kamco.cd.training.common.enums.StatusType;
|
||||
import com.kamco.cd.training.members.dto.MembersDto;
|
||||
import jakarta.persistence.*;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.ColumnDefault;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@Table(name = "tb_member")
|
||||
public class MemberEntity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id", nullable = false)
|
||||
private Long id;
|
||||
|
||||
@NotNull
|
||||
@ColumnDefault("gen_random_uuid()")
|
||||
@Column(name = "uuid", nullable = false)
|
||||
private UUID uuid = UUID.randomUUID();
|
||||
|
||||
@Size(max = 50)
|
||||
@NotNull
|
||||
@Column(name = "user_role", nullable = false, length = 50)
|
||||
private String userRole;
|
||||
|
||||
@Size(max = 50)
|
||||
@NotNull
|
||||
@Column(name = "user_id", nullable = false, length = 50)
|
||||
private String userId;
|
||||
|
||||
@Size(max = 50)
|
||||
@NotNull
|
||||
@Column(name = "employee_no", nullable = false, length = 50)
|
||||
private String employeeNo;
|
||||
|
||||
@Size(max = 100)
|
||||
@NotNull
|
||||
@Column(name = "name", nullable = false, length = 100)
|
||||
private String name;
|
||||
|
||||
@Size(max = 255)
|
||||
@NotNull
|
||||
@Column(name = "password", nullable = false)
|
||||
private String password;
|
||||
|
||||
@Size(max = 20)
|
||||
@Column(name = "status", length = 20)
|
||||
private String status = StatusType.PENDING.getId();
|
||||
|
||||
@NotNull
|
||||
@ColumnDefault("now()")
|
||||
@Column(name = "created_dttm", nullable = false)
|
||||
private ZonedDateTime createdDttm = ZonedDateTime.now();
|
||||
|
||||
@ColumnDefault("now()")
|
||||
@Column(name = "updated_dttm")
|
||||
private ZonedDateTime updatedDttm = ZonedDateTime.now();
|
||||
|
||||
@Column(name = "first_login_dttm")
|
||||
private ZonedDateTime firstLoginDttm;
|
||||
|
||||
@Column(name = "last_login_dttm")
|
||||
private ZonedDateTime lastLoginDttm;
|
||||
|
||||
@Column(name = "login_fail_count")
|
||||
@ColumnDefault("0")
|
||||
private Integer loginFailCount = 0;
|
||||
|
||||
@Column(name = "rgstr_uid")
|
||||
private Long rgstrUidl;
|
||||
|
||||
@Column(name = "updtr_uid")
|
||||
private Long updtrUid;
|
||||
|
||||
@Column(name = "status_chg_dttm")
|
||||
private ZonedDateTime statusChgDttm;
|
||||
|
||||
@Column(name = "pwd_reset_yn")
|
||||
private Boolean pwdResetYn;
|
||||
|
||||
public void changeStatus(String newStatus) {
|
||||
// 같은 값 보내도 무시
|
||||
if (Objects.equals(this.status, newStatus)) {
|
||||
return;
|
||||
}
|
||||
this.status = newStatus;
|
||||
this.statusChgDttm = ZonedDateTime.now();
|
||||
}
|
||||
|
||||
public MembersDto.Basic toDto() {
|
||||
return new MembersDto.Basic(
|
||||
this.id,
|
||||
this.uuid,
|
||||
this.userRole,
|
||||
this.name,
|
||||
this.employeeNo,
|
||||
this.status,
|
||||
this.createdDttm,
|
||||
this.firstLoginDttm,
|
||||
this.lastLoginDttm,
|
||||
this.statusChgDttm,
|
||||
this.pwdResetYn);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.kamco.cd.training.postgres.entity;
|
||||
|
||||
import com.kamco.cd.training.menu.dto.MenuDto;
|
||||
import com.kamco.cd.training.postgres.CommonDateEntity;
|
||||
import jakarta.persistence.*;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@NoArgsConstructor(access = AccessLevel.PROTECTED)
|
||||
@Table(name = "tb_menu")
|
||||
public class MenuEntity extends CommonDateEntity {
|
||||
@Id
|
||||
@Column(name = "menu_uid")
|
||||
private String menuUid;
|
||||
|
||||
@Column(name = "menu_nm")
|
||||
private String menuNm;
|
||||
|
||||
@Column(name = "menu_url")
|
||||
private String menuUrl;
|
||||
|
||||
@Column(name = "description")
|
||||
private String description;
|
||||
|
||||
@Column(name = "menu_order")
|
||||
private Long menuOrder;
|
||||
|
||||
@NotNull
|
||||
@Column(name = "is_use", nullable = true)
|
||||
private Boolean isUse = true;
|
||||
|
||||
@NotNull
|
||||
@Column(name = "deleted", nullable = false)
|
||||
private Boolean deleted = false;
|
||||
|
||||
private Long createdUid;
|
||||
private Long updatedUid;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "parent_menu_uid")
|
||||
private MenuEntity parent;
|
||||
|
||||
@OneToMany(mappedBy = "parent", fetch = FetchType.LAZY, cascade = CascadeType.ALL)
|
||||
private List<MenuEntity> children = new ArrayList<>();
|
||||
|
||||
@Column(name = "menu_api_uri")
|
||||
private String menuApiUri;
|
||||
|
||||
public MenuDto.Basic toDto() {
|
||||
return new MenuDto.Basic(
|
||||
this.menuUid,
|
||||
this.menuNm,
|
||||
this.menuUrl,
|
||||
this.description,
|
||||
this.menuOrder,
|
||||
this.isUse,
|
||||
this.deleted,
|
||||
this.createdUid,
|
||||
this.updatedUid,
|
||||
this.children.stream().map(MenuEntity::toDto).toList(),
|
||||
this.getCreatedDate(),
|
||||
this.getModifiedDate(),
|
||||
this.menuApiUri);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.kamco.cd.training.postgres.entity;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.IdClass;
|
||||
import jakarta.persistence.Table;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Table(name = "tb_model_dataset_mapp")
|
||||
@IdClass(ModelDatasetMappEntity.ModelDatasetMappId.class)
|
||||
public class ModelDatasetMappEntity {
|
||||
|
||||
@Id
|
||||
@NotNull
|
||||
@Column(name = "model_uid", nullable = false)
|
||||
private Long modelUid;
|
||||
|
||||
@Id
|
||||
@NotNull
|
||||
@Column(name = "dataset_uid", nullable = false)
|
||||
private Long datasetUid;
|
||||
|
||||
@Size(max = 20)
|
||||
@Column(name = "dataset_type", length = 20)
|
||||
private String datasetType;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class ModelDatasetMappId implements Serializable {
|
||||
private Long modelUid;
|
||||
private Long datasetUid;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,232 @@
|
||||
package com.kamco.cd.training.postgres.entity;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Table;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import java.time.ZonedDateTime;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.ColumnDefault;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Table(name = "tb_model_hyper_param")
|
||||
public class ModelHyperParamEntity {
|
||||
|
||||
@Id
|
||||
@NotNull
|
||||
@Size(max = 50)
|
||||
@Column(name = "hyper_ver", nullable = false, length = 50)
|
||||
private String hyperVer;
|
||||
|
||||
// ==================== Important Parameters ====================
|
||||
|
||||
@Size(max = 20)
|
||||
@ColumnDefault("'large'")
|
||||
@Column(name = "backbone", length = 20)
|
||||
private String backbone = "large";
|
||||
|
||||
@Size(max = 20)
|
||||
@ColumnDefault("'256,256'")
|
||||
@Column(name = "input_size", length = 20)
|
||||
private String inputSize = "256,256";
|
||||
|
||||
@Size(max = 20)
|
||||
@ColumnDefault("'256,256'")
|
||||
@Column(name = "crop_size", length = 20)
|
||||
private String cropSize = "256,256";
|
||||
|
||||
@ColumnDefault("200")
|
||||
@Column(name = "epoch_cnt")
|
||||
private Integer epochCnt = 200;
|
||||
|
||||
@ColumnDefault("16")
|
||||
@Column(name = "batch_size")
|
||||
private Integer batchSize = 16;
|
||||
|
||||
// ==================== Model Architecture ====================
|
||||
|
||||
@ColumnDefault("0.3")
|
||||
@Column(name = "drop_path_rate")
|
||||
private Double dropPathRate = 0.3;
|
||||
|
||||
@ColumnDefault("-1")
|
||||
@Column(name = "frozen_stages")
|
||||
private Integer frozenStages = -1;
|
||||
|
||||
@Size(max = 20)
|
||||
@ColumnDefault("'abs_diff'")
|
||||
@Column(name = "neck_policy", length = 20)
|
||||
private String neckPolicy = "abs_diff";
|
||||
|
||||
@Size(max = 255)
|
||||
@ColumnDefault("'512,256,128,64'")
|
||||
@Column(name = "decoder_channels", length = 255)
|
||||
private String decoderChannels = "512,256,128,64";
|
||||
|
||||
@Size(max = 500)
|
||||
@Column(name = "class_weight", length = 500)
|
||||
private String classWeight;
|
||||
|
||||
@Column(name = "num_layers")
|
||||
private Integer numLayers;
|
||||
|
||||
// ==================== Loss & Optimization ====================
|
||||
|
||||
@ColumnDefault("0.00006")
|
||||
@Column(name = "learning_rate")
|
||||
private Double learningRate = 0.00006;
|
||||
|
||||
@ColumnDefault("0.05")
|
||||
@Column(name = "weight_decay")
|
||||
private Double weightDecay = 0.05;
|
||||
|
||||
@ColumnDefault("0.9")
|
||||
@Column(name = "layer_decay_rate")
|
||||
private Double layerDecayRate = 0.9;
|
||||
|
||||
@ColumnDefault("true")
|
||||
@Column(name = "ddp_find_unused_params")
|
||||
private Boolean ddpFindUnusedParams = true;
|
||||
|
||||
@ColumnDefault("255")
|
||||
@Column(name = "ignore_index")
|
||||
private Integer ignoreIndex = 255;
|
||||
|
||||
// ==================== Data ====================
|
||||
|
||||
@ColumnDefault("16")
|
||||
@Column(name = "train_num_workers")
|
||||
private Integer trainNumWorkers = 16;
|
||||
|
||||
@ColumnDefault("8")
|
||||
@Column(name = "val_num_workers")
|
||||
private Integer valNumWorkers = 8;
|
||||
|
||||
@ColumnDefault("8")
|
||||
@Column(name = "test_num_workers")
|
||||
private Integer testNumWorkers = 8;
|
||||
|
||||
@ColumnDefault("true")
|
||||
@Column(name = "train_shuffle")
|
||||
private Boolean trainShuffle = true;
|
||||
|
||||
@ColumnDefault("true")
|
||||
@Column(name = "train_persistent")
|
||||
private Boolean trainPersistent = true;
|
||||
|
||||
@ColumnDefault("true")
|
||||
@Column(name = "val_persistent")
|
||||
private Boolean valPersistent = true;
|
||||
|
||||
// ==================== Evaluation ====================
|
||||
|
||||
@Size(max = 255)
|
||||
@ColumnDefault("'mFscore,mIoU'")
|
||||
@Column(name = "metrics", length = 255)
|
||||
private String metrics = "mFscore,mIoU";
|
||||
|
||||
@Size(max = 50)
|
||||
@ColumnDefault("'changed_fscore'")
|
||||
@Column(name = "save_best", length = 50)
|
||||
private String saveBest = "changed_fscore";
|
||||
|
||||
@Size(max = 20)
|
||||
@ColumnDefault("'greater'")
|
||||
@Column(name = "save_best_rule", length = 20)
|
||||
private String saveBestRule = "greater";
|
||||
|
||||
@ColumnDefault("10")
|
||||
@Column(name = "val_interval")
|
||||
private Integer valInterval = 10;
|
||||
|
||||
@ColumnDefault("400")
|
||||
@Column(name = "log_interval")
|
||||
private Integer logInterval = 400;
|
||||
|
||||
@ColumnDefault("1")
|
||||
@Column(name = "vis_interval")
|
||||
private Integer visInterval = 1;
|
||||
|
||||
// ==================== Hardware ====================
|
||||
|
||||
@ColumnDefault("4")
|
||||
@Column(name = "gpu_cnt")
|
||||
private Integer gpuCnt = 4;
|
||||
|
||||
@Size(max = 100)
|
||||
@ColumnDefault("'0,1,2,3'")
|
||||
@Column(name = "gpu_ids", length = 100)
|
||||
private String gpuIds = "0,1,2,3";
|
||||
|
||||
@ColumnDefault("1122")
|
||||
@Column(name = "master_port")
|
||||
private Integer masterPort = 1122;
|
||||
|
||||
// ==================== Augmentation ====================
|
||||
|
||||
@ColumnDefault("0.5")
|
||||
@Column(name = "rot_prob")
|
||||
private Double rotProb = 0.5;
|
||||
|
||||
@ColumnDefault("0.5")
|
||||
@Column(name = "flip_prob")
|
||||
private Double flipProb = 0.5;
|
||||
|
||||
@Size(max = 20)
|
||||
@ColumnDefault("'-20,20'")
|
||||
@Column(name = "rot_degree", length = 20)
|
||||
private String rotDegree = "-20,20";
|
||||
|
||||
@ColumnDefault("0.5")
|
||||
@Column(name = "exchange_prob")
|
||||
private Double exchangeProb = 0.5;
|
||||
|
||||
@ColumnDefault("10")
|
||||
@Column(name = "brightness_delta")
|
||||
private Integer brightnessDelta = 10;
|
||||
|
||||
@Size(max = 20)
|
||||
@ColumnDefault("'0.8,1.2'")
|
||||
@Column(name = "contrast_range", length = 20)
|
||||
private String contrastRange = "0.8,1.2";
|
||||
|
||||
@Size(max = 20)
|
||||
@ColumnDefault("'0.8,1.2'")
|
||||
@Column(name = "saturation_range", length = 20)
|
||||
private String saturationRange = "0.8,1.2";
|
||||
|
||||
@ColumnDefault("10")
|
||||
@Column(name = "hue_delta")
|
||||
private Integer hueDelta = 10;
|
||||
|
||||
// ==================== Legacy (deprecated) ====================
|
||||
|
||||
@Column(name = "cnn_filter_cnt")
|
||||
private Integer cnnFilterCnt;
|
||||
|
||||
@Column(name = "dropout_ratio")
|
||||
private Double dropoutRatio;
|
||||
|
||||
// ==================== Common ====================
|
||||
|
||||
@Column(name = "memo", length = Integer.MAX_VALUE)
|
||||
private String memo;
|
||||
|
||||
@Size(max = 255)
|
||||
@ColumnDefault("'N'")
|
||||
@Column(name = "del_yn", length = 255)
|
||||
private String delYn = "N";
|
||||
|
||||
@ColumnDefault("now()")
|
||||
@Column(name = "created_dttm")
|
||||
private ZonedDateTime createdDttm;
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package com.kamco.cd.training.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.PrePersist;
|
||||
import jakarta.persistence.Table;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import java.time.Instant;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.UUID;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.ColumnDefault;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@Table(name = "tb_model_mng")
|
||||
public class ModelMngEntity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "model_uid", nullable = false)
|
||||
private Long id;
|
||||
|
||||
@Column(name = "uuid", columnDefinition = "uuid", nullable = false, updatable = false)
|
||||
private UUID uuid;
|
||||
|
||||
@Size(max = 100)
|
||||
@ColumnDefault("'NULL::character varying'")
|
||||
@Column(name = "model_nm", length = 100)
|
||||
private String modelNm;
|
||||
|
||||
@Size(max = 64)
|
||||
@ColumnDefault("'NULL::character varying'")
|
||||
@Column(name = "model_cate", length = 64)
|
||||
private String modelCate;
|
||||
|
||||
@Size(max = 255)
|
||||
@ColumnDefault("'NULL::character varying'")
|
||||
@Column(name = "model_path")
|
||||
private String modelPath;
|
||||
|
||||
@Column(name = "created_dttm")
|
||||
private Instant createdDttm;
|
||||
|
||||
@Column(name = "created_uid")
|
||||
private Long createdUid;
|
||||
|
||||
@Column(name = "updated_dttm")
|
||||
private Instant updatedDttm;
|
||||
|
||||
@Column(name = "updated_uid")
|
||||
private Long updatedUid;
|
||||
|
||||
@Column(name = "start_dttm")
|
||||
private ZonedDateTime startDttm;
|
||||
|
||||
@Column(name = "training_end_dttm")
|
||||
private ZonedDateTime trainingEndDttm;
|
||||
|
||||
@Column(name = "test_end_dttm")
|
||||
private ZonedDateTime testEndDttm;
|
||||
|
||||
@Column(name = "duration_dttm")
|
||||
private ZonedDateTime durationDttm;
|
||||
|
||||
@Size(max = 50)
|
||||
@Column(name = "process_stage", length = 50)
|
||||
private String processStage;
|
||||
|
||||
@Size(max = 50)
|
||||
@Column(name = "status", length = 50)
|
||||
private String status;
|
||||
|
||||
@ColumnDefault("false")
|
||||
@Column(name = "deleted")
|
||||
private Boolean deleted;
|
||||
|
||||
@PrePersist
|
||||
public void prePersist() {
|
||||
if (this.uuid == null) {
|
||||
this.uuid = UUID.randomUUID();
|
||||
}
|
||||
}
|
||||
|
||||
/** UUID 필드가 제대로 설정되었는지 확인 (디버그용) */
|
||||
public String getUuidString() {
|
||||
return this.uuid != null ? this.uuid.toString() : null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,170 @@
|
||||
package com.kamco.cd.training.postgres.entity;
|
||||
|
||||
import com.kamco.cd.training.model.dto.ModelMngDto;
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.PrePersist;
|
||||
import jakarta.persistence.Table;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import java.time.Instant;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.UUID;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.ColumnDefault;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@Table(name = "tb_model_train_master")
|
||||
public class ModelTrainMasterEntity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "model_uid", nullable = false)
|
||||
private Long id;
|
||||
|
||||
@Column(name = "uuid", columnDefinition = "uuid", nullable = false, updatable = false)
|
||||
private UUID uuid;
|
||||
|
||||
@Size(max = 50)
|
||||
@NotNull
|
||||
@Column(name = "model_ver", nullable = false, length = 50)
|
||||
private String modelVer;
|
||||
|
||||
@Size(max = 50)
|
||||
@Column(name = "hyper_ver", length = 50)
|
||||
private String hyperVer;
|
||||
|
||||
@Size(max = 50)
|
||||
@Column(name = "epoch_ver", length = 50)
|
||||
private String epochVer;
|
||||
|
||||
@Size(max = 50)
|
||||
@Column(name = "process_step", length = 50)
|
||||
private String processStep;
|
||||
|
||||
@Size(max = 20)
|
||||
@Column(name = "status_cd", length = 20)
|
||||
private String statusCd;
|
||||
|
||||
@Column(name = "train_start_dttm")
|
||||
private ZonedDateTime trainStartDttm;
|
||||
|
||||
@Column(name = "epoch_cnt")
|
||||
private Integer epochCnt;
|
||||
|
||||
@Size(max = 50)
|
||||
@Column(name = "dataset_ratio", length = 50)
|
||||
private String datasetRatio;
|
||||
|
||||
@Column(name = "best_epoch")
|
||||
private Integer bestEpoch;
|
||||
|
||||
@Column(name = "step1_end_dttm")
|
||||
private ZonedDateTime step1EndDttm;
|
||||
|
||||
@Size(max = 50)
|
||||
@Column(name = "step1_duration", length = 50)
|
||||
private String step1Duration;
|
||||
|
||||
@Column(name = "step2_end_dttm")
|
||||
private ZonedDateTime step2EndDttm;
|
||||
|
||||
@Size(max = 50)
|
||||
@Column(name = "step2_duration", length = 50)
|
||||
private String step2Duration;
|
||||
|
||||
@ColumnDefault("false")
|
||||
@Column(name = "del_yn")
|
||||
private Boolean delYn = false;
|
||||
|
||||
@Column(name = "created_uid")
|
||||
private Long createdUid;
|
||||
|
||||
@Column(name = "updated_uid")
|
||||
private Long updatedUid;
|
||||
|
||||
@ColumnDefault("now()")
|
||||
@Column(name = "created_dttm")
|
||||
private ZonedDateTime createdDttm;
|
||||
|
||||
@Column(name = "updated_dttm")
|
||||
private ZonedDateTime updatedDttm;
|
||||
|
||||
@ColumnDefault("0")
|
||||
@Column(name = "progress_rate")
|
||||
private Integer progressRate;
|
||||
|
||||
@Column(name = "stop_dttm")
|
||||
private Instant stopDttm;
|
||||
|
||||
@Column(name = "confirmed_best_epoch")
|
||||
private Integer confirmedBestEpoch;
|
||||
|
||||
@Size(max = 255)
|
||||
@Column(name = "model_path")
|
||||
private String modelPath;
|
||||
|
||||
@Column(name = "error_msg", length = Integer.MAX_VALUE)
|
||||
private String errorMsg;
|
||||
|
||||
// ==================== Resume Training (학습 재시작) ====================
|
||||
|
||||
@Column(name = "last_checkpoint_epoch")
|
||||
private Integer lastCheckpointEpoch;
|
||||
|
||||
@Size(max = 500)
|
||||
@Column(name = "checkpoint_path", length = 500)
|
||||
private String checkpointPath;
|
||||
|
||||
@ColumnDefault("false")
|
||||
@Column(name = "can_resume")
|
||||
private Boolean canResume = false;
|
||||
|
||||
@Column(name = "step2_start_dttm")
|
||||
private Instant step2StartDttm;
|
||||
|
||||
@Size(max = 1000)
|
||||
@Column(name = "train_log_path", length = 1000)
|
||||
private String trainLogPath;
|
||||
|
||||
@Column(name = "memo", length = Integer.MAX_VALUE)
|
||||
private String memo;
|
||||
|
||||
@Column(name = "base_model_uid")
|
||||
private Integer baseModelUid;
|
||||
|
||||
@Size(max = 1000)
|
||||
@Column(name = "pretrained_model_path", length = 1000)
|
||||
private String pretrainedModelPath;
|
||||
|
||||
@PrePersist
|
||||
public void prePersist() {
|
||||
if (this.uuid == null) {
|
||||
this.uuid = UUID.randomUUID();
|
||||
}
|
||||
}
|
||||
|
||||
public ModelMngDto.Basic toDto() {
|
||||
ModelMngDto.Basic dto = new ModelMngDto.Basic();
|
||||
dto.setId(this.id);
|
||||
dto.setModelNm(this.modelVer);
|
||||
dto.setStartDttm(this.trainStartDttm);
|
||||
dto.setTrainingEndDttm(this.step1EndDttm);
|
||||
dto.setTestEndDttm(this.step2EndDttm);
|
||||
dto.setDurationDttm(this.step2Duration);
|
||||
dto.setProcessStage(this.processStep);
|
||||
dto.setStatusCd(this.statusCd);
|
||||
return dto;
|
||||
}
|
||||
|
||||
/** UUID 필드가 제대로 설정되었는지 확인 (디버그용) */
|
||||
public String getUuidString() {
|
||||
return this.uuid != null ? this.uuid.toString() : null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.kamco.cd.training.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.Table;
|
||||
import java.time.ZonedDateTime;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Entity
|
||||
@Table(name = "system_metrics")
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class SystemMetricsEntity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Integer id;
|
||||
|
||||
@Column(nullable = false)
|
||||
private ZonedDateTime timestamp;
|
||||
|
||||
@Column(name = "server_name", nullable = false)
|
||||
private String serverName;
|
||||
|
||||
@Column(name = "cpu_user")
|
||||
private Float cpuUser;
|
||||
|
||||
@Column(name = "cpu_system")
|
||||
private Float cpuSystem;
|
||||
|
||||
@Column(name = "cpu_iowait")
|
||||
private Float cpuIowait;
|
||||
|
||||
@Column(name = "cpu_idle")
|
||||
private Float cpuIdle;
|
||||
|
||||
@Column(name = "kbmemfree")
|
||||
private Long kbmemfree;
|
||||
|
||||
@Column(name = "kbmemused")
|
||||
private Long kbmemused;
|
||||
|
||||
@Column(name = "memused")
|
||||
private Float memused;
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package com.kamco.cd.training.postgres.entity;
|
||||
|
||||
import com.kamco.cd.training.upload.dto.UploadDto;
|
||||
import jakarta.persistence.*;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.UUID;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.ColumnDefault;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@Table(name = "tb_upload_session")
|
||||
public class UploadSessionEntity {
|
||||
|
||||
@Id
|
||||
@Column(name = "upload_id", nullable = false, length = 100)
|
||||
private String uploadId;
|
||||
|
||||
@Size(max = 255)
|
||||
@NotNull
|
||||
@Column(name = "file_name", nullable = false, length = 255)
|
||||
private String fileName;
|
||||
|
||||
@NotNull
|
||||
@Column(name = "file_size", nullable = false)
|
||||
private Long fileSize;
|
||||
|
||||
@Column(name = "dataset_id")
|
||||
private Long datasetId;
|
||||
|
||||
@Column(name = "total_chunks")
|
||||
private Integer totalChunks;
|
||||
|
||||
@Column(name = "uploaded_chunks")
|
||||
private Integer uploadedChunks = 0;
|
||||
|
||||
@Size(max = 20)
|
||||
@NotNull
|
||||
@Column(name = "status", nullable = false, length = 20)
|
||||
private String status; // INIT, UPLOADING, PROCESSING, COMPLETED, FAILED
|
||||
|
||||
@Size(max = 500)
|
||||
@Column(name = "temp_path", length = 500)
|
||||
private String tempPath;
|
||||
|
||||
@Size(max = 500)
|
||||
@Column(name = "final_path", length = 500)
|
||||
private String finalPath;
|
||||
|
||||
@Column(name = "error_message", columnDefinition = "text")
|
||||
private String errorMessage;
|
||||
|
||||
@NotNull
|
||||
@ColumnDefault("now()")
|
||||
@Column(name = "created_dttm", nullable = false)
|
||||
private ZonedDateTime createdDttm = ZonedDateTime.now();
|
||||
|
||||
@NotNull
|
||||
@ColumnDefault("now()")
|
||||
@Column(name = "updated_dttm", nullable = false)
|
||||
private ZonedDateTime updatedDttm = ZonedDateTime.now();
|
||||
|
||||
@Column(name = "completed_dttm")
|
||||
private ZonedDateTime completedDttm;
|
||||
|
||||
@Size(max = 50)
|
||||
@Column(name = "upload_divi", length = 50)
|
||||
private String uploadDivi;
|
||||
|
||||
@Size(max = 300)
|
||||
@Column(name = "file_hash", length = 300)
|
||||
private String fileHash;
|
||||
|
||||
@Column(name = "chunk_total_index")
|
||||
private Integer chunkTotalIndex;
|
||||
|
||||
@Column(name = "chunk_index")
|
||||
private Integer chunkIndex = 0;
|
||||
|
||||
@NotNull
|
||||
@ColumnDefault("uuid_generate_v4()")
|
||||
@Column(name = "uuid", nullable = false)
|
||||
private UUID uuid;
|
||||
|
||||
@PrePersist
|
||||
protected void onPersist() {
|
||||
if (this.createdDttm == null) {
|
||||
this.createdDttm = ZonedDateTime.now();
|
||||
}
|
||||
if (this.chunkIndex == null) {
|
||||
this.chunkIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user