코드리스트 중분류 작업중

cks
유민형 2023-12-01 17:58:36 +09:00
parent 36232d6748
commit 5bafa8f96e
6 changed files with 75 additions and 37 deletions

View File

@ -73,13 +73,14 @@ function StandardCodeList(props) {
const location = useLocation();
console.log("StandardCodeList [location] : ", location);
const cndRef = useRef();
const category1Ref = useRef();
const category2Ref = useRef();
const wrdRef = useRef();
const bbsId = location.state?.bbsId || NOTICE_BBS_ID;
// eslint-disable-next-line no-unused-vars
const [searchCondition, setSearchCondition] = useState(location.state?.searchCondition || {listCode: listCode, pageIndex: 1, category1: '', searchWrd: ''});// ||
const [searchCondition, setSearchCondition] = useState(location.state?.searchCondition || {listCode: listCode, pageIndex: 1, category1: '', category2: '', searchWrd: ''});// ||
const [masterBoard, setMasterBoard] = useState({});
const [paginationInfo, setPaginationInfo] = useState({});
@ -88,6 +89,7 @@ function StandardCodeList(props) {
/* 검색기능 추가 변수*/
const [listdata, setlistdata] = useState([]);
const [filterData, setfilterData] = useState('');
const [categoryList, setCategoryList] = useState([]);
/* 탭 */
const [activeTab, setActiveTab] = useState('10');
@ -97,9 +99,10 @@ function StandardCodeList(props) {
retrieveList({
...searchCondition,
category1: cndRef.current.value,
searchWrd: wrdRef.current.value,
tab: tabName
tab: tabName,
category1: category1Ref.current.value,
category2: category2Ref.current.value,
searchWrd: wrdRef.current.value
});
};
@ -122,6 +125,7 @@ function StandardCodeList(props) {
setPaginationInfo(resp.result.paginationInfo);
/*검색을 위한 리스트 state에 저장*/
setlistdata(resp.result.resultList);
setCategoryList(resp.result.categoryList);
//
},
function (resp) {
@ -178,16 +182,16 @@ function StandardCodeList(props) {
/>
<button type="button"
onClick={() => {
retrieveList({...searchCondition, pageIndex: 1, category1: cndRef.current.value, searchWrd: wrdRef.current.value, tab: activeTab});
retrieveList({...searchCondition, pageIndex: 1, category1: category1Ref.current.value, searchWrd: wrdRef.current.value, tab: activeTab});
}}>조회</button>
</span>
</li>
<li className="third_1 L">
<label className="f_select" htmlFor="sel1">
<select id="sel1" title="조건" defaultValue={listCode.substring(2, 4)} ref={cndRef}
<select id="sel1" title="조건" defaultValue={listCode.substring(2, 4)} ref={category1Ref}
onChange={e => {
cndRef.current.value = e.target.value;
retrieveList({...searchCondition, pageIndex: 1, category1: cndRef.current.value, searchWrd: wrdRef.current.value, tab: activeTab});
category1Ref.current.value = e.target.value;
retrieveList({...searchCondition, pageIndex: 1, category1: category1Ref.current.value, searchWrd: wrdRef.current.value, tab: activeTab});
}}
>
<option value="">전체</option>
@ -196,26 +200,24 @@ function StandardCodeList(props) {
</select>
</label>
</li>
{/*<li className="third_1 L">
<li className="third_1 L">
<label className="f_select" htmlFor="sel1">
<select id="sel2" title="조건" defaultValue={searchCondition.category1} ref={cndRef}
<select id="sel2" title="조건" defaultValue={searchCondition.category2} ref={category2Ref}
onChange={e => {
cndRef.current.value = e.target.value;
retrieveList({...searchCondition, pageIndex: 1, category1: cndRef.current.value, searchWrd: wrdRef.current.value});
category2Ref.current.value = e.target.value;
retrieveList({...searchCondition, pageIndex: 1, category1: category1Ref.current.value, category2: category2Ref, searchWrd: wrdRef.current.value});
}}
>
<option value="10">전체</option>
<option value="1010">공통편</option>
<option value="1020">시설물편</option>
<option value="">전체</option>
</select>
</label>
</li>
<li className="third_1 L">
{/*<li className="third_1 L">
<label className="f_select" htmlFor="sel1">
<select id="sel3" title="조건" defaultValue={searchCondition.category1} ref={cndRef}
<select id="sel3" title="조건" defaultValue={searchCondition.category1} ref={category1Ref}
onChange={e => {
cndRef.current.value = e.target.value;
retrieveList({...searchCondition, pageIndex: 1, category1: cndRef.current.value, searchWrd: wrdRef.current.value});
category1Ref.current.value = e.target.value;
retrieveList({...searchCondition, pageIndex: 1, category1: category1Ref.current.value, searchWrd: wrdRef.current.value});
}}
>
<option value="10">전체</option>

View File

@ -160,11 +160,17 @@ public class StandardCodeController extends BaseController {
System.out.println("@@@ category1 : " + tnDocumentInfo.getCategory1());
System.out.println("@@@ searchWrd : " + tnDocumentInfo.getSearchWrd());
System.out.println("@@@ tab : " + tnDocumentInfo.getTab());
if (!tnDocumentInfo.getCategory1().isEmpty()) {
tnDocumentInfo.setListCode(tnDocumentInfo.getTab() + tnDocumentInfo.getCategory1());
}
Integer groupFullCd = standardCodeService.selectStandardCodeGroupSeq(tnDocumentInfo.getTab() + tnDocumentInfo.getCategory1());
System.out.println("@@@ groupFullCd : " + groupFullCd);
List<TnDocumentCodeList> tnDocumentCodeList = standardCodeService.selectStandardCodeList(tnDocumentInfo);
resultMap.put("resultList", tnDocumentCodeList);
resultMap.put("categoryList", standardCodeService.selectStandardCodeCategoryList(groupFullCd));
Integer totCnt = tnDocumentCodeList.get(0).getContentcount();
resultMap.put("resultCnt", totCnt);
resultMap.put("user", user);

View File

@ -18,6 +18,9 @@ import javax.persistence.Id;
@DynamicUpdate
public class TnDocumentCodeList {
@Id
@Column(name ="group_seq")
private Integer groupSeq;
@Column(name = "main_category")
private String mainCategory;
@Column(name = "middle_category")
@ -28,9 +31,8 @@ public class TnDocumentCodeList {
private String kcscCd;
@Column(name = "doc_file_grp_id")
private String docFileGrpId;
@Id
@Column(name ="group_seq")
private Integer groupSeq;
@Column(name = "contentcount")
private Integer contentcount;
@Column(name = "parent_group_seq")
private String parentGroupSeq;
}

View File

@ -16,4 +16,8 @@ public interface StandardCodeMapper {
List<TnDocumentInfo> selectStandardCodeRevisionhistoryList(Integer groupseq);
Integer selectStandardCodeGroupSeq(String groupFullCd);
List<TnDocumentCodeList> selectStandardCodeCategoryList(Integer parentGroupSeq);
}

View File

@ -53,4 +53,9 @@ public class StandardCodeService extends EgovAbstractServiceImpl {
public List<TnDocumentInfo> selectStandardCodeRevisionhistoryList(Integer groupseq) {
return standardCodeMapper.selectStandardCodeRevisionhistoryList(groupseq);
}
public Integer selectStandardCodeGroupSeq(String groupFullCd) { return standardCodeMapper.selectStandardCodeGroupSeq(groupFullCd); }
public List<TnDocumentCodeList> selectStandardCodeCategoryList(Integer parentGroupSeq){ return standardCodeMapper.selectStandardCodeCategoryList(parentGroupSeq); }
}

View File

@ -3,6 +3,21 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.dbnt.kcscbackend.standardCode.mapper.StandardCodeMapper">
<sql id="selectStandardCodeListWhere">
<where>
a.parent_group_seq = a2.seq
and a2.parent_seq = a3.seq
<if test="listCode != null and listCode != ''">
and a.group_full_cd like #{listCode} || '%'
</if>
<if test="searchWrd != null and searchWrd != ''">
and a.group_nm like '%' || #{searchWrd} || '%'
</if>
and a.group_type = 'D'
and tdi.last_yn = 'Y'
</where>
</sql>
<select id="selectStandardCodeList" parameterType="TnDocumentInfo" resultType="TnDocumentCodeList">
select
case
@ -31,20 +46,24 @@
order by a.kcsc_cd
</select>
<sql id="selectStandardCodeListWhere">
<where>
a.parent_group_seq = a2.seq
and a2.parent_seq = a3.seq
<if test="listCode != null and listCode != ''">
and a.group_full_cd like #{listCode} || '%'
</if>
<if test="searchWrd != null and searchWrd != ''">
and a.group_nm like '%' || #{searchWrd} || '%'
</if>
and a.group_type = 'D'
and tdi.last_yn = 'Y'
</where>
</sql>
<select id="selectStandardCodeGroupSeq" parameterType="String" resultType="Integer">
select
group_seq
from tn_document_group
where group_full_cd = #{groupFullCd}
</select>
<select id="selectStandardCodeCategoryList" parameterType="Integer" resultType="TnDocumentCodeList">
select
group_seq,
group_full_cd,
kcsc_cd,
group_cur_cd,
group_nm,
parent_group_seq
from tn_document_group
where parent_group_seq = #{parentGroupSeq}
</select>
<select id="selectStandardCodeRevisionhistoryList" resultType="TnDocumentInfo">
select tdi.aplcn_bgng_ymd,tdi.doc_file_grp_id,tdi.rvsn_file_grp_id from tn_document_info tdi, tn_document_group tdg