コード例 #1
0
 /* 商品发布 */
 @RequestMapping(value = "/provider/products", params = "form", method = RequestMethod.GET)
 public String create(Model uiModel) {
   Product p = new Product();
   p.setName("123456");
   uiModel.addAttribute("product", new Product());
   uiModel.addAttribute("brand", brandService.findAll());
   List<ProductCategory> pcs = productCategoryService.findAllFirstCategory(ActivateEnum.ACTIVATE);
   uiModel.addAttribute("pcs", pcs);
   return "user/provider/release";
 }
コード例 #2
0
 // 商品下架
 @RequestMapping(value = "/provider/products/{id}/{status}", method = RequestMethod.PUT)
 public String offProduct(
     @PathVariable("id") Long id,
     @PathVariable("status") String status,
     @SecurityUser SiteUser user,
     Model uiModel) {
   Product product = productService.findOneByUser(new Provider(user.getId()), id);
   if (product == null) throw new ProductNotFoundException();
   product.setOriginal(OriginalEnum.valueOf(status));
   product = productService.saveOne(product);
   uiModel.addAttribute("product", product);
   return "user/provider/maintaintd";
 }
コード例 #3
0
 @RequestMapping(value = "/provider/products", method = RequestMethod.POST, params = "form")
 public String createProcess(
     @Valid @ModelAttribute("product") Product product,
     BindingResult bindingResult,
     Model uiModel,
     @SecurityUser SiteUser user) {
   if (bindingResult.hasErrors()) {
     uiModel.addAttribute("product", product);
     System.out.println("hasErrors");
     return "user/provider/release";
   }
   product.setCreatedBy(new Provider(user.getId()));
   // product = productService.addOneProduct(product);
   uiModel.addAttribute("product", product);
   return "user/provider/release";
 }