fix: Entity manual ID fix

dev
minuk926 3 years ago
parent d85dd15ff6
commit 54432028c7

@ -1,6 +1,5 @@
package com.xit.biz.ctgy.entity; package com.xit.biz.ctgy.entity;
import com.xit.biz.ctgy.CtgyConstants;
import com.xit.core.oauth2.utils.HeaderUtil; import com.xit.core.oauth2.utils.HeaderUtil;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*; import lombok.*;
@ -9,10 +8,13 @@ import org.hibernate.annotations.DynamicUpdate;
import org.springframework.data.domain.Persistable; import org.springframework.data.domain.Persistable;
import javax.persistence.*; import javax.persistence.*;
import java.io.Serializable;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
/**
* ID manual set
* Persistable : persitance getId isNew Override
*/
@Schema(name = "MinCivBoard680", description = "게시판") @Schema(name = "MinCivBoard680", description = "게시판")
@Table(name = "min_civ_board680", schema = "", catalog = "") @Table(name = "min_civ_board680", schema = "", catalog = "")
@Entity @Entity

@ -9,6 +9,10 @@ import org.springframework.data.domain.Persistable;
import javax.persistence.*; import javax.persistence.*;
import java.time.LocalDate; import java.time.LocalDate;
/**
* ID manual set
* Persistable : persitance getId isNew Override
*/
@Schema(name = "MinSimsa680", description = "민원심사") @Schema(name = "MinSimsa680", description = "민원심사")
@Table(name = "min_simsa680", schema = "", catalog = "") @Table(name = "min_simsa680", schema = "", catalog = "")
@Entity @Entity

@ -12,6 +12,10 @@ import javax.persistence.Id;
import javax.persistence.Table; import javax.persistence.Table;
import java.time.LocalDate; import java.time.LocalDate;
/**
* ID manual set
* Persistable : persitance getId isNew Override
*/
@Schema(name = "MinSimsa680Sc", description = "민원심사") @Schema(name = "MinSimsa680Sc", description = "민원심사")
@Table(name = "min_simsa680_sc", schema = "", catalog = "") @Table(name = "min_simsa680_sc", schema = "", catalog = "")
@Entity @Entity

@ -12,6 +12,10 @@ import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.Objects; import java.util.Objects;
/**
* ID manual set
* Persistable : persitance getId isNew Override
*/
@Schema(name = "MinUserinfo", description = "null") @Schema(name = "MinUserinfo", description = "null")
@Table(name = "min_userinfo", schema = "", catalog = "") @Table(name = "min_userinfo", schema = "", catalog = "")
@Entity @Entity

@ -4,10 +4,15 @@ import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*; import lombok.*;
import org.hibernate.annotations.DynamicInsert; import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate; import org.hibernate.annotations.DynamicUpdate;
import org.springframework.data.domain.Persistable;
import javax.persistence.*; import javax.persistence.*;
import java.io.Serializable; import java.io.Serializable;
/**
* ID manual set
* Persistable : persitance getId isNew Override
*/
@Schema(name = "Tf680Main", description = "메인") @Schema(name = "Tf680Main", description = "메인")
@Table(name = "tf680_main", schema = "", catalog = "") @Table(name = "tf680_main", schema = "", catalog = "")
@Entity @Entity
@ -17,9 +22,7 @@ import java.io.Serializable;
@NoArgsConstructor(access = AccessLevel.PROTECTED) @NoArgsConstructor(access = AccessLevel.PROTECTED)
@Getter @Getter
@Builder @Builder
public class Tf680Main implements Serializable { public class Tf680Main implements Persistable<Long> {
private static final long SerialVersionUID = 1L;
@Id @Id
@Schema(required = true, title = "메인코드", example = " ", description = "Input Description...") @Schema(required = true, title = "메인코드", example = " ", description = "Input Description...")
@Column(name = "mm_code", nullable = false) @Column(name = "mm_code", nullable = false)
@ -330,4 +333,13 @@ public class Tf680Main implements Serializable {
private String virtlacnutnoF; private String virtlacnutnoF;
@Override
public Long getId() {
return this.mmCode;
}
@Override
public boolean isNew() {
return this.mmCode == 0L;
}
} }

@ -9,6 +9,10 @@ import org.springframework.data.domain.Persistable;
import javax.persistence.*; import javax.persistence.*;
import java.io.Serializable; import java.io.Serializable;
/**
* ID manual set
* Persistable : persitance getId isNew Override
*/
@Schema(name = "Tf680Recall", description = "민원") @Schema(name = "Tf680Recall", description = "민원")
@Table(name = "tf680_recall", schema = "", catalog = "") @Table(name = "tf680_recall", schema = "", catalog = "")
@Entity @Entity
@ -27,10 +31,7 @@ public class Tf680Recall implements Persistable<Long> {
@Schema(required = false, title = "메인코드", example = " ", description = "Input Description...") @Schema(required = false, title = "메인코드", example = " ", description = "Input Description...")
@Column(name = "rc_maincode", nullable = true) @Column(name = "rc_maincode", nullable = true)
//@OneToOne(fetch = FetchType.LAZY)
//@JoinColumn(name = "mm_code")
private Long rcMaincode; private Long rcMaincode;
//private Tf680Main tf680Main;
@Schema(required = false, title = "민원구분(1:의견진술, 2:이의신청)", example = " ", description = "Input Description...") @Schema(required = false, title = "민원구분(1:의견진술, 2:이의신청)", example = " ", description = "Input Description...")
@Column(name = "rc_gb", nullable = true) @Column(name = "rc_gb", nullable = true)

@ -4,6 +4,7 @@ import com.xit.biz.ctgy.entity.MinCivBoard680;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query; import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import java.util.List; import java.util.List;
@ -14,7 +15,7 @@ public interface IBoardRepository extends JpaRepository<MinCivBoard680, Long>, I
@Modifying(clearAutomatically = true) @Modifying(clearAutomatically = true)
@Query("UPDATE MinCivBoard680 m SET m.ciHit = m.ciHit + 1 WHERE m.ciCode = :ciCode") @Query("UPDATE MinCivBoard680 m SET m.ciHit = m.ciHit + 1 WHERE m.ciCode = :ciCode")
int updateInHitForMinCivBoard680(Long ciCode); int updateInHitForMinCivBoard680(@Param("ciCode") Long ciCode);
List<MinCivBoard680> findByCiRef(Long ciCode); List<MinCivBoard680> findByCiRef(Long ciCode);
} }

@ -7,6 +7,7 @@ import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query; import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
public interface IPublicBoardRepository extends JpaRepository<MinInfoBoard680, Long> { public interface IPublicBoardRepository extends JpaRepository<MinInfoBoard680, Long> {
@ -17,5 +18,5 @@ public interface IPublicBoardRepository extends JpaRepository<MinInfoBoard680, L
@Modifying(clearAutomatically = true) @Modifying(clearAutomatically = true)
@Query("UPDATE MinInfoBoard680 m SET m.inHit = m.inHit + 1 WHERE m.inCode = :inCode") @Query("UPDATE MinInfoBoard680 m SET m.inHit = m.inHit + 1 WHERE m.inCode = :inCode")
int updateInHitForMinInfoBoard680(Long inCode); int updateInHitForMinInfoBoard680(@Param("inCode") Long inCode);
} }

@ -10,5 +10,5 @@ public interface IRecallRepository extends JpaRepository<Tf680Recall, Long> {
@Modifying @Modifying
@Query(value = "UPDATE #{#entityName} m SET m.rcIrTransfer = '1', m.rcState = '0' WHERE m.rcCode = :msMaincode") @Query(value = "UPDATE #{#entityName} m SET m.rcIrTransfer = '1', m.rcState = '0' WHERE m.rcCode = :msMaincode")
int updateRcIrTransferAndRcState(@Param("msMaincode")Long msMaincode); int updateRcIrTransferAndRcState(@Param("msMaincode") Long msMaincode);
} }

Loading…
Cancel
Save