From f301e28f89f4342439a75b8839c7b8307c2b9781 Mon Sep 17 00:00:00 2001 From: esoe Date: Mon, 8 Apr 2024 18:02:25 +0300 Subject: [PATCH] qq --- resource-service-api/pom.xml | 15 ++++++++++- .../resourceserviceapi/entities/Teacher.java | 26 +++++++++++++++++++ .../repositories/TeachersRepositoryFace.java | 11 ++++++++ .../src/main/resources/application.yaml | 8 ++++++ 4 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 resource-service-api/src/main/java/ru/molokoin/resourceserviceapi/entities/Teacher.java create mode 100644 resource-service-api/src/main/java/ru/molokoin/resourceserviceapi/repositories/TeachersRepositoryFace.java diff --git a/resource-service-api/pom.xml b/resource-service-api/pom.xml index 96196b5..92a6274 100644 --- a/resource-service-api/pom.xml +++ b/resource-service-api/pom.xml @@ -31,12 +31,25 @@ spring-boot-starter-test test - org.springframework.boot spring-boot-devtools runtime + + org.springframework.boot + spring-boot-starter-data-jpa + + + org.postgresql + postgresql + runtime + + + org.projectlombok + lombok + annotationProcessor + diff --git a/resource-service-api/src/main/java/ru/molokoin/resourceserviceapi/entities/Teacher.java b/resource-service-api/src/main/java/ru/molokoin/resourceserviceapi/entities/Teacher.java new file mode 100644 index 0000000..6cca95b --- /dev/null +++ b/resource-service-api/src/main/java/ru/molokoin/resourceserviceapi/entities/Teacher.java @@ -0,0 +1,26 @@ +package ru.molokoin.resourceserviceapi.entities; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@NoArgsConstructor +@AllArgsConstructor +@Entity +@Data +public class Teacher { + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + private long id; + @Column(length=50) + private String first_name;//Имя + private String second_name;//Фамилия + private String last_name;//Отчество + private String employee_id; + private String snils; +} diff --git a/resource-service-api/src/main/java/ru/molokoin/resourceserviceapi/repositories/TeachersRepositoryFace.java b/resource-service-api/src/main/java/ru/molokoin/resourceserviceapi/repositories/TeachersRepositoryFace.java new file mode 100644 index 0000000..7ff4873 --- /dev/null +++ b/resource-service-api/src/main/java/ru/molokoin/resourceserviceapi/repositories/TeachersRepositoryFace.java @@ -0,0 +1,11 @@ +package ru.molokoin.resourceserviceapi.repositories; + +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + +import ru.molokoin.resourceserviceapi.entities.Teacher; + +@Repository +public interface TeachersRepositoryFace extends CrudRepository{ + +} diff --git a/resource-service-api/src/main/resources/application.yaml b/resource-service-api/src/main/resources/application.yaml index 701120b..2107639 100644 --- a/resource-service-api/src/main/resources/application.yaml +++ b/resource-service-api/src/main/resources/application.yaml @@ -3,3 +3,11 @@ server: spring: application: name: resource-service-api + jpa: + hibernate: + ddl-auto: update + database-platform: org.hibernate.dialect.PostgreSQLDialect + datasource: + url: "jdbc:postgresql://postgres-service:5432/tech-services" + username: tech-services + password: password