fix: Entity manual ID fix

dev
minuk926 3 years ago
parent d85dd15ff6
commit 54432028c7

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

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

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

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

@ -4,10 +4,15 @@ 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;
/**
* ID manual set
* Persistable : persitance getId isNew Override
*/
@Schema(name = "Tf680Main", description = "메인")
@Table(name = "tf680_main", schema = "", catalog = "")
@Entity
@ -17,9 +22,7 @@ import java.io.Serializable;
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Getter
@Builder
public class Tf680Main implements Serializable {
private static final long SerialVersionUID = 1L;
public class Tf680Main implements Persistable<Long> {
@Id
@Schema(required = true, title = "메인코드", example = " ", description = "Input Description...")
@Column(name = "mm_code", nullable = false)
@ -330,4 +333,13 @@ public class Tf680Main implements Serializable {
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 java.io.Serializable;
/**
* ID manual set
* Persistable : persitance getId isNew Override
*/
@Schema(name = "Tf680Recall", description = "민원")
@Table(name = "tf680_recall", schema = "", catalog = "")
@Entity
@ -27,10 +31,7 @@ public class Tf680Recall implements Persistable<Long> {
@Schema(required = false, title = "메인코드", example = " ", description = "Input Description...")
@Column(name = "rc_maincode", nullable = true)
//@OneToOne(fetch = FetchType.LAZY)
//@JoinColumn(name = "mm_code")
private Long rcMaincode;
//private Tf680Main tf680Main;
@Schema(required = false, title = "민원구분(1:의견진술, 2:이의신청)", example = " ", description = "Input Description...")
@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.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import java.util.List;
@ -14,7 +15,7 @@ public interface IBoardRepository extends JpaRepository<MinCivBoard680, Long>, I
@Modifying(clearAutomatically = true)
@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);
}

@ -7,6 +7,7 @@ import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
public interface IPublicBoardRepository extends JpaRepository<MinInfoBoard680, Long> {
@ -17,5 +18,5 @@ public interface IPublicBoardRepository extends JpaRepository<MinInfoBoard680, L
@Modifying(clearAutomatically = true)
@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
@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