2horang2 / community

iz-community
0 stars 0 forks source link

DB기준 DTO 생성 #8

Closed 2horang2 closed 1 year ago

2horang2 commented 1 year ago

api에서 jsonproperty로 값을 주는데, 난 column 기준으로 db 컬럼과 연동하고 싶어

lombok하고 jpa 기반으로 만들려고하는데 spring boot 어노테이션 써서 dto 하나 만들어줘

@jsonproperty 도 사용해줘야돼

2horang2 commented 1 year ago

import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Data;

import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table;

@Data @Entity @Table(name = "DEASA0001") public class DEASA0001DTO { @Id @Column(name = "PBC_SV_ID") @JsonProperty("서비스ID") private String serviceId;

@Column(name = "PBC_SV_AID_TP_NM")
@JsonProperty("지원유형")
private String supportType;

@Column(name = "PBC_SV_NM")
@JsonProperty("서비스명")
private String serviceName;

@Column(name = "PBC_SV_PPS_NM")
@JsonProperty("서비스목적요약")
private String serviceSummary;

@Column(name = "PBC_SV_AID_BJ_NM")
@JsonProperty("지원대상")
private String supportTarget;

@Column(name = "PBC_SV_CHO_TA_TT")
@JsonProperty("선정기준")
private String selectionCriteria;

@Column(name = "PBC_SV_AID_TA_TT")
@JsonProperty("지원내용")
private String supportContent;

@Column(name = "PBC_SV_PT_MT_TT")
@JsonProperty("신청방법")
private String applicationMethod;

@Column(name = "PBC_SV_PT_TRM_VL")
@JsonProperty("신청기한")
private String applicationDeadline;

@Column(name = "PBC_SV_DL_QY_URL_VL")
@JsonProperty("상세조회URL")
private String detailedInquiryUrl;

@Column(name = "PBC_SV_JUC_ICD_VL")
@JsonProperty("소관기관코드")
private String jurisdictionAgencyCode;

@Column(name = "PBC_SV_JUC_IE_NM")
@JsonProperty("소관기관명")
private String jurisdictionAgencyName;

@Column(name = "PBC_SV_JUC_DP_NM")
@JsonProperty("부서명")
private String departmentName;

@Column(name = "PBC_SV_QY_CN_VL")
@JsonProperty("조회수")
private Integer queryCount;

@Column(name = "NI_RG_XCT_ID")
private String initialRegistrationExecutionId;

@Column(name = "NI_RG_DT")
private LocalDateTime initialRegistrationDateTime;

@Column(name = "LS_ALT_XCT_ID")
private String lastAlterationExecutionId;

@Column(name = "LS_ALT_DT")
private LocalDateTime lastAlterationDateTime;

}

2horang2 commented 1 year ago

springboot 3은 jakarta.persistence 사용이다