중간저장.
parent
d7d8b717c5
commit
199697a3c5
|
|
@ -1,26 +0,0 @@
|
|||
package com.dbnt.faisp.config;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Transient;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class BaseBoard extends BaseModel {
|
||||
|
||||
@Column(name = "wrt_organ")
|
||||
private String wrtOrgan;
|
||||
@Column(name = "wrt_nm")
|
||||
private String wrtNm;
|
||||
@Column(name = "wrt_dt")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDateTime wrtDt;
|
||||
|
||||
}
|
||||
|
|
@ -48,6 +48,6 @@ public class FpiMgtController { // 외사경찰견문관리
|
|||
public Integer savePlan(BoardPlan boardPlan,
|
||||
@RequestParam(value = "planInfos", required = false) List<String> planInfos,
|
||||
@RequestParam(value = "detailPlanInfos", required = false)List<String> detailPlanInfos){
|
||||
return 0;
|
||||
return monthPlanService.saveBoardPlan(boardPlan, planInfos, detailPlanInfos);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,11 +3,16 @@ package com.dbnt.faisp.fpiMgt.monthPlan;
|
|||
|
||||
import com.dbnt.faisp.fpiMgt.monthPlan.model.BoardPlan;
|
||||
import com.dbnt.faisp.fpiMgt.monthPlan.model.PlanFile;
|
||||
import com.dbnt.faisp.fpiMgt.monthPlan.model.PlanMainInfo;
|
||||
import com.dbnt.faisp.fpiMgt.monthPlan.repository.BoardPlanRepository;
|
||||
import com.dbnt.faisp.fpiMgt.monthPlan.repository.PlanFileRepository;
|
||||
import com.dbnt.faisp.fpiMgt.monthPlan.repository.PlanMainInfoRepository;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.persistence.Transient;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
|
|
@ -22,4 +27,24 @@ public class MonthPlanService {
|
|||
savedPlan.setMainInfoList(planMainInfoRepository.findByPlanKey(planKey));
|
||||
return savedPlan;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Integer saveBoardPlan(BoardPlan boardPlan, List<String> planInfos, List<String> detailPlanInfos) {
|
||||
Integer planKey = boardPlanRepository.save(boardPlan).getPlanKey();
|
||||
Integer infoSeq = savePlanMainInfos(planKey,0, "S", planInfos);//요약 summery
|
||||
savePlanMainInfos(planKey, infoSeq, "D", detailPlanInfos);//상세 detail
|
||||
return planKey;
|
||||
}
|
||||
|
||||
private Integer savePlanMainInfos(Integer planKey, Integer planSeq, String infoType, List<String> infoList){
|
||||
for(String info: infoList){
|
||||
PlanMainInfo planMainInfo = new PlanMainInfo();
|
||||
planMainInfo.setPlanKey(planKey);
|
||||
planMainInfo.setPlanSeq(++planSeq);
|
||||
planMainInfo.setPlanType(infoType);
|
||||
planMainInfo.setPlanInfo(info);
|
||||
planMainInfoRepository.save(planMainInfo);
|
||||
}
|
||||
return planSeq;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package com.dbnt.faisp.fpiMgt.monthPlan.model;
|
||||
|
||||
import com.dbnt.faisp.config.BaseBoard;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.dbnt.faisp.config.BaseModel;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
|
@ -11,6 +10,7 @@ import org.springframework.format.annotation.DateTimeFormat;
|
|||
|
||||
import javax.persistence.*;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
|
|
@ -20,7 +20,7 @@ import java.util.List;
|
|||
@DynamicInsert
|
||||
@DynamicUpdate
|
||||
@Table(name = "board_plan")
|
||||
public class BoardPlan extends BaseBoard {
|
||||
public class BoardPlan extends BaseModel {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "plan_key")
|
||||
|
|
@ -44,6 +44,13 @@ public class BoardPlan extends BaseBoard {
|
|||
private String headApprv;
|
||||
@Column(name = "head_etc")
|
||||
private String headEtc;
|
||||
@Column(name = "wrt_organ")
|
||||
private String wrtOrgan;
|
||||
@Column(name = "wrt_nm")
|
||||
private String wrtNm;
|
||||
@Column(name = "wrt_dt")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDateTime wrtDt;
|
||||
|
||||
@Transient
|
||||
private List<PlanMainInfo> mainInfoList;
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import java.io.Serializable;
|
|||
@NoArgsConstructor
|
||||
@DynamicInsert
|
||||
@DynamicUpdate
|
||||
@Table(name = "board_plan")
|
||||
@Table(name = "plan_main_info")
|
||||
@IdClass(PlanMainInfo.PlanMainInfoId.class)
|
||||
public class PlanMainInfo {
|
||||
@Id
|
||||
|
|
|
|||
Loading…
Reference in New Issue