연도 표시 및 재개정 여부 표시.

연도, 재개정 셀렉트박스 기능 구현중.
cks
강석 최 2023-11-30 17:58:53 +09:00
parent 35c6517954
commit 3bf36a235e
7 changed files with 119 additions and 13 deletions

View File

@ -16,8 +16,10 @@ function CodeViewer(props) {
const [treeLoading, setTreeLoading] = useState(true);
const [docLoading, setDocLoading] = useState(true);
const {linkedDocCode} = useParams();
const [docInfoSeq, setDocInfoSeq] = useState()
const [docCode, setDocCode] = useState(linkedDocCode !== undefined?linkedDocCode:props.docCode);
const [docName, setDocName] = useState(props.docName);
const [docInfo, setDocInfo] = useState();
const [codeTree, setCodeTree] = useState();
const [docSummary, setDocSummary] = useState();
const [docDetail, setDocDetail] = useState();
@ -42,7 +44,7 @@ function CodeViewer(props) {
const updateDocCode = (docCode, docName)=>{
setDocCode(docCode);
setDocName(docName);
getCodeDetailInfo(docCode);
getCodeDetailInfo(null, docCode);
}
const getCodeTree = ()=>{
@ -84,8 +86,43 @@ function CodeViewer(props) {
);
}
const getCodeInfo = useCallback((docCode) => {
console.groupCollapsed("EgovMain.getCodeInfo()");
EgovNet.requestFetch(
'/standardCode/getCodeInfo.do',
{
method: "POST",
headers: {
'Content-type': 'application/json'
},
body: JSON.stringify({
docCode: docCode
})
},
(resp) => {
const docInfo = resp.result.docInfo;
// 헤더 연도 선택지 구성
let headTag = [];
if(docInfo.length>0){
let optionTag = [];
docInfo.forEach(function (item, index){
optionTag.push(
<option value={item.doc_info_seq}
selected={docInfoSeq===item.doc_info_seq || (docInfoSeq===undefined && item.last_yn === 'Y')}>
{item.doc_er==='E'?'재정':'개정'} {item.kcsc_cd} {item.doc_nm} :{item.doc_yr}
</option>
)
})
headTag.push(<select onChange={docInfoSelectorChange}>{optionTag}</select>)
}else{
headTag.push(<div>검색된 결과가 없습니다.</div>); // 코드 목록 초기값
}
setDocInfo(headTag);
}
)
})
const getCodeDetailInfo = useCallback((docCode) => {
const getCodeDetailInfo = useCallback((docInfoSeq, docCode) => {
console.groupCollapsed("EgovMain.getCodeDetailInfo()");
EgovNet.requestFetch(
'/standardCode/getCodeDetailInfo.do',
@ -95,6 +132,7 @@ function CodeViewer(props) {
'Content-type': 'application/json'
},
body: JSON.stringify({
docInfoSeq: docInfoSeq,
docCode: docCode
})
},
@ -213,6 +251,9 @@ function CodeViewer(props) {
console.groupEnd("EgovMain.getCodeDetailInfo()");
},[]);
const docInfoSelectorChange = (el) => {
getCodeDetailInfo(el.target.value, null);
}
const actionAppend = (el) => {
if(!el) return;
if(el.childNodes.length===0){
@ -311,7 +352,8 @@ function CodeViewer(props) {
useEffect(() => {
getCodeTree();
getCodeDetailInfo(docCode);
getCodeInfo(docCode);
getCodeDetailInfo(null, docCode);
}, []);
console.log("------------------------------viewer [End]");
@ -323,7 +365,7 @@ function CodeViewer(props) {
<Col xs={12} className="border-bottom">
<Row>
<Col xs={3}></Col>
<Col xs={9}>{docCode} {docName}</Col>
<Col xs={9}>{docInfo}</Col>
</Row>
</Col>
<Col xs={3} className="border-end viewerDiv">
@ -345,7 +387,7 @@ function CodeViewer(props) {
}
CodeViewer.defaultProps = {
docCode: 'KDS 24 10 11',
docCode: 'KDS 24 14 21',
docName: '교량 설계 일반사항(한계상태설계법)'
}

View File

@ -90,8 +90,27 @@ public class StandardCodeController extends BaseController {
}
@Operation(
summary = "건설기준코드 트리 조회",
description = "건설기준코드 트리 조회",
summary = "건설기준코드 이력 조회",
description = "건설기준코드 이력 조회",
tags = {"StandardCodeController"}
)
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "조회 성공"),
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
})
@PostMapping(value = "/getCodeInfo.do", consumes = MediaType.APPLICATION_JSON_VALUE)
public ResultVO getCodeInfo(@RequestBody StandardCodeVO param, @AuthenticationPrincipal LoginVO user)
throws Exception {
ResultVO resultVO = new ResultVO();
Map<String, Object> resultMap = new HashMap<>();
resultMap.put("docInfo", standardCodeService.selectStandardCodeDocInfo(param));
resultVO.setResult(resultMap);
return resultVO;
}
@Operation(
summary = "건설기준코드 에러 문구 수정",
description = "건설기준코드 에러 문구 수정",
tags = {"StandardCodeController"}
)
@ApiResponses(value = {

View File

@ -11,8 +11,11 @@ import java.util.Optional;
public interface TnDocumentContentRepository extends JpaRepository<TnDocumentContent, Integer> {
@Query(value = "select * from get_recent_full_context_by_content(:docCode, :docPart)", nativeQuery = true)
List<StandardCodeContentInterface> getRecentFullContextByContent(String docCode, String docPart);
@Query(value = "select * from get_year_full_context_by_content(:docInfoSeq, :docCode, :docPart, null, null)", nativeQuery = true)
List<StandardCodeContentInterface> getRecentFullContextByContent(Integer docInfoSeq, String docCode, String docPart);
List<StandardCodeContentInterface> getYearFullContextByContent(Integer docInfoSeq, String docCode, String docPart);
Optional<TnDocumentContent> findByContTypeCd(String contTypeCd);

View File

@ -10,6 +10,5 @@ import java.util.List;
public interface TnDocumentGroupRepository extends JpaRepository<TnDocumentGroup, Integer> {
@Query(value = "select * from sp_get_tn_document_code_by_tree()", nativeQuery = true)
public List<StandardCodeTreeInterface> spGetTnDocumentCodeByTree();
List<StandardCodeTreeInterface> spGetTnDocumentCodeByTree();
}

View File

@ -1,8 +1,13 @@
package com.dbnt.kcscbackend.standardCode.repository;
import com.dbnt.kcscbackend.standardCode.entity.TnDocumentInfo;
import com.dbnt.kcscbackend.standardCode.service.TnDocumentInfoInterface;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import java.util.List;
public interface TnDocumentInfoRepository extends JpaRepository<TnDocumentInfo, Integer> {
@Query(value = "select * from sp_get_tn_document_info_by_group_cd(null, :docCode)", nativeQuery = true)
List<TnDocumentInfoInterface> spGetTnDocumentInfoByGroupCd(String docCode);
}

View File

@ -6,6 +6,7 @@ import com.dbnt.kcscbackend.standardCode.entity.TnDocumentInfo;
import com.dbnt.kcscbackend.standardCode.mapper.StandardCodeMapper;
import com.dbnt.kcscbackend.standardCode.repository.TnDocumentContentRepository;
import com.dbnt.kcscbackend.standardCode.repository.TnDocumentGroupRepository;
import com.dbnt.kcscbackend.standardCode.repository.TnDocumentInfoRepository;
import lombok.RequiredArgsConstructor;
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
import org.springframework.stereotype.Service;
@ -20,6 +21,7 @@ public class StandardCodeService extends EgovAbstractServiceImpl {
private final TnDocumentGroupRepository tnDocumentGroupRepository;
private final TnDocumentContentRepository tnDocumentContentRepository;
private final TnDocumentInfoRepository tnDocumentInfoRepository;
private final StandardCodeMapper standardCodeMapper;
@Transactional
@ -35,7 +37,11 @@ public class StandardCodeService extends EgovAbstractServiceImpl {
}
public List<StandardCodeContentInterface> selectStandardCodeDocument(StandardCodeVO param) {
return tnDocumentContentRepository.getRecentFullContextByContent(param.getDocInfoSeq(), param.getDocCode(), param.getDocPart());
return tnDocumentContentRepository.getYearFullContextByContent(param.getDocInfoSeq(), param.getDocCode(), param.getDocPart());
}
public List<TnDocumentInfoInterface> selectStandardCodeDocInfo(StandardCodeVO param) {
return tnDocumentInfoRepository.spGetTnDocumentInfoByGroupCd(param.getDocCode());
}
public List<TnDocumentCodeList> selectStandardCodeList(TnDocumentInfo tnDocumentInfo){ return standardCodeMapper.selectStandardCodeList(tnDocumentInfo); }
@ -47,5 +53,4 @@ public class StandardCodeService extends EgovAbstractServiceImpl {
public List<TnDocumentInfo> selectStandardCodeRevisionhistoryList(Integer groupseq) {
return standardCodeMapper.selectStandardCodeRevisionhistoryList(groupseq);
}
}

View File

@ -0,0 +1,33 @@
package com.dbnt.kcscbackend.standardCode.service;
public interface TnDocumentInfoInterface {
Integer getDoc_info_seq();
Integer getGroup_seq();
String getKcsc_cd();
String getOld_kcsc_cd();
String getDoc_nm();
String getDoc_yr();
Integer getDoc_cycl();
String getDoc_er();
String getEstb_ymd();
String getRvsn_ymd();
Integer getDoc_rev_hist_seq();
String getDoc_brief();
String getDoc_rvsn_remark();
String getDoc_consider();
String getDoc_advice();
String getDoc_dept();
String getDoc_relation();
String getDoc_publish();
String getAplcn_bgng_ymd();
String getAplcn_end_ymd();
Integer getDoc_order();
String getLast_yn();
String getDoc_file_grp_id();
String getRvsn_file_grp_id();
String getFrst_crt_id();
String getFrst_crt_dt();
String getLast_chg_id();
String getLast_chg_dt();
String getUse_yn();
}