mirror of
https://github.com/suhf/No1WMS.git
synced 2026-02-04 19:54:00 +09:00
update Category
This commit is contained in:
@@ -126,13 +126,11 @@ public class CategoryController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// KAN코드 중복확인 메서드
|
// KAN코드 중복확인 메서드
|
||||||
|
@PostMapping("/category/checkKancode")
|
||||||
@PostMapping("/category/chackKancode")
|
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public int chackKancode(String kan_code) {
|
public String chackKancode(String kan_code) {
|
||||||
int chack = categoryService.checkKan(kan_code);
|
String checkkan = categoryService.kanCheck(kan_code);
|
||||||
System.out.println(chack);
|
return checkkan;
|
||||||
return chack;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -14,4 +14,5 @@ public interface CategoryMapper {
|
|||||||
int updateByKanCode(CategoryDto dto);
|
int updateByKanCode(CategoryDto dto);
|
||||||
int deactivateByKanCode(String kan_code);
|
int deactivateByKanCode(String kan_code);
|
||||||
int activateByKanCode(String kan_code);
|
int activateByKanCode(String kan_code);
|
||||||
|
String kanCheck(String kan_code);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,14 +52,8 @@ public class CategoryService {
|
|||||||
return mapper.activateByKanCode(kan_code);
|
return mapper.activateByKanCode(kan_code);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int checkKan(String kan_code) {
|
public String kanCheck(String kan_code) {
|
||||||
CategoryDto dto = mapper.selectByKanCode(kan_code);
|
return mapper.kanCheck(kan_code);
|
||||||
String kancode = dto.getKan_code();
|
|
||||||
if(kancode == null) {
|
|
||||||
return 0;
|
|
||||||
}else {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,9 @@
|
|||||||
select * from product_category
|
select * from product_category
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="kanCheck" parameterType="String" resultType="String">
|
||||||
|
select kan_code from product_category where kan_code = #{kan_code}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -6,25 +6,28 @@
|
|||||||
<title>카테고리 생성</title>
|
<title>카테고리 생성</title>
|
||||||
<style>
|
<style>
|
||||||
|
|
||||||
input {
|
|
||||||
display: inline-block;
|
|
||||||
}
|
|
||||||
|
|
||||||
#checkKan {
|
.header-white {
|
||||||
margin-left: 10px; /* .checkKan 버튼과 옆의 input 사이 간격 조절 */
|
|
||||||
}
|
|
||||||
.header {
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
.body{
|
.body{
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
.col-centered{
|
||||||
|
margin: 0 auto;
|
||||||
|
float: none;
|
||||||
|
}
|
||||||
|
.col-margin-left-32{
|
||||||
|
margin-left: 32%;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="header">
|
<div class="header-white">
|
||||||
<h1><b>제품 카테고리 생성</b></h1>
|
<h1><b>제품 카테고리 생성</b></h1>
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
@@ -32,51 +35,34 @@ input {
|
|||||||
<form id="createForm">
|
<form id="createForm">
|
||||||
<div class="ulTag">
|
<div class="ulTag">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12" style="text-align: center;">
|
||||||
<div class="input-group mb-3">
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
<span class="input-group-text" id="basic-addon1">대분류</span>
|
<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" class="form-control" placeholder="대분류를 입력하세요" aria-label="대분류" aria-describedby="basic-addon1">
|
||||||
</div>
|
</div>
|
||||||
<!-- 설명만 있는 입력 -->
|
<!-- 설명만 있는 입력 -->
|
||||||
<div class="input-group mb-3">
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
<span class="input-group-text" id="basic-addon1">중분류</span>
|
<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" class="form-control" placeholder="중분류를 입력하세요" aria-label="중분류" aria-describedby="basic-addon1">
|
||||||
</div>
|
</div>
|
||||||
<div class="input-group mb-3">
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
<span class="input-group-text" id="basic-addon1">소분류</span>
|
<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" class="form-control" placeholder="소분류를 입력하세요" aria-label="소분류" aria-describedby="basic-addon1">
|
||||||
</div>
|
</div>
|
||||||
<div class="input-group mb-3">
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
<span class="input-group-text" id="basic-addon1">중분류</span>
|
<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" class="form-control" placeholder="세분류를 입력하세요" aria-label="세분류" aria-describedby="basic-addon1">
|
||||||
</div>
|
</div>
|
||||||
<div class="input-group mb-3">
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
<input type="text" name="kan_code" class="form-control" placeholder="KAN 분류코드" aria-label="KAN 분류코드" aria-describedby="button-addon2">
|
<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" style="background-color:#FF5E5E;" type="button" id="button-addon2">중복확인</button>
|
<button class="btn btn-outline-secondary" id="checkKan" style="background-color:#FF5E5E;" type="button" id="button-addon2">중복확인</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
대분류
|
|
||||||
<input type="text" name="cls_nm_1">
|
|
||||||
|
|
||||||
중분류
|
|
||||||
<input type="text" name="cls_nm_2">
|
|
||||||
|
|
||||||
소분류
|
|
||||||
<input type="text" name="cls_nm_3">
|
|
||||||
|
|
||||||
세분류
|
|
||||||
<input type="text" name="cls_nm_4">
|
|
||||||
|
|
||||||
KAN 분류코드
|
|
||||||
<input type="text" name="kan_code" id="kan_code">
|
|
||||||
<input type="button" id="checkKan" value="중복확인">
|
|
||||||
<span id="chackDiv"></span>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="Btn">
|
<div class="col-margin-left-32">
|
||||||
<button id="commit">생성</button>
|
<button class="btn btn-success" id="commit">생성</button>
|
||||||
<button id="cancel">취소</button>
|
<button class="btn btn-secondary" id="cancel">취소</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
@@ -87,29 +73,30 @@ input {
|
|||||||
// 중복 클릭 방지를 위해 버튼을 비활성화
|
// 중복 클릭 방지를 위해 버튼을 비활성화
|
||||||
$("#checkKan").prop("disabled", true);
|
$("#checkKan").prop("disabled", true);
|
||||||
|
|
||||||
// 이전 결과 및 메시지 초기화
|
|
||||||
$("#chackDiv").html("");
|
|
||||||
|
|
||||||
var kanCode = $("#kan_code").val();
|
var kanCode = $("#kan_code").val();
|
||||||
|
|
||||||
if (!kanCode) {
|
if (!kanCode) {
|
||||||
$("#chackDiv").html("KAN 분류코드를 입력하세요.");
|
alert("KAN 분류코드를 입력하세요.");
|
||||||
|
$("#kan_code").focus();
|
||||||
// 버튼 다시 활성화
|
// 버튼 다시 활성화
|
||||||
$("#checkKan").prop("disabled", false);
|
$("#checkKan").prop("disabled", false);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
url: "/category/checkKancode",
|
||||||
type: "post",
|
type: "post",
|
||||||
url: "/category/chackKancode",
|
data: {"kan_code": kanCode},
|
||||||
data: { kan_code: kanCode },
|
datatype:"text"
|
||||||
dataType: text
|
|
||||||
}).done(function(data) {
|
}).done(function(data) {
|
||||||
if (data == 0) {
|
if (data == "") {
|
||||||
$("#chackDiv").html("사용가능합니다");
|
$("#checkKan").css("background-color", "#4CAF50"); // 파란색 배경으로 변경
|
||||||
$("#chackDiv").append("<input type='hidden' id='kan_chack' value='1'>");
|
$("#checkKan").text("사용가능"); // 버튼 텍스트 변경
|
||||||
|
|
||||||
|
$("#checkKan").append("<input type='hidden' id='kan_chack' value='1'>");
|
||||||
} else {
|
} else {
|
||||||
$("#chackDiv").html("이미 사용중인 KAN 분류코드입니다.");
|
$("#checkKan").css("background-color", "#FF5E5E"); // 원래의 빨간색 배경으로 변경
|
||||||
|
$("#checkKan").text("사용불가"); // 버튼 텍스트 변경
|
||||||
}
|
}
|
||||||
}).fail(function() {
|
}).fail(function() {
|
||||||
alert("오류가 발생했습니다.");
|
alert("오류가 발생했습니다.");
|
||||||
@@ -118,11 +105,6 @@ input {
|
|||||||
$("#checkKan").prop("disabled", false);
|
$("#checkKan").prop("disabled", false);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// 포커스를 잃었을 때 KAN 분류코드 입력 안내 메시지를 초기화
|
|
||||||
$("#kan_code").on("blur", function() {
|
|
||||||
$("#chackDiv").html("");
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -6,37 +6,42 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>제품 카테고리</title>
|
<title>제품 카테고리</title>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
.header {
|
.header-white {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
.w-5{
|
||||||
|
width : 5%!important;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
|
||||||
<div class="header">
|
<div class="header-white">
|
||||||
<h1>제품 카테고리 관리</h1>
|
<h1><b>제품 카테고리 관리</b></h1>
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
<div class="body">
|
<div class="body">
|
||||||
<div class="search12">
|
<div class="search12">
|
||||||
<form action="categorysearch">
|
<form action="categorySearch">
|
||||||
<div class="searchDropdown" id="searchDropdown">
|
<div class="input-group mb-3 w-30">
|
||||||
<select>
|
<div class="w-25">
|
||||||
<option value="0"></option>
|
<select class="form-select">
|
||||||
<option value="1"></option>
|
<option selected="selected" value="cls_nm_4">세분류</option>
|
||||||
<option value="2"></option>
|
<option value="cls_nm_1">대분류</option>
|
||||||
|
<option value="cls_nm_2">중분류</option>
|
||||||
|
<option value="cls_nm_3">세분류</option>
|
||||||
|
<option value="kan_code">KAN코드</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="searchInput">
|
<input type="text" name="categorySearch" class="form-control" aria-label="Text input with dropdown button" placeholder="검색어를 입력하세요">
|
||||||
<input type="text" name="searchInput" id="searchInput"
|
<button class="btn btn-outline-secondary" style="background-color:aqua;" type="button" id="button-addon2 searchBtn">검색</button>
|
||||||
placeholder="검색어를 입력하세요" />
|
|
||||||
</div>
|
|
||||||
<div class="searchButton">
|
|
||||||
<button id="searchButton">검색</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
<div class="table12">
|
<div class="table12">
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@@ -5,14 +5,77 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>test상세페이지</title>
|
<title>test상세페이지</title>
|
||||||
|
<style type="text/css">
|
||||||
|
.col-centered{
|
||||||
|
margin: 0 auto;
|
||||||
|
float: none;
|
||||||
|
}
|
||||||
|
.col-margin-left-32{
|
||||||
|
margin-left: 32%;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
test success<br>
|
test success
|
||||||
|
<br>
|
||||||
<hr>
|
<hr>
|
||||||
<c:forEach items="${dto }" var="item">
|
<c:forEach items="${dto }" var="item">
|
||||||
${item.kan_code} : ${item.cls_nm_1} > ${item.cls_nm_2} > ${item.cls_nm_3} > ${item.cls_nm_4}<br>
|
${item.kan_code} : ${item.cls_nm_1} > ${item.cls_nm_2} > ${item.cls_nm_3} > ${item.cls_nm_4}<br>
|
||||||
활성화 : ${item.activation}<br>
|
활성화 : ${item.activation}<br>
|
||||||
<hr>
|
<hr>
|
||||||
</c:forEach>
|
</c:forEach>
|
||||||
|
코드테스트 버튼 :
|
||||||
|
<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>
|
||||||
|
</div>
|
||||||
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
$("#checkKan").on("click", function() {
|
||||||
|
// 중복 클릭 방지를 위해 버튼을 비활성화
|
||||||
|
$("#checkKan").prop("disabled", true);
|
||||||
|
|
||||||
|
let kanCode = $("#kan_code").val();
|
||||||
|
|
||||||
|
if (!kanCode) {
|
||||||
|
alert("KAN 분류코드를 입력하세요.");
|
||||||
|
$("#kan_code").focus();
|
||||||
|
// 버튼 다시 활성화
|
||||||
|
$("#checkKan").prop("disabled", false);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: "/category/checkKancode",
|
||||||
|
type: "post",
|
||||||
|
data: {"kan_code": kanCode},
|
||||||
|
datatype:"text"
|
||||||
|
}).done(function(data) {
|
||||||
|
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("사용불가"); // 버튼 텍스트 변경
|
||||||
|
}
|
||||||
|
}).fail(function() {
|
||||||
|
alert("오류가 발생했습니다.");
|
||||||
|
}).always(function() {
|
||||||
|
// Ajax 요청 완료 후 버튼 다시 활성화
|
||||||
|
$("#checkKan").prop("disabled", false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
Reference in New Issue
Block a user