mirror of
https://github.com/suhf/No1WMS.git
synced 2026-02-04 12:13:24 +09:00
change Categorys
This commit is contained in:
@@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
@@ -83,7 +84,7 @@ public class CategoryController {
|
||||
}
|
||||
// 수정 - Ajax
|
||||
|
||||
@PutMapping("/category//update_process")
|
||||
@PutMapping("/category/update_process")
|
||||
@ResponseBody
|
||||
public int updateProcess(CategoryDto dto, Model m) {
|
||||
|
||||
@@ -111,6 +112,7 @@ public class CategoryController {
|
||||
}
|
||||
}
|
||||
|
||||
// 엑셀다운로드테스트
|
||||
@GetMapping("/category/download")
|
||||
public void downloadExcel(HttpServletResponse response) {
|
||||
List<CategoryDto> dto = categoryService.selectAllCategory();
|
||||
@@ -122,8 +124,13 @@ public class CategoryController {
|
||||
}
|
||||
|
||||
// KAN코드 중복확인 메서드
|
||||
|
||||
@PostMapping("/category/chackKancode")
|
||||
@ResponseBody
|
||||
public int chackKancode(String kan_code) {
|
||||
return 0;
|
||||
int chack = categoryService.checkKan(kan_code);
|
||||
System.out.println(chack);
|
||||
return chack;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -52,7 +52,15 @@ public class CategoryService {
|
||||
return mapper.activateByKanCode(kan_code);
|
||||
}
|
||||
|
||||
|
||||
public int checkKan(String kan_code) {
|
||||
CategoryDto dto = mapper.selectByKanCode(kan_code);
|
||||
String kancode = dto.getKan_code();
|
||||
if(kancode == null) {
|
||||
return 0;
|
||||
}else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -15,19 +15,19 @@
|
||||
<update id="updateByKanCode" parameterType="CategoryDto">
|
||||
UPDATE product_category
|
||||
SET cls_nm_1 = #{dto.cls_nm_1}, cls_nm_2 = #{dto.cls_nm_2},cls_nm_3 = #{dto.cls_nm_3}, cls_nm_4 = #{dto.cls_nm_4}
|
||||
WHERE kan_code = {dto.kan_code}
|
||||
WHERE kan_code = #{dto.kan_code}
|
||||
</update>
|
||||
|
||||
<update id="deactivateByKanCode" parameterType="String">
|
||||
UPDATE product_category
|
||||
SET activation = 0
|
||||
WHERE kan_code = {kan_code}
|
||||
WHERE kan_code = #{kan_code}
|
||||
</update>
|
||||
|
||||
<update id="activateByKanCode" parameterType="String">
|
||||
UPDATE product_category
|
||||
SET activation = 1
|
||||
WHERE kan_code = {kan_code}
|
||||
WHERE kan_code = #{kan_code}
|
||||
</update>
|
||||
|
||||
|
||||
|
||||
@@ -46,8 +46,8 @@ input {
|
||||
<input type="text" name="cls_nm_4">
|
||||
<br>
|
||||
<li>KAN 분류코드</li>
|
||||
<input type="text" name="kan_code">
|
||||
<button id="checkKan">중복확인</button>
|
||||
<input type="text" name="kan_code" id="kan_code">
|
||||
<input type="button" id="checkKan" value="중복확인">
|
||||
<span id="chackDiv"></span>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -59,10 +59,50 @@ input {
|
||||
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
<script>
|
||||
$("#checkKan").click(function() {
|
||||
|
||||
})
|
||||
</script>
|
||||
$(document).ready(function() {
|
||||
$("#checkKan").on("click", function() {
|
||||
// 중복 클릭 방지를 위해 버튼을 비활성화
|
||||
$("#checkKan").prop("disabled", true);
|
||||
|
||||
// 이전 결과 및 메시지 초기화
|
||||
$("#chackDiv").html("");
|
||||
|
||||
var kanCode = $("#kan_code").val();
|
||||
|
||||
if (!kanCode) {
|
||||
$("#chackDiv").html("KAN 분류코드를 입력하세요.");
|
||||
// 버튼 다시 활성화
|
||||
$("#checkKan").prop("disabled", false);
|
||||
return false;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "/category/chackKancode",
|
||||
data: { kan_code: kanCode },
|
||||
dataType: text
|
||||
}).done(function(data) {
|
||||
if (data == 0) {
|
||||
$("#chackDiv").html("사용가능합니다");
|
||||
$("#chackDiv").append("<input type='hidden' id='kan_chack' value='1'>");
|
||||
} else {
|
||||
$("#chackDiv").html("이미 사용중인 KAN 분류코드입니다.");
|
||||
}
|
||||
}).fail(function() {
|
||||
alert("오류가 발생했습니다.");
|
||||
}).always(function() {
|
||||
// Ajax 요청 완료 후 버튼 다시 활성화
|
||||
$("#checkKan").prop("disabled", false);
|
||||
});
|
||||
});
|
||||
|
||||
// 포커스를 잃었을 때 KAN 분류코드 입력 안내 메시지를 초기화
|
||||
$("#kan_code").on("blur", function() {
|
||||
$("#chackDiv").html("");
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user