From 2bfc67d5e34690331d97e0b41cdd58b528887098 Mon Sep 17 00:00:00 2001 From: Lim Jonguk Date: Sat, 16 Apr 2022 06:58:13 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20jpa=20=EB=A1=9C=EA=B7=B8=20=EC=B6=9C?= =?UTF-8?q?=EB=A0=A5=20=EC=84=A4=EC=A0=95=20=EC=B6=94=EA=B0=80=20=20=20=20?= =?UTF-8?q?=20=20=EC=88=98=EB=8F=99=20ID=EB=A5=BC=20=EA=B0=96=EB=8A=94=20?= =?UTF-8?q?=EC=97=94=ED=8B=B0=ED=8B=B0=20->=20Persistable=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/xit/biz/ctgy/entity/MinCivBoard680.java | 12 ++++++++++-- .../java/com/xit/biz/ctgy/entity/MinSimsa680.java | 14 +++++++++++--- .../com/xit/biz/ctgy/entity/MinSimsa680Sc.java | 15 ++++++++++++--- .../java/com/xit/biz/ctgy/entity/MinUserinfo.java | 12 ++++++++++-- .../java/com/xit/biz/ctgy/entity/Tf680Recall.java | 12 ++++++++++-- .../service/impl/ResidentAndDisabledService.java | 3 ++- 6 files changed, 55 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/xit/biz/ctgy/entity/MinCivBoard680.java b/src/main/java/com/xit/biz/ctgy/entity/MinCivBoard680.java index eef4404..a1b14ac 100644 --- a/src/main/java/com/xit/biz/ctgy/entity/MinCivBoard680.java +++ b/src/main/java/com/xit/biz/ctgy/entity/MinCivBoard680.java @@ -4,6 +4,7 @@ import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; import org.hibernate.annotations.DynamicInsert; import org.hibernate.annotations.DynamicUpdate; +import org.springframework.data.domain.Persistable; import javax.persistence.*; import java.io.Serializable; @@ -17,8 +18,7 @@ import java.io.Serializable; @NoArgsConstructor(access = AccessLevel.PROTECTED) @Getter @Builder -public class MinCivBoard680 implements Serializable { - private static final long SerialVersionUID = 1L; +public class MinCivBoard680 implements Persistable { @Id @Schema(required = true, title = "게시판코드", example = " ", description = "Input Description...") @@ -85,5 +85,13 @@ public class MinCivBoard680 implements Serializable { @Column(name = "ci_ip", nullable = true) private String ciIp; + @Override + public Long getId() { + return this.ciCode; + } + @Override + public boolean isNew() { + return this.ciCode == 0L && this.ciNalja == null; + } } diff --git a/src/main/java/com/xit/biz/ctgy/entity/MinSimsa680.java b/src/main/java/com/xit/biz/ctgy/entity/MinSimsa680.java index 12280e9..c091380 100644 --- a/src/main/java/com/xit/biz/ctgy/entity/MinSimsa680.java +++ b/src/main/java/com/xit/biz/ctgy/entity/MinSimsa680.java @@ -4,6 +4,7 @@ import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; import org.hibernate.annotations.DynamicInsert; import org.hibernate.annotations.DynamicUpdate; +import org.springframework.data.domain.Persistable; import javax.persistence.*; import java.time.LocalDate; @@ -17,15 +18,13 @@ import java.time.LocalDate; @AllArgsConstructor @Getter @Builder -public class MinSimsa680 { //implements Serializable { - //private static final long SerialVersionUID = 1L; +public class MinSimsa680 implements Persistable { @Schema(required = true, title = "민원코드", example = " ", description = "Input Description...") @Id @Column(name = "ms_maincode") private Long msMaincode; - @Schema(required = true, title = "접수번호", example = " ", description = "Input Description...") @Column(name = "ms_seq", nullable = false) private String msSeq; @@ -78,4 +77,13 @@ public class MinSimsa680 { //implements Serializable { @Column(name = "ms_jbtime", nullable = true) private String msJbtime; + @Override + public Long getId() { + return this.msMaincode; + } + + @Override + public boolean isNew() { + return this.msMaincode == 0L; + } } diff --git a/src/main/java/com/xit/biz/ctgy/entity/MinSimsa680Sc.java b/src/main/java/com/xit/biz/ctgy/entity/MinSimsa680Sc.java index ee5eaed..b6c4e0e 100644 --- a/src/main/java/com/xit/biz/ctgy/entity/MinSimsa680Sc.java +++ b/src/main/java/com/xit/biz/ctgy/entity/MinSimsa680Sc.java @@ -4,6 +4,7 @@ import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; import org.hibernate.annotations.DynamicInsert; import org.hibernate.annotations.DynamicUpdate; +import org.springframework.data.domain.Persistable; import javax.persistence.Column; import javax.persistence.Entity; @@ -20,15 +21,13 @@ import java.time.LocalDate; @NoArgsConstructor(access = AccessLevel.PROTECTED) @Getter @Builder -public class MinSimsa680Sc { //implements Serializable { - //private static final long SerialVersionUID = 1L; +public class MinSimsa680Sc implements Persistable { @Schema(required = true, title = "민원코드", example = " ", description = "Input Description...") @Id @Column(name = "ms_maincode") private Long msMaincode; - @Schema(required = true, title = "접수번호", example = " ", description = "Input Description...") @Column(name = "ms_seq", nullable = false) private String msSeq; @@ -84,4 +83,14 @@ public class MinSimsa680Sc { //implements Serializable { @Schema(required = false, title = "데이타구분", example = "1", description = "데이타구분: 1-거주자, 2-장애인") @Column(name = "ms_datagb", nullable = false) private String msDatagb; + + @Override + public Long getId() { + return this.msMaincode; + } + + @Override + public boolean isNew() { + return this.msMaincode == 0L; + } } diff --git a/src/main/java/com/xit/biz/ctgy/entity/MinUserinfo.java b/src/main/java/com/xit/biz/ctgy/entity/MinUserinfo.java index 961626f..a181c26 100644 --- a/src/main/java/com/xit/biz/ctgy/entity/MinUserinfo.java +++ b/src/main/java/com/xit/biz/ctgy/entity/MinUserinfo.java @@ -5,6 +5,7 @@ import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; import org.hibernate.annotations.DynamicInsert; import org.hibernate.annotations.DynamicUpdate; +import org.springframework.data.domain.Persistable; import javax.persistence.*; import java.io.Serializable; @@ -21,8 +22,7 @@ import java.util.Set; @NoArgsConstructor(access = AccessLevel.PROTECTED) @Getter @Builder -public class MinUserinfo implements Serializable { - private static final long SerialVersionUID = 1L; +public class MinUserinfo implements Persistable { @Id @Schema(required = true, title = "민원심사사용자코드", example = " ", description = "Input Description...") @@ -70,7 +70,15 @@ public class MinUserinfo implements Serializable { private String gu; + @Override + public String getId() { + return this.userid; + } + @Override + public boolean isNew() { + return this.userid == null; + } //@Transient diff --git a/src/main/java/com/xit/biz/ctgy/entity/Tf680Recall.java b/src/main/java/com/xit/biz/ctgy/entity/Tf680Recall.java index f531d7b..39644c3 100644 --- a/src/main/java/com/xit/biz/ctgy/entity/Tf680Recall.java +++ b/src/main/java/com/xit/biz/ctgy/entity/Tf680Recall.java @@ -4,6 +4,7 @@ import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; import org.hibernate.annotations.DynamicInsert; import org.hibernate.annotations.DynamicUpdate; +import org.springframework.data.domain.Persistable; import javax.persistence.*; import java.io.Serializable; @@ -17,8 +18,7 @@ import java.io.Serializable; @NoArgsConstructor(access = AccessLevel.PROTECTED) @Getter @Builder -public class Tf680Recall implements Serializable { - private static final long SerialVersionUID = 1L; +public class Tf680Recall implements Persistable { @Id @Schema(required = true, title = "민원코드", example = " ", description = "Input Description...") @@ -202,5 +202,13 @@ public class Tf680Recall implements Serializable { @Column(name = "rc_sms_send", nullable = true) private String rcSmsSend; + @Override + public Long getId() { + return this.rcCode; + } + @Override + public boolean isNew() { + return this.rcCode == 0L; + } } diff --git a/src/main/java/com/xit/biz/ctgy/service/impl/ResidentAndDisabledService.java b/src/main/java/com/xit/biz/ctgy/service/impl/ResidentAndDisabledService.java index 373d9b6..d8983bb 100644 --- a/src/main/java/com/xit/biz/ctgy/service/impl/ResidentAndDisabledService.java +++ b/src/main/java/com/xit/biz/ctgy/service/impl/ResidentAndDisabledService.java @@ -151,7 +151,8 @@ public class ResidentAndDisabledService implements IResidentAndDisabledService { GnRecallSc entity = repository.findById(dto.getScCode()).orElseThrow(() -> new CustomBaseException(ErrorCode.DATA_NOT_FOUND)); entity.setScTransfer(CtgyConstants.Judge.TRANSFER_ACCEPT.getCode()); //entity.setScState(CtgyConstants.Judge.DATA_STATE_JUDGE.getCode()); - JpaUtil.saveIfNullId(dto.getScCode(), repository, entity); + //JpaUtil.saveIfNullId(dto.getScCode(), repository, entity); + repository.save(entity); //--------------------------------------------------------- // 심사자 등록