feat: 들여쓰기

This commit is contained in:
2025-11-17 14:19:29 +09:00
parent 92f5b61114
commit dc9b40e78b
29 changed files with 735 additions and 777 deletions

View File

@@ -28,48 +28,48 @@ import lombok.NoArgsConstructor;
@Table(name = "tb_animal")
public class AnimalEntity extends CommonDateEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long uid;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long uid;
@Column(unique = true)
private UUID uuid;
@Column(unique = true)
private UUID uuid;
@Enumerated(EnumType.STRING)
private Category category;
@Enumerated(EnumType.STRING)
private Category category;
@Enumerated(EnumType.STRING)
private Species species;
@Enumerated(EnumType.STRING)
private Species species;
private String name;
private Boolean isDeleted;
private String name;
private Boolean isDeleted;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "zoo_id")
private ZooEntity zoo;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "zoo_id")
private ZooEntity zoo;
// Construct
public AnimalEntity(Category category, Species species, String name, ZooEntity zoo) {
this.uuid = UUID.randomUUID();
this.category = category;
this.species = species;
this.name = name;
this.isDeleted = false;
this.zoo = zoo;
}
// Construct
public AnimalEntity(Category category, Species species, String name, ZooEntity zoo) {
this.uuid = UUID.randomUUID();
this.category = category;
this.species = species;
this.name = name;
this.isDeleted = false;
this.zoo = zoo;
}
public AnimalDto.Basic toDto() {
return new AnimalDto.Basic(
this.uid,
this.uuid.toString(),
this.name,
this.category,
this.species,
super.getCreatedDate(),
super.getModifiedDate());
}
public AnimalDto.Basic toDto() {
return new AnimalDto.Basic(
this.uid,
this.uuid.toString(),
this.name,
this.category,
this.species,
super.getCreatedDate(),
super.getModifiedDate());
}
public void deleted() {
this.isDeleted = true;
}
public void deleted() {
this.isDeleted = true;
}
}

View File

@@ -23,44 +23,44 @@ import lombok.NoArgsConstructor;
@Table(name = "tb_zoo")
public class ZooEntity extends CommonDateEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long uid;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long uid;
@Column(unique = true, nullable = false)
private UUID uuid;
@Column(unique = true, nullable = false)
private UUID uuid;
@Column(nullable = false, length = 200)
private String name;
@Column(nullable = false, length = 200)
private String name;
@Column(length = 300)
private String location;
@Column(length = 300)
private String location;
@Column(columnDefinition = "TEXT")
private String description;
@Column(columnDefinition = "TEXT")
private String description;
@Column(nullable = false)
private Boolean isDeleted;
@Column(nullable = false)
private Boolean isDeleted;
@OneToMany(mappedBy = "zoo", fetch = FetchType.LAZY, cascade = CascadeType.ALL)
private List<AnimalEntity> animals = new ArrayList<>();
@OneToMany(mappedBy = "zoo", fetch = FetchType.LAZY, cascade = CascadeType.ALL)
private List<AnimalEntity> animals = new ArrayList<>();
// Constructor
public ZooEntity(String name, String location, String description) {
this.uuid = UUID.randomUUID();
this.name = name;
this.location = location;
this.description = description;
this.isDeleted = false;
}
// Constructor
public ZooEntity(String name, String location, String description) {
this.uuid = UUID.randomUUID();
this.name = name;
this.location = location;
this.description = description;
this.isDeleted = false;
}
// 논리 삭제
public void deleted() {
this.isDeleted = true;
}
// 논리 삭제
public void deleted() {
this.isDeleted = true;
}
// 현재 활성 동물 개수 조회 (삭제되지 않은 동물만)
public long getActiveAnimalCount() {
return animals.stream().filter(animal -> !animal.getIsDeleted()).count();
}
// 현재 활성 동물 개수 조회 (삭제되지 않은 동물만)
public long getActiveAnimalCount() {
return animals.stream().filter(animal -> !animal.getIsDeleted()).count();
}
}