mirror of
https://github.com/suhf/No1WMS.git
synced 2026-02-05 04:03:45 +09:00
#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
This commit is contained in:
@@ -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<Object> dto = service.list(searchn, search, perPage);
|
||||
m.addAttribute("list", dto);
|
||||
|
||||
int pageNum = 4;//보여질 페이지 번호 수
|
||||
List<Map<String, Object>> 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<Map<String, Object>> 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<String, Object> 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<String, Object> 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<Map<String, Object>> 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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -10,17 +10,37 @@ import java.util.Map;
|
||||
public interface StockMapper {
|
||||
|
||||
int count(Map<String, Object> m);//검색 글 갯수
|
||||
|
||||
List<Object> list(Map<String, Object> m);
|
||||
// List<StockDto> list(Map<String, Object> m);
|
||||
|
||||
List<Map<String, Object>> list(Map<String, Object> m);
|
||||
|
||||
|
||||
int count2(Map<String, Object> m);//검색 글 갯수
|
||||
|
||||
List<Map<String, Object>> list2(Map<String, Object> 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<String, Object> stockOne(String id);
|
||||
|
||||
int deleteStock(StockDto dto);
|
||||
|
||||
List<Map<String, Object>> productSelect(Map<String, Object> m);
|
||||
|
||||
int productCount(Map<String, Object> m);//검색 글 갯수
|
||||
|
||||
List<Map<String, Object>> warehouseSelect(Map<String, Object> m);
|
||||
|
||||
int warehouseCount(Map<String, Object> m);//검색 글 갯수
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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<String,Object> m = new HashMap<String, Object>();
|
||||
m.put("searchn",searchn);
|
||||
m.put("search", search);
|
||||
m.put("start", 0);
|
||||
m.put("perPage", 10000);
|
||||
return mapper.count(m);
|
||||
}
|
||||
|
||||
|
||||
public List<Object> list(int searchn, String search, int start){
|
||||
public List<Map<String, Object>> 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<Map<String, Object>> result = mapper.list(m);
|
||||
log.debug("warehouseOne테스트 :: " + result);
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
public int count2(int searchn, String search) {
|
||||
|
||||
System.out.println(searchn+search);
|
||||
|
||||
Map<String,Object> m = new HashMap<String, Object>();
|
||||
m.put("searchn",searchn);
|
||||
m.put("search", search);
|
||||
return mapper.count2(m);
|
||||
}
|
||||
|
||||
|
||||
public List<Map<String, Object>> list2(int searchn, String search, int start, int perPage){
|
||||
|
||||
System.out.println(searchn+search);
|
||||
|
||||
Map<String, Object> m = new HashMap<String, Object>();
|
||||
m.put("searchn",searchn);
|
||||
m.put("search", search);
|
||||
m.put("start", start);
|
||||
m.put("perPage", perPage);
|
||||
|
||||
List<Map<String, Object>> result = mapper.list2(m);
|
||||
log.debug("warehouseOne테스트 :: " + result);
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public StockDto stockOne(String id) {
|
||||
public Map<String, Object> 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<Map<String, Object>> productSelect(int searchn, String search, int start, int perPage){
|
||||
Map<String, Object> m = new HashMap<String, Object>();
|
||||
m.put("searchn", searchn);
|
||||
m.put("search", search);
|
||||
m.put("start", start);
|
||||
m.put("perPage", perPage);
|
||||
|
||||
List<Map<String, Object>> productresult = mapper.productSelect(m);
|
||||
|
||||
return productresult;
|
||||
}
|
||||
|
||||
public int productCount(int searchn, String search) {
|
||||
|
||||
|
||||
Map<String,Object> m = new HashMap<String, Object>();
|
||||
m.put("searchn",searchn);
|
||||
m.put("search", search);
|
||||
return mapper.productCount(m);
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> warehousesSelect(int searchn, String search, int start, int perPage){
|
||||
Map<String, Object> m = new HashMap<String, Object>();
|
||||
m.put("searchn", searchn);
|
||||
m.put("search", search);
|
||||
m.put("start", start);
|
||||
m.put("perPage", perPage);
|
||||
|
||||
List<Map<String, Object>> warehouseresult = mapper.warehouseSelect(m);
|
||||
|
||||
return warehouseresult;
|
||||
}
|
||||
|
||||
public int warehouseCount(int searchn, String search) {
|
||||
|
||||
|
||||
Map<String,Object> m = new HashMap<String, Object>();
|
||||
m.put("searchn",searchn);
|
||||
m.put("search", search);
|
||||
return mapper.warehouseCount(m);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
124
src/main/java/com/no1/wms/vendor/VendorController.java
vendored
Normal file
124
src/main/java/com/no1/wms/vendor/VendorController.java
vendored
Normal file
@@ -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<VendorDto> 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;
|
||||
}
|
||||
}
|
||||
18
src/main/java/com/no1/wms/vendor/VendorDto.java
vendored
18
src/main/java/com/no1/wms/vendor/VendorDto.java
vendored
@@ -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;
|
||||
}
|
||||
|
||||
26
src/main/java/com/no1/wms/vendor/VendorMapper.java
vendored
Normal file
26
src/main/java/com/no1/wms/vendor/VendorMapper.java
vendored
Normal file
@@ -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<VendorDto> list(Map<String, Object> m);
|
||||
|
||||
int count(Map<String, Object> m);//검색 글 갯수
|
||||
|
||||
VendorDto vendorOne(String id);
|
||||
|
||||
int updateVendor(VendorDto dto);
|
||||
|
||||
int createVendor(VendorDto dto);
|
||||
|
||||
int deleteVendor(String id);
|
||||
|
||||
|
||||
}
|
||||
57
src/main/java/com/no1/wms/vendor/VendorService.java
vendored
Normal file
57
src/main/java/com/no1/wms/vendor/VendorService.java
vendored
Normal file
@@ -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<String, Object> m = new HashMap<String, Object>();
|
||||
m.put("searchn", searchn);
|
||||
m.put("search", search);
|
||||
return mapper.count(m);
|
||||
}
|
||||
|
||||
|
||||
public List<VendorDto> list(int searchn, String search, int start, int perPage) {
|
||||
|
||||
System.out.println(searchn + search);
|
||||
|
||||
Map<String, Object> m = new HashMap<String, Object>();
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -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<Map<String, Object>> 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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user