parent
8cdfa27383
commit
a414fd0d90
|
|
@ -0,0 +1,39 @@
|
||||||
|
package com.dbnt.faisp.main.equip.model;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
import org.hibernate.annotations.DynamicInsert;
|
||||||
|
import org.hibernate.annotations.DynamicUpdate;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Entity
|
||||||
|
@NoArgsConstructor
|
||||||
|
@DynamicInsert
|
||||||
|
@DynamicUpdate
|
||||||
|
@Table(name = "use_info")
|
||||||
|
public class UseInfo extends UseInfoBase {
|
||||||
|
@Id
|
||||||
|
@Column(name = "use_key")
|
||||||
|
private Integer useKey;
|
||||||
|
@Column(name = "state")
|
||||||
|
private String state;
|
||||||
|
|
||||||
|
@Transient
|
||||||
|
private String excel;
|
||||||
|
|
||||||
|
@Transient
|
||||||
|
private String sosok;
|
||||||
|
|
||||||
|
@Transient
|
||||||
|
private String year;
|
||||||
|
@Transient
|
||||||
|
private String detailTypeName;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,55 @@
|
||||||
|
package com.dbnt.faisp.main.equip.model;
|
||||||
|
|
||||||
|
import com.dbnt.faisp.config.BaseModel;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
import org.hibernate.annotations.DynamicInsert;
|
||||||
|
import org.hibernate.annotations.DynamicUpdate;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@MappedSuperclass
|
||||||
|
public class UseInfoBase extends BaseModel{
|
||||||
|
@Column(name = "use_type")
|
||||||
|
private String useType;
|
||||||
|
@Column(name = "use_no")
|
||||||
|
private String useNo;
|
||||||
|
@Column(name = "mgt_organ")
|
||||||
|
private String mgtOrgan;
|
||||||
|
@Column(name = "mgt_part")
|
||||||
|
private String mgtPart;
|
||||||
|
@Column(name = "use_dt")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||||
|
private LocalDate useDt;
|
||||||
|
@Column(name = "detail_type")
|
||||||
|
private String detailType;
|
||||||
|
@Column(name = "detail_self")
|
||||||
|
private String detailSelf;
|
||||||
|
@Column(name = "people_cnt")
|
||||||
|
private Integer peopleCnt;
|
||||||
|
@Column(name = "description")
|
||||||
|
private String description;
|
||||||
|
@Column(name = "wrt_organ")
|
||||||
|
private String wrtOrgan;
|
||||||
|
@Column(name = "wrt_part")
|
||||||
|
private String wrtPart;
|
||||||
|
@Column(name = "wrt_user_grd")
|
||||||
|
private String wrtUserGrd;
|
||||||
|
@Column(name = "wrt_user_seq")
|
||||||
|
private Integer wrtUserSeq;
|
||||||
|
@Column(name = "wrt_user_nm")
|
||||||
|
private String wrtUserNm;
|
||||||
|
@Column(name = "wrt_dt")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
|
||||||
|
private LocalDateTime wrtDt;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
package com.dbnt.faisp.main.equip.model;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import org.hibernate.annotations.DynamicInsert;
|
||||||
|
import org.hibernate.annotations.DynamicUpdate;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Entity
|
||||||
|
@NoArgsConstructor
|
||||||
|
@DynamicInsert
|
||||||
|
@DynamicUpdate
|
||||||
|
@Table(name = "use_info_version")
|
||||||
|
@IdClass(UseInfoVersion.UseInfoVersionId.class)
|
||||||
|
public class UseInfoVersion extends UseInfoBase {
|
||||||
|
@Id
|
||||||
|
@Column(name = "use_key")
|
||||||
|
private Integer useKey;
|
||||||
|
@Id
|
||||||
|
@Column(name = "version_no")
|
||||||
|
private Integer versionNo;
|
||||||
|
|
||||||
|
@Embeddable
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class UseInfoVersionId implements Serializable{
|
||||||
|
private Integer useKey;
|
||||||
|
private Integer versionNo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,126 +0,0 @@
|
||||||
package com.dbnt.faisp.main.equip.model;
|
|
||||||
|
|
||||||
import com.dbnt.faisp.config.BaseModel;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import lombok.Setter;
|
|
||||||
import org.hibernate.annotations.DynamicInsert;
|
|
||||||
import org.hibernate.annotations.DynamicUpdate;
|
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
|
||||||
|
|
||||||
import javax.persistence.*;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@Entity
|
|
||||||
@NoArgsConstructor
|
|
||||||
@DynamicInsert
|
|
||||||
@DynamicUpdate
|
|
||||||
@IdClass(UseList.UseListId.class)
|
|
||||||
@Table(name = "use_list")
|
|
||||||
public class UseList extends BaseModel implements Serializable{
|
|
||||||
@Id
|
|
||||||
@Column(name = "mgt_organ")
|
|
||||||
private String mgtOrgan;
|
|
||||||
@Id
|
|
||||||
@Column(name = "use_no")
|
|
||||||
private String useNo;
|
|
||||||
@Id
|
|
||||||
@Column(name = "version_no")
|
|
||||||
private Integer versionNo;
|
|
||||||
@Id
|
|
||||||
@Column(name = "use_type")
|
|
||||||
private String useType;
|
|
||||||
@Column(name = "use_dt")
|
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
|
||||||
private LocalDate useDt;
|
|
||||||
@Column(name = "detail_type")
|
|
||||||
private String detailType;
|
|
||||||
@Column(name = "detail_self")
|
|
||||||
private String detailSelf;
|
|
||||||
@Column(name = "people_cnt")
|
|
||||||
private Integer peopleCnt;
|
|
||||||
@Column(name = "description")
|
|
||||||
private String description;
|
|
||||||
@Column(name = "wrt_organ")
|
|
||||||
private String wrtOrgan;
|
|
||||||
@Column(name = "wrt_part")
|
|
||||||
private String wrtPart;
|
|
||||||
@Column(name = "wrt_title")
|
|
||||||
private String wrtTitle;
|
|
||||||
@Column(name = "wrt_user_seq")
|
|
||||||
private Integer wrtUserSeq;
|
|
||||||
@Column(name = "wrt_nm")
|
|
||||||
private String wrtNm;
|
|
||||||
@Column(name = "wrt_dt")
|
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
|
|
||||||
private LocalDateTime wrtDt;
|
|
||||||
|
|
||||||
@Transient
|
|
||||||
private String excel;
|
|
||||||
|
|
||||||
@Transient
|
|
||||||
private String sosok;
|
|
||||||
|
|
||||||
@Transient
|
|
||||||
private String year;
|
|
||||||
@Transient
|
|
||||||
private String detailTypeName;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "UseList [mgtOrgan=" + mgtOrgan + ", useNo=" + useNo + ", versionNo=" + versionNo + ", useType=" + useType
|
|
||||||
+ ", useDt=" + useDt + ", detailType=" + detailType + ", detailSelf=" + detailSelf + ", peopleCnt="
|
|
||||||
+ peopleCnt + ", description=" + description + ", wrtOrgan=" + wrtOrgan + ", wrtPart=" + wrtPart
|
|
||||||
+ ", wrtTitle=" + wrtTitle + ", wrtUserSeq=" + wrtUserSeq + ", wrtNm=" + wrtNm + ", wrtDt=" + wrtDt
|
|
||||||
+ ", excel=" + excel + ", sosok=" + sosok + ", year=" + year + ", detailTypeName=" + detailTypeName + "]";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Embeddable
|
|
||||||
@Data
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
public static class UseListId implements Serializable {
|
|
||||||
private String mgtOrgan;
|
|
||||||
private String useNo;
|
|
||||||
private Integer versionNo;
|
|
||||||
private String useType;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.dbnt.faisp.main.equip.repository;
|
||||||
|
|
||||||
|
import com.dbnt.faisp.main.equip.model.UseInfo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.Modifying;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public interface UseInfoRepository extends JpaRepository<UseInfo, Integer> {
|
||||||
|
|
||||||
|
@Modifying(clearAutomatically = true)
|
||||||
|
@Query("update UseInfo set state = 'D' where useKey in (:useKeyList)")
|
||||||
|
void bulkModifyingByUseInfoToUseKeyList(List<Integer> useKeyList);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.dbnt.faisp.main.equip.repository;
|
||||||
|
|
||||||
|
import com.dbnt.faisp.main.equip.model.UseInfoVersion;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
|
||||||
|
public interface UseInfoVersionRepository extends JpaRepository<UseInfoVersion, UseInfoVersion.UseInfoVersionId> {
|
||||||
|
|
||||||
|
Optional<UseInfoVersion> findByUseKey(Integer useKey);
|
||||||
|
}
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
package com.dbnt.faisp.main.equip.repository;
|
|
||||||
|
|
||||||
import com.dbnt.faisp.main.equip.model.UseList;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
|
||||||
import org.springframework.data.jpa.repository.Query;
|
|
||||||
import org.springframework.data.repository.query.Param;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public interface UseListRepository extends JpaRepository<UseList, UseList.UseListId> {
|
|
||||||
|
|
||||||
List<UseList> findByMgtOrganAndUseNoAndUseTypeOrderByVersionNoDesc(String mgtOrgan, String useNo, String useType);
|
|
||||||
|
|
||||||
void deleteByMgtOrganAndUseNoAndUseType(String mgtOrgan, String useNo, String useType);
|
|
||||||
|
|
||||||
@Query(value = "SELECT wrt_user_seq FROM use_list WHERE mgt_organ=:mgtOrgan AND use_no=:useNo And use_type=:useType order by version_no asc limit 1", nativeQuery = true)
|
|
||||||
Integer getWrtUserSeq(@Param("mgtOrgan") String mgtOrgan,@Param("useNo") String useNo,@Param("useType") String useType);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue