add product dto, mapper, mapper.xml, controller, service,

product.list.jsp, vendorDto, change category controller, mapper.xml,
read.jsp
This commit is contained in:
Kana
2024-01-09 17:21:15 +09:00
parent cd726d6c42
commit 8d6174c39e
10 changed files with 346 additions and 10 deletions

View File

@@ -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;
}
}

View 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";
}
}

View 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;
}

View 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);
}

View 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);
}
}

View 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;
}