mirror of
https://github.com/suhf/No1WMS.git
synced 2026-02-05 04:03:45 +09:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -158,7 +158,8 @@ public class CategoryController {
|
||||
return checkkan;
|
||||
}
|
||||
|
||||
@PostMapping("/category/categorysearch")
|
||||
//카테고리 검색 모달
|
||||
@GetMapping("/category/categorysearch")
|
||||
public String categorySearch(@RequestParam(name = "searchn", defaultValue = "4") int searchn,
|
||||
@RequestParam(name = "search", defaultValue = "") String search,
|
||||
@RequestParam(name = "p", defaultValue = "1") int page, Model m) {
|
||||
@@ -181,6 +182,8 @@ public class CategoryController {
|
||||
if (end > totalPages) {
|
||||
end = totalPages;
|
||||
}
|
||||
m.addAttribute("searchn",searchn);
|
||||
m.addAttribute("search",search);
|
||||
m.addAttribute("begin", begin);
|
||||
m.addAttribute("end", end);
|
||||
m.addAttribute("pageNum", pageNum);
|
||||
|
||||
91
src/main/java/com/no1/wms/price/PriceController.java
Normal file
91
src/main/java/com/no1/wms/price/PriceController.java
Normal file
@@ -0,0 +1,91 @@
|
||||
package com.no1.wms.price;
|
||||
|
||||
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.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.no1.wms.category.CategoryDto;
|
||||
|
||||
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/price")
|
||||
public class PriceController {
|
||||
|
||||
@Autowired
|
||||
PriceService priceService;
|
||||
|
||||
@GetMapping("/list")
|
||||
public String list(@RequestParam(name = "searchn", defaultValue = "0") int searchn,
|
||||
@RequestParam(name = "search", defaultValue = "") String search,
|
||||
@RequestParam(name = "p", defaultValue = "1") int page, Model m) {
|
||||
|
||||
int count = priceService.count(searchn, search);
|
||||
|
||||
int perPage = 15; // 한 페이지에 보일 글의 개수
|
||||
int startRow = (page - 1) * perPage;
|
||||
|
||||
List<PriceDto> dto = priceService.priceList2(searchn, search, startRow ,perPage);
|
||||
|
||||
m.addAttribute("list", dto);
|
||||
m.addAttribute("start", startRow + 1);
|
||||
|
||||
int pageNum = 5;//보여질 페이지 번호 수
|
||||
int totalPages = count / perPage + (count % perPage > 0 ? 1 : 0); // 전체 페이지 수
|
||||
|
||||
int begin = (page - 1) / pageNum * pageNum + 1;
|
||||
int end = begin + pageNum - 1;
|
||||
if (end > totalPages) {
|
||||
end = totalPages;
|
||||
}
|
||||
|
||||
m.addAttribute("searchn",searchn);
|
||||
m.addAttribute("search",search);
|
||||
m.addAttribute("begin", begin);
|
||||
m.addAttribute("end", end);
|
||||
m.addAttribute("pageNum", pageNum);
|
||||
m.addAttribute("totalPages", totalPages);
|
||||
m.addAttribute("p" , page);
|
||||
|
||||
|
||||
|
||||
return "/price/list";
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 생성 - 폼
|
||||
@PostMapping("/create")
|
||||
public String create() {
|
||||
return "price/create";
|
||||
}
|
||||
|
||||
|
||||
// 생성 - Ajax
|
||||
@PostMapping("/price/create_process")
|
||||
@ResponseBody
|
||||
public boolean createProcess(PriceDto dto) {
|
||||
int i = priceService.createProcess(dto);
|
||||
if (i == 1) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
32
src/main/java/com/no1/wms/price/PriceDto.java
Normal file
32
src/main/java/com/no1/wms/price/PriceDto.java
Normal file
@@ -0,0 +1,32 @@
|
||||
package com.no1.wms.price;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.apache.ibatis.type.Alias;
|
||||
|
||||
import com.no1.wms.account.AccountDto;
|
||||
import com.no1.wms.product.ProductDto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Alias("PriceDto")
|
||||
public class PriceDto {
|
||||
|
||||
private String id;//id
|
||||
private String price;//가격
|
||||
private Date registration_date;//등록날짜
|
||||
private String manager_id;//담당자
|
||||
private String product_id; //제품 아이디
|
||||
private boolean activation;//활성화
|
||||
|
||||
private ProductDto productDto;
|
||||
private AccountDto accountDto;
|
||||
|
||||
}
|
||||
17
src/main/java/com/no1/wms/price/PriceMapper.java
Normal file
17
src/main/java/com/no1/wms/price/PriceMapper.java
Normal file
@@ -0,0 +1,17 @@
|
||||
package com.no1.wms.price;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import com.no1.wms.category.CategoryDto;
|
||||
|
||||
@Mapper
|
||||
public interface PriceMapper {
|
||||
|
||||
List<PriceDto> priceList(Map<String, Object> m);
|
||||
int count(Map<String, Object> m);//카운터
|
||||
List<PriceDto> priceList2(Map<String, Object> m);//검색기능까지 포함
|
||||
int createProcess(PriceDto dto);
|
||||
}
|
||||
56
src/main/java/com/no1/wms/price/PriceService.java
Normal file
56
src/main/java/com/no1/wms/price/PriceService.java
Normal file
@@ -0,0 +1,56 @@
|
||||
package com.no1.wms.price;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.no1.wms.category.CategoryDto;
|
||||
import com.no1.wms.product.ProductDto;
|
||||
|
||||
@Service
|
||||
public class PriceService {
|
||||
|
||||
@Autowired
|
||||
PriceMapper mapper;
|
||||
|
||||
public List<PriceDto> priceList(int p){
|
||||
|
||||
int start = 0;
|
||||
int count = 10;
|
||||
|
||||
Map m = new HashMap<String, Object>();
|
||||
m.put("start", start);
|
||||
m.put("count", count);
|
||||
|
||||
return mapper.priceList(m);
|
||||
}
|
||||
|
||||
//페이징 카운터
|
||||
public int count(int searchn, String search) {
|
||||
|
||||
Map<String,Object> m = new HashMap<String, Object>();
|
||||
m.put("searchn",searchn);
|
||||
m.put("search", search);
|
||||
return mapper.count(m);
|
||||
}
|
||||
|
||||
public List<PriceDto> priceList2(int searchn, String search, int start, int perPage){
|
||||
|
||||
Map<String, Object> m = new HashMap<String, Object>();
|
||||
m.put("searchn",searchn);
|
||||
m.put("search", search);
|
||||
m.put("start", start);
|
||||
m.put("perPage", perPage);
|
||||
|
||||
return mapper.priceList2(m);
|
||||
}
|
||||
|
||||
public int createProcess(PriceDto dto) {
|
||||
return mapper.createProcess(dto);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -5,6 +5,7 @@ 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.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
@@ -12,18 +13,22 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.no1.wms.category.CategoryDto;
|
||||
import com.no1.wms.category.CategoryService;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/product")
|
||||
public class ProductController {
|
||||
|
||||
@Autowired
|
||||
ProductService productservice;
|
||||
ProductService productService;
|
||||
|
||||
|
||||
@GetMapping("list")
|
||||
public String list(@RequestParam(name = "p", defaultValue = "1") int p, Model m) {
|
||||
|
||||
// 서비스로 카테고리 목록 불러오는 메서드 작성
|
||||
List<ProductDto> dto = productservice.productList(p);
|
||||
List<ProductDto> dto = productService.productList(p);
|
||||
m.addAttribute("list", dto);
|
||||
return "/product/list";
|
||||
}
|
||||
@@ -38,7 +43,7 @@ public class ProductController {
|
||||
@PostMapping("/create_process")
|
||||
@ResponseBody
|
||||
public boolean createProcess(ProductDto dto) {
|
||||
int i = productservice.createProcess(dto);
|
||||
int i = productService.createProcess(dto);
|
||||
if (i == 1) {
|
||||
return true;
|
||||
} else {
|
||||
@@ -49,25 +54,23 @@ public class ProductController {
|
||||
// 상세페이지
|
||||
@PostMapping("/read")
|
||||
public String read(String id, Model m) {
|
||||
ProductDto dto = productservice.selectById(id);
|
||||
ProductDto dto = productService.selectById(id);
|
||||
m.addAttribute("dto", dto);
|
||||
return "product/read";
|
||||
}
|
||||
|
||||
// 수정 폼
|
||||
@PostMapping("/update")
|
||||
public String update(String id, Model m) {
|
||||
ProductDto dto = productservice.selectById(id);
|
||||
ProductDto dto = productService.selectById(id);
|
||||
m.addAttribute("dto", dto);
|
||||
return "product/update";
|
||||
}
|
||||
|
||||
// 수정 - Ajax
|
||||
@PutMapping("update_process")
|
||||
@PutMapping("/update_process")
|
||||
@ResponseBody
|
||||
public boolean update_process(ProductDto dto) {
|
||||
System.out.println(dto.getId());
|
||||
|
||||
int i = productservice.updateById(dto);
|
||||
int i = productService.updateById(dto);
|
||||
if (i == 1) {
|
||||
return true;
|
||||
} else {
|
||||
@@ -76,5 +79,33 @@ public class ProductController {
|
||||
}
|
||||
|
||||
|
||||
// 삭제
|
||||
@DeleteMapping("/delete")
|
||||
@ResponseBody
|
||||
public boolean delete(String id) {
|
||||
int i = productService.deactivateById(id);
|
||||
if(i == 1) {
|
||||
return true;
|
||||
}else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -12,4 +12,6 @@ public interface ProductMapper {
|
||||
int createProcess(ProductDto dto);
|
||||
ProductDto selectById(String id);
|
||||
int updateById(ProductDto dto);
|
||||
int deactivateById(String id);
|
||||
|
||||
}
|
||||
|
||||
@@ -38,4 +38,8 @@ public class ProductService {
|
||||
return mapper.updateById(dto);
|
||||
}
|
||||
|
||||
public int deactivateById(String id) {
|
||||
return mapper.deactivateById(id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ public class WarehouseController {
|
||||
|
||||
int count = service.count(searchn, search);
|
||||
|
||||
int perPage = 5; // 한 페이지에 보일 글의 갯수
|
||||
int perPage = 10; // 한 페이지에 보일 글의 갯수
|
||||
int startRow = (page - 1) * perPage;
|
||||
|
||||
//스톡서비스로 재고 리스트 출력 메서트 작성
|
||||
@@ -97,10 +97,10 @@ public class WarehouseController {
|
||||
|
||||
|
||||
// 수정 - 폼
|
||||
@GetMapping("/warehouse/update/{id}")
|
||||
public String update(@PathVariable String id, Model m) {
|
||||
@PostMapping("/warehouse/update")
|
||||
public String update(String id, Model m) {
|
||||
WarehouseDto dto = service.One(id);
|
||||
m.addAttribute("One", dto);
|
||||
m.addAttribute("dto", dto);
|
||||
return "warehouse/update";
|
||||
}
|
||||
|
||||
@@ -108,9 +108,14 @@ public class WarehouseController {
|
||||
// 수정 프로세스
|
||||
@PutMapping("/warehouse/update_process")
|
||||
@ResponseBody
|
||||
public String updateProcess(WarehouseDto dto) {
|
||||
service.updateWarehouse(dto);
|
||||
return "redirect:list";
|
||||
public boolean updateProcess(WarehouseDto dto) {
|
||||
|
||||
int i = service.updateWarehouse(dto);
|
||||
if (i == 1) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user