add Stock

This commit is contained in:
sungsu
2024-01-04 12:10:41 +09:00
parent 066ec4a711
commit 0bbff1a007
5 changed files with 113 additions and 1 deletions

View File

@@ -1,7 +1,41 @@
package com.no1.wms.stock;
import java.util.List;
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.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
public class StockController {
@Autowired
StockService service;
// 재고 리스트 출력
@GetMapping("stock/list")
public String list(@RequestParam(name = "p", defaultValue = "1")int p, Model m) {
//스톡서비스로 재고 리스트 출력 메서트 작성
List<StockDto> dto = service.stockList(p);
m.addAttribute("list", dto);
return "stock/list";
}
// 재고 상세페이지
@PostMapping("stock/read/{id}")
@ResponseBody
public String read(@PathVariable String id, Model m) {
//스톡서비스로 재고 상세페이지 출력 메서드 작성
StockDto dto = service.
}
}

View File

@@ -0,0 +1,13 @@
package com.no1.wms.stock;
import lombok.Data;
@Data
public class StockDto {
private int id;
private int warehouse_id;
private int product_id;
private int quantity;
private boolean activation;
}

View File

@@ -0,0 +1,13 @@
package com.no1.wms.stock;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface StockMapper {
List<StockDto> stockList(Map<String, Object> m);
}

View File

@@ -0,0 +1,30 @@
package com.no1.wms.stock;
import java.io.Console;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class StockService {
@Autowired
StockMapper mapper;
public List<StockDto> stockList(int p){
int start = 0;
int end = 0;
Map m = new HashMap<String, Object>();
m.put("start", start);
m.put("end", end);
return mapper.stockList(m);
}
}

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!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">
<!-- select -->
<select id="stockList" parameterType="map" resultType="com.no1.wms.stock.StockDto">
select * from stock product warehouse
<where>
<choose>
<when test="searchn == 0"> name like ('%',#{search},'%')</when>
<when test="searchn == 1"> content like concat('%',#{search},'%') </when>
</choose>
</where>
order by id desc limit #{start}, #{count}
</select>
<!-- select -->
</mapper>