Перенос кода из ЛР5 в ЛР6 (начало)

This commit is contained in:
2026-11-24 15:44:25 +03:00
parent 470d9d6f1e
commit a1071c87e9
71 changed files with 3179 additions and 0 deletions
@@ -0,0 +1,62 @@
package ru.mtusi.messenger.entity;
import jakarta.persistence.*;
import java.io.Serializable;
import java.util.Objects;
import java.util.UUID;
@Entity
@Table(name = "attachment_variants")
@IdClass(AttachmentVariantId.class)
public class AttachmentVariantEntity {
@Id
@Column(name = "attachment_id")
private UUID attachmentId;
@Id
@Column(name = "name")
private String name;
@Column(name = "object_key", nullable = false, length = 255)
private String objectKey;
@Column(name = "content_type", nullable = false, length = 100)
private String contentType;
@Column(name = "size_bytes", nullable = false)
private long sizeBytes;
@Column(nullable = false, length = 64)
private String sha256;
@Column(nullable = false)
private int width;
@Column(nullable = false)
private int height;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "attachment_id", insertable = false, updatable = false)
private AttachmentEntity attachment;
// Геттеры и сеттеры
public UUID getAttachmentId() { return attachmentId; }
public void setAttachmentId(UUID attachmentId) { this.attachmentId = attachmentId; }
public String getName() { return name; }
public void setName(String name) { this.name = name; }
public String getObjectKey() { return objectKey; }
public void setObjectKey(String objectKey) { this.objectKey = objectKey; }
public String getContentType() { return contentType; }
public void setContentType(String contentType) { this.contentType = contentType; }
public long getSizeBytes() { return sizeBytes; }
public void setSizeBytes(long sizeBytes) { this.sizeBytes = sizeBytes; }
public String getSha256() { return sha256; }
public void setSha256(String sha256) { this.sha256 = sha256; }
public int getWidth() { return width; }
public void setWidth(int width) { this.width = width; }
public int getHeight() { return height; }
public void setHeight(int height) { this.height = height; }
public AttachmentEntity getAttachment() { return attachment; }
public void setAttachment(AttachmentEntity attachment) { this.attachment = attachment; }
}