feat: polishing
This commit is contained in:
@@ -1,37 +1,92 @@
|
||||
package com.kamco.cd.kamcoback.postgres.entity;
|
||||
|
||||
import com.kamco.cd.kamcoback.postgres.CommonDateEntity;
|
||||
import jakarta.persistence.*;
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.FetchType;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import jakarta.persistence.Table;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import java.time.ZonedDateTime;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* This class represents the entity for managing the history of map sheets. It is mapped to the
|
||||
* database table "tb_map_sheet_mng_hst" and contains various properties related to the 1:5k map
|
||||
* sheet information, as well as metadata for file synchronization and management.
|
||||
*
|
||||
* <p>This entity: - Includes a primary key (hstUid) for unique identification. - Maintains
|
||||
* information associated with map sheets such as code, name, scale ratio, and paths. - Tracks
|
||||
* states, timestamps, and data synchronization details. - Maintains relationships with the
|
||||
* `MapInkx5kEntity` entity through a many-to-one association. - Provides functionality to update
|
||||
* file information and sizes (`tifSizeBytes`, `tfwSizeBytes`, and `totalSizeBytes`).
|
||||
*
|
||||
* <p>It extends the `CommonDateEntity` class to include common date management fields, such as
|
||||
* creation and modification timestamps.
|
||||
*
|
||||
* <p>The `@Getter` annotation generates getter methods for all fields, while the access to setters
|
||||
* is restricted to enforce controlled modifications. The entity uses `@NoArgsConstructor` with
|
||||
* `AccessLevel.PROTECTED` to restrict direct instantiation. The `updateFileInfos` method allows
|
||||
* dynamic updates of specific file information.
|
||||
*
|
||||
* <p>Fields include: - hstUid: Unique identifier for the history record. - mngYyyy: Year associated
|
||||
* with the management record. - mapInkx5kByCode: Reference to the related `MapInkx5kEntity` object.
|
||||
* - mapSheetNum: Map sheet number identifying specific map. - mapSheetName: Name of the map sheet.
|
||||
* - mapSheetCodeSrc: Source code of the map sheet. - scaleRatio: Scale ratio of the map. -
|
||||
* dataState: State/status of the map sheet data. - dataStateDttm: Timestamp of the data state. -
|
||||
* useInference: Indicator or metadata for inference usage. - useInferenceDttm: Timestamp for
|
||||
* inference-related use. - mapSheetPath: Path or location of the map sheet file. - refMapSheetNum:
|
||||
* Reference to a related map sheet number. - createdUid: User ID of the record creator. -
|
||||
* updatedUid: User ID of the last updater. - syncState and related fields: Fields to manage
|
||||
* synchronization states and processes. - tifSizeBytes, tfwSizeBytes, totalSizeBytes: Fields to
|
||||
* track file size details. - sync file name fields: Stores names of files relevant for
|
||||
* synchronization and verification.
|
||||
*
|
||||
* <p>This entity is essential for tracking and managing map sheet revisions, status, and usage in a
|
||||
* system leveraging 1:5k map data.
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
// entity의 접근제어를 위해 @setter를 사용 x
|
||||
// @Setter
|
||||
@NoArgsConstructor(access = AccessLevel.PROTECTED)
|
||||
@Entity
|
||||
// 영상관리이력
|
||||
@Table(name = "tb_map_sheet_mng_hst")
|
||||
public class MapSheetMngHstEntity extends CommonDateEntity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "hst_uid")
|
||||
private Long hstUid;
|
||||
private Long hstUid; // id
|
||||
|
||||
@Column(name = "mng_yyyy")
|
||||
private Integer mngYyyy;
|
||||
private Integer mngYyyy; // 년도
|
||||
|
||||
@Column(name = "map_sheet_code")
|
||||
private Integer mapSheetCode;
|
||||
// JPA 연관관계: MapInkx5k 참조 (PK 기반) 소속도엽번호 1:5k
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "map_sheet_code", referencedColumnName = "fid")
|
||||
private MapInkx5kEntity mapInkx5kByCode;
|
||||
|
||||
// TODO 1:5k 관련 정보 추후 제거 필요
|
||||
@Column(name = "map_sheet_num")
|
||||
private String mapSheetNum;
|
||||
private String mapSheetNum; // 도엽번호
|
||||
|
||||
@Column(name = "map_sheet_name")
|
||||
private String mapSheetName;
|
||||
|
||||
// TODO END
|
||||
|
||||
// 도엽파일이 저장된 경로
|
||||
@Column(name = "map_sheet_code_src")
|
||||
private Integer mapSheetCodeSrc;
|
||||
|
||||
// 도엽비율?
|
||||
@Column(name = "scale_ratio")
|
||||
private Integer scaleRatio;
|
||||
|
||||
@@ -103,4 +158,13 @@ public class MapSheetMngHstEntity extends CommonDateEntity {
|
||||
@Size(max = 100)
|
||||
@Column(name = "sync_check_tfw_file_name", length = 100)
|
||||
private String syncCheckTfwFileName;
|
||||
|
||||
// 파일정보 업데이트
|
||||
public void updateFileInfos(Long tifSizeBytes, Long tfwSizeBytes) {
|
||||
tifSizeBytes = tifSizeBytes == null ? 0L : tifSizeBytes;
|
||||
tfwSizeBytes = tfwSizeBytes == null ? 0L : tfwSizeBytes;
|
||||
this.tifSizeBytes = tifSizeBytes;
|
||||
this.tfwSizeBytes = tfwSizeBytes;
|
||||
this.totalSizeBytes = tifSizeBytes + tfwSizeBytes;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user