Files
UserBaseService/src/main/java/com/yunhai/userbase/entity/SysUserCurrentRole.java
T
chenxing c588dedea7
ci-userbase-service / build-and-push (push) Successful in 44s
跨校身份修订
2026-08-27 20:14:12 +08:00

61 lines
1.5 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package com.yunhai.userbase.entity;
import com.yunhai.userbase.common.validation.ValidationGroups;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
/**
* @author chenx
* @date 2026/7/15 15:05
* @description 用户当前角色
*/
@Data
@NoArgsConstructor
@Entity
@Table(
name = "sys_user_current_role",
uniqueConstraints = @UniqueConstraint(columnNames = {"userId"}),
indexes = {@Index(columnList = "userId")}
)
@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = false)
public class SysUserCurrentRole {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@NotNull(groups = ValidationGroups.Update.class)
private Integer id;
/**
* 用户ID,一对一唯一
*/
@Column(nullable = false)
private Integer userId;
/**
* 用户切换选中的身份归属学校(恒为真实组 id:学校组/区域组/根直属=根节点 id;原「区域/学段/根直属=0或null」约定废弃)
*/
private Integer schoolId;
/**
* 用户切换后生效角色ID(SysRoleEnum.key)
*/
private Integer roleId;
/**
* 最近一次切换时间(服务端 now() 写入)
*/
@Column(name = "switch_time")
private LocalDateTime switchTime;
/**
* 学校名冗余(避免每次 join sys_group 取 name)
*/
@Column(name = "school_name", length = 100)
private String schoolName;
}