mirror of
https://github.com/suhf/No1WMS.git
synced 2026-02-05 04:03:45 +09:00
#update
warehouse/list.jsp warehouse/read.jsp StockDto.java WarehouseController.java WarehouseDto.java WarehouseMapper.java WarehouseMapper.xml WarehouseService.java #insert warehouse/update.jsp
This commit is contained in:
@@ -6,8 +6,8 @@ import lombok.Data;
|
||||
public class StockDto {
|
||||
|
||||
private String id;
|
||||
private int warehouse_id;
|
||||
private int product_id;
|
||||
private int warehouseId;
|
||||
private int productId;
|
||||
private int quantity;
|
||||
private boolean activation;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Controller
|
||||
@Slf4j
|
||||
@@ -20,6 +21,7 @@ public class WarehouseController {
|
||||
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 = 5; // 한 페이지에 보일 글의 갯수
|
||||
@@ -27,6 +29,8 @@ public class WarehouseController {
|
||||
|
||||
//스톡서비스로 재고 리스트 출력 메서트 작성
|
||||
List<WarehouseDto> dto = service.list(searchn, search, startRow ,perPage);
|
||||
|
||||
|
||||
m.addAttribute("wlist", dto);
|
||||
m.addAttribute("start", startRow + 1);
|
||||
|
||||
@@ -50,19 +54,53 @@ public class WarehouseController {
|
||||
|
||||
// 재고 상세페이지
|
||||
@PostMapping("warehouse/read")
|
||||
public String read(String id, Model m) {
|
||||
public String read(@RequestParam(name = "searchn", defaultValue = "0") int searchn,
|
||||
@RequestParam(name = "search", defaultValue = "") String search,
|
||||
@RequestParam(name = "p", defaultValue = "1") int page, String id, Model m) {
|
||||
//스톡서비스로 재고 상세페이지 출력 메서드 작성
|
||||
WarehouseDto dto = service.warehouseOne(id);
|
||||
m.addAttribute("dto", dto);
|
||||
return "warehouse/read/";
|
||||
|
||||
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);
|
||||
|
||||
List<Map<String, Object>> dto = service.warehouseOne(searchn, search, id, startRow, perPage);
|
||||
m.addAttribute("wlist", dto);
|
||||
System.out.println("list ::" + dto);
|
||||
|
||||
log.debug("dto테스트 :: " + dto);
|
||||
|
||||
int pageNum = 5;//보여질 페이지 번호 수
|
||||
int totalPages = warehouseOneCount / perPage + (warehouseOneCount % perPage > 0 ? 1 : 0); // 전체 페이지 수
|
||||
int begin = (page - 1) / pageNum * pageNum + 1;
|
||||
int end = begin + pageNum - 1;
|
||||
if (end > totalPages) {
|
||||
end = totalPages;
|
||||
}
|
||||
m.addAttribute("begin", begin);
|
||||
m.addAttribute("end", end);
|
||||
m.addAttribute("pageNum", pageNum);
|
||||
m.addAttribute("totalPages", totalPages);
|
||||
m.addAttribute("p" , page);
|
||||
|
||||
return "warehouse/read";
|
||||
}
|
||||
|
||||
|
||||
// 수정 - 폼
|
||||
@GetMapping("/warehouse/update/{id}")
|
||||
public String update(@PathVariable String id, Model m) {
|
||||
WarehouseDto dto = service.warehouseOne(id);
|
||||
m.addAttribute("dto", dto);
|
||||
WarehouseDto dto = service.One(id);
|
||||
m.addAttribute("One", dto);
|
||||
return "warehouse/update";
|
||||
}
|
||||
|
||||
|
||||
@@ -1,15 +1,26 @@
|
||||
package com.no1.wms.warehouse;
|
||||
|
||||
import com.no1.wms.product.ProductDto;
|
||||
import com.no1.wms.stock.StockDto;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WarehouseDto {
|
||||
|
||||
private String id;
|
||||
private String name;
|
||||
private int capacity;
|
||||
private int current_capacity;
|
||||
private String manager_id;
|
||||
private int currentCapacity;
|
||||
private String managerId;
|
||||
private String address;
|
||||
private boolean activation;
|
||||
|
||||
private List<ProductDto> productDto;
|
||||
private List<StockDto> stockDto;
|
||||
}
|
||||
|
||||
@@ -8,19 +8,22 @@ import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
public interface WarehouseMapper {
|
||||
|
||||
int count(Map<String, Object> m);//검색 글 갯수
|
||||
|
||||
|
||||
List<WarehouseDto> list(Map<String, Object> m);
|
||||
|
||||
int count(Map<String, Object> m);//검색 글 갯수
|
||||
|
||||
List<Map<String, Object>> warehouseOne(Map<String, Object> m);
|
||||
|
||||
int warehouseOneCount(Map<String, Object> m);//검색 글 갯수
|
||||
|
||||
WarehouseDto One(String id);
|
||||
|
||||
int updateWarehouse(WarehouseDto dto);
|
||||
|
||||
int createWarehouse(WarehouseDto dto);
|
||||
|
||||
WarehouseDto warehouseOne(String id);
|
||||
|
||||
int deleteWarehouse(String id);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,19 +1,21 @@
|
||||
package com.no1.wms.warehouse;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.awt.color.ICC_ColorSpace;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class WarehouseService {
|
||||
@Autowired
|
||||
WarehouseMapper mapper;
|
||||
|
||||
public int count(int searchn, String search) {
|
||||
|
||||
|
||||
Map<String,Object> m = new HashMap<String, Object>();
|
||||
m.put("searchn",searchn);
|
||||
@@ -37,11 +39,37 @@ public class WarehouseService {
|
||||
}
|
||||
|
||||
|
||||
public WarehouseDto warehouseOne(String id) {
|
||||
return mapper.warehouseOne(id);
|
||||
public List<Map<String, Object>> warehouseOne(int searchn, String search, String id, 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);
|
||||
m.put("id" , id);
|
||||
System.out.println(m);
|
||||
|
||||
List<Map<String, Object>> result = mapper.warehouseOne(m);
|
||||
log.debug("warehouseOne테스트 :: " + result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public int warehouseOneCount(int searchn, String search, String id){
|
||||
|
||||
Map<String,Object> m = new HashMap<String, Object>();
|
||||
m.put("searchn",searchn);
|
||||
m.put("search", search);
|
||||
m.put("id", id);
|
||||
|
||||
log.debug("warehouseOneCount테스트 :: " + m);
|
||||
|
||||
return mapper.warehouseOneCount(m);
|
||||
}
|
||||
|
||||
public WarehouseDto One(String id){
|
||||
return mapper.One(id);
|
||||
}
|
||||
|
||||
public int createWarehouse(WarehouseDto dto) {
|
||||
return mapper.createWarehouse(dto);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user