mirror of
https://github.com/suhf/No1WMS.git
synced 2026-02-04 19:54:00 +09:00
Merge branch 'master' of https://github.com/suhf/No1WMS.git
This commit is contained in:
@@ -1,20 +1,12 @@
|
||||
package com.no1.wms.stock;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
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.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.no1.wms.stock.StockDto;
|
||||
import java.util.List;
|
||||
|
||||
@Controller
|
||||
@Slf4j
|
||||
@@ -34,7 +26,7 @@ public class StockController {
|
||||
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);
|
||||
|
||||
int pageNum = 4;//보여질 페이지 번호 수
|
||||
@@ -56,7 +48,7 @@ public class StockController {
|
||||
|
||||
// 재고 상세페이지
|
||||
@PostMapping("stock/read/{id}")
|
||||
public String read(@PathVariable UUID id, Model m) {
|
||||
public String read(@PathVariable String id, Model m) {
|
||||
//스톡서비스로 재고 상세페이지 출력 메서드 작성
|
||||
StockDto dto = service.stockOne(id);
|
||||
m.addAttribute("dto", dto);
|
||||
@@ -66,10 +58,44 @@ public class StockController {
|
||||
|
||||
// 수정 - 폼
|
||||
@GetMapping("/stock/update/{id}")
|
||||
public String update(@PathVariable UUID id, Model m) {
|
||||
// StockDto dto = service.updateStock();
|
||||
// m.addAttribute("dto", dto);
|
||||
public String update(@PathVariable String id, Model m) {
|
||||
StockDto dto = service.stockOne(id);
|
||||
m.addAttribute("dto", dto);
|
||||
return "stock/update";
|
||||
}
|
||||
|
||||
|
||||
// 수정 프로세스
|
||||
@PutMapping("/board/update_process")
|
||||
@ResponseBody
|
||||
public String updateProcess(StockDto dto) {
|
||||
service.updateStock(dto);
|
||||
return "redirect:list";
|
||||
}
|
||||
|
||||
|
||||
// 생성 폼
|
||||
@PostMapping("/stock/create")
|
||||
public String create()
|
||||
{
|
||||
return "stock/create";
|
||||
}
|
||||
|
||||
|
||||
// 생성 프로세스
|
||||
@PostMapping("/stock/create_process")
|
||||
@ResponseBody
|
||||
public String createProcess(StockDto dto) {
|
||||
service.createStock(dto);
|
||||
return "redirect:list";// 글목록
|
||||
}
|
||||
|
||||
|
||||
// 삭제
|
||||
@DeleteMapping("/stock/delete")
|
||||
@ResponseBody
|
||||
public int delete(String id) {
|
||||
int i = service.deleteBoard(id);
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
package com.no1.wms.stock;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class StockDto {
|
||||
|
||||
private UUID id;
|
||||
private String id;
|
||||
private int warehouse_id;
|
||||
private int product_id;
|
||||
private int quantity;
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
package com.no1.wms.stock;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
|
||||
@Mapper
|
||||
@@ -18,7 +17,10 @@ public interface StockMapper {
|
||||
|
||||
int createStock(StockDto dto);
|
||||
|
||||
StockDto stockOne(UUID id);
|
||||
StockDto stockOne(String id);
|
||||
|
||||
int deleteStock(String id);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
package com.no1.wms.stock;
|
||||
|
||||
import java.io.Console;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class StockService {
|
||||
@Autowired
|
||||
@@ -25,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);
|
||||
|
||||
@@ -40,7 +38,7 @@ public class StockService {
|
||||
}
|
||||
|
||||
|
||||
public StockDto stockOne(UUID id) {
|
||||
public StockDto stockOne(String id) {
|
||||
return mapper.stockOne(id);
|
||||
}
|
||||
|
||||
@@ -53,4 +51,9 @@ public class StockService {
|
||||
public int updateStock(StockDto dto) {
|
||||
return mapper.updateStock(dto);
|
||||
}
|
||||
|
||||
|
||||
public int deleteBoard(String id) {
|
||||
return mapper.deleteStock(id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,32 +2,32 @@
|
||||
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTO Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.no1.wms.stock.StockMapper">
|
||||
<mapper namespace="com.no1.wms.authority.StockMapper">
|
||||
|
||||
<!-- select -->
|
||||
<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
|
||||
<where>
|
||||
<choose>
|
||||
<when test="searchn == 0"> activation = 1 and warehouse.name like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 1"> activation = 1 and product.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"> wms.stock.activation = 1 and wms.product.name like concat('%',#{search},'%') </when>
|
||||
</choose>
|
||||
</where>
|
||||
order by id desc limit #{start}, #{perPage}
|
||||
</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
|
||||
<where>
|
||||
<choose>
|
||||
<when test="searchn == 0"> activation = 1 and warehouse.name like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 1"> activation = 1 and product.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"> wms.stock.activation = 1 and wms.product.name like concat('%',#{search},'%') </when>
|
||||
</choose>
|
||||
</where>
|
||||
order by id desc limit #{start}, #{perPage}
|
||||
</select>
|
||||
|
||||
<select id="stockOne" parameterType="java.util.UUID" resultType="com.no1.wms.stock.StockDto">
|
||||
<select id="stockOne" parameterType="String" resultType="com.no1.wms.stock.StockDto">
|
||||
selct * from stock where id = #{id}
|
||||
</select>
|
||||
<!-- select -->
|
||||
@@ -44,8 +44,14 @@
|
||||
|
||||
<!-- insert -->
|
||||
<insert id="createStock" parameterType="com.no1.wms.stock.StockDto">
|
||||
insert into stock (id, quantity, activation)
|
||||
values (#{dto.id}, #{dto.quantity}, 1)
|
||||
insert into stock (id, warehouse_id, product_id, quantity, activation)
|
||||
values (#{dto.id}, #{dto.warehouse_id}, #{dto.product_id}, #{dto.quantity}, 1)
|
||||
</insert>
|
||||
<!-- insert -->
|
||||
|
||||
<!-- delete -->
|
||||
<delete id="deleteStock" parameterType="String">
|
||||
delete from stock where no = #{id}
|
||||
</delete>
|
||||
<!-- delete -->
|
||||
</mapper>
|
||||
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