260306_01_ENH: DTO 아키텍처 조정 및 ListHeader RU 구현
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
package com.kri.contact.server.dto.user;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.kri.contact.server.persistence.entity.TRoleEntity;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
@Schema(description = "권한 정보")
|
||||
public class RoleInfoDto {
|
||||
|
||||
@Schema(description = "권한 코드")
|
||||
private Integer roleCd;
|
||||
|
||||
@Schema(description = "권한 명")
|
||||
private String roleNm;
|
||||
|
||||
@Schema(description = "메모")
|
||||
private String memo;
|
||||
|
||||
@Schema(description = "등록자", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
||||
private String regUser;
|
||||
|
||||
@Schema(description = "등록일시", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
||||
private LocalDateTime regDt;
|
||||
|
||||
@Schema(description = "수정자", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
||||
private String modUser;
|
||||
|
||||
@Schema(description = "수정일시", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
||||
private LocalDateTime modDt;
|
||||
|
||||
|
||||
public static RoleInfoDto from(TRoleEntity roleEntity) {
|
||||
return RoleInfoDto.builder()
|
||||
.roleCd(roleEntity.getRoleCd())
|
||||
.roleNm(roleEntity.getRoleNm())
|
||||
.memo(roleEntity.getMemo())
|
||||
.regUser(roleEntity.getRegUser())
|
||||
.regDt(roleEntity.getRegDt())
|
||||
.modUser(roleEntity.getModUser())
|
||||
.modDt(roleEntity.getModDt())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
104
src/main/java/com/kri/contact/server/dto/user/UserInfoDto.java
Normal file
104
src/main/java/com/kri/contact/server/dto/user/UserInfoDto.java
Normal file
@@ -0,0 +1,104 @@
|
||||
package com.kri.contact.server.dto.user;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.kri.common.datetime.DateTimeUtil;
|
||||
import com.kri.contact.server.dto.excel.UserUploadDto;
|
||||
import com.kri.contact.server.persistence.entity.TUserEntity;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(description = "사용자 정보")
|
||||
public class UserInfoDto {
|
||||
|
||||
@Size(max = 32)
|
||||
@NotBlank
|
||||
@Schema(description = "사용자 ID")
|
||||
private String userId;
|
||||
|
||||
@Size(max = 128)
|
||||
@NotBlank
|
||||
@Schema(description = "사용자 PW")
|
||||
private String userPw;
|
||||
|
||||
@Size(max = 32)
|
||||
@NotBlank
|
||||
@Schema(description = "사용자 이름")
|
||||
private String userName;
|
||||
|
||||
@Size(max = 32)
|
||||
@NotBlank
|
||||
@Schema(description = "사용자 소속 회사")
|
||||
private String userCmpn;
|
||||
|
||||
@Size(max = 32)
|
||||
@NotBlank
|
||||
@Schema(description = "사용자 소속 팀")
|
||||
private String userTeam = "S101";
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "사용자 권한")
|
||||
private Integer userRole;
|
||||
|
||||
@Schema(description = "메모")
|
||||
private String memo;
|
||||
|
||||
@Size(max = 32)
|
||||
@Schema(description = "등록자", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
||||
private String regUser;
|
||||
|
||||
@Schema(description = "등록일시", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
||||
private LocalDateTime regDt;
|
||||
|
||||
@Size(max = 32)
|
||||
@Schema(description = "수정자", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
||||
private String modUser;
|
||||
|
||||
@Schema(description = "수정일시", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
||||
private LocalDateTime modDt;
|
||||
|
||||
public static UserInfoDto from(TUserEntity entity) {
|
||||
return UserInfoDto.builder()
|
||||
.userId(entity.getUserId())
|
||||
.userName(entity.getUserNm())
|
||||
.userCmpn(entity.getUserCmpn())
|
||||
.userTeam(entity.getUserTeam())
|
||||
.userRole(entity.getUserRole())
|
||||
.memo(entity.getMemo())
|
||||
.regUser(entity.getRegUser())
|
||||
.regDt(entity.getRegDt())
|
||||
.modUser(entity.getModUser())
|
||||
.modDt(entity.getModDt())
|
||||
.build();
|
||||
}
|
||||
|
||||
public static UserInfoDto from(UserUploadDto dto, Integer userRole, String regUser) {
|
||||
return UserInfoDto.builder()
|
||||
.userId(dto.getUserId())
|
||||
.userPw(dto.getUserPw())
|
||||
.userName(dto.getUserName())
|
||||
.userCmpn(dto.getUserCmpn())
|
||||
.userTeam("S101")
|
||||
.userRole(userRole)
|
||||
.memo(dto.getMemo())
|
||||
.regUser(regUser)
|
||||
.regDt(DateTimeUtil.nowKstLocalDateTime())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user