From b069e1d1be248d3030996ea4b3ec069c3f10e80c Mon Sep 17 00:00:00 2001 From: Kana Date: Mon, 15 Jan 2024 18:00:19 +0900 Subject: [PATCH 1/6] add excel upload --- .../no1/wms/category/CategoryController.java | 112 +++++++++++++---- .../com/no1/wms/category/CategoryDto.java | 4 +- .../java/com/no1/wms/excel/EgovWebUtil.java | 17 +++ ...xcelUtils.java => ExcelDownlodeUtils.java} | 54 +++++++- .../com/no1/wms/excel/ExcelManagerXlsx.java | 110 +++++++++++++++++ .../no1/wms/excel/ExcelRequestManager.java | 86 +++++++++++++ .../webapp/WEB-INF/views/category/list.jsp | 65 +++++++++- .../webapp/WEB-INF/views/category/test.jsp | 115 +++++++----------- src/main/webapp/WEB-INF/views/main.jsp | 32 +++++ .../excelform/카테고리 데이터 입력 서식.xlsx | Bin 0 -> 7485 bytes 10 files changed, 496 insertions(+), 99 deletions(-) create mode 100644 src/main/java/com/no1/wms/excel/EgovWebUtil.java rename src/main/java/com/no1/wms/excel/{ExcelUtils.java => ExcelDownlodeUtils.java} (54%) create mode 100644 src/main/java/com/no1/wms/excel/ExcelManagerXlsx.java create mode 100644 src/main/java/com/no1/wms/excel/ExcelRequestManager.java create mode 100644 src/main/webapp/WEB-INF/views/main.jsp create mode 100644 src/main/webapp/excelfiles/excelform/카테고리 데이터 입력 서식.xlsx diff --git a/src/main/java/com/no1/wms/category/CategoryController.java b/src/main/java/com/no1/wms/category/CategoryController.java index c30c745..9e7e4f3 100644 --- a/src/main/java/com/no1/wms/category/CategoryController.java +++ b/src/main/java/com/no1/wms/category/CategoryController.java @@ -1,23 +1,32 @@ package com.no1.wms.category; -import java.util.List; +import java.io.IOException; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; +import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.ModelAttribute; 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; -import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springframework.web.servlet.mvc.support.RedirectAttributes; -import com.no1.wms.excel.ExcelUtils; +import com.no1.wms.excel.ExcelRequestManager; +import com.no1.wms.excel.ExcelDownlodeUtils; @@ -28,16 +37,15 @@ public class CategoryController { CategoryService categoryService; @Autowired - ExcelUtils excelUtils; + ExcelDownlodeUtils excelDownlodeUtils; //테스트 @GetMapping("/category/test") - public String testPage(Model m) { - List dto = categoryService.selectAllCategory(); - m.addAttribute("dto", dto); + public String testPage(Model m, HttpServletRequest request) { + return "category/test"; - } + }; // 카테고리 리스트 출력 @GetMapping("/category/list") @@ -77,7 +85,7 @@ public class CategoryController { //List dto = categoryService.categoryList(page); //m.addAttribute("list", dto); return "category/list"; - } + }; // 상세페이지 @PostMapping("/category/read") @@ -86,13 +94,13 @@ public class CategoryController { CategoryDto dto = categoryService.selectByKanCode(kan_code); m.addAttribute("dto", dto); return "category/read"; - } + }; // 생성 - 폼 @PostMapping("/category/create") public String create() { return "category/create"; - } + }; // 생성 - Ajax @@ -105,7 +113,7 @@ public class CategoryController { } else { return false; } - } + }; // 수정 - 폼 @PostMapping("/category/update") @@ -113,7 +121,7 @@ public class CategoryController { CategoryDto dto = categoryService.selectByKanCode(kan_code); m.addAttribute("dto", dto); return "category/update"; - } + }; // 수정 - Ajax @PutMapping("/category/update_process") @@ -126,7 +134,7 @@ public class CategoryController { } else { return false; } - } + }; // 삭제 @DeleteMapping("/category/delete") @@ -138,18 +146,18 @@ public class CategoryController { } else { return false; } - } + }; // 엑셀다운로드테스트 - @GetMapping("/category/download") - public void downloadExcel(HttpServletResponse response) { + @GetMapping("/category/downloadTest") + public void downloadExcelTest(HttpServletResponse response) { List dto = categoryService.selectAllCategory(); String excelFileName = "카테고리 테스트 파일"; String sheetName = "카테고리"; String[] columnName = {"KAN_CODE","대분류","중분류","소분류","세분류"}; - excelUtils.downloadCategoryExcelFile(excelFileName, response, sheetName, columnName, dto); + excelDownlodeUtils.downloadCategoryExcelFile(excelFileName, response, sheetName, columnName, dto); - } + }; // KAN코드 중복확인 메서드 @PostMapping("/category/checkKancode") @@ -157,7 +165,7 @@ public class CategoryController { public String chackKancode(String kan_code) { String checkkan = categoryService.kanCheck(kan_code); return checkkan; - } + }; //카테고리 검색 모달 @GetMapping("/category/categorysearch") @@ -192,9 +200,67 @@ public class CategoryController { m.addAttribute("p" , page); return "modal/categorysearch"; - } + }; + + @GetMapping("/category/downlodeCategoryForm") + public void downlodeCategoryForm (HttpServletResponse response) throws IOException{ + String categoryFormName = "카테고리 데이터 입력 서식.xlsx"; + excelDownlodeUtils.downlodeExcelForm(response, categoryFormName); + }; + @PostMapping("/category/uplodeExcel") + public String uploadExcel(@ModelAttribute("dto") CategoryDto dto , RedirectAttributes redirectAttributes,final MultipartHttpServletRequest multiRequest, + HttpServletRequest request,ModelMap model) { + + Map resMap = new HashMap<>(); + + + try { + + ExcelRequestManager em = new ExcelRequestManager(); + + // 멀티파트 요청 객체에서 파일 맵을 가져옴 + final Map files = multiRequest.getFileMap(); + //초기화 + List> apply =null; + + //엑셀파일 가져와서 저장 및 읽기 + //변수는 멀티파트 요청 객체의 파일맵, 저장할 엑셀파일명 이름에 추가할 숫자(그냥 0으로 해도 됨) + //마찬가지로 엑셀파일 명 이름에 추가할 문자열, uplode폴더에 들어갈 폴더명(카테고리같은 파트 이름으로 해주세요) + //폴더가 없으면 자동생성되게 해뒀습니다. + //마지막으로 HttpServletRequest + apply = em.parseExcelSpringMultiPart(files, "테스트파일", 0, "", "category", request); + + for (int i = 0; i < apply.size(); i++) { + + dto.setKan_code(apply.get(i).get("cell_0")); + dto.setCls_nm_1(apply.get(i).get("cell_1")); + dto.setCls_nm_2(apply.get(i).get("cell_2")); + dto.setCls_nm_3(apply.get(i).get("cell_3")); + dto.setCls_nm_4(apply.get(i).get("cell_4")); + dto.setActivation(true); + + categoryService.createProcess(dto); + + } + + resMap.put("res", "ok"); + resMap.put("msg", "업로드 성공"); + } catch (Exception e) { + System.out.println(e.toString()); + resMap.put("res", "error"); + resMap.put("msg", "업로드 실패"); + } + + redirectAttributes.addFlashAttribute("resMap", resMap); + + return "redirect:/category/list"; + }; + + + + diff --git a/src/main/java/com/no1/wms/category/CategoryDto.java b/src/main/java/com/no1/wms/category/CategoryDto.java index dddabe6..47511b0 100644 --- a/src/main/java/com/no1/wms/category/CategoryDto.java +++ b/src/main/java/com/no1/wms/category/CategoryDto.java @@ -3,6 +3,7 @@ package com.no1.wms.category; import org.apache.ibatis.type.Alias; import lombok.AllArgsConstructor; +import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; @@ -16,5 +17,6 @@ public class CategoryDto { private String cls_nm_2; private String cls_nm_3; private String cls_nm_4; - private boolean activation; + @Builder.Default + private Boolean activation = true; } diff --git a/src/main/java/com/no1/wms/excel/EgovWebUtil.java b/src/main/java/com/no1/wms/excel/EgovWebUtil.java new file mode 100644 index 0000000..c647c1c --- /dev/null +++ b/src/main/java/com/no1/wms/excel/EgovWebUtil.java @@ -0,0 +1,17 @@ +package com.no1.wms.excel; + +//../을 통해 부모디렉토리로 이동하는 방법을 막기 위한 보안 +public class EgovWebUtil { + public static String filePathBlackList(String value) { + String returnValue = value; + if (returnValue == null || returnValue.trim().equals("")) { + return ""; + } + + returnValue = returnValue.replaceAll("\\.\\./", ""); + returnValue = returnValue.replaceAll("\\.\\.\\\\", ""); + + return returnValue; + } + +} diff --git a/src/main/java/com/no1/wms/excel/ExcelUtils.java b/src/main/java/com/no1/wms/excel/ExcelDownlodeUtils.java similarity index 54% rename from src/main/java/com/no1/wms/excel/ExcelUtils.java rename to src/main/java/com/no1/wms/excel/ExcelDownlodeUtils.java index 32e5af0..0bd2d6d 100644 --- a/src/main/java/com/no1/wms/excel/ExcelUtils.java +++ b/src/main/java/com/no1/wms/excel/ExcelDownlodeUtils.java @@ -1,16 +1,21 @@ package com.no1.wms.excel; +import java.io.BufferedInputStream; +import java.io.File; +import java.io.FileInputStream; import java.io.IOException; +import java.io.OutputStream; import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; import java.util.List; import javax.servlet.http.HttpServletResponse; -import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.springframework.stereotype.Service; import com.no1.wms.category.CategoryDto; @@ -19,8 +24,12 @@ import com.no1.wms.category.CategoryDto; @Service -public class ExcelUtils { +public class ExcelDownlodeUtils { + + + + //마지막 List dto 이부분을 수정해서 만들어야함. public void downloadCategoryExcelFile(String excelFileName, HttpServletResponse response, String sheetName, String[] columnName, List dto) { String fileName = ""; @@ -32,7 +41,7 @@ public class ExcelUtils { response.setContentType("ms-vnd/excel"); response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\";"); - Workbook workbook = new HSSFWorkbook(); + Workbook workbook = new XSSFWorkbook(); Sheet sheet = workbook.createSheet(sheetName); Row row = null; @@ -45,6 +54,7 @@ public class ExcelUtils { cell.setCellValue(columnName[i]); } rowNum += 1; + //수정부분 makeCategoryBody(dto,row,sheet,cell,rowNum); @@ -77,5 +87,43 @@ public class ExcelUtils { } } + //엑셀 폼 파일 다운로드 + //엑셀 폼은 직접 만들어서 src/main/webapp/excelfiles/excelform 이 경로의 폴더안에 넣으면 됩니다. + //확장자는 .xlsx로 해주세요. + //매개변수는 HttpServletResponse response와 파일명 String을 넣으면 되고 파일명은 한글도 가능합니다. + public void downlodeExcelForm(HttpServletResponse response, String formName) throws IOException { + String excelfilesDirectory = "src/main/webapp/excelfiles/excelform/"; + + + File file = new File(excelfilesDirectory+formName); + + try( FileInputStream fis = new FileInputStream(file); + BufferedInputStream bis = new BufferedInputStream(fis); + OutputStream out = response.getOutputStream()){ + String encodedFilename = URLEncoder.encode(formName, "UTF-8").replaceAll("\\+", "%20"); + + response.addHeader("Content-Disposition", "attachment;filename=\""+encodedFilename+"\""); + response.setContentType("application/vnd.ms-excel"); + // 응답 크기 명시 + response.setContentLength((int)file.length()); + int read = 0; + while((read = bis.read()) != -1) { + out.write(read); + } + + + }catch(IOException e) { + e.printStackTrace(); + } + + + } + + + + + + + } diff --git a/src/main/java/com/no1/wms/excel/ExcelManagerXlsx.java b/src/main/java/com/no1/wms/excel/ExcelManagerXlsx.java new file mode 100644 index 0000000..53d08e8 --- /dev/null +++ b/src/main/java/com/no1/wms/excel/ExcelManagerXlsx.java @@ -0,0 +1,110 @@ +package com.no1.wms.excel; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; + +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.CellType; +import org.apache.poi.ss.usermodel.DateUtil; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; + +public class ExcelManagerXlsx { + + private static ExcelManagerXlsx excelXlsxMng; + + public ExcelManagerXlsx() { + } + + public static ExcelManagerXlsx getInstance() { + if (excelXlsxMng == null) { + excelXlsxMng = new ExcelManagerXlsx(); + } + return excelXlsxMng; + } + + public List> getListXlsxRead(String excel) throws Exception { + + List> list = new ArrayList>(); + File file = new File( excel ); + if( !file.exists() || !file.isFile() || !file.canRead() ) { + throw new IOException( excel ); + } + XSSFWorkbook wb = new XSSFWorkbook( new FileInputStream(file) ); + + //xls시 이용 + //HSSFWorkbook wb = new HSSFWorkbook ( new FileInputStream(file) ); + + int sheetIndex = 0; + + try { + // 모든 시트 순회 + for( int i=0; i<1; i++ ) { + XSSFSheet sheet = wb.getSheetAt(sheetIndex); + for( Row row : sheet ) { + // 첫 번째 시트만 사용 + if(row.getRowNum() == 0) { + continue; + } + + HashMap hMap = new HashMap(); + String valueStr = ""; + + int cellLength = (int) row.getLastCellNum();/// + + for (int j = 0; j < row.getLastCellNum(); j++) { + Cell cell = row.getCell(j); + + if (cell == null || cell.getCellType() == CellType.BLANK) { + valueStr = ""; + }else{ + switch(cell.getCellType()){ + case STRING : + valueStr = cell.getStringCellValue(); + break; + case NUMERIC : // 날짜 형식이든 숫자 형식이든 다 CELL_TYPE_NUMERIC으로 인식함. + if(DateUtil.isCellDateFormatted(cell)){ // 날짜 유형의 데이터일 경우, + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.KOREA); + String formattedStr = dateFormat.format(cell.getDateCellValue()); + valueStr = formattedStr; + break; + }else{ //숫자 데이터일 경우, + Double numericCellValue = cell.getNumericCellValue(); + if(Math.floor(numericCellValue) == numericCellValue){ // 소수점 이하를 버린 값이 원래의 값과 같다면,, + valueStr = numericCellValue.intValue() + ""; // int형으로 소수점 이하 버리고 String으로 데이터 담는다. + }else{ + valueStr = numericCellValue + ""; + } + break; + } + case BOOLEAN : + valueStr = cell.getBooleanCellValue() + ""; + break; + } + + } + // 엑셀의 열 인덱스와 함께 값 매핑 + hMap.put("cell_"+j ,valueStr); + + } + // 결과 리스트에 추가 + list.add(hMap); + } + sheetIndex++; + } + + }catch(Exception ex){ + ex.printStackTrace(); + } + + return list; + } + +} diff --git a/src/main/java/com/no1/wms/excel/ExcelRequestManager.java b/src/main/java/com/no1/wms/excel/ExcelRequestManager.java new file mode 100644 index 0000000..fa8cf26 --- /dev/null +++ b/src/main/java/com/no1/wms/excel/ExcelRequestManager.java @@ -0,0 +1,86 @@ +package com.no1.wms.excel; + +import java.io.File; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import javax.servlet.http.HttpServletRequest; + +import org.springframework.web.multipart.MultipartFile; + +public class ExcelRequestManager { + + public List> parseExcelSpringMultiPart + (Map files , String KeyStr, int fileKeyParam,String atchFileId ,String storePath,HttpServletRequest request) throws Exception{ + List> list = null; + int fileKey = fileKeyParam; + + String storePathString = ""; + String atchFileIdString = ""; + + String folder = request.getServletContext().getRealPath("/"); + + if ("".equals(storePath) || storePath == null) { + storePathString = folder+"/excelfiles/upload/"; + } else { + storePathString = folder+"/excelfiles/upload/"+storePath; + } + + if (!"".equals(atchFileId) || atchFileId != null) { + atchFileIdString = atchFileId; + } + + File saveFolder = new File(EgovWebUtil.filePathBlackList(storePathString)); + + //폴더 없으면 생성 + if (!saveFolder.exists() || saveFolder.isFile()) { + saveFolder.mkdirs(); + } + + Iterator> itr = files.entrySet().iterator(); + MultipartFile file; + String filePath = ""; + + while (itr.hasNext()) { + //파일 이름을 가져오는데 파일이 여러개일 경우 + Entry entry = itr.next(); + + file = entry.getValue(); + String orginFileName = file.getOriginalFilename(); + + if ("".equals(orginFileName)) { + continue; + } + + //파일의 확장자 + int index = orginFileName.lastIndexOf("."); + String fileExt = orginFileName.substring(index + 1); + //파일의 이름 정하기 지정한 KeyStr값과 시간 값과 fileKey를 넣어서 만듬 + String newName = KeyStr + getTimeStamp() + fileKey; + + if (!"".equals(orginFileName)) { + filePath = storePathString + File.separator + newName+"."+fileExt; + file.transferTo(new File(EgovWebUtil.filePathBlackList(filePath))); + } + list = ExcelManagerXlsx.getInstance().getListXlsxRead(filePath); + + fileKey++; + } + return list; + } + + private static String getTimeStamp() { + long currentTimeMillis = System.currentTimeMillis(); + Date currentDate = new Date(currentTimeMillis); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd_HHmmss"); + String formattedTimeStamp = dateFormat.format(currentDate); + return formattedTimeStamp; + } + + +} diff --git a/src/main/webapp/WEB-INF/views/category/list.jsp b/src/main/webapp/WEB-INF/views/category/list.jsp index 7e1b41c..e65beb7 100644 --- a/src/main/webapp/WEB-INF/views/category/list.jsp +++ b/src/main/webapp/WEB-INF/views/category/list.jsp @@ -69,7 +69,9 @@
- + + +
+
+
+
+ + + + + + + + +
+ +
+
+
+
+ +
+
+
+
@@ -113,6 +137,16 @@ document.body.appendChild(form); form.submit(); }); + + $("#downlodeExcelForm").on("click",function(){ + var form = document.createElement("form"); + form.action = "/category/downlodeCategoryForm"; + form.method = "GET"; + document.body.appendChild(form); + form.submit(); + }); + + $("body").on("click", ".detailTr", function(){ var kan_code = $(this).data("kan_code"); @@ -166,8 +200,13 @@ }); - + + var msg = "${resMap.msg}"; + if (msg != "") alert(msg); + });//ready + + function pagingFunction(clickedId){ var searchn1 = $("#searchn1").val(); var search1 = $("#search1").val(); @@ -196,7 +235,27 @@ document.body.appendChild(form); form.submit(); - } + + }//pagingFunction + + + function _onSubmit(){ + + if($("#file").val() == ""){ + alert("파일을 업로드해주세요."); + $("#file").focus(); + return false; + } + + + + return true; + } + + + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/category/test.jsp b/src/main/webapp/WEB-INF/views/category/test.jsp index 8a91481..3e72406 100644 --- a/src/main/webapp/WEB-INF/views/category/test.jsp +++ b/src/main/webapp/WEB-INF/views/category/test.jsp @@ -5,77 +5,54 @@ test상세페이지 - + - - test success -
-
- -${item.kan_code} : ${item.cls_nm_1} > ${item.cls_nm_2} > ${item.cls_nm_3} > ${item.cls_nm_4}
-활성화 : ${item.activation}
-
-
- 코드테스트 버튼 : -
- - -
- - +
+
+
+ + + + + + + + +
+ +
+
+
+
+ +
+
+
+
+ + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/main.jsp b/src/main/webapp/WEB-INF/views/main.jsp new file mode 100644 index 0000000..e39f901 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/main.jsp @@ -0,0 +1,32 @@ +<%@ page contentType="text/html; charset=UTF-8"%> + + + + +Insert title here + + +
+
+
+ + 달력 +
+
+ + 로고 +
+
+
+
+ + 부족한 재고 +
+
+ + 개시판(공지사항) +
+
+
+ + \ No newline at end of file diff --git a/src/main/webapp/excelfiles/excelform/카테고리 데이터 입력 서식.xlsx b/src/main/webapp/excelfiles/excelform/카테고리 데이터 입력 서식.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..6a42a08056ae7059847bffb1b8fed3536fd63188 GIT binary patch literal 7485 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 MzwZ}S^1nX)4|x9OZ~y=R literal 0 HcmV?d00001 From 056e39dedcd8b83cfc08fbe836e6c9b858a85955 Mon Sep 17 00:00:00 2001 From: sungsu Date: Mon, 15 Jan 2024 23:50:25 +0900 Subject: [PATCH 2/6] #update /stock/create.jsp /warehouse/create.jsp /stock/list.jsp /warehouse/list.jsp /warehouse/read.jsp StockController.java StockDto.java StockMapper.xml StockMapper.java StockService.java VendorDto.java WarehouseMapper.xml WarehouseController.java #insert /vendor/create.jsp /vendor/list.jsp product_category_company_search.jsp /stock/read.jsp /vendor/read.jsp /stock/update.jsp /vendor/update.jsp VendorController.java VendorMapper.java VendorMapper.xml VendorService.java warehouse_capacity_currentCapacity.jsp --- .../com/no1/wms/stock/StockController.java | 184 +++++-- src/main/java/com/no1/wms/stock/StockDto.java | 14 +- .../java/com/no1/wms/stock/StockMapper.java | 32 +- .../java/com/no1/wms/stock/StockService.java | 106 ++++- .../com/no1/wms/vendor/VendorController.java | 124 +++++ .../java/com/no1/wms/vendor/VendorDto.java | 18 +- .../java/com/no1/wms/vendor/VendorMapper.java | 26 + .../com/no1/wms/vendor/VendorService.java | 57 +++ .../wms/warehouse/WarehouseController.java | 25 +- src/main/resources/mappers/StockMapper.xml | 231 +++++++-- src/main/resources/mappers/VendorMapper.xml | 106 +++++ .../resources/mappers/WarehouseMapper.xml | 30 +- .../modal/product_category_company_search.jsp | 157 ++++++ .../warehouse_capacity_currentCapacity.jsp | 163 +++++++ .../webapp/WEB-INF/views/stock/create.jsp | 224 ++++++--- src/main/webapp/WEB-INF/views/stock/list.jsp | 449 ++++++++++++++---- src/main/webapp/WEB-INF/views/stock/read.jsp | 190 ++++++++ .../webapp/WEB-INF/views/stock/update.jsp | 200 ++++++++ .../webapp/WEB-INF/views/vendor/create.jsp | 253 ++++++++++ src/main/webapp/WEB-INF/views/vendor/list.jsp | 203 ++++++++ src/main/webapp/WEB-INF/views/vendor/read.jsp | 181 +++++++ .../webapp/WEB-INF/views/vendor/update.jsp | 263 ++++++++++ .../webapp/WEB-INF/views/warehouse/create.jsp | 55 ++- .../webapp/WEB-INF/views/warehouse/list.jsp | 29 +- .../webapp/WEB-INF/views/warehouse/read.jsp | 6 +- 25 files changed, 3012 insertions(+), 314 deletions(-) create mode 100644 src/main/java/com/no1/wms/vendor/VendorController.java create mode 100644 src/main/java/com/no1/wms/vendor/VendorMapper.java create mode 100644 src/main/java/com/no1/wms/vendor/VendorService.java create mode 100644 src/main/resources/mappers/VendorMapper.xml create mode 100644 src/main/webapp/WEB-INF/views/modal/product_category_company_search.jsp create mode 100644 src/main/webapp/WEB-INF/views/modal/warehouse_capacity_currentCapacity.jsp create mode 100644 src/main/webapp/WEB-INF/views/stock/read.jsp create mode 100644 src/main/webapp/WEB-INF/views/stock/update.jsp create mode 100644 src/main/webapp/WEB-INF/views/vendor/create.jsp create mode 100644 src/main/webapp/WEB-INF/views/vendor/list.jsp create mode 100644 src/main/webapp/WEB-INF/views/vendor/read.jsp create mode 100644 src/main/webapp/WEB-INF/views/vendor/update.jsp diff --git a/src/main/java/com/no1/wms/stock/StockController.java b/src/main/java/com/no1/wms/stock/StockController.java index c78764c..09eeaee 100644 --- a/src/main/java/com/no1/wms/stock/StockController.java +++ b/src/main/java/com/no1/wms/stock/StockController.java @@ -1,101 +1,223 @@ package com.no1.wms.stock; + +import com.no1.wms.vendor.VendorDto; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.ModelAndView; import java.util.List; +import java.util.Map; @Controller @Slf4j +@RequestMapping("/stock") public class StockController { @Autowired StockService service; - // 재고 리스트 출력 - @GetMapping("stock/list") + // 탭 1 재고 리스트 출력 + @GetMapping("/list") public String list(@RequestParam(name = "searchn", defaultValue = "0") int searchn, @RequestParam(name = "search", defaultValue = "") String search, @RequestParam(name = "p", defaultValue = "1") int page, Model m) { int count = service.count(searchn, search); - + int perPage = 10; // 한 페이지에 보일 글의 갯수 int startRow = (page - 1) * perPage; - + //스톡서비스로 재고 리스트 출력 메서트 작성 - List dto = service.list(searchn, search, perPage); - m.addAttribute("list", dto); - - int pageNum = 4;//보여질 페이지 번호 수 + List> dto = service.list(searchn, search, startRow ,perPage); + m.addAttribute("slist", dto); + + m.addAttribute("start", startRow + 1); + + int pageNum = 5;//보여질 페이지 번호 수 int totalPages = count / perPage + (count % perPage > 0 ? 1 : 0); // 전체 페이지 수 - + int begin = (page - 1) / pageNum * pageNum + 1; int end = begin + pageNum - 1; if (end > totalPages) { end = totalPages; } + m.addAttribute("searchn", searchn); + m.addAttribute("search", search); m.addAttribute("begin", begin); m.addAttribute("end", end); m.addAttribute("pageNum", pageNum); m.addAttribute("totalPages", totalPages); + m.addAttribute("p" , page); + + + return "stock/list"; + } + + + // 탭 2 재고 리스트 출력 + @GetMapping("/list2") + public String list2(@RequestParam(name = "searchn", defaultValue = "0") int searchn, + @RequestParam(name = "search", defaultValue = "") String search, + @RequestParam(name = "p2", defaultValue = "1") int page, Model m) { + int count = service.count(searchn, search); + + int perPage = 10; // 한 페이지에 보일 글의 갯수 + int startRow = (page - 1) * perPage; + + //스톡서비스로 재고 리스트 출력 메서트 작성 + List> dto = service.list(searchn, search, startRow ,perPage); + m.addAttribute("slist2", dto); + + m.addAttribute("start2", startRow + 1); + + int pageNum = 5;//보여질 페이지 번호 수 + int totalPages = count / perPage + (count % perPage > 0 ? 1 : 0); // 전체 페이지 수 + + int begin = (page - 1) / pageNum * pageNum + 1; + int end = begin + pageNum - 1; + if (end > totalPages) { + end = totalPages; + } + m.addAttribute("searchn2", searchn); + m.addAttribute("search2", search); + m.addAttribute("begin2", begin); + m.addAttribute("end2", end); + m.addAttribute("pageNum2", pageNum); + m.addAttribute("totalPages2", totalPages); + m.addAttribute("p2" , page); + + + return "stock/list"; } // 재고 상세페이지 - @PostMapping("stock/read/{id}") - public String read(@PathVariable String id, Model m) { + @PostMapping("/read") + public String read(@RequestParam String id, Model m) { //스톡서비스로 재고 상세페이지 출력 메서드 작성 - StockDto dto = service.stockOne(id); + Map dto = service.stockOne(id); m.addAttribute("dto", dto); - return "stock/read/"; + return "stock/read"; } // 수정 - 폼 - @GetMapping("/stock/update/{id}") - public String update(@PathVariable String id, Model m) { - StockDto dto = service.stockOne(id); + @PostMapping("/update") + public String update(String id, Model m) { + Map dto = service.stockOne(id); m.addAttribute("dto", dto); return "stock/update"; } // 수정 프로세스 - @PutMapping("/board/update_process") + @PutMapping("/update_process") @ResponseBody - public String updateProcess(StockDto dto) { - service.updateStock(dto); - return "redirect:list"; + public boolean updateProcess(StockDto dto) { + + int i = service.updateStock(dto); + if (i == 1) { + service.updateWarehouse(dto); + return true; + } else { + return false; + } } + // 생성 폼 - @GetMapping ("/stock/create") - public String create() - { + @PostMapping("/create") + public String create() { return "stock/create"; } - // 생성 프로세스 - @PostMapping("/stock/create_process") + // 생성 - Ajax + @PostMapping("/create_process") @ResponseBody - public String createProcess(StockDto dto) { - service.createStock(dto); - return "redirect:list";// 글목록 + public boolean createProcess(StockDto dto) { + int i = service.createStock(dto); + if (i != 0) { + service.updateWarehousePlus(dto); + return true; + } else { + return false; + } } // 삭제 - @DeleteMapping("/stock/delete") + @DeleteMapping("/delete") @ResponseBody - public int delete(String id) { - int i = service.deleteBoard(id); + public int delete(StockDto dto) { + System.out.println("데이터 :: " + dto); + int i = service.deleteStock(dto); + service.updateWarehouseDeleteStock(dto); return i; } + + + + @PostMapping("/show_modal") + public ModelAndView showModal(@RequestParam(name = "searchn", defaultValue = "0") int searchn, + @RequestParam(name = "search", defaultValue = "") String search, + @RequestParam(name = "p", defaultValue = "1") int page, + @RequestParam String name, ModelAndView mav){ + + int perPage = 5; // 한 페이지에 보일 글의 갯수 + int startRow = (page - 1) * perPage; + + List> list = null; + int count = 0; + + //테스트 + System.out.println("name : " + name); + System.out.println("list : " + list); + System.out.println("count : " + count); + System.out.println("mav : " + mav); + //테스트 + + // 모달 선택 + if(name.equals("product_category_company_search")){ + list = service.productSelect(searchn, search, startRow, perPage); + count = service.productCount(searchn, search); + }else if(name.equals("warehouse_capacity_currentCapacity")) { + list = service.warehousesSelect(searchn, search, startRow, perPage); + count = service.warehouseCount(searchn, search); + } + + mav.addObject("list", list); + + mav.addObject("start", startRow + 1); + + int pageNum = 5;//보여질 페이지 번호 수 + int totalPages = count / perPage + (count % perPage > 0 ? 1 : 0); // 전체 페이지 수 + + int begin = (page - 1) / pageNum * pageNum + 1; + int end = begin + pageNum - 1; + if (end > totalPages) { + end = totalPages; + } + mav.addObject("begin", begin); + mav.addObject("end", end); + mav.addObject("pageNum", pageNum); + mav.addObject("totalPages", totalPages); + mav.addObject("p" , page); + + mav.setViewName(name); + + //테스트 + System.out.println("name : " + name); + System.out.println("list : " + list); + System.out.println("count : " + count); + System.out.println("mav : " + mav); + //테스트 + return mav; + } } diff --git a/src/main/java/com/no1/wms/stock/StockDto.java b/src/main/java/com/no1/wms/stock/StockDto.java index 7fb44bf..a7a7682 100644 --- a/src/main/java/com/no1/wms/stock/StockDto.java +++ b/src/main/java/com/no1/wms/stock/StockDto.java @@ -1,13 +1,23 @@ package com.no1.wms.stock; +import com.no1.wms.product.ProductDto; +import com.no1.wms.warehouse.WarehouseDto; +import lombok.AllArgsConstructor; import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; @Data +@NoArgsConstructor +@AllArgsConstructor public class StockDto { private String id; - private int warehouseId; - private int productId; + private String warehouseId; + private String productId; private int quantity; private boolean activation; + + private int quantityAdjustment; } diff --git a/src/main/java/com/no1/wms/stock/StockMapper.java b/src/main/java/com/no1/wms/stock/StockMapper.java index 99238b5..79d8476 100644 --- a/src/main/java/com/no1/wms/stock/StockMapper.java +++ b/src/main/java/com/no1/wms/stock/StockMapper.java @@ -10,17 +10,37 @@ import java.util.Map; public interface StockMapper { int count(Map m);//검색 글 갯수 - - List list(Map m); -// List list(Map m); + + List> list(Map m); + + + int count2(Map m);//검색 글 갯수 + + List> list2(Map m); + int updateStock(StockDto dto); + + int updateWarehouse(StockDto dto); + + int updateWarehousePlus(StockDto dto); + + int updateWarehouseDeleteStock(StockDto dto); int createStock(StockDto dto); - - StockDto stockOne(String id); - int deleteStock(String id); + Map stockOne(String id); + + int deleteStock(StockDto dto); + + List> productSelect(Map m); + + int productCount(Map m);//검색 글 갯수 + + List> warehouseSelect(Map m); + + int warehouseCount(Map m);//검색 글 갯수 + diff --git a/src/main/java/com/no1/wms/stock/StockService.java b/src/main/java/com/no1/wms/stock/StockService.java index 44f617e..03ef0ed 100644 --- a/src/main/java/com/no1/wms/stock/StockService.java +++ b/src/main/java/com/no1/wms/stock/StockService.java @@ -1,5 +1,6 @@ package com.no1.wms.stock; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -8,6 +9,7 @@ import java.util.List; import java.util.Map; @Service +@Slf4j public class StockService { @Autowired StockMapper mapper; @@ -19,13 +21,11 @@ public class StockService { Map m = new HashMap(); m.put("searchn",searchn); m.put("search", search); - m.put("start", 0); - m.put("perPage", 10000); return mapper.count(m); } - public List list(int searchn, String search, int start){ + public List> list(int searchn, String search, int start, int perPage){ System.out.println(searchn+search); @@ -33,14 +33,43 @@ public class StockService { m.put("searchn",searchn); m.put("search", search); m.put("start", start); - m.put("perPage", 10); + m.put("perPage", perPage); - return mapper.list(m); + List> result = mapper.list(m); + log.debug("warehouseOne테스트 :: " + result); + return result; } + + public int count2(int searchn, String search) { + + System.out.println(searchn+search); + + Map m = new HashMap(); + m.put("searchn",searchn); + m.put("search", search); + return mapper.count2(m); + } + + + public List> list2(int searchn, String search, int start, int perPage){ + + System.out.println(searchn+search); + + Map m = new HashMap(); + m.put("searchn",searchn); + m.put("search", search); + m.put("start", start); + m.put("perPage", perPage); + + List> result = mapper.list2(m); + log.debug("warehouseOne테스트 :: " + result); + return result; + + } + - - public StockDto stockOne(String id) { + public Map stockOne(String id) { return mapper.stockOne(id); } @@ -54,8 +83,65 @@ public class StockService { return mapper.updateStock(dto); } - - public int deleteBoard(String id) { - return mapper.deleteStock(id); + public int updateWarehouse(StockDto dto){ + return mapper.updateWarehouse(dto); } + + public int updateWarehousePlus(StockDto dto){ + return mapper.updateWarehousePlus(dto); + } + + public int updateWarehouseDeleteStock(StockDto dto){ + return mapper.updateWarehouseDeleteStock(dto); + } + + public int deleteStock(StockDto dto) { + return mapper.deleteStock(dto); + } + + + public List> productSelect(int searchn, String search, int start, int perPage){ + Map m = new HashMap(); + m.put("searchn", searchn); + m.put("search", search); + m.put("start", start); + m.put("perPage", perPage); + + List> productresult = mapper.productSelect(m); + + return productresult; + } + + public int productCount(int searchn, String search) { + + + Map m = new HashMap(); + m.put("searchn",searchn); + m.put("search", search); + return mapper.productCount(m); + } + + public List> warehousesSelect(int searchn, String search, int start, int perPage){ + Map m = new HashMap(); + m.put("searchn", searchn); + m.put("search", search); + m.put("start", start); + m.put("perPage", perPage); + + List> warehouseresult = mapper.warehouseSelect(m); + + return warehouseresult; + } + + public int warehouseCount(int searchn, String search) { + + + Map m = new HashMap(); + m.put("searchn",searchn); + m.put("search", search); + return mapper.warehouseCount(m); + } + + } + diff --git a/src/main/java/com/no1/wms/vendor/VendorController.java b/src/main/java/com/no1/wms/vendor/VendorController.java new file mode 100644 index 0000000..39d21ec --- /dev/null +++ b/src/main/java/com/no1/wms/vendor/VendorController.java @@ -0,0 +1,124 @@ +package com.no1.wms.vendor; + +import com.no1.wms.warehouse.WarehouseDto; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.Map; + +@Controller +@Slf4j +public class VendorController { + + @Autowired + VendorService service; + + // 재고 리스트 출력 + @GetMapping("vendor/list") + public String list(@RequestParam(name = "searchn", defaultValue = "0") int searchn, + @RequestParam(name = "search", defaultValue = "") String search, + @RequestParam(name = "p", defaultValue = "1") int page, Model m) { + + int count = service.count(searchn, search); + + int perPage = 10; // 한 페이지에 보일 글의 갯수 + int startRow = (page - 1) * perPage; + + //스톡서비스로 재고 리스트 출력 메서트 작성 + List dto = service.list(searchn, search, startRow ,perPage); + + + m.addAttribute("vlist", dto); + m.addAttribute("start", startRow + 1); + + int pageNum = 5;//보여질 페이지 번호 수 + int totalPages = count / perPage + (count % perPage > 0 ? 1 : 0); // 전체 페이지 수 + + int begin = (page - 1) / pageNum * pageNum + 1; + int end = begin + pageNum - 1; + if (end > totalPages) { + end = totalPages; + } + m.addAttribute("searchn", searchn); + m.addAttribute("search", search); + m.addAttribute("begin", begin); + m.addAttribute("end", end); + m.addAttribute("pageNum", pageNum); + m.addAttribute("totalPages", totalPages); + m.addAttribute("p" , page); + + return "vendor/list"; + } + + + // 재고 상세페이지 + @PostMapping("vendor/read") + public String read(String id, Model m) { + //스톡서비스로 재고 상세페이지 출력 메서드 작성 + + VendorDto One = service.vendorOne(id); + System.out.println("one :: " + One); + log.debug("One테스트 :: " + One); + + m.addAttribute("One", One); + + return "vendor/read"; + } + + + // 수정 - 폼 + @PostMapping("/vendor/update") + public String update(String id, Model m) { + VendorDto dto = service.vendorOne(id); + m.addAttribute("dto", dto); + return "vendor/update"; + } + + + // 수정 프로세스 + @PutMapping("/vendor/update_process") + @ResponseBody + public boolean updateProcess(VendorDto dto) { + + int i = service.updateVendor(dto); + if (i == 1) { + return true; + } else { + return false; + } + } + + + // 생성 폼 + @PostMapping("/vendor/create") + public String create() + { + return "vendor/create"; + } + + + // 생성 프로세스 + @PostMapping("/vendor/create_process") + @ResponseBody + public boolean createProcess(VendorDto dto) { + int i = service.createVendor(dto); + if (i == 1) { + return true; + } else { + return false; + } + } + + + // 삭제 + @DeleteMapping("/vendor/delete") + @ResponseBody + public int delete(String id) { + int i = service.deleteVendor(id); + return i; + } +} diff --git a/src/main/java/com/no1/wms/vendor/VendorDto.java b/src/main/java/com/no1/wms/vendor/VendorDto.java index 06935a0..a32f249 100644 --- a/src/main/java/com/no1/wms/vendor/VendorDto.java +++ b/src/main/java/com/no1/wms/vendor/VendorDto.java @@ -8,20 +8,20 @@ import lombok.NoArgsConstructor; @Data @AllArgsConstructor -@NoArgsConstructor + @Alias("VendorDto") public class VendorDto { private String id; private String name; - private String president_name; + private String presidentName; private String address; - private String registration_number; + private String registrationNumber; private String email; - private String president_telephone; - private String vendor_manager; - private String vendor_manager_telephone; - private String main_product; - private String manager_id; - private boolean activation; + private String presidentTelephone; + private String vendorManager; + private String vendorManagerTelephone; + private String mainProduct; + private String managerId; + private boolean activation; } diff --git a/src/main/java/com/no1/wms/vendor/VendorMapper.java b/src/main/java/com/no1/wms/vendor/VendorMapper.java new file mode 100644 index 0000000..f8b0a86 --- /dev/null +++ b/src/main/java/com/no1/wms/vendor/VendorMapper.java @@ -0,0 +1,26 @@ +package com.no1.wms.vendor; + +import com.no1.wms.warehouse.WarehouseDto; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; +import java.util.Map; + + +@Mapper +public interface VendorMapper { + + List list(Map m); + + int count(Map m);//검색 글 갯수 + + VendorDto vendorOne(String id); + + int updateVendor(VendorDto dto); + + int createVendor(VendorDto dto); + + int deleteVendor(String id); + + +} diff --git a/src/main/java/com/no1/wms/vendor/VendorService.java b/src/main/java/com/no1/wms/vendor/VendorService.java new file mode 100644 index 0000000..f0793c5 --- /dev/null +++ b/src/main/java/com/no1/wms/vendor/VendorService.java @@ -0,0 +1,57 @@ +package com.no1.wms.vendor; + +import com.no1.wms.warehouse.WarehouseDto; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Service +@Slf4j +public class VendorService { + @Autowired + VendorMapper mapper; + + public int count(int searchn, String search) { + + Map m = new HashMap(); + m.put("searchn", searchn); + m.put("search", search); + return mapper.count(m); + } + + + public List list(int searchn, String search, int start, int perPage) { + + System.out.println(searchn + search); + + Map m = new HashMap(); + m.put("searchn", searchn); + m.put("search", search); + m.put("start", start); + m.put("perPage", perPage); + + return mapper.list(m); + } + + public VendorDto vendorOne(String id) { + return mapper.vendorOne(id); + } + + public int updateVendor(VendorDto dto) { + return mapper.updateVendor(dto); + } + + + public int createVendor(VendorDto dto) { + return mapper.createVendor(dto); + } + + + public int deleteVendor(String id) { + return mapper.deleteVendor(id); + } +} diff --git a/src/main/java/com/no1/wms/warehouse/WarehouseController.java b/src/main/java/com/no1/wms/warehouse/WarehouseController.java index c5edbab..84e25fd 100644 --- a/src/main/java/com/no1/wms/warehouse/WarehouseController.java +++ b/src/main/java/com/no1/wms/warehouse/WarehouseController.java @@ -33,6 +33,10 @@ public class WarehouseController { m.addAttribute("wlist", dto); m.addAttribute("start", startRow + 1); + + //테스트 + System.out.println("list" + dto); + //테스트 int pageNum = 5;//보여질 페이지 번호 수 int totalPages = count / perPage + (count % perPage > 0 ? 1 : 0); // 전체 페이지 수 @@ -42,6 +46,8 @@ public class WarehouseController { if (end > totalPages) { end = totalPages; } + m.addAttribute("searchn", searchn); + m.addAttribute("search", search); m.addAttribute("begin", begin); m.addAttribute("end", end); m.addAttribute("pageNum", pageNum); @@ -60,19 +66,16 @@ public class WarehouseController { //스톡서비스로 재고 상세페이지 출력 메서드 작성 WarehouseDto One = service.One(id); - System.out.println("one :: " + One); - log.debug("Osne테스트 :: " + One); - m.addAttribute("One", One); - int warehouseOneCount = service.warehouseOneCount(searchn, search, id); - log.debug("warehouseOneCount테스트 :: " + warehouseOneCount); + int perPage = 5; // 한 페이지에 보일 글의 갯수 int startRow = (page - 1) * perPage; m.addAttribute("start", startRow + 1); + int warehouseOneCount = service.warehouseOneCount(searchn, search, id); List> dto = service.warehouseOne(searchn, search, id, startRow, perPage); m.addAttribute("wlist", dto); System.out.println("list ::" + dto); @@ -86,6 +89,8 @@ public class WarehouseController { if (end > totalPages) { end = totalPages; } + m.addAttribute("searchn", searchn); + m.addAttribute("search", search); m.addAttribute("begin", begin); m.addAttribute("end", end); m.addAttribute("pageNum", pageNum); @@ -130,9 +135,13 @@ public class WarehouseController { // 생성 프로세스 @PostMapping("/warehouse/create_process") @ResponseBody - public String createProcess(WarehouseDto dto) { - service.createWarehouse(dto); - return "redirect:list";// 글목록 + public boolean createProcess(WarehouseDto dto) { + int i = service.createWarehouse(dto); + if (i == 1) { + return true; + } else { + return false; + } } diff --git a/src/main/resources/mappers/StockMapper.xml b/src/main/resources/mappers/StockMapper.xml index e27c9e1..dc43d41 100644 --- a/src/main/resources/mappers/StockMapper.xml +++ b/src/main/resources/mappers/StockMapper.xml @@ -3,55 +3,188 @@ - - - - - - - - - - - - update stock - set quantity = #{dto.quantity} - where id = #{dto.id} - - - - - - - insert into stock (id, warehouse_id, product_id, quantity, activation) - values (#{dto.id}, #{dto.warehouse_id}, #{dto.product_id}, #{dto.quantity}, 1) - - + + + + + + + + + + + + + + + + + + + + + + + + update stock + set warehouse_id = #{warehouseId}, quantity = #{quantityAdjustment} + where id = #{id} + + + + update warehouse w + left join stock s on w.id = s.warehouse_id + set w.current_capacity = w.current_capacity + #{quantity} + where w.id = #{warehouseId}; + + + + update warehouse w + left join stock s on w.id = s.warehouse_id + set w.current_capacity = w.current_capacity + (#{quantityAdjustment} - #{quantity}) + where w.id = #{warehouseId}; + + + + update warehouse + set current_capacity = current_capacity - #{quantity} + where id = #{warehouseId}; + + + + + + + insert into stock (id, warehouse_id, product_id, quantity, activation) + values (UUID(), #{warehouseId}, #{productId}, #{quantity}, #{activation}) + + + + + + delete + from stock + where id = #{id} + + \ No newline at end of file diff --git a/src/main/resources/mappers/VendorMapper.xml b/src/main/resources/mappers/VendorMapper.xml new file mode 100644 index 0000000..3e3f8b4 --- /dev/null +++ b/src/main/resources/mappers/VendorMapper.xml @@ -0,0 +1,106 @@ + + + + + + + + + + + + + + + + + + + + update vendor + set name = #{name}, + president_name = #{presidentName}, + address = #{address}, + registration_number = #{registrationNumber}, + email = #{email}, + president_telephone = #{presidentTelephone}, + vendor_manager = #{vendorManager}, + vendor_manager_telephone = #{vendorManagerTelephone}, + main_product = #{mainProduct}, + manager_id = #{managerId}, + activation = #{activation} + where id = #{id} + + + + + + + insert into vendor (id, name, president_name, address, registration_number, email, president_telephone, vendor_manager, vendor_manager_telephone, main_product, manager_id, activation) + values (UUID(), #{name}, #{presidentName}, #{address}, #{registrationNumber}, #{email}, #{presidentTelephone}, #{vendorManager}, #{vendorManagerTelephone}, #{mainProduct}, #{managerId}, #{activation}) + + + + + + delete from vendor where id = #{id} + + + \ No newline at end of file diff --git a/src/main/resources/mappers/WarehouseMapper.xml b/src/main/resources/mappers/WarehouseMapper.xml index 3988987..5d997a5 100644 --- a/src/main/resources/mappers/WarehouseMapper.xml +++ b/src/main/resources/mappers/WarehouseMapper.xml @@ -31,7 +31,15 @@ w.activation = 1 and w.current_capacity like concat('%',#{search},'%') - order by w.id desc limit #{start}, #{perPage} + order by w.name ASC limit #{start}, #{perPage} + + + - @@ -84,13 +85,14 @@ set capacity = #{capacity}, name = #{name}, address = #{address} where id = #{id} + - insert into warehouse (id, name, capacity, current_capacity as currentCapacity, manager_id as managerId, address, activation) - values (UUID(), #{dto.name}, #{dto.capacity}, 0, #{dto.managerId}, #{dto.address}, 1) + insert into warehouse (id, name, capacity, current_capacity, manager_id, address, activation) + values (UUID(), #{name}, #{capacity}, #{currentCapacity}, #{managerId}, #{address}, #{activation}) diff --git a/src/main/webapp/WEB-INF/views/modal/product_category_company_search.jsp b/src/main/webapp/WEB-INF/views/modal/product_category_company_search.jsp new file mode 100644 index 0000000..38aff74 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/modal/product_category_company_search.jsp @@ -0,0 +1,157 @@ +<%@ page contentType="text/html; charset=UTF-8" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + +
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + +
제품카테고리제조사
${dto.name }${dto.cls_Nm_4 }${dto.company_name } + +
+
+
+ +
+ +
+ +
+
+
diff --git a/src/main/webapp/WEB-INF/views/modal/warehouse_capacity_currentCapacity.jsp b/src/main/webapp/WEB-INF/views/modal/warehouse_capacity_currentCapacity.jsp new file mode 100644 index 0000000..bdf2f27 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/modal/warehouse_capacity_currentCapacity.jsp @@ -0,0 +1,163 @@ +<%@ page contentType="text/html; charset=UTF-8" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + +
+
+
+
+
+
+ +
+ + + +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
창고명지역용적잔여 용량
${dto.warehouseName }${dto.address }${dto.capacity }${dto.capacity - dto.current_capacity } + +
+
+
+ +
+ +
+ +
+
+
\ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/stock/create.jsp b/src/main/webapp/WEB-INF/views/stock/create.jsp index 22d012e..84baacf 100644 --- a/src/main/webapp/WEB-INF/views/stock/create.jsp +++ b/src/main/webapp/WEB-INF/views/stock/create.jsp @@ -1,68 +1,186 @@ -<%@ page contentType="text/html; charset=UTF-8"%> -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> +<%@ page contentType="text/html; charset=UTF-8" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> - - - - - 재고 생성 - - - -
-
-

재고 관리 생성

-
-
-
-
-
- - -
-
-
+
+

재고 생성

+
+
+
+
+
+ + + + + + +
+ 제품 + + + +
+ +
+ 카테고리 + +
+ +
+ 제조사 + +
+ + + +
+ 창고 + + + +
+ +
+ 주소 + +
+ +
+ 용적 + +
+ +
+ 잔여 용량 + +
+ + + +
+ 재고량 + +
-
- - + $(document).ready(function () { - \ No newline at end of file + + $("#submitBtn").on("click", function () { + var product_id = $("#product_id").val(); + var warehouse_id = $("#warehouse_id").val(); + var quantity = $("#quantity").val(); + var activation = $("#activation").val(); + var remainingcapacity = $("#remainingcapacity").val(); + + if (!product_id) { + alert("제품을 선택해야 합니다."); + $("#product_id").focus(); + return false; + } + if (!warehouse_id) { + alert("적재할 창고를 선택해야 합니다."); + $("#warehouse_id").focus(); + return false; + } + + if (!quantity) { + alert("재고량를 입력해야 합니다."); + $("#quantity").focus(); + return false; + } + + if (quantity > remainingcapacity) { + alert("적재 할 재고량이 잔여 용량을 넘을 수 없습니다."); + $("#quantity").focus(); + return false; + } + + $.ajax({ + url: "/stock/create_process", + type: "post", + data: { + "productId": product_id, + "warehouseId": warehouse_id, + "quantity": quantity, + "activation": activation + + }, + datatype: "json" + }).done(function (data) { + if (data == true) { + alert("재고 정보가 생성되었습니다."); + + var form = document.createElement("form"); + form.action = "/stock/read"; + form.method = "POST"; + document.body.appendChild(form); + + var input = document.createElement("input"); + input.type = "hidden"; + input.name = "name"; + input.value = name; + form.appendChild(input); + + form.submit(); + + window.location.href = "/stock/list"; + } else { + alert("재고 정보 생성에 실패하였습니다."); + } + }).fail(function () { + alert("오류가 발생했습니다."); + }).always(function () { + // + }); + + }) + + $("#cancelBtn").on("click", function () { + $(location).attr("href", "/stock/list"); + + }) + + + }); + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/stock/list.jsp b/src/main/webapp/WEB-INF/views/stock/list.jsp index 817a95d..b7be395 100644 --- a/src/main/webapp/WEB-INF/views/stock/list.jsp +++ b/src/main/webapp/WEB-INF/views/stock/list.jsp @@ -1,121 +1,388 @@ <%@ page contentType="text/html; charset=UTF-8"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> - - 재고 리스트 - + + + + + + + + + 재고 관리 - -
-

재고 리스트

+
+

재고 관리


-
- - -
-
- - - - - - - - - - - - - - - - -
번호제품명창고명
${stock.id}${stock.product_name }${stock.warehouse_name }
+ +
+
+
+
+
+
+
+ +
+ + - -
- -
-
- - [<] - - - ${i} - - - [>] - -
+ + + + -
- +
+ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + +
번호제품명카테고리재고수
${start} ${dto.productName }${dto.cls_nm_4 }${dto.quantity}
+
+
+
+
+
+
+ ms-excel + +
+
+ +
+
+ +
+
+
+ +
+
+
+
+
+
+ +
+ + + + + + + + +
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + +
번호제품명카테고리재고수
${start} ${dto.productName }${dto.cls_nm_4 }${dto.quantity }
+
+
+
+
+
+
+ ms-excel + +
+
+ +
+
+ +
+
+
+
- -
-
- 탭2 내용 -
-
- - - - + - + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/stock/read.jsp b/src/main/webapp/WEB-INF/views/stock/read.jsp new file mode 100644 index 0000000..8fe410e --- /dev/null +++ b/src/main/webapp/WEB-INF/views/stock/read.jsp @@ -0,0 +1,190 @@ +<%@ page contentType="text/html; charset=UTF-8" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> + +
+

재고 상세페이지

+
+ +
+
+
+
+
+
+
+ + + + + + +
+ 제품 + + + <%-- --%> +
+ +
+ 카테고리 + +
+ +
+ 제조사 + +
+ + + +
+ 창고 + + + <%-- --%> +
+ +
+ 주소 + +
+ +
+ 용적 + +
+ + + +
+ 재고량 + +
+ + + + +
+
+
+
+
+
+ + + +
+
+
+
+ + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/stock/update.jsp b/src/main/webapp/WEB-INF/views/stock/update.jsp new file mode 100644 index 0000000..a9982ff --- /dev/null +++ b/src/main/webapp/WEB-INF/views/stock/update.jsp @@ -0,0 +1,200 @@ +<%@ page contentType="text/html; charset=UTF-8" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> + + +
+

재고 수정

+
+
+
+
+
+
+ + + + + + + +
+ 제품 + + + <%-- --%> +
+ +
+ 카테고리 + +
+ +
+ 제조사 + +
+ + + +
+ 창고 + + + <%-- --%> +
+ +
+ 주소 + +
+ +
+ 용적 + +
+ +
+ 재고량 한도 + +
+ + +
+ 기존 재고량 + +
+ +
+ 수정 할 재고량 + +
+ + + + + +
+
+
+
+
+
+ + + +
+
+
+
+ \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/vendor/create.jsp b/src/main/webapp/WEB-INF/views/vendor/create.jsp new file mode 100644 index 0000000..2a931b4 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/vendor/create.jsp @@ -0,0 +1,253 @@ +<%@ page contentType="text/html; charset=UTF-8" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> + + + + + 거래처 생성 + + + +
+

거래처 생성

+
+
+
+
+
+
+
+ + + <%-- 세션 만들어지고 value 수정--%> + + + + + +
+ 업체명 + +
+ +
+ 대표자명 + +
+ +
+ 주소 + +
+ +
+ 사업자등록번호 + +
+ +
+ email + +
+ +
+ 대표번호 + +
+ +
+ 거래처 담당자 이름 + +
+ +
+ 거래처 담당자 연락 번호 + +
+ +
+ 주요품목 + +
+ + +
+
+
+
+
+
+ + + +
+
+
+
+ + + + +
+ + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/vendor/list.jsp b/src/main/webapp/WEB-INF/views/vendor/list.jsp new file mode 100644 index 0000000..9bd2736 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/vendor/list.jsp @@ -0,0 +1,203 @@ +<%@ page contentType="text/html; charset=UTF-8"%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> + + + + +거래처 관리 + + +
+

거래처 관리

+
+
+
+
+
+
+
+
+ +
+ + + + + + + + +
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + +
번호업체명대표번호거래처 담당자거래처 담당자 전화번호
${start} ${dto.name }${dto.presidentTelephone }${dto.vendorManager }${dto.vendorManagerTelephone }
+
+
+
+
+
+
+ ms-excel + + +
+
+ +
+
+ +
+
+
+
+ + + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/vendor/read.jsp b/src/main/webapp/WEB-INF/views/vendor/read.jsp new file mode 100644 index 0000000..3dcc24f --- /dev/null +++ b/src/main/webapp/WEB-INF/views/vendor/read.jsp @@ -0,0 +1,181 @@ +<%@ page contentType="text/html; charset=UTF-8" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + + + + + 거래처 상세페이지 + + + +
+ +
+

거래처 상세페이지

+
+ +
+
+
+
+
+
+
+
+
+ + + +
+ 업체명 + +
+ +
+ 대표자명 + +
+ +
+ 주소 + +
+ +
+ 사업자등록번호 + +
+ +
+ email + +
+ +
+ 대표번호 + +
+ +
+ 거래처 담당자 이름 + +
+ +
+ 거래처 담당자 연락 번호 + +
+ +
+ 주요품목 + +
+
+
+
+
+ +
+
+
+
+
+
+ + +
+ + + + + diff --git a/src/main/webapp/WEB-INF/views/vendor/update.jsp b/src/main/webapp/WEB-INF/views/vendor/update.jsp new file mode 100644 index 0000000..39417ab --- /dev/null +++ b/src/main/webapp/WEB-INF/views/vendor/update.jsp @@ -0,0 +1,263 @@ +<%@ page contentType="text/html; charset=UTF-8" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> + + + + + + 창고 정보 수정페이지 + + + +
+

창고 정보 수정페이지

+
+
+
+
+ +
+
+
+ + + + + + +
+ 업체명 + +
+ +
+ 대표자명 + +
+ +
+ 주소 + +
+ +
+ 사업자등록번호 + +
+ +
+ email + +
+ +
+ 대표번호 + +
+ +
+ 거래처 담당자 이름 + +
+ +
+ 거래처 담당자 연락 번호 + +
+ +
+ 주요품목 + +
+ + +
+
+
+ +
+
+
+ + +
+
+
+
+
+ + + + diff --git a/src/main/webapp/WEB-INF/views/warehouse/create.jsp b/src/main/webapp/WEB-INF/views/warehouse/create.jsp index 1e41b0b..d2bb1e9 100644 --- a/src/main/webapp/WEB-INF/views/warehouse/create.jsp +++ b/src/main/webapp/WEB-INF/views/warehouse/create.jsp @@ -1,25 +1,26 @@ -<%@ page contentType="text/html; charset=UTF-8"%> -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> -<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> +<%@ page contentType="text/html; charset=UTF-8" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> 창고 생성 @@ -34,9 +35,10 @@
- <-- 세션 만들어지고 value 수정--> + <%-- 세션 만들어지고 value 수정--%> - + +
@@ -75,28 +77,29 @@ diff --git a/src/main/webapp/WEB-INF/views/warehouse/list.jsp b/src/main/webapp/WEB-INF/views/warehouse/list.jsp index cba2276..6c05c2d 100644 --- a/src/main/webapp/WEB-INF/views/warehouse/list.jsp +++ b/src/main/webapp/WEB-INF/views/warehouse/list.jsp @@ -26,7 +26,7 @@
-
+
- - - -
- 업체명 - -
- -
- 대표자명 - -
- -
- 주소 - -
- -
- 사업자등록번호 - -
- -
- email - -
- -
- 대표번호 - -
- -
- 거래처 담당자 이름 - -
- -
- 거래처 담당자 연락 번호 - -
- -
- 주요품목 - -
- - -
-
-
-
-
-
- - - -
-
-
- - - - - -
- +<%@ page contentType="text/html; charset=UTF-8" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> + + + + + 거래처 생성 + + + +
+

거래처 생성

+
+
+
+
+
+
+
+ + + <%-- 세션 만들어지고 value 수정--%> + + + + + +
+ 업체명 + +
+ +
+ 대표자명 + +
+ +
+ 주소 + +
+ +
+ 사업자등록번호 + +
+ +
+ email + +
+ +
+ 대표번호 + +
+ +
+ 거래처 담당자 이름 + +
+ +
+ 거래처 담당자 연락 번호 + +
+ +
+ 주요품목 + +
+ + +
+
+
+
+
+
+ + + +
+
+
+
+ + + + +
+ \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/vendor/list.jsp b/src/main/webapp/WEB-INF/views/vendor/list.jsp index 9bd2736..e97833e 100644 --- a/src/main/webapp/WEB-INF/views/vendor/list.jsp +++ b/src/main/webapp/WEB-INF/views/vendor/list.jsp @@ -1,203 +1,203 @@ -<%@ page contentType="text/html; charset=UTF-8"%> -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> - - - - -거래처 관리 - - -
-

거래처 관리

-
-
-
-
-
-
-
-
- -
- - - - - - - - -
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - -
번호업체명대표번호거래처 담당자거래처 담당자 전화번호
${start} ${dto.name }${dto.presidentTelephone }${dto.vendorManager }${dto.vendorManagerTelephone }
-
-
-
-
-
-
- ms-excel - - -
-
- -
-
- -
-
-
-
- - - - +<%@ page contentType="text/html; charset=UTF-8"%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> + + + + +거래처 관리 + + +
+

거래처 관리

+
+
+
+
+
+
+
+
+ +
+ + + + + + + + +
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + +
번호업체명대표번호거래처 담당자거래처 담당자 전화번호
${start} ${dto.name }${dto.president_telephone }${dto.vendor_manager }${dto.vendor_manager_telephone }
+
+
+
+
+
+
+ ms-excel + + +
+
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/vendor/read.jsp b/src/main/webapp/WEB-INF/views/vendor/read.jsp index 3dcc24f..c674fa2 100644 --- a/src/main/webapp/WEB-INF/views/vendor/read.jsp +++ b/src/main/webapp/WEB-INF/views/vendor/read.jsp @@ -1,181 +1,181 @@ -<%@ page contentType="text/html; charset=UTF-8" %> -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> - - - - - - 거래처 상세페이지 - - - -
- -
-

거래처 상세페이지

-
- -
-
-
-
-
-
-
-
-
- - - -
- 업체명 - -
- -
- 대표자명 - -
- -
- 주소 - -
- -
- 사업자등록번호 - -
- -
- email - -
- -
- 대표번호 - -
- -
- 거래처 담당자 이름 - -
- -
- 거래처 담당자 연락 번호 - -
- -
- 주요품목 - -
-
-
-
-
- -
-
-
-
-
-
- - -
- - - - - +<%@ page contentType="text/html; charset=UTF-8" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + + + + + 거래처 상세페이지 + + + +
+ +
+

거래처 상세페이지

+
+ +
+
+
+
+
+
+
+
+
+ + + +
+ 업체명 + +
+ +
+ 대표자명 + +
+ +
+ 주소 + +
+ +
+ 사업자등록번호 + +
+ +
+ email + +
+ +
+ 대표번호 + +
+ +
+ 거래처 담당자 이름 + +
+ +
+ 거래처 담당자 연락 번호 + +
+ +
+ 주요품목 + +
+
+
+
+
+ +
+
+
+
+
+
+ + +
+ + + + + diff --git a/src/main/webapp/WEB-INF/views/vendor/update.jsp b/src/main/webapp/WEB-INF/views/vendor/update.jsp index 39417ab..734d253 100644 --- a/src/main/webapp/WEB-INF/views/vendor/update.jsp +++ b/src/main/webapp/WEB-INF/views/vendor/update.jsp @@ -1,263 +1,263 @@ -<%@ page contentType="text/html; charset=UTF-8" %> -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> - - - - - - 창고 정보 수정페이지 - - - -
-

창고 정보 수정페이지

-
-
-
-
- -
-
-
- - - - - - -
- 업체명 - -
- -
- 대표자명 - -
- -
- 주소 - -
- -
- 사업자등록번호 - -
- -
- email - -
- -
- 대표번호 - -
- -
- 거래처 담당자 이름 - -
- -
- 거래처 담당자 연락 번호 - -
- -
- 주요품목 - -
- - -
-
-
- -
-
-
- - -
-
-
-
-
- - - - +<%@ page contentType="text/html; charset=UTF-8" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> + + + + + + 창고 정보 수정페이지 + + + +
+

창고 정보 수정페이지

+
+
+
+
+ +
+
+
+ + + + + + +
+ 업체명 + +
+ +
+ 대표자명 + +
+ +
+ 주소 + +
+ +
+ 사업자등록번호 + +
+ +
+ email + +
+ +
+ 대표번호 + +
+ +
+ 거래처 담당자 이름 + +
+ +
+ 거래처 담당자 연락 번호 + +
+ +
+ 주요품목 + +
+ + +
+
+
+ +
+
+
+ + +
+
+
+
+
+ + + + From 67b0fa90bf6003252c130a22af6ecf1ad909d0e6 Mon Sep 17 00:00:00 2001 From: sungsuhub <145002081+sungsuhub@users.noreply.github.com> Date: Tue, 16 Jan 2024 00:15:56 +0900 Subject: [PATCH 5/6] Add files via upload --- src/main/resources/mappers/VendorMapper.xml | 210 ++++++++++---------- 1 file changed, 105 insertions(+), 105 deletions(-) diff --git a/src/main/resources/mappers/VendorMapper.xml b/src/main/resources/mappers/VendorMapper.xml index 3e3f8b4..b1fbe85 100644 --- a/src/main/resources/mappers/VendorMapper.xml +++ b/src/main/resources/mappers/VendorMapper.xml @@ -1,106 +1,106 @@ - - - - - - - - - - - - - - - - - - - - update vendor - set name = #{name}, - president_name = #{presidentName}, - address = #{address}, - registration_number = #{registrationNumber}, - email = #{email}, - president_telephone = #{presidentTelephone}, - vendor_manager = #{vendorManager}, - vendor_manager_telephone = #{vendorManagerTelephone}, - main_product = #{mainProduct}, - manager_id = #{managerId}, - activation = #{activation} - where id = #{id} - - - - - - - insert into vendor (id, name, president_name, address, registration_number, email, president_telephone, vendor_manager, vendor_manager_telephone, main_product, manager_id, activation) - values (UUID(), #{name}, #{presidentName}, #{address}, #{registrationNumber}, #{email}, #{presidentTelephone}, #{vendorManager}, #{vendorManagerTelephone}, #{mainProduct}, #{managerId}, #{activation}) - - - - - - delete from vendor where id = #{id} - - + + + + + + + + + + + + + + + + + + + + update vendor + set name = #{name}, + president_name = #{president_name}, + address = #{address}, + registration_number = #{registration_number}, + email = #{email}, + president_telephone = #{president_telephone}, + vendor_manager = #{vendor_manager}, + vendor_manager_telephone = #{vendor_manager_telephone}, + main_product = #{main_product}, + manager_id = #{manager_id}, + activation = #{activation} + where id = #{id} + + + + + + + insert into vendor (id, name, president_name, address, registration_number, email, president_telephone, vendor_manager, vendor_manager_telephone, main_product, manager_id, activation) + values (UUID(), #{name}, #{president_name}, #{address}, #{registration_number}, #{email}, #{president_telephone}, #{vendor_manager}, #{vendor_manager_telephone}, #{main_product}, #{manager_id}, #{activation}) + + + + + + delete from vendor where id = #{id} + + \ No newline at end of file From 00398754c3741916cb6e0d75560bbf033f261621 Mon Sep 17 00:00:00 2001 From: Kana Date: Tue, 16 Jan 2024 11:53:15 +0900 Subject: [PATCH 6/6] The paging and search functions of the modal screens of the category page, price page, and product page have been completed --- .../no1/wms/category/CategoryController.java | 2 + .../com/no1/wms/price/PriceController.java | 2 + .../no1/wms/product/ProductController.java | 44 +++++- .../webapp/WEB-INF/views/category/read.jsp | 13 +- .../webapp/WEB-INF/views/modal/category.jsp | 95 ++++++++++- src/main/webapp/WEB-INF/views/modal/price.jsp | 71 +++++++++ .../webapp/WEB-INF/views/modal/product.jsp | 92 ++++++++++- .../webapp/WEB-INF/views/modal/vendor.jsp | 147 ++++++++++++++++++ src/main/webapp/WEB-INF/views/price/read.jsp | 12 +- .../webapp/WEB-INF/views/product/create.jsp | 10 +- .../webapp/WEB-INF/views/product/read.jsp | 12 +- .../webapp/WEB-INF/views/product/update.jsp | 41 +++-- 12 files changed, 501 insertions(+), 40 deletions(-) create mode 100644 src/main/webapp/WEB-INF/views/modal/price.jsp create mode 100644 src/main/webapp/WEB-INF/views/modal/vendor.jsp diff --git a/src/main/java/com/no1/wms/category/CategoryController.java b/src/main/java/com/no1/wms/category/CategoryController.java index 9e7e4f3..d427557 100644 --- a/src/main/java/com/no1/wms/category/CategoryController.java +++ b/src/main/java/com/no1/wms/category/CategoryController.java @@ -202,6 +202,8 @@ public class CategoryController { return "modal/categorysearch"; }; + + //서식 다운로드 @GetMapping("/category/downlodeCategoryForm") public void downlodeCategoryForm (HttpServletResponse response) throws IOException{ String categoryFormName = "카테고리 데이터 입력 서식.xlsx"; diff --git a/src/main/java/com/no1/wms/price/PriceController.java b/src/main/java/com/no1/wms/price/PriceController.java index e389aea..84d6467 100644 --- a/src/main/java/com/no1/wms/price/PriceController.java +++ b/src/main/java/com/no1/wms/price/PriceController.java @@ -166,4 +166,6 @@ public class PriceController { } + + } diff --git a/src/main/java/com/no1/wms/product/ProductController.java b/src/main/java/com/no1/wms/product/ProductController.java index d4476ce..b5a9240 100644 --- a/src/main/java/com/no1/wms/product/ProductController.java +++ b/src/main/java/com/no1/wms/product/ProductController.java @@ -17,6 +17,8 @@ import org.springframework.web.servlet.ModelAndView; import com.no1.wms.category.CategoryDto; import com.no1.wms.category.CategoryService; import com.no1.wms.price.PriceDto; +import com.no1.wms.vendor.VendorDto; +import com.no1.wms.vendor.VendorService; @Controller @RequestMapping("/product") @@ -26,6 +28,8 @@ public class ProductController { ProductService productService; @Autowired CategoryService categoryService; + @Autowired + VendorService service; /* @GetMapping("list") @@ -141,7 +145,7 @@ public class ProductController { @RequestParam(name = "p", defaultValue = "1") int page, ModelAndView m, String name) { int count = categoryService.count(searchn, search); - int perPage = 10; // 한 페이지에 보일 글의 개수 + int perPage =9; // 한 페이지에 보일 글의 개수 int startRow = (page - 1) * perPage; List dto = categoryService.categoryList2(searchn, search, startRow ,perPage); @@ -171,6 +175,44 @@ public class ProductController { + + @PostMapping("/show_modal2") + public ModelAndView vendorShowModal(@RequestParam(name = "searchn", defaultValue = "0") int searchn, + @RequestParam(name = "search", defaultValue = "") String search, + @RequestParam(name = "p", defaultValue = "1") int page, ModelAndView m, String name) { + + int count = service.count(searchn, search); + + int perPage = 9; // 한 페이지에 보일 글의 갯수 + int startRow = (page - 1) * perPage; + + //스톡서비스로 재고 리스트 출력 메서트 작성 + List dto = service.list(searchn, search, startRow ,perPage); + + + m.addObject("vlist", dto); + m.addObject("start", startRow + 1); + + int pageNum = 5;//보여질 페이지 번호 수 + int totalPages = count / perPage + (count % perPage > 0 ? 1 : 0); // 전체 페이지 수 + + int begin = (page - 1) / pageNum * pageNum + 1; + int end = begin + pageNum - 1; + if (end > totalPages) { + end = totalPages; + } + m.addObject("searchn", searchn); + m.addObject("search", search); + m.addObject("begin", begin); + m.addObject("end", end); + m.addObject("pageNum", pageNum); + m.addObject("totalPages", totalPages); + m.addObject("p" , page); + m.setViewName(name); + + return m; + } + diff --git a/src/main/webapp/WEB-INF/views/category/read.jsp b/src/main/webapp/WEB-INF/views/category/read.jsp index 8bd5901..7e9a3ee 100644 --- a/src/main/webapp/WEB-INF/views/category/read.jsp +++ b/src/main/webapp/WEB-INF/views/category/read.jsp @@ -12,7 +12,7 @@

제품 카테고리 상세페이지

- +
@@ -91,8 +91,6 @@ form.submit(); })//modifyBtn click - - yesNoModal.yesFunction = deleteCategoryFunction; });//ready @@ -123,6 +121,15 @@ }//deleteCategoryFunction + function goDelete(){ + yesNoModalTextDefine("카테고리 삭제", "해당 카테고리를 삭제하시겠습니까?"); + $("#yesNoModalLabel").text(yesNoModal.title); + $("#yesNoModalBodyTextDiv").text(yesNoModal.body); + yesNoModal.yesFunction = deleteCategoryFunction; + yesNoModalBootStrap.show(); + + + } diff --git a/src/main/webapp/WEB-INF/views/modal/category.jsp b/src/main/webapp/WEB-INF/views/modal/category.jsp index 859198e..044403d 100644 --- a/src/main/webapp/WEB-INF/views/modal/category.jsp +++ b/src/main/webapp/WEB-INF/views/modal/category.jsp @@ -1,12 +1,9 @@ <%@ page contentType="text/html; charset=UTF-8"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> +
@@ -59,11 +119,32 @@ ${dto.cls_nm_3 } ${dto.cls_nm_4 } ${dto.kan_code } - +
+
+
+
\ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/modal/price.jsp b/src/main/webapp/WEB-INF/views/modal/price.jsp new file mode 100644 index 0000000..6afa5e7 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/modal/price.jsp @@ -0,0 +1,71 @@ +<%@ page contentType="text/html; charset=UTF-8"%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> + +
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
번호제품명가격등록날짜담당자선택
${status.count }${dto.productDto.name }${dto.price }${dto.accountDto.name }
+
+
+
\ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/modal/product.jsp b/src/main/webapp/WEB-INF/views/modal/product.jsp index 3092221..7ae22a1 100644 --- a/src/main/webapp/WEB-INF/views/modal/product.jsp +++ b/src/main/webapp/WEB-INF/views/modal/product.jsp @@ -1,13 +1,10 @@ <%@ page contentType="text/html; charset=UTF-8"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> +
@@ -62,11 +119,32 @@ ${dto.accountDto.name } - +
+
+
+
\ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/modal/vendor.jsp b/src/main/webapp/WEB-INF/views/modal/vendor.jsp new file mode 100644 index 0000000..2fa73e5 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/modal/vendor.jsp @@ -0,0 +1,147 @@ +<%@ page contentType="text/html; charset=UTF-8"%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> + + +
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + +
번호업체명대표번호거래처 담당자거래처 담당자 전화번호선택
${start} ${dto.name }${dto.president_telephone }${dto.vendor_manager }${dto.vendor_manager_telephone }
+
+
+
+
+ +
\ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/price/read.jsp b/src/main/webapp/WEB-INF/views/price/read.jsp index 9071a73..2418ee8 100644 --- a/src/main/webapp/WEB-INF/views/price/read.jsp +++ b/src/main/webapp/WEB-INF/views/price/read.jsp @@ -11,7 +11,7 @@

제품 상세페이지

- +
@@ -118,6 +118,16 @@ }); }//deletePriceFunction + function goDelete(){ + yesNoModalTextDefine("제품가격 삭제", "해당 제품가격을 삭제하시겠습니까?"); + $("#yesNoModalLabel").text(yesNoModal.title); + $("#yesNoModalBodyTextDiv").text(yesNoModal.body); + yesNoModal.yesFunction = deletePriceFunction; + yesNoModalBootStrap.show(); + + + } + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/product/create.jsp b/src/main/webapp/WEB-INF/views/product/create.jsp index 9e78404..a2f0686 100644 --- a/src/main/webapp/WEB-INF/views/product/create.jsp +++ b/src/main/webapp/WEB-INF/views/product/create.jsp @@ -57,17 +57,15 @@ 거래처 + aria-describedby="button-addon2" readonly> - +
- - - +
@@ -190,7 +188,7 @@ const data = { name : val}; $.ajax({ type : 'post', // 타입 (get, post, put 등등) - url : '/category/show_modal', // 요청할 서버url + url : '/product/show_modal2', // 요청할 서버url dataType : 'html', // 데이터 타입 (html, xml, json, text 등등) data : data, success : function(result) { // 결과 성공 콜백함수 diff --git a/src/main/webapp/WEB-INF/views/product/read.jsp b/src/main/webapp/WEB-INF/views/product/read.jsp index 46d6994..2cda58f 100644 --- a/src/main/webapp/WEB-INF/views/product/read.jsp +++ b/src/main/webapp/WEB-INF/views/product/read.jsp @@ -11,7 +11,7 @@

제품 상세페이지

- +
@@ -128,7 +128,15 @@ }); }//deleteProductFunction - + function goDelete(){ + yesNoModalTextDefine("제품 삭제", "해당 제품을 삭제하시겠습니까?"); + $("#yesNoModalLabel").text(yesNoModal.title); + $("#yesNoModalBodyTextDiv").text(yesNoModal.body); + yesNoModal.yesFunction = deleteProductFunction; + yesNoModalBootStrap.show(); + + + } \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/product/update.jsp b/src/main/webapp/WEB-INF/views/product/update.jsp index 8f03a25..4e43aa0 100644 --- a/src/main/webapp/WEB-INF/views/product/update.jsp +++ b/src/main/webapp/WEB-INF/views/product/update.jsp @@ -42,15 +42,15 @@ -
- 거래처 - - - - -
+
+ 거래처 + + + +
등록날짜 @@ -61,9 +61,7 @@ - - - +
@@ -188,7 +186,24 @@ alert(error) } }); - } + }//showSearchModal + function showSearchModal2(title, val){ + $("#searchModalLabel").text(title); + const data = { name : val}; + $.ajax({ + type : 'post', // 타입 (get, post, put 등등) + url : '/product/show_modal2', // 요청할 서버url + dataType : 'html', // 데이터 타입 (html, xml, json, text 등등) + data : data, + success : function(result) { // 결과 성공 콜백함수 + $("#search_modal_body").html(result); + searchModalBootStrap.show(); + }, + error : function(request, status, error) { + alert(error) + } + }); + }//showSearchModal2