heheng
2025-06-10 db8242513644b246a30222663ef20e21f1e7c7ce
exam-common/src/main/java/com/gkhy/exam/common/domain/entity/SysUser.java
@@ -14,6 +14,7 @@
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.time.LocalDateTime;
import java.util.List;
import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL;
@@ -39,6 +40,7 @@
    private Long id;
    @NotBlank(message = "登录账号不能为空")
    @Length(min = 2,  message = "登录账号长度不正确")
    @ApiModelProperty(value = "登录账号",required = true)
    @TableField("username")
    private String username;
@@ -73,6 +75,7 @@
    private Long companyId;
    @NotBlank(message = "密码不能为空")
    @Length(min = 2,  message = "密码长度不正确")
    @ApiModelProperty(value = "密码",required = true)
    @TableField("password")
    private String password;
@@ -106,8 +109,27 @@
    @TableField(exist = false)
    private String companyName;
    @ApiModelProperty("剩余课时(分)")
    @TableField(exist = false)
    private Long remainPeriod;
    @ApiModelProperty("父级账号名称")
    @TableField(exist = false)
    private String parentName;
    @TableField(exist = false)
    private List<SysRole> roles;
    @ApiModelProperty("是否为管理员")
    @TableField(exist = false)
    private Boolean admin;
    public boolean isAdmin()
    {
        return isAdmin(this.id);
    }
    public static boolean isAdmin(Long userId)
    {
        return userId != null && 1L == userId;
    }
}