예제 #1
0
  @Request.Post("/product/search")
  public View search(Params params) {
    int pageNumber = params.getInt(Constant.PAGE_NUMBER);
    int pageSize = params.getInt(Constant.PAGE_SIZE);
    String name = params.getString("name");

    Pager<ProductBean> productBeanPager =
        productService.getProductBeanPager(pageNumber, pageSize, name);
    return new View("product_list.jsp").data("productBeanPager", productBeanPager);
  }
예제 #2
0
 @HasRoles("admin")
 @Request.Put("/product/update/{id}")
 public Result update(long id, Params params) {
   Map<String, Object> fieldMap = params.getFieldMap();
   boolean success = productService.updateProduct(id, fieldMap, null);
   return new Result(success);
 }
예제 #3
0
 @HasPermissions("product.create")
 @Request.Post("/product/create")
 public Result create(Params params, Multiparts multiparts) {
   Map<String, Object> fieldMap = params.getFieldMap();
   Multipart multipart = multiparts.getOne();
   boolean success = productService.createProduct(fieldMap, multipart);
   return new Result(success);
 }
예제 #4
0
 @HasRoles("admin")
 @Request.Post("/product/upload_picture/{id}")
 public Result uploadPicture(long id, Params params, Multiparts multiparts) {
   Map<String, Object> fieldMap = params.getFieldMap();
   Multipart multipart = multiparts.getOne();
   boolean success = productService.updateProduct(id, fieldMap, multipart);
   return new Result(success).data(multipart.getFileName());
 }