stock/create.jsp
stock/list.jsp
stock/read.jsp
stock/update.jsp
WarehouseController.java
WarehouseMapper.xml
This commit is contained in:
sungsu
2024-01-22 10:11:07 +09:00
parent fd2d273f54
commit 75e2cbaade
3 changed files with 11 additions and 14 deletions

View File

@@ -172,7 +172,7 @@ public class StockController {
@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, String product_id,
@RequestParam(name = "p", defaultValue = "1") int page,
@RequestParam String name, ModelAndView mav){
int perPage = 5; // 한 페이지에 보일 글의 갯수
@@ -193,10 +193,9 @@ public class StockController {
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 ,product_id);
count = service.warehouseCount(searchn, search ,product_id);
list = service.warehousesSelect(searchn, search, startRow, perPage);
count = service.warehouseCount(searchn, search);
}
System.out.println("테스트 :: "+ product_id);
mav.addObject("list", list);
mav.addObject("start", startRow + 1);

View File

@@ -121,26 +121,24 @@ public class StockService {
return mapper.productCount(m);
}
public List<Map<String, Object>> warehousesSelect(int searchn, String search, int start, int perPage, String product_id){
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);
m.put("product_id", product_id);
List<Map<String, Object>> warehouseresult = mapper.warehouseSelect(m);
return warehouseresult;
}
public int warehouseCount(int searchn, String search, String product_id) {
public int warehouseCount(int searchn, String search) {
Map<String,Object> m = new HashMap<String, Object>();
m.put("searchn",searchn);
m.put("search", search);
m.put("product_id", product_id);
return mapper.warehouseCount(m);
}

View File

@@ -147,9 +147,9 @@
<where>
<choose>
<when test="searchn == 0"> (s.product_id &lt;&gt; #{product_id} or s.product_id is null) and w.activation = 1 and w.name like concat('%',#{search},'%')</when>
<when test="searchn == 1"> (s.product_id &lt;&gt; #{product_id} or s.product_id is null) and w.activation = 1 and address like concat('%',#{search},'%')</when>
<when test="searchn == 2"> (s.product_id &lt;&gt; #{product_id} or s.product_id is null) and w.activation = 1 and capacity like concat('%',#{search},'%')</when>
<when test="searchn == 0"> w.activation = 1 and w.name like concat('%',#{search},'%')</when>
<when test="searchn == 1"> w.activation = 1 and address like concat('%',#{search},'%')</when>
<when test="searchn == 2"> w.activation = 1 and capacity like concat('%',#{search},'%')</when>
</choose>
</where>
order by w.name desc limit #{start}, #{perPage}
@@ -162,9 +162,9 @@
<where>
<choose>
<when test="searchn == 0"> (s.product_id &lt;&gt; #{product_id} or s.product_id is null) and w.activation = 1 and w.name like concat('%',#{search},'%')</when>
<when test="searchn == 1"> (s.product_id &lt;&gt; #{product_id} or s.product_id is null) and w.activation = 1 and address like concat('%',#{search},'%')</when>
<when test="searchn == 2"> (s.product_id &lt;&gt; #{product_id} or s.product_id is null) and w.activation = 1 and capacity like concat('%',#{search},'%')</when>
<when test="searchn == 0"> w.activation = 1 and w.name like concat('%',#{search},'%')</when>
<when test="searchn == 1"> w.activation = 1 and address like concat('%',#{search},'%')</when>
<when test="searchn == 2"> and w.activation = 1 and capacity like concat('%',#{search},'%')</when>
</choose>
</where>
</select>