Пример #1
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);
 }
Пример #2
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);
 }
Пример #3
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());
 }