Esempio n. 1
0
  /**
   * autocomplate mf
   *
   * @param keyword
   * @param cateId
   * @return
   */
  @RequestMapping(value = "/searchmf", method = RequestMethod.GET)
  @ResponseBody
  public Response searchmf(
      @RequestParam(value = "keyword", defaultValue = "") String keyword,
      @RequestParam(value = "cateId", defaultValue = "") String cateId) {

    ManufacturerSearch search = new ManufacturerSearch();
    search.setName(keyword.trim());
    if (cateId != null && !"".equals(cateId.trim()) && !"0".equals(cateId.trim())) {
      search.setCategoryId(cateId);
    }

    search.setPageIndex(0);
    search.setPageSize(100);
    DataPage<Manufacturer> dataPage = manufacturerService.search(search);
    return new Response(true, "Danh sách thương hiệu", dataPage);
  }
Esempio n. 2
0
 /**
  * service Lấy danh sách thương hiệu theo mã danh mục sản phẩm
  *
  * @param id
  * @param manufacturerId
  * @param manufacturerName
  * @param pageIndex
  * @param pageSize
  * @return
  */
 @ResponseBody
 @RequestMapping(value = "/viewmanufacturer", method = RequestMethod.GET)
 public Response viewManuFacturerByIdCategory(
     @RequestParam(value = "id", defaultValue = "") String id,
     @RequestParam(value = "manufacturerId", defaultValue = "") String manufacturerId,
     @RequestParam(value = "manufacturerName", defaultValue = "") String manufacturerName,
     @RequestParam(value = "pageIndex", defaultValue = "0") int pageIndex,
     @RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
   ManufacturerSearch manufacturerSearch = new ManufacturerSearch();
   manufacturerSearch.setCategoryId(id);
   manufacturerSearch.setManufacturerId(manufacturerId);
   if (pageIndex == 0) {
     manufacturerSearch.setPageIndex(pageIndex);
   } else {
     manufacturerSearch.setPageIndex(pageIndex - 1);
   }
   manufacturerSearch.setPageSize(pageSize);
   if (!manufacturerName.equals("")) {
     manufacturerSearch.setName(manufacturerName);
   }
   return new Response(true, "Load thành công", manufacturerService.search(manufacturerSearch));
 }