Ejemplo n.º 1
0
  @RequestMapping(value = "/provider/products/{status}", method = RequestMethod.GET)
  public String productLists(
      Model uiModel,
      @RequestParam(value = "page", defaultValue = "1") int page,
      @RequestParam(value = "size", defaultValue = "15") int size,
      @SecurityUser SiteUser user,
      @PathVariable("status") String status) {
    System.out.println("user" + user.getId());
    Page<Product> products = null;
    if (status.equals(OriginalEnum.ALL.toString().toUpperCase())) {

      System.out.println("1");
      products =
          productService.findByUsers(
              new Provider(user.getId()),
              new PageRequest(page - 1, size, Direction.DESC, "createdTime"));
    } else {
      System.out.println("2");
      products =
          productService.findByUsers(
              new Provider(user.getId()),
              new PageRequest(page - 1, size, Direction.DESC, "createdTime"),
              OriginalEnum.fromString(status));
    }
    uiModel.addAttribute("lists", products);
    uiModel.addAttribute("status", OriginalEnum.fromString(status));
    return "user/provider/maintain";
  }
Ejemplo n.º 2
0
 @RequestMapping(value = "/provider/count", method = RequestMethod.GET)
 public String findCount(
     Model uiModel,
     @SecurityUser SiteUser user,
     @RequestParam(value = "page", defaultValue = "1") int page,
     @RequestParam(value = "size", defaultValue = "15") int size) {
   Page<Product> products =
       productService.findByUsers(
           new Provider(user.getId()),
           new PageRequest(page - 1, size, Direction.DESC, "createdTime"));
   uiModel.addAttribute("products", products);
   return "user/provider/count";
 }