package com.imdroid.beidou.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "UserCfg")
public class User {

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    Integer tenantid;
    String tenantname;
    private String name;
    private String pwd;
    String role;
    private Boolean locked;
    private String nickname;
    private Boolean init_pwd=true;
    private String mobile;
    private String avatar_url;
    private String openid;
    private Boolean warning_enabled;

    public String getUsername() {
        return name;
    }

    public String getPassword() {
        return pwd;
    }


//    @Override
//    public Collection<? extends GrantedAuthority> getAuthorities() {
//        List<SimpleGrantedAuthority> authorities = new ArrayList<>();
//        // 必须加上ROLE_，否则授权不通过
//        authorities.add(new SimpleGrantedAuthority("ROLE_"+role));
//        return authorities;
//    }
//
//    @Override
//    public boolean isAccountNonExpired() {
//        return true;
//    }
//
//    @Override
//    public boolean isAccountNonLocked() {
//        return !locked;
//    }
//
//    @Override
//    public boolean isCredentialsNonExpired() {
//        return true;
//    }
//
//    @Override
//    public boolean isEnabled() {
//        return true;
//    }

}
