코드리스트 중분류 작업중

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

View File

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

View File

@ -18,6 +18,9 @@ import javax.persistence.Id;
@DynamicUpdate @DynamicUpdate
public class TnDocumentCodeList { public class TnDocumentCodeList {
@Id
@Column(name ="group_seq")
private Integer groupSeq;
@Column(name = "main_category") @Column(name = "main_category")
private String mainCategory; private String mainCategory;
@Column(name = "middle_category") @Column(name = "middle_category")
@ -28,9 +31,8 @@ public class TnDocumentCodeList {
private String kcscCd; private String kcscCd;
@Column(name = "doc_file_grp_id") @Column(name = "doc_file_grp_id")
private String docFileGrpId; private String docFileGrpId;
@Id
@Column(name ="group_seq")
private Integer groupSeq;
@Column(name = "contentcount") @Column(name = "contentcount")
private Integer 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); 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) { public List<TnDocumentInfo> selectStandardCodeRevisionhistoryList(Integer groupseq) {
return standardCodeMapper.selectStandardCodeRevisionhistoryList(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"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.dbnt.kcscbackend.standardCode.mapper.StandardCodeMapper"> <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 id="selectStandardCodeList" parameterType="TnDocumentInfo" resultType="TnDocumentCodeList">
select select
case case
@ -31,20 +46,24 @@
order by a.kcsc_cd order by a.kcsc_cd
</select> </select>
<sql id="selectStandardCodeListWhere"> <select id="selectStandardCodeGroupSeq" parameterType="String" resultType="Integer">
<where> select
a.parent_group_seq = a2.seq group_seq
and a2.parent_seq = a3.seq from tn_document_group
<if test="listCode != null and listCode != ''"> where group_full_cd = #{groupFullCd}
and a.group_full_cd like #{listCode} || '%' </select>
</if>
<if test="searchWrd != null and searchWrd != ''"> <select id="selectStandardCodeCategoryList" parameterType="Integer" resultType="TnDocumentCodeList">
and a.group_nm like '%' || #{searchWrd} || '%' select
</if> group_seq,
and a.group_type = 'D' group_full_cd,
and tdi.last_yn = 'Y' kcsc_cd,
</where> group_cur_cd,
</sql> group_nm,
parent_group_seq
from tn_document_group
where parent_group_seq = #{parentGroupSeq}
</select>
<select id="selectStandardCodeRevisionhistoryList" resultType="TnDocumentInfo"> <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 select tdi.aplcn_bgng_ymd,tdi.doc_file_grp_id,tdi.rvsn_file_grp_id from tn_document_info tdi, tn_document_group tdg