From 78646fa540836af50ecb23f9198de4cd7e43f0aa Mon Sep 17 00:00:00 2001 From: Cristobal Bernal Mayordomo <90463533+Racriberny@users.noreply.github.com> Date: Mon, 5 Dec 2022 16:53:14 +0100 Subject: [PATCH] EntidadesCreadasSolas... --- pom.xml | 6 + .../foro/entidades/AutorsEntity.java | 90 +++++++++++ .../foro/entidades/CategoriaForoEntity.java | 77 ++++++++++ .../foro/entidades/ForoPrincipalEntity.java | 144 ++++++++++++++++++ .../foro/entidades/ImagenEntity.java | 51 +++++++ .../foro/entidades/RespuestasEntity.java | 92 +++++++++++ .../entidades/TipoPrivileguiosEntity.java | 51 +++++++ .../foro/entidades/UsersEntity.java | 142 +++++++++++++++++ 8 files changed, 653 insertions(+) create mode 100644 src/main/java/com/cristobalbernal/foro/entidades/AutorsEntity.java create mode 100644 src/main/java/com/cristobalbernal/foro/entidades/CategoriaForoEntity.java create mode 100644 src/main/java/com/cristobalbernal/foro/entidades/ForoPrincipalEntity.java create mode 100644 src/main/java/com/cristobalbernal/foro/entidades/ImagenEntity.java create mode 100644 src/main/java/com/cristobalbernal/foro/entidades/RespuestasEntity.java create mode 100644 src/main/java/com/cristobalbernal/foro/entidades/TipoPrivileguiosEntity.java create mode 100644 src/main/java/com/cristobalbernal/foro/entidades/UsersEntity.java diff --git a/pom.xml b/pom.xml index 5ef814f..4d3d6f9 100644 --- a/pom.xml +++ b/pom.xml @@ -21,12 +21,18 @@ org.springframework.boot spring-boot-starter + + + org.springframework.boot + spring-boot-starter-data-jpa + org.springframework.boot spring-boot-starter-test test + diff --git a/src/main/java/com/cristobalbernal/foro/entidades/AutorsEntity.java b/src/main/java/com/cristobalbernal/foro/entidades/AutorsEntity.java new file mode 100644 index 0000000..b35371a --- /dev/null +++ b/src/main/java/com/cristobalbernal/foro/entidades/AutorsEntity.java @@ -0,0 +1,90 @@ +package com.cristobalbernal.foro.entidades; + +import jakarta.persistence.*; + +@Entity +@Table(name = "autors", schema = "foro", catalog = "") +public class AutorsEntity { + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Id + @Column(name = "id", nullable = false) + private int id; + @Basic + @Column(name = "imagen", nullable = true, length = 45) + private String imagen; + @Basic + @Column(name = "name", nullable = true, length = 45) + private String name; + @Basic + @Column(name = "surnames", nullable = true, length = 45) + private String surnames; + @Basic + @Column(name = "email", nullable = true, length = 45) + private String email; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getImagen() { + return imagen; + } + + public void setImagen(String imagen) { + this.imagen = imagen; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getSurnames() { + return surnames; + } + + public void setSurnames(String surnames) { + this.surnames = surnames; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + AutorsEntity that = (AutorsEntity) o; + + if (id != that.id) return false; + if (imagen != null ? !imagen.equals(that.imagen) : that.imagen != null) return false; + if (name != null ? !name.equals(that.name) : that.name != null) return false; + if (surnames != null ? !surnames.equals(that.surnames) : that.surnames != null) return false; + if (email != null ? !email.equals(that.email) : that.email != null) return false; + + return true; + } + + @Override + public int hashCode() { + int result = id; + result = 31 * result + (imagen != null ? imagen.hashCode() : 0); + result = 31 * result + (name != null ? name.hashCode() : 0); + result = 31 * result + (surnames != null ? surnames.hashCode() : 0); + result = 31 * result + (email != null ? email.hashCode() : 0); + return result; + } +} diff --git a/src/main/java/com/cristobalbernal/foro/entidades/CategoriaForoEntity.java b/src/main/java/com/cristobalbernal/foro/entidades/CategoriaForoEntity.java new file mode 100644 index 0000000..e3ffd42 --- /dev/null +++ b/src/main/java/com/cristobalbernal/foro/entidades/CategoriaForoEntity.java @@ -0,0 +1,77 @@ +package com.cristobalbernal.foro.entidades; + +import jakarta.persistence.*; + +@Entity +@Table(name = "categoria_foro", schema = "foro", catalog = "") +public class CategoriaForoEntity { + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Id + @Column(name = "id", nullable = false) + private int id; + @Basic + @Column(name = "name", nullable = true, length = 45) + private String name; + @Basic + @Column(name = "descripcion", nullable = true, length = 45) + private String descripcion; + @Basic + @Column(name = "users_id", nullable = false) + private int usersId; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescripcion() { + return descripcion; + } + + public void setDescripcion(String descripcion) { + this.descripcion = descripcion; + } + + public int getUsersId() { + return usersId; + } + + public void setUsersId(int usersId) { + this.usersId = usersId; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + CategoriaForoEntity that = (CategoriaForoEntity) o; + + if (id != that.id) return false; + if (usersId != that.usersId) return false; + if (name != null ? !name.equals(that.name) : that.name != null) return false; + if (descripcion != null ? !descripcion.equals(that.descripcion) : that.descripcion != null) return false; + + return true; + } + + @Override + public int hashCode() { + int result = id; + result = 31 * result + (name != null ? name.hashCode() : 0); + result = 31 * result + (descripcion != null ? descripcion.hashCode() : 0); + result = 31 * result + usersId; + return result; + } +} diff --git a/src/main/java/com/cristobalbernal/foro/entidades/ForoPrincipalEntity.java b/src/main/java/com/cristobalbernal/foro/entidades/ForoPrincipalEntity.java new file mode 100644 index 0000000..1fc17f1 --- /dev/null +++ b/src/main/java/com/cristobalbernal/foro/entidades/ForoPrincipalEntity.java @@ -0,0 +1,144 @@ +package com.cristobalbernal.foro.entidades; + +import jakarta.persistence.*; + +import java.sql.Timestamp; + +@Entity +@Table(name = "foro_principal", schema = "foro", catalog = "") +public class ForoPrincipalEntity { + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Id + @Column(name = "id", nullable = false) + private int id; + @Basic + @Column(name = "titulo", nullable = true, length = 45) + private String titulo; + @Basic + @Column(name = "descripcion", nullable = true, length = 45) + private String descripcion; + @Basic + @Column(name = "fechaYHora", nullable = true) + private Timestamp fechaYHora; + @Basic + @Column(name = "autors_id", nullable = false) + private int autorsId; + @Basic + @Column(name = "imagen_id", nullable = false) + private int imagenId; + @Basic + @Column(name = "users_id", nullable = false) + private int usersId; + @Basic + @Column(name = "categoria_foro_id", nullable = false) + private int categoriaForoId; + @Basic + @Column(name = "Respuestas_id", nullable = false) + private int respuestasId; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getTitulo() { + return titulo; + } + + public void setTitulo(String titulo) { + this.titulo = titulo; + } + + public String getDescripcion() { + return descripcion; + } + + public void setDescripcion(String descripcion) { + this.descripcion = descripcion; + } + + public Timestamp getFechaYHora() { + return fechaYHora; + } + + public void setFechaYHora(Timestamp fechaYHora) { + this.fechaYHora = fechaYHora; + } + + public int getAutorsId() { + return autorsId; + } + + public void setAutorsId(int autorsId) { + this.autorsId = autorsId; + } + + public int getImagenId() { + return imagenId; + } + + public void setImagenId(int imagenId) { + this.imagenId = imagenId; + } + + public int getUsersId() { + return usersId; + } + + public void setUsersId(int usersId) { + this.usersId = usersId; + } + + public int getCategoriaForoId() { + return categoriaForoId; + } + + public void setCategoriaForoId(int categoriaForoId) { + this.categoriaForoId = categoriaForoId; + } + + public int getRespuestasId() { + return respuestasId; + } + + public void setRespuestasId(int respuestasId) { + this.respuestasId = respuestasId; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + ForoPrincipalEntity that = (ForoPrincipalEntity) o; + + if (id != that.id) return false; + if (autorsId != that.autorsId) return false; + if (imagenId != that.imagenId) return false; + if (usersId != that.usersId) return false; + if (categoriaForoId != that.categoriaForoId) return false; + if (respuestasId != that.respuestasId) return false; + if (titulo != null ? !titulo.equals(that.titulo) : that.titulo != null) return false; + if (descripcion != null ? !descripcion.equals(that.descripcion) : that.descripcion != null) return false; + if (fechaYHora != null ? !fechaYHora.equals(that.fechaYHora) : that.fechaYHora != null) return false; + + return true; + } + + @Override + public int hashCode() { + int result = id; + result = 31 * result + (titulo != null ? titulo.hashCode() : 0); + result = 31 * result + (descripcion != null ? descripcion.hashCode() : 0); + result = 31 * result + (fechaYHora != null ? fechaYHora.hashCode() : 0); + result = 31 * result + autorsId; + result = 31 * result + imagenId; + result = 31 * result + usersId; + result = 31 * result + categoriaForoId; + result = 31 * result + respuestasId; + return result; + } +} diff --git a/src/main/java/com/cristobalbernal/foro/entidades/ImagenEntity.java b/src/main/java/com/cristobalbernal/foro/entidades/ImagenEntity.java new file mode 100644 index 0000000..f94bfcd --- /dev/null +++ b/src/main/java/com/cristobalbernal/foro/entidades/ImagenEntity.java @@ -0,0 +1,51 @@ +package com.cristobalbernal.foro.entidades; + +import jakarta.persistence.*; + +@Entity +@Table(name = "imagen", schema = "foro", catalog = "") +public class ImagenEntity { + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Id + @Column(name = "id", nullable = false) + private int id; + @Basic + @Column(name = "url", nullable = true, length = 45) + private String url; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + ImagenEntity that = (ImagenEntity) o; + + if (id != that.id) return false; + if (url != null ? !url.equals(that.url) : that.url != null) return false; + + return true; + } + + @Override + public int hashCode() { + int result = id; + result = 31 * result + (url != null ? url.hashCode() : 0); + return result; + } +} diff --git a/src/main/java/com/cristobalbernal/foro/entidades/RespuestasEntity.java b/src/main/java/com/cristobalbernal/foro/entidades/RespuestasEntity.java new file mode 100644 index 0000000..744585b --- /dev/null +++ b/src/main/java/com/cristobalbernal/foro/entidades/RespuestasEntity.java @@ -0,0 +1,92 @@ +package com.cristobalbernal.foro.entidades; + +import jakarta.persistence.*; + +import java.sql.Timestamp; + +@Entity +@Table(name = "respuestas", schema = "foro", catalog = "") +public class RespuestasEntity { + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Id + @Column(name = "id", nullable = false) + private int id; + @Basic + @Column(name = "Post", nullable = true, length = 45) + private String post; + @Basic + @Column(name = "Respuestas_id", nullable = false) + private int respuestasId; + @Basic + @Column(name = "autors_id", nullable = false) + private int autorsId; + @Basic + @Column(name = "fechaYHora", nullable = true) + private Timestamp fechaYHora; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getPost() { + return post; + } + + public void setPost(String post) { + this.post = post; + } + + public int getRespuestasId() { + return respuestasId; + } + + public void setRespuestasId(int respuestasId) { + this.respuestasId = respuestasId; + } + + public int getAutorsId() { + return autorsId; + } + + public void setAutorsId(int autorsId) { + this.autorsId = autorsId; + } + + public Timestamp getFechaYHora() { + return fechaYHora; + } + + public void setFechaYHora(Timestamp fechaYHora) { + this.fechaYHora = fechaYHora; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + RespuestasEntity that = (RespuestasEntity) o; + + if (id != that.id) return false; + if (respuestasId != that.respuestasId) return false; + if (autorsId != that.autorsId) return false; + if (post != null ? !post.equals(that.post) : that.post != null) return false; + if (fechaYHora != null ? !fechaYHora.equals(that.fechaYHora) : that.fechaYHora != null) return false; + + return true; + } + + @Override + public int hashCode() { + int result = id; + result = 31 * result + (post != null ? post.hashCode() : 0); + result = 31 * result + respuestasId; + result = 31 * result + autorsId; + result = 31 * result + (fechaYHora != null ? fechaYHora.hashCode() : 0); + return result; + } +} diff --git a/src/main/java/com/cristobalbernal/foro/entidades/TipoPrivileguiosEntity.java b/src/main/java/com/cristobalbernal/foro/entidades/TipoPrivileguiosEntity.java new file mode 100644 index 0000000..2850cc7 --- /dev/null +++ b/src/main/java/com/cristobalbernal/foro/entidades/TipoPrivileguiosEntity.java @@ -0,0 +1,51 @@ +package com.cristobalbernal.foro.entidades; + +import jakarta.persistence.*; + +@Entity +@Table(name = "tipo_privileguios", schema = "foro", catalog = "") +public class TipoPrivileguiosEntity { + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Id + @Column(name = "id", nullable = false) + private int id; + @Basic + @Column(name = "tipo", nullable = true, length = 45) + private String tipo; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getTipo() { + return tipo; + } + + public void setTipo(String tipo) { + this.tipo = tipo; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + TipoPrivileguiosEntity that = (TipoPrivileguiosEntity) o; + + if (id != that.id) return false; + if (tipo != null ? !tipo.equals(that.tipo) : that.tipo != null) return false; + + return true; + } + + @Override + public int hashCode() { + int result = id; + result = 31 * result + (tipo != null ? tipo.hashCode() : 0); + return result; + } +} diff --git a/src/main/java/com/cristobalbernal/foro/entidades/UsersEntity.java b/src/main/java/com/cristobalbernal/foro/entidades/UsersEntity.java new file mode 100644 index 0000000..b91655b --- /dev/null +++ b/src/main/java/com/cristobalbernal/foro/entidades/UsersEntity.java @@ -0,0 +1,142 @@ +package com.cristobalbernal.foro.entidades; + +import jakarta.persistence.*; + +@Entity +@Table(name = "users", schema = "foro", catalog = "") +public class UsersEntity { + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Id + @Column(name = "id", nullable = false) + private int id; + @Basic + @Column(name = "name", nullable = true, length = 45) + private String name; + @Basic + @Column(name = "firstname", nullable = true, length = 45) + private String firstname; + @Basic + @Column(name = "secondname", nullable = true, length = 45) + private String secondname; + @Basic + @Column(name = "password", nullable = true, length = 45) + private String password; + @Basic + @Column(name = "email", nullable = true, length = 45) + private String email; + @Basic + @Column(name = "username", nullable = true, length = 45) + private String username; + @Basic + @Column(name = "imagen_id", nullable = false) + private int imagenId; + @Basic + @Column(name = "tipo_privileguios_id", nullable = false) + private int tipoPrivileguiosId; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getFirstname() { + return firstname; + } + + public void setFirstname(String firstname) { + this.firstname = firstname; + } + + public String getSecondname() { + return secondname; + } + + public void setSecondname(String secondname) { + this.secondname = secondname; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public int getImagenId() { + return imagenId; + } + + public void setImagenId(int imagenId) { + this.imagenId = imagenId; + } + + public int getTipoPrivileguiosId() { + return tipoPrivileguiosId; + } + + public void setTipoPrivileguiosId(int tipoPrivileguiosId) { + this.tipoPrivileguiosId = tipoPrivileguiosId; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + UsersEntity that = (UsersEntity) o; + + if (id != that.id) return false; + if (imagenId != that.imagenId) return false; + if (tipoPrivileguiosId != that.tipoPrivileguiosId) return false; + if (name != null ? !name.equals(that.name) : that.name != null) return false; + if (firstname != null ? !firstname.equals(that.firstname) : that.firstname != null) return false; + if (secondname != null ? !secondname.equals(that.secondname) : that.secondname != null) return false; + if (password != null ? !password.equals(that.password) : that.password != null) return false; + if (email != null ? !email.equals(that.email) : that.email != null) return false; + if (username != null ? !username.equals(that.username) : that.username != null) return false; + + return true; + } + + @Override + public int hashCode() { + int result = id; + result = 31 * result + (name != null ? name.hashCode() : 0); + result = 31 * result + (firstname != null ? firstname.hashCode() : 0); + result = 31 * result + (secondname != null ? secondname.hashCode() : 0); + result = 31 * result + (password != null ? password.hashCode() : 0); + result = 31 * result + (email != null ? email.hashCode() : 0); + result = 31 * result + (username != null ? username.hashCode() : 0); + result = 31 * result + imagenId; + result = 31 * result + tipoPrivileguiosId; + return result; + } +}