mirror of
https://github.com/suhf/No1WMS.git
synced 2026-02-05 12:13:33 +09:00
add product dto, mapper, mapper.xml, controller, service,
product.list.jsp, vendorDto, change category controller, mapper.xml, read.jsp
This commit is contained in:
@@ -98,16 +98,14 @@ public class CategoryController {
|
||||
}
|
||||
|
||||
// 삭제
|
||||
@DeleteMapping("/category/delete/{kan_code}")
|
||||
@DeleteMapping("/category/delete")
|
||||
@ResponseBody
|
||||
public int delete(@PathVariable String kan_code) {
|
||||
public boolean delete(String kan_code) {
|
||||
int i = categoryService.deactivateByKanCode(kan_code);
|
||||
if (i == 1) {
|
||||
return i;
|
||||
return true;
|
||||
} else {
|
||||
// ajax테스트후 결정
|
||||
// m.addAttribute("dto", dto);
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
28
src/main/java/com/no1/wms/product/ProductController.java
Normal file
28
src/main/java/com/no1/wms/product/ProductController.java
Normal file
@@ -0,0 +1,28 @@
|
||||
package com.no1.wms.product;
|
||||
|
||||
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.RequestParam;
|
||||
|
||||
@Controller
|
||||
public class ProductController {
|
||||
|
||||
@Autowired
|
||||
ProductService productservice;
|
||||
|
||||
@GetMapping("/product/list")
|
||||
public String list(@RequestParam(name = "p", defaultValue = "1") int p, Model m) {
|
||||
|
||||
// 서비스로 카테고리 목록 불러오는 메서드 작성
|
||||
List<ProductDto> dto = productservice.productList(p);
|
||||
m.addAttribute("list", dto);
|
||||
return "product/list";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
30
src/main/java/com/no1/wms/product/ProductDto.java
Normal file
30
src/main/java/com/no1/wms/product/ProductDto.java
Normal file
@@ -0,0 +1,30 @@
|
||||
package com.no1.wms.product;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.apache.ibatis.type.Alias;
|
||||
|
||||
import com.no1.wms.category.CategoryDto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@Alias("ProductDto")
|
||||
public class ProductDto {
|
||||
|
||||
private String id;
|
||||
private String name;
|
||||
private String company_name;
|
||||
private String kan_code;
|
||||
private String vendor_id;
|
||||
private Date registration_date;
|
||||
private String manager_id;
|
||||
private boolean activation;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
15
src/main/java/com/no1/wms/product/ProductMapper.java
Normal file
15
src/main/java/com/no1/wms/product/ProductMapper.java
Normal file
@@ -0,0 +1,15 @@
|
||||
package com.no1.wms.product;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface ProductMapper {
|
||||
|
||||
List<ProductDto> productList(Map<String, Object> m);
|
||||
|
||||
|
||||
|
||||
}
|
||||
29
src/main/java/com/no1/wms/product/ProductService.java
Normal file
29
src/main/java/com/no1/wms/product/ProductService.java
Normal file
@@ -0,0 +1,29 @@
|
||||
package com.no1.wms.product;
|
||||
|
||||
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 ProductService {
|
||||
|
||||
@Autowired
|
||||
ProductMapper mapper;
|
||||
|
||||
public List<ProductDto> productList(int p){
|
||||
//페이징 완료되면 수정해야함.
|
||||
|
||||
int start = 0;
|
||||
int count = 10;
|
||||
|
||||
Map m = new HashMap<String, Object>();
|
||||
m.put("start", start);
|
||||
m.put("count", count);
|
||||
|
||||
return mapper.productList(m);
|
||||
}
|
||||
|
||||
}
|
||||
25
src/main/java/com/no1/wms/vendor/VendorDto.java
vendored
Normal file
25
src/main/java/com/no1/wms/vendor/VendorDto.java
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
package com.no1.wms.vendor;
|
||||
|
||||
import org.apache.ibatis.type.Alias;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@Alias("VendorDto")
|
||||
public class VendorDto {
|
||||
|
||||
private String id;
|
||||
private String name;
|
||||
private String president_name;
|
||||
private String address;
|
||||
private String registration_number;
|
||||
private String email;
|
||||
private String president_telephone;
|
||||
private String vendor_manager;
|
||||
private String vendor_manager_telephone;
|
||||
private String main_product;
|
||||
private String manager_id;
|
||||
private boolean activation;
|
||||
}
|
||||
Reference in New Issue
Block a user