mirror of
https://github.com/suhf/No1WMS.git
synced 2026-02-04 12:13:24 +09:00
카테고리 수정 및 카테고리 jsp수정
This commit is contained in:
@@ -66,14 +66,14 @@ public class CategoryController {
|
||||
// 생성 - Ajax
|
||||
@PostMapping("/category/create_process")
|
||||
@ResponseBody
|
||||
public int createProcess(CategoryDto dto, Model m) {
|
||||
public boolean createProcess(CategoryDto dto, Model m) {
|
||||
int i = categoryService.createProcess(dto);
|
||||
if (i == 1) {
|
||||
return i;
|
||||
return true;
|
||||
} else {
|
||||
// ajax테스트후 결정
|
||||
// m.addAttribute("dto", dto);
|
||||
return 0;
|
||||
m.addAttribute("dto", dto);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,5 +16,4 @@ public class CategoryDto {
|
||||
private String cls_nm_3;
|
||||
private String cls_nm_4;
|
||||
private boolean activation;
|
||||
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
<insert id="createProcess" parameterType="CategoryDto">
|
||||
INSERT INTO product_category (kan_code, cls_nm_1, cls_nm_2, cls_nm_3, cls_nm_4, activation)
|
||||
VALUES (#{dto.kan_code}, #{dto.cls_nm_1},#{dto.cls_nm_2},#{dto.cls_nm_3},#{dto.cls_nm_4},1)
|
||||
VALUES (#{kan_code}, #{cls_nm_1},#{cls_nm_2},#{cls_nm_3},#{cls_nm_4},1)
|
||||
</insert>
|
||||
|
||||
<!-- update -->
|
||||
|
||||
@@ -38,30 +38,42 @@
|
||||
<div class="col-12" style="text-align: center;">
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon1">대분류</span>
|
||||
<input type="text" name="cls_nm_1" class="form-control" placeholder="대분류를 입력하세요" aria-label="대분류" aria-describedby="basic-addon1">
|
||||
<input type="text" name="cls_nm_1" id="cls_nm_1" class="form-control"
|
||||
placeholder="대분류를 입력하세요" aria-label="대분류" value="${dto.cls_nm_1 }"
|
||||
aria-describedby="basic-addon1">
|
||||
</div>
|
||||
<!-- 설명만 있는 입력 -->
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon1">중분류</span>
|
||||
<input type="text" name="cls_nm_2" class="form-control" placeholder="중분류를 입력하세요" aria-label="중분류" aria-describedby="basic-addon1">
|
||||
<input type="text" name="cls_nm_2" id="cls_nm_2" class="form-control"
|
||||
placeholder="중분류를 입력하세요" aria-label="중분류" value="${dto.cls_nm_2 }"
|
||||
aria-describedby="basic-addon1">
|
||||
</div>
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon1">소분류</span>
|
||||
<input type="text" name="cls_nm_3" class="form-control" placeholder="소분류를 입력하세요" aria-label="소분류" aria-describedby="basic-addon1">
|
||||
<input type="text" name="cls_nm_3" id="cls_nm_3" class="form-control"
|
||||
placeholder="소분류를 입력하세요" aria-label="소분류" value="${dto.cls_nm_3 }"
|
||||
aria-describedby="basic-addon1">
|
||||
</div>
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon1">세분류</span>
|
||||
<input type="text" name="cls_nm_4" class="form-control" placeholder="세분류를 입력하세요" aria-label="세분류" aria-describedby="basic-addon1">
|
||||
<input type="text" name="cls_nm_4" id="cls_nm_4" class="form-control"
|
||||
placeholder="세분류를 입력하세요" aria-label="세분류" value="${dto.cls_nm_4 }"
|
||||
aria-describedby="basic-addon1">
|
||||
</div>
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<input type="text" name="kan_code" id="kan_code" class="form-control" placeholder="KAN 분류코드" aria-label="KAN 분류코드" aria-describedby="button-addon2">
|
||||
<button class="btn btn-outline-secondary" id="checkKan" style="background-color:#FF5E5E;" type="button" id="button-addon2">중복확인</button>
|
||||
<input type="number" name="kan_code" id="kan_code" class="form-control"
|
||||
placeholder="KAN 분류코드" aria-label="KAN 분류코드" value="${dto.kan_code }"
|
||||
aria-describedby="button-addon2">
|
||||
<button class="btn btn-outline-secondary" id="checkKan"
|
||||
style="background-color:#FF5E5E;" type="button"
|
||||
id="button-addon2">중복확인</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-margin-left-32">
|
||||
<button class="btn btn-success" id="commit">생성</button>
|
||||
<button class="btn btn-success" id="submit">생성</button>
|
||||
<button class="btn btn-secondary" id="cancel">취소</button>
|
||||
</div>
|
||||
</form>
|
||||
@@ -92,11 +104,12 @@
|
||||
if (data == "") {
|
||||
$("#checkKan").css("background-color", "#4CAF50"); // 파란색 배경으로 변경
|
||||
$("#checkKan").text("사용가능"); // 버튼 텍스트 변경
|
||||
|
||||
$("#checkKan").append("<input type='hidden' id='kan_chack' value='1'>");
|
||||
} else {
|
||||
$("#checkKan").css("background-color", "#FF5E5E"); // 원래의 빨간색 배경으로 변경
|
||||
$("#checkKan").text("사용불가"); // 버튼 텍스트 변경
|
||||
$("#kan_chack").val('0');
|
||||
//여기
|
||||
}
|
||||
}).fail(function() {
|
||||
alert("오류가 발생했습니다.");
|
||||
@@ -104,7 +117,71 @@
|
||||
// Ajax 요청 완료 후 버튼 다시 활성화
|
||||
$("#checkKan").prop("disabled", false);
|
||||
});
|
||||
});//kan중복체크 기능
|
||||
|
||||
|
||||
|
||||
$("#submit").on("click", function(){
|
||||
var clsnm1 = $("#cls_nm_1").val();
|
||||
var clsnm2 = $("#cls_nm_2").val();
|
||||
var clsnm3 = $("#cls_nm_3").val();
|
||||
var clsnm4 = $("#cls_nm_4").val();
|
||||
var kanCode = $("#kan_code").val();
|
||||
if(!clsnm1){
|
||||
alert("대분류를 입력해야 합니다.");
|
||||
return false;
|
||||
}
|
||||
if(!clsnm2){
|
||||
alert("중분류를 입력해야 합니다.");
|
||||
return false;
|
||||
}
|
||||
if(!clsnm3){
|
||||
alert("소분류를 입력해야 합니다.");
|
||||
return false;
|
||||
}
|
||||
if(!clsnm4){
|
||||
alert("세분류를 입력해야 합니다.");
|
||||
return false;
|
||||
}
|
||||
if( $("#kan_chack").val() != 1){
|
||||
alert("KAN코드를 입력후 중복체크를 해야합니다.");
|
||||
return false;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: "/category/create_process",
|
||||
type: "post",
|
||||
data: {
|
||||
"cls_nm_1": clsnm1,
|
||||
"cls_nm_2": clsnm2,
|
||||
"cls_nm_3": clsnm3,
|
||||
"cls_nm_4": clsnm4,
|
||||
"kan_code": kanCode,
|
||||
"activation": true
|
||||
},
|
||||
datatype:"json"
|
||||
}).done(function(data) {
|
||||
if (data == true) {
|
||||
alert("카테고리가 생성되었습니다.");
|
||||
$(location).attr("href", "/category/list")
|
||||
} else {
|
||||
alert("카테고리 생성에 실패하였습니다.");
|
||||
}
|
||||
}).fail(function() {
|
||||
alert("오류가 발생했습니다.");
|
||||
}).always(function() {
|
||||
// Ajax 요청 완료 후 버튼 다시 활성화
|
||||
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@@ -10,9 +10,7 @@
|
||||
text-align: center;
|
||||
color: white;
|
||||
}
|
||||
.w-5{
|
||||
width : 5%!important;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
@@ -40,8 +38,6 @@
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="table12">
|
||||
<table>
|
||||
<tr>
|
||||
|
||||
Reference in New Issue
Block a user