세션의 공통코드 관리방식 변경
parent
02e620ffeb
commit
887a89c59f
|
|
@ -22,7 +22,7 @@ public class BaseController {
|
|||
if(loginUser == null){
|
||||
mav = new ModelAndView("redirect:/login");
|
||||
}else{
|
||||
session.setAttribute("commonCodeList", codeMgtService.selectCodeCatgAndChild());
|
||||
session.setAttribute("commonCodeList", codeMgtService.selectCommonCodeList());
|
||||
mav = new ModelAndView("redirect:/dashboard");
|
||||
}
|
||||
return mav;
|
||||
|
|
@ -30,7 +30,7 @@ public class BaseController {
|
|||
|
||||
@GetMapping("/refreshSession")
|
||||
public void getSession(HttpSession session){
|
||||
session.setAttribute("commonCodeList", codeMgtService.selectCodeCatgAndChild());
|
||||
session.setAttribute("commonCodeList", codeMgtService.selectCommonCodeList());
|
||||
}
|
||||
|
||||
@GetMapping("/login")
|
||||
|
|
|
|||
|
|
@ -10,4 +10,5 @@ import java.util.Optional;
|
|||
public interface CodeMgtRepository extends JpaRepository<CodeMgt, CodeMgt.CodeMgtId> {
|
||||
|
||||
List<CodeMgt> findByCategoryCdOrderByItemCdAsc(String categoryCd);
|
||||
List<CodeMgt> findByUseChkOrderByItemCdAsc(String useChk);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,4 +41,8 @@ public class CodeMgtService{
|
|||
}
|
||||
return codeCatgList;
|
||||
}
|
||||
|
||||
public List<CodeMgt> selectCommonCodeList() {
|
||||
return codeMgtRepository.findByUseChkOrderByItemCdAsc("T");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,12 +32,13 @@ $(document).on('click', '#itemAddBtn', function (){
|
|||
$('#itemTable').find('tbody').append(
|
||||
'<tr class="itemTr">' +
|
||||
'<td><button class="btn btn-sm btn-outline-danger rowDeleteBtn"><i class="bi bi-x"></i></button></td>'+
|
||||
'<td><input type="text" class="form-control form-control-sm itemInput" name="itemCd"></td>'+
|
||||
'<td><input type="text" class="form-control form-control-sm itemInput" name="itemCd" value="'+codeCategoryList[selectedCategoryIdx].categoryCd+'"></td>'+
|
||||
'<td><input type="text" class="form-control form-control-sm itemInput" name="itemValue"></td>'+
|
||||
'<td></td>'+
|
||||
'</tr>'
|
||||
)
|
||||
codeCategoryList[selectedCategoryIdx].itemList.push({categoryCd:codeCategoryList[selectedCategoryIdx].categoryCd, itemCd:"", itemValue: "", useChk: "", status:"new"})
|
||||
codeCategoryList[selectedCategoryIdx].itemList
|
||||
.push({categoryCd:codeCategoryList[selectedCategoryIdx].categoryCd, itemCd:codeCategoryList[selectedCategoryIdx].categoryCd, itemValue: "", useChk: "T", status:"new"})
|
||||
})
|
||||
|
||||
$(document).on('click', '.rowDeleteBtn', function (){
|
||||
|
|
@ -149,7 +150,7 @@ function makeItemTr(itemList){
|
|||
'<td>'+(item.status==="new"?'<button class="btn btn-sm btn-outline-danger rowDeleteBtn"><i class="bi bi-x"></i></button>':'')+'</td>'+
|
||||
'<td><input type="text" class="form-control form-control-sm itemInput" name="itemCd" value="'+item.itemCd+'"></td>'+
|
||||
'<td><input type="text" class="form-control form-control-sm itemInput" name="itemValue" value="'+item.itemValue+'"></td>'+
|
||||
'<td><input type="checkbox" class="itemInput" name="useChk" '+(item.useChk==="T"?'checked':'')+'></td>'+
|
||||
'<td>'+(item.status==="new"?'':'<input type="checkbox" class="itemInput" name="useChk" '+(item.useChk==="T"?'checked':'')+'>')+'</td>'+
|
||||
'</tr>'
|
||||
)
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue