esoe
3 months ago
9 changed files with 246 additions and 109 deletions
@ -0,0 +1,23 @@ |
|||||||
|
package ru.mlokoin.gates.model.fs; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.NoArgsConstructor; |
||||||
|
|
||||||
|
|
||||||
|
@AllArgsConstructor |
||||||
|
@NoArgsConstructor |
||||||
|
@Data |
||||||
|
public class Post implements Serializable { |
||||||
|
private long id; |
||||||
|
private String type;//тип документа (реестр/ списочный состав/ прочее)
|
||||||
|
private Document document; |
||||||
|
|
||||||
|
public Post(String type, Document document) { |
||||||
|
this.type = type; |
||||||
|
this.document = document; |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,32 @@ |
|||||||
|
package ru.molokoin.resourceserviceapi.entities; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
|
||||||
|
import org.hibernate.annotations.OnDelete; |
||||||
|
import org.hibernate.annotations.OnDeleteAction; |
||||||
|
|
||||||
|
import jakarta.persistence.Entity; |
||||||
|
import jakarta.persistence.FetchType; |
||||||
|
import jakarta.persistence.GeneratedValue; |
||||||
|
import jakarta.persistence.GenerationType; |
||||||
|
import jakarta.persistence.Id; |
||||||
|
import jakarta.persistence.OneToOne; |
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.NoArgsConstructor; |
||||||
|
|
||||||
|
|
||||||
|
@AllArgsConstructor |
||||||
|
@NoArgsConstructor |
||||||
|
@Entity |
||||||
|
@Data |
||||||
|
public class Post implements Serializable { |
||||||
|
@Id |
||||||
|
@GeneratedValue(strategy=GenerationType.AUTO) |
||||||
|
private long id; |
||||||
|
private String type;//тип документа (реестр/ списочный состав/ прочее)
|
||||||
|
|
||||||
|
@OneToOne(fetch = FetchType.EAGER, optional = false) |
||||||
|
@OnDelete(action = OnDeleteAction.CASCADE) |
||||||
|
private StorageEntry document; |
||||||
|
} |
@ -0,0 +1,13 @@ |
|||||||
|
package ru.molokoin.resourceserviceapi.repositories; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
import org.springframework.data.repository.ListCrudRepository; |
||||||
|
import org.springframework.stereotype.Repository; |
||||||
|
|
||||||
|
import ru.molokoin.resourceserviceapi.entities.Post; |
||||||
|
|
||||||
|
@Repository |
||||||
|
public interface PostFace extends ListCrudRepository<Post, Long>{ |
||||||
|
List<Post> findAll(); |
||||||
|
} |
Loading…
Reference in new issue