All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.feingto.cloud.domain.account.UserRole Maven / Gradle / Ivy

package com.feingto.cloud.domain.account;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.feingto.cloud.domain.IdEntity;
import lombok.*;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.Where;

import javax.persistence.*;
import javax.validation.constraints.NotNull;

/**
 * 用户角色关系
 *
 * @author longfei
 */
@Builder
@Setter
@Getter
@NoArgsConstructor
@AllArgsConstructor(access = AccessLevel.PROTECTED)
@Entity
@DynamicUpdate
@Table(name = "sy_user_role")
public class UserRole extends IdEntity {
    private static final long serialVersionUID = -5633660441245469510L;

    @NotNull
    @JsonIgnoreProperties(value = {"userRoles", "resources", "quickMenus", "systemAdmin"}, allowSetters = true)
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(nullable = false)
    protected User user;

    @NotNull
    @JsonIgnoreProperties(value = {"userRoles", "resources"}, allowSetters = true)
    @ManyToOne
    @JoinColumn(nullable = false)
    @Where(clause = "enabled = True")
    protected Role role;
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy