mirror of
https://git.imnavajas.es/jjimenez/erp-imprimelibros.git
synced 2026-01-13 08:58:48 +00:00
implementado el soft-delete
This commit is contained in:
@ -7,6 +7,14 @@ import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Table;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import org.hibernate.annotations.SQLRestriction;
|
||||
import jakarta.persistence.OneToMany;
|
||||
import jakarta.persistence.FetchType;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
@Entity
|
||||
@Table(name = "roles")
|
||||
public class Role {
|
||||
@ -15,10 +23,15 @@ public class Role {
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id")
|
||||
private Long id;
|
||||
|
||||
|
||||
@Column(name = "name")
|
||||
private String name;
|
||||
|
||||
@JsonIgnore
|
||||
@SQLRestriction("deleted = false")
|
||||
@OneToMany(mappedBy = "role", fetch = FetchType.LAZY)
|
||||
private Set<UserRole> usersLink = new HashSet<>();
|
||||
|
||||
public Role() {
|
||||
}
|
||||
|
||||
@ -42,6 +55,14 @@ public class Role {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Set<UserRole> getUsersLink() {
|
||||
return usersLink;
|
||||
}
|
||||
|
||||
public void setUsersLink(Set<UserRole> usersLink) {
|
||||
this.usersLink = usersLink;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Role{" + "id=" + id + ", name='" + name + '\'' + '}';
|
||||
|
||||
Reference in New Issue
Block a user