입고예정 리스트 검색 기능 추가

This commit is contained in:
김민구
2024-01-23 21:30:32 +09:00
parent 3329c00019
commit c94cebdd13
4 changed files with 19 additions and 12 deletions

View File

@@ -33,9 +33,9 @@ public class PlanInController {
@GetMapping("/list") @GetMapping("/list")
public ModelAndView list(ModelAndView mav,@RequestParam(defaultValue = "0") int searchn, @RequestParam(defaultValue = "") String search, @RequestParam(defaultValue = "1") int page){ public ModelAndView list(ModelAndView mav,@RequestParam(defaultValue = "0") int searchn, @RequestParam(defaultValue = "") String search, @RequestParam(defaultValue = "1") int page){
int perPage = 10; int perPage = 15;
int startRow = (page - 1) * perPage; int startRow = (page - 1) * perPage;
int count = planinservice.count(searchn, search, startRow, perPage); int count = planinservice.count(searchn, search);
@@ -44,8 +44,6 @@ public class PlanInController {
//스톡서비스로 재고 리스트 출력 메서트 작성
List<PlanInDto> list = planinservice.selectAll(searchn, search, startRow, perPage); List<PlanInDto> list = planinservice.selectAll(searchn, search, startRow, perPage);
HashMap<String, Integer> map = new HashMap<>(); HashMap<String, Integer> map = new HashMap<>();
for( int i = 0 ; i < list.size(); ++i){ for( int i = 0 ; i < list.size(); ++i){

View File

@@ -21,12 +21,10 @@ public class PlanInService {
} }
int count(int searchn, String search, int start, int perPage){ int count(int searchn, String search){
HashMap<String, Object> m = new HashMap<>(); HashMap<String, Object> m = new HashMap<>();
m.put("searchn", searchn); m.put("searchn", searchn);
m.put("search", search); m.put("search", search);
m.put("start", start);
m.put("perPage", perPage);
return mapper.count(m); return mapper.count(m);
} }

View File

@@ -66,8 +66,9 @@
and plan.warehouse_id = warehouse.id and product.kan_code = product_category.kan_code and plan.warehouse_id = warehouse.id and product.kan_code = product_category.kan_code
<where> <where>
<choose> <choose>
<when test="searchn == 1"> plan.activation = 1 and pn like concat('%',#{search},'%')</when> <when test="searchn == 0"> plan.activation = 1 and plan.view_group_number like concat('%',#{search},'%') </when>
<when test="searchn == 0"> plan.activation = 1 and plan.group_number like concat('%',#{search},'%') </when> <when test="searchn == 1"> plan.activation = 1 and product.name like concat('%',#{search},'%')</when>
<when test="searchn == 2"> plan.activation = 1 and plan.quantity like concat(#{search})</when>
</choose> </choose>
</where> </where>
order by plan.view_group_number desc limit #{start}, #{perPage} order by plan.view_group_number desc limit #{start}, #{perPage}

View File

@@ -46,6 +46,16 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col-12 att"> <div class="col-12 att">
<form class="d-inline" id="search_form">
<select name="searchn">
<option <c:if test="${searchn == 0}">selected="selected"</c:if> value="0">그룹번호</option>
<option <c:if test="${searchn == 1}">selected="selected"</c:if> value="1">제품명</option>
<option <c:if test="${searchn == 2}">selected="selected"</c:if> value="2">수량</option>
</select>
<input type="text" name="search" maxlength="50" value="${search}"/>
<button type="submit" class="btn btn-primary" >검색</button>
<input id="pPage" hidden type="text" name="page">
</form>
<button style="float: right;" class="btn btn-primary" type="submit" id="btn_create" onclick="goCreate() ">생성</button> <button style="float: right;" class="btn btn-primary" type="submit" id="btn_create" onclick="goCreate() ">생성</button>
</div> </div>
<div class="col-12 m-0"> <div class="col-12 m-0">