Beispiel #1
0
  /**
   * Lấy thông tin thuộc tính model theo id
   *
   * @param id
   * @return
   */
  @RequestMapping(value = "/getproperties", method = RequestMethod.GET)
  @ResponseBody
  public Response getProperties(@RequestParam(value = "id", defaultValue = "") String id)
      throws Exception {
    Model model = modelService.getModel(id);
    if (model == null) {
      throw new Exception("Model không tồn tại");
    }
    HashMap<String, Object> data = new HashMap<>();
    List<ModelProperty> properties = modelService.getProperties(id);
    data.put("model", model);
    data.put("properties", properties);
    data.put("categoryProperties", categoryService.getProperties(model.getCategoryId()));
    data.put(
        "categoryPropertyValues",
        categoryService.getPropertyValuesWithCategoryId(model.getCategoryId()));

    return new Response(true, "Thông tin model", data);
  }