This commit is contained in:
sungsu
2024-01-24 11:12:02 +09:00
parent bbf093258e
commit dd502574fb
3 changed files with 156 additions and 92 deletions

View File

@@ -1,13 +1,32 @@
package com.no1.wms.base; package com.no1.wms.base;
import com.no1.wms.stock.StockService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
import java.util.Map;
@Controller @Controller
public class MainPageController { public class MainPageController {
@Autowired
StockService service;
@GetMapping("/main") @GetMapping("/main")
public String mainPage() { public String mainPage(@RequestParam(name = "searchn2", defaultValue = "0") int searchn2,
@RequestParam(name = "search2", defaultValue = "") String search2,
@RequestParam(name = "p2", defaultValue = "1") int p2, Model m) {
int perPage2 = 5; // 한 페이지에 보일 글의 갯수
int startRow2 = (p2 - 1) * perPage2;
List<Map<String, Object>> dto2 = service.list2(searchn2, search2, startRow2 ,perPage2);
m.addAttribute("slist2", dto2);
System.out.println("리스트 확인 : : " + dto2);
return "base/main"; return "base/main";
} }
} }

View File

@@ -64,7 +64,7 @@
<when test="searchn == 0"> quantity &lt;= 200 and s.activation = 1 and p.name like concat('%',#{search},'%')</when> <when test="searchn == 0"> quantity &lt;= 200 and s.activation = 1 and p.name like concat('%',#{search},'%')</when>
<when test="searchn == 1"> quantity &lt;= 200 and s.activation = 1 and c.cls_Nm_4 like concat('%',#{search},'%')</when> <when test="searchn == 1"> quantity &lt;= 200 and s.activation = 1 and c.cls_Nm_4 like concat('%',#{search},'%')</when>
<when test="searchn == 2"> quantity &lt;= 200 and s.activation = 1 and s.quantity like concat('%',#{search},'%')</when> <when test="searchn == 2"> quantity &lt;= 200 and s.activation = 1 and s.quantity like concat('%',#{search},'%')</when>
<when test="searchn == 3">s.activation = 1 and w.name like concat('%',#{search},'%')</when> <when test="searchn == 3"> quantity &lt;= 200 and s.activation = 1 and w.name like concat('%',#{search},'%')</when>
</choose> </choose>
</where> </where>
</select> </select>
@@ -82,7 +82,7 @@
<when test="searchn == 0"> quantity &lt;= 200 and s.activation = 1 and p.name like concat('%',#{search},'%')</when> <when test="searchn == 0"> quantity &lt;= 200 and s.activation = 1 and p.name like concat('%',#{search},'%')</when>
<when test="searchn == 1"> quantity &lt;= 200 and s.activation = 1 and c.cls_Nm_4 like concat('%',#{search},'%')</when> <when test="searchn == 1"> quantity &lt;= 200 and s.activation = 1 and c.cls_Nm_4 like concat('%',#{search},'%')</when>
<when test="searchn == 2"> quantity &lt;= 200 and s.activation = 1 and s.quantity like concat('%',#{search},'%')</when> <when test="searchn == 2"> quantity &lt;= 200 and s.activation = 1 and s.quantity like concat('%',#{search},'%')</when>
<when test="searchn == 3">s.activation = 1 and w.name like concat('%',#{search},'%')</when> <when test="searchn == 3"> quantity &lt;= 200 and s.activation = 1 and w.name like concat('%',#{search},'%')</when>
</choose> </choose>
</where> </where>
order by s.id desc limit #{start}, #{perPage} order by s.id desc limit #{start}, #{perPage}

View File

@@ -1,4 +1,5 @@
<%@ page contentType="text/html; charset=UTF-8"%> <%@ page contentType="text/html; charset=UTF-8" %>3
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
@@ -10,20 +11,47 @@
<div class="row"> <div class="row">
<div class="col-md-6 "> <div class="col-md-6 ">
<div>첫 번째 공간</div> <div><img alt="Default Image" src="/resources/static/img/mainpage/2.png" width="500px" /></div>
</div> </div>
<div class="col-md-5"> <div class="col-md-5">
<div class="text-center"><h2><b>No.1 WMS 달력</b></h2></div> <div class="text-center"><h2><b>No.1 WMS 달력</b></h2></div>
<div id='calendar'></div> <div id='calendar'></div>
<div id='popup' style="width: 500px; height: 600px; display: none; background-color: white; padding: 20px; border-radius: 14px; border: 2px solid #eeeeee"></div> <div id='popup'
style="width: 500px; height: 600px; display: none; background-color: white; padding: 20px; border-radius: 14px; border: 2px solid #eeeeee"></div>
</div> </div>
</div> </div>
<div class="row mt-4"> <div class="row mt-4">
<div class="col-md-6"> <div class="col-md-6">
<!-- 세 번째 공간 --> <!-- 세 번째 공간 -->
<div>세 번째 공간</div> <div>
<div class=" text-center">
<h5>부족한 재고</h5>
</div>
<table class="table">
<thead class="table-dark">
<tr>
<th>번호</th>
<th>제품명</th>
<th>카테고리</th>
<th>재고수</th>
<th>창고</th>
</tr>
</thead>
<tbody>
<c:forEach items="${slist2 }" var="dto">
<tr class="detailTr col-5" data-id="${dto.id}" style="font-size: small;">
<td class="col-1">${start2} <c:set var="start2" value="${start2 +1 }"/></td>
<td class="col-1">${dto.productName }</td>
<td class="col-1">${dto.cls_nm_4 }</td>
<td class="col-1">${dto.quantity }</td>
<td class="col-1">${dto.warehouseName}</td>
</tr>
</c:forEach>
</tbody>
</table>
</div>
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
@@ -34,9 +62,6 @@
</div> </div>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<link href='/resources/static/css/fullcalendar.main.min.css' rel='stylesheet'/> <link href='/resources/static/css/fullcalendar.main.min.css' rel='stylesheet'/>
<script src='/resources/static/js/ko.js'></script> <script src='/resources/static/js/ko.js'></script>
@@ -101,6 +126,26 @@
}); });
calendar.render(); calendar.render();
}); });
$(document).ready(function () {
$("body").on("click", ".detailTr", function () {
var id = $(this).data("id");
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 = "id";
input.value = id;
form.appendChild(input);
form.submit();
});
});
</script> </script>
</body> </body>
</html> </html>