init
This commit is contained in:
96
src/main/java/com/caliverse/admin/domain/entity/Admin.java
Normal file
96
src/main/java/com/caliverse/admin/domain/entity/Admin.java
Normal file
@@ -0,0 +1,96 @@
|
||||
package com.caliverse.admin.domain.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.security.core.GrantedAuthority;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
@Builder
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class Admin implements UserDetails{
|
||||
private Long id;
|
||||
@JsonProperty("row_num")
|
||||
private Long rowNum;
|
||||
|
||||
private String name;
|
||||
|
||||
private String password;
|
||||
|
||||
private String email;
|
||||
|
||||
@JsonIgnore
|
||||
private Groups groups;
|
||||
|
||||
private STATUS status;
|
||||
|
||||
@JsonProperty("expired_dt")
|
||||
private LocalDateTime expiredDt;
|
||||
|
||||
/* 만료일 만 가져올려면 */
|
||||
/*@Column(name = "expired_dt")
|
||||
@Temporal(TemporalType.DATE)
|
||||
private Date expiredDt;*/
|
||||
|
||||
@JsonProperty("group_id")
|
||||
private Long groupId;
|
||||
@JsonProperty("group_nm")
|
||||
private String groupNm;
|
||||
@JsonProperty("pw_update_dt")
|
||||
private LocalDateTime pwUpdateDt;
|
||||
@JsonProperty("create_dt")
|
||||
private LocalDateTime createDt;
|
||||
@JsonProperty("update_dt")
|
||||
private LocalDateTime updateDt;
|
||||
@JsonProperty("update_by")
|
||||
private String updateBy;
|
||||
|
||||
@Override
|
||||
public Collection<? extends GrantedAuthority> getAuthorities() {
|
||||
return this.groups != null? this.groups.getAuthorities(): Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUsername() {
|
||||
return email;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAccountNonExpired() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAccountNonLocked() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCredentialsNonExpired() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user