@RequestMapping(value = "/product/html/list/{productId}") public void productHtmlDesc( @PathVariable("productId") int productId, HttpServletResponse response) throws IOException { HtmlDesc htmlDesc = productService.getHtmlDesc(productId); new JsonResult(true) .addData("totalCount", htmlDesc.getHtmlList().size()) .addData("result", htmlDesc.getHtmlList()) .toJson(response); }
@RequestMapping(value = "/product/html/new", method = RequestMethod.POST) public void crateHtmlDesc(Html html, HttpServletResponse response) throws IOException { try { HtmlDesc htmlDesc = productService.getHtmlDesc(html.getProductId()); if (htmlDesc.hasHtml(html.getName())) { new JsonResult(false, "名字重复了").toJson(response); return; } productService.createHtml(html); } catch (Exception e) { logger.error("商品管理的添加描述信息异常:" + e); new JsonResult(false, "添加描述信息出错").toJson(response); return; } new JsonResult(true).toJson(response); }