mirror of
https://github.com/suhf/No1WMS.git
synced 2026-02-05 04:03:45 +09:00
#update
StockController.java StockDto.java StockMapper.xml StockMapper.java StockService.java
This commit is contained in:
@@ -1,22 +1,13 @@
|
|||||||
package com.no1.wms.category;
|
package com.no1.wms.category;
|
||||||
|
|
||||||
import java.util.List;
|
import com.no1.wms.excel.ExcelUtils;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
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.ui.Model;
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
|
||||||
|
|
||||||
import com.no1.wms.excel.ExcelUtils;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ public class StockController {
|
|||||||
int startRow = (page - 1) * perPage;
|
int startRow = (page - 1) * perPage;
|
||||||
|
|
||||||
//스톡서비스로 재고 리스트 출력 메서트 작성
|
//스톡서비스로 재고 리스트 출력 메서트 작성
|
||||||
List<StockDto> dto = service.stockList(searchn, search, perPage);
|
List<StockDto> dto = service.list(searchn, search, perPage);
|
||||||
m.addAttribute("list", dto);
|
m.addAttribute("list", dto);
|
||||||
|
|
||||||
int pageNum = 4;//보여질 페이지 번호 수
|
int pageNum = 4;//보여질 페이지 번호 수
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public class StockService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<StockDto> stockList(int searchn, String search, int start){
|
public List<StockDto> list(int searchn, String search, int start){
|
||||||
|
|
||||||
System.out.println(searchn+search);
|
System.out.println(searchn+search);
|
||||||
|
|
||||||
|
|||||||
@@ -2,26 +2,26 @@
|
|||||||
|
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTO Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTO Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
|
||||||
<mapper namespace="com.no1.wms.authority.AuthorityMapper">
|
<mapper namespace="com.no1.wms.authority.StockMapper">
|
||||||
|
|
||||||
<!-- select -->
|
<!-- select -->
|
||||||
<select id="count" parameterType="map" resultType="com.no1.wms.stock.StockDto">
|
<select id="count" parameterType="map" resultType="com.no1.wms.stock.StockDto">
|
||||||
select count(*) from wms.stock left join wms.warehouse on wms.stock.warehouse_id = wms.warehouse.id left join wms.product on wms.stock.product_id = wms.product.id
|
select count(*) from wms.stock left join wms.warehouse on wms.stock.warehouse_id = wms.warehouse.id left join wms.product on wms.stock.product_id = wms.product.id
|
||||||
<where>
|
<where>
|
||||||
<choose>
|
<choose>
|
||||||
<when test="searchn == 0"> activation = 1 and warehouse.name like concat('%',#{search},'%')</when>
|
<when test="searchn == 0"> wms.stock.activation = 1 and wms.warehouse.name like concat('%',#{search},'%')</when>
|
||||||
<when test="searchn == 1"> activation = 1 and product.name like concat('%',#{search},'%') </when>
|
<when test="searchn == 1"> wms.stock.activation = 1 and wms.product.name like concat('%',#{search},'%') </when>
|
||||||
</choose>
|
</choose>
|
||||||
</where>
|
</where>
|
||||||
order by id desc limit #{start}, #{perPage}
|
order by id desc limit #{start}, #{perPage}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="stockList" parameterType="map" resultType="com.no1.wms.stock.StockDto">
|
<select id="list" parameterType="map" resultType="com.no1.wms.stock.StockDto">
|
||||||
select * from wms.stock left join wms.warehouse on wms.stock.warehouse_id = wms.warehouse.id left join wms.product on wms.stock.product_id = wms.product.id
|
select * from wms.stock left join wms.warehouse on wms.stock.warehouse_id = wms.warehouse.id left join wms.product on wms.stock.product_id = wms.product.id
|
||||||
<where>
|
<where>
|
||||||
<choose>
|
<choose>
|
||||||
<when test="searchn == 0"> activation = 1 and warehouse.name like concat('%',#{search},'%')</when>
|
<when test="searchn == 0"> wms.stock.activation = 1 and wms.warehouse.name like concat('%',#{search},'%')</when>
|
||||||
<when test="searchn == 1"> activation = 1 and product.name like concat('%',#{search},'%') </when>
|
<when test="searchn == 1"> wms.stock.activation = 1 and wms.product.name like concat('%',#{search},'%') </when>
|
||||||
</choose>
|
</choose>
|
||||||
</where>
|
</where>
|
||||||
order by id desc limit #{start}, #{perPage}
|
order by id desc limit #{start}, #{perPage}
|
||||||
|
|||||||
103
src/main/webapp/WEB-INF/views/stock/list.jsp
Normal file
103
src/main/webapp/WEB-INF/views/stock/list.jsp
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
<%@ page contentType="text/html; charset=UTF-8"%>
|
||||||
|
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>재고 리스트</title>
|
||||||
|
<style type="text/css">
|
||||||
|
.header {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="header">
|
||||||
|
<h1>재고 리스트</h1>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<script>
|
||||||
|
/*
|
||||||
|
yes no 모달의 확인 버튼을 누를때 재정의할 function
|
||||||
|
|
||||||
|
yesNoModal.yesFunction = myYesFunction;
|
||||||
|
function myYesFunction(){
|
||||||
|
alert("재정의 됨");
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
$(function(){
|
||||||
|
$('.tabcontent > div').hide();
|
||||||
|
$('.tabnav a').click(function () {
|
||||||
|
$('.tabcontent > div').hide().filter(this.hash).fadeIn();
|
||||||
|
$('.tabnav a').removeClass('active');
|
||||||
|
$(this).addClass('active');
|
||||||
|
return false;
|
||||||
|
}).filter(':eq(0)').click();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
여기다가 화면 만들기
|
||||||
|
<!--탭키명 -->
|
||||||
|
<div class="tab">
|
||||||
|
<ul class="tabnav">
|
||||||
|
<li><a href="#tab01">재고</a></li>
|
||||||
|
<li><a href="#tab02">부족한재고</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<!--탭키 내용-->
|
||||||
|
<div class="tabcontent">
|
||||||
|
|
||||||
|
<!--재고 탭 내용-->
|
||||||
|
<div id="tab01">
|
||||||
|
<div id="search" align="center">
|
||||||
|
<form action="search">
|
||||||
|
<select name="searchn">
|
||||||
|
<option value="0">창고명</option>
|
||||||
|
<option value="1">제품명</option>
|
||||||
|
</select>
|
||||||
|
<input type="text" name="search" maxlength="50"/>
|
||||||
|
<input type="submit" class="btn btn-primary" value="검색" />
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!--재고 리스트 -->
|
||||||
|
<c:if test="${count != 0 }">
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th>번호</th>
|
||||||
|
<th>제품명</th>
|
||||||
|
<th>창고명</th>
|
||||||
|
</tr>
|
||||||
|
<c:forEach items="${list}" var="stock">
|
||||||
|
<tr>
|
||||||
|
<td><a href ="read/${stock.id}">${stock.stock.id}</a></td>
|
||||||
|
<td>${stock.product.name }</td>
|
||||||
|
<td>${stock.warehouse.name }</td>
|
||||||
|
</tr>
|
||||||
|
</c:forEach>
|
||||||
|
</table>
|
||||||
|
<div id="page">
|
||||||
|
<c:if test="${begin > pageNum }">
|
||||||
|
<a href="list?p=${begin-1 }">[이전]</a>
|
||||||
|
</c:if>
|
||||||
|
<c:forEach begin="${begin }" end="${end}" var="i">
|
||||||
|
<a href="list?p=${i}">${i}</a>
|
||||||
|
</c:forEach>
|
||||||
|
<c:if test="${end < totalPages }">
|
||||||
|
<a href="list?p=${end+1}">[다음]</a>
|
||||||
|
</c:if>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</c:if>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!--부족한재고 탭 내용-->
|
||||||
|
<div id="tab02">
|
||||||
|
tab2 content
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user