com.macro.mall.model.PmsProduct Java Examples

The following examples show how to use com.macro.mall.model.PmsProduct. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PmsBrandServiceImpl.java    From macrozheng with Apache License 2.0 6 votes vote down vote up
@Override
public int updateBrand(Long id, PmsBrandParam pmsBrandParam) {
    PmsBrand pmsBrand = new PmsBrand();
    BeanUtils.copyProperties(pmsBrandParam, pmsBrand);
    pmsBrand.setId(id);
    //如果创建时首字母为空,取名称的第一个为首字母
    if (StringUtils.isEmpty(pmsBrand.getFirstLetter())) {
        pmsBrand.setFirstLetter(pmsBrand.getName().substring(0, 1));
    }
    //更新品牌时要更新商品中的品牌名称
    PmsProduct product = new PmsProduct();
    product.setBrandName(pmsBrand.getName());
    PmsProductExample example = new PmsProductExample();
    example.createCriteria().andBrandIdEqualTo(id);
    productMapper.updateByExampleSelective(product,example);
    return brandMapper.updateByPrimaryKeySelective(pmsBrand);
}
 
Example #2
Source File: PmsBrandServiceImpl.java    From mall with Apache License 2.0 6 votes vote down vote up
@Override
public int updateBrand(Long id, PmsBrandParam pmsBrandParam) {
    PmsBrand pmsBrand = new PmsBrand();
    BeanUtils.copyProperties(pmsBrandParam, pmsBrand);
    pmsBrand.setId(id);
    //如果创建时首字母为空,取名称的第一个为首字母
    if (StringUtils.isEmpty(pmsBrand.getFirstLetter())) {
        pmsBrand.setFirstLetter(pmsBrand.getName().substring(0, 1));
    }
    //更新品牌时要更新商品中的品牌名称
    PmsProduct product = new PmsProduct();
    product.setBrandName(pmsBrand.getName());
    PmsProductExample example = new PmsProductExample();
    example.createCriteria().andBrandIdEqualTo(id);
    productMapper.updateByExampleSelective(product,example);
    return brandMapper.updateByPrimaryKeySelective(pmsBrand);
}
 
Example #3
Source File: PmsBrandServiceImpl.java    From macrozheng-mall with MIT License 6 votes vote down vote up
@Override
public int updateBrand(Long id, PmsBrandParam pmsBrandParam) {
    PmsBrand pmsBrand = new PmsBrand();
    BeanUtils.copyProperties(pmsBrandParam, pmsBrand);
    pmsBrand.setId(id);
    //如果创建时首字母为空,取名称的第一个为首字母
    if (StringUtils.isEmpty(pmsBrand.getFirstLetter())) {
        pmsBrand.setFirstLetter(pmsBrand.getName().substring(0, 1));
    }
    //更新品牌时要更新商品中的品牌名称
    PmsProduct product = new PmsProduct();
    product.setBrandName(pmsBrand.getName());
    PmsProductExample example = new PmsProductExample();
    example.createCriteria().andBrandIdEqualTo(id);
    productMapper.updateByExampleSelective(product,example);
    return brandMapper.updateByPrimaryKeySelective(pmsBrand);
}
 
Example #4
Source File: MallDemoApplicationTests.java    From mall-swarm with Apache License 2.0 5 votes vote down vote up
@Test
public void testLogStash() throws Exception {
	ObjectMapper mapper = new ObjectMapper();
	PmsProduct product = new PmsProduct();
	product.setId(1L);
	product.setName("小米手机");
	product.setBrandName("小米");
	logger.info(mapper.writeValueAsString(product));
	logger.error(mapper.writeValueAsString(product));
}
 
Example #5
Source File: HomeController.java    From macrozheng with Apache License 2.0 5 votes vote down vote up
@ApiOperation("分页获取推荐商品")
@RequestMapping(value = "/recommendProductList", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<PmsProduct>> recommendProductList(@RequestParam(value = "pageSize", defaultValue = "4") Integer pageSize,
                                                           @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
    List<PmsProduct> productList = homeService.recommendProductList(pageSize, pageNum);
    return CommonResult.success(productList);
}
 
Example #6
Source File: PmsProductController.java    From mall with Apache License 2.0 5 votes vote down vote up
@ApiOperation("查询商品")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<PmsProduct>> getList(PmsProductQueryParam productQueryParam,
                                                    @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
                                                    @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
    List<PmsProduct> productList = productService.list(productQueryParam, pageSize, pageNum);
    return CommonResult.success(CommonPage.restPage(productList));
}
 
Example #7
Source File: PmsProductController.java    From mall with Apache License 2.0 5 votes vote down vote up
@ApiOperation("根据商品名称或货号模糊查询")
@RequestMapping(value = "/simpleList", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<PmsProduct>> getList(String keyword) {
    List<PmsProduct> productList = productService.list(keyword);
    return CommonResult.success(productList);
}
 
Example #8
Source File: MallDemoApplicationTests.java    From macrozheng with Apache License 2.0 5 votes vote down vote up
@Test
public void testLogStash() throws Exception {
	ObjectMapper mapper = new ObjectMapper();
	PmsProduct product = new PmsProduct();
	product.setId(1L);
	product.setName("小米手机");
	product.setBrandName("小米");
	logger.info(mapper.writeValueAsString(product));
	logger.error(mapper.writeValueAsString(product));
}
 
Example #9
Source File: PmsProductController.java    From macrozheng-mall with MIT License 5 votes vote down vote up
@ApiOperation("查询商品")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
@PreAuthorize("hasAuthority('pms:product:read')")
public Object getList(PmsProductQueryParam productQueryParam,
                   @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
                   @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
    List<PmsProduct> productList = productService.list(productQueryParam, pageSize, pageNum);
    return new CommonResult().pageSuccess(productList);
}
 
Example #10
Source File: PmsProductController.java    From macrozheng-mall with MIT License 5 votes vote down vote up
@ApiOperation("根据商品名称或货号模糊查询")
@RequestMapping(value = "/simpleList", method = RequestMethod.GET)
@ResponseBody
public Object getList(String  keyword) {
    List<PmsProduct> productList = productService.list(keyword);
    return new CommonResult().success(productList);
}
 
Example #11
Source File: PmsProductController.java    From mall-swarm with Apache License 2.0 5 votes vote down vote up
@ApiOperation("根据商品名称或货号模糊查询")
@RequestMapping(value = "/simpleList", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<PmsProduct>> getList(String keyword) {
    List<PmsProduct> productList = productService.list(keyword);
    return CommonResult.success(productList);
}
 
Example #12
Source File: PmsProductController.java    From mall-swarm with Apache License 2.0 5 votes vote down vote up
@ApiOperation("查询商品")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<PmsProduct>> getList(PmsProductQueryParam productQueryParam,
                                                    @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
                                                    @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
    List<PmsProduct> productList = productService.list(productQueryParam, pageSize, pageNum);
    return CommonResult.success(CommonPage.restPage(productList));
}
 
Example #13
Source File: PmsProductController.java    From macrozheng with Apache License 2.0 5 votes vote down vote up
@ApiOperation("根据商品名称或货号模糊查询")
@RequestMapping(value = "/simpleList", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<PmsProduct>> getList(String keyword) {
    List<PmsProduct> productList = productService.list(keyword);
    return CommonResult.success(productList);
}
 
Example #14
Source File: HomeController.java    From mall-swarm with Apache License 2.0 5 votes vote down vote up
@ApiOperation("分页获取推荐商品")
@RequestMapping(value = "/recommendProductList", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<PmsProduct>> recommendProductList(@RequestParam(value = "pageSize", defaultValue = "4") Integer pageSize,
                                                           @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
    List<PmsProduct> productList = homeService.recommendProductList(pageSize, pageNum);
    return CommonResult.success(productList);
}
 
Example #15
Source File: MallDemoApplicationTests.java    From macrozheng-mall with MIT License 5 votes vote down vote up
@Test
public void testLogStash() throws Exception {
	ObjectMapper mapper = new ObjectMapper();
	PmsProduct product = new PmsProduct();
	product.setId(1L);
	product.setName("小米手机");
	product.setBrandName("小米");
	logger.info(mapper.writeValueAsString(product));
	logger.error(mapper.writeValueAsString(product));
}
 
Example #16
Source File: MallDemoApplicationTests.java    From mall with Apache License 2.0 5 votes vote down vote up
@Test
public void testLogStash() throws Exception {
	ObjectMapper mapper = new ObjectMapper();
	PmsProduct product = new PmsProduct();
	product.setId(1L);
	product.setName("小米手机");
	product.setBrandName("小米");
	logger.info(mapper.writeValueAsString(product));
	logger.error(mapper.writeValueAsString(product));
}
 
Example #17
Source File: PortalBrandController.java    From mall with Apache License 2.0 5 votes vote down vote up
@ApiOperation("分页获取品牌相关商品")
@RequestMapping(value = "/productList", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<PmsProduct>> productList(@RequestParam Long brandId,
                                                        @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                                        @RequestParam(value = "pageSize", defaultValue = "6") Integer pageSize) {
    CommonPage<PmsProduct> result = homeBrandService.productList(brandId,pageNum, pageSize);
    return CommonResult.success(result);
}
 
Example #18
Source File: PmsPortalProductController.java    From mall with Apache License 2.0 5 votes vote down vote up
@ApiOperation(value = "综合搜索、筛选、排序")
@ApiImplicitParam(name = "sort", value = "排序字段:0->按相关度;1->按新品;2->按销量;3->价格从低到高;4->价格从高到低",
        defaultValue = "0", allowableValues = "0,1,2,3,4", paramType = "query", dataType = "integer")
@RequestMapping(value = "/search", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<PmsProduct>> search(@RequestParam(required = false) String keyword,
                                                   @RequestParam(required = false) Long brandId,
                                                   @RequestParam(required = false) Long productCategoryId,
                                                   @RequestParam(required = false, defaultValue = "0") Integer pageNum,
                                                   @RequestParam(required = false, defaultValue = "5") Integer pageSize,
                                                   @RequestParam(required = false, defaultValue = "0") Integer sort) {
    List<PmsProduct> productList = portalProductService.search(keyword, brandId, productCategoryId, pageNum, pageSize, sort);
    return CommonResult.success(CommonPage.restPage(productList));
}
 
Example #19
Source File: HomeController.java    From mall with Apache License 2.0 5 votes vote down vote up
@ApiOperation("分页获取新品推荐商品")
@RequestMapping(value = "/newProductList", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<PmsProduct>> newProductList(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                                     @RequestParam(value = "pageSize", defaultValue = "6") Integer pageSize) {
    List<PmsProduct> productList = homeService.newProductList(pageNum,pageSize);
    return CommonResult.success(productList);
}
 
Example #20
Source File: HomeController.java    From mall with Apache License 2.0 5 votes vote down vote up
@ApiOperation("分页获取推荐商品")
@RequestMapping(value = "/recommendProductList", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<PmsProduct>> recommendProductList(@RequestParam(value = "pageSize", defaultValue = "4") Integer pageSize,
                                                           @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
    List<PmsProduct> productList = homeService.recommendProductList(pageSize, pageNum);
    return CommonResult.success(productList);
}
 
Example #21
Source File: HomeDao.java    From mall-swarm with Apache License 2.0 2 votes vote down vote up
/**
 * 获取人气推荐
 */
List<PmsProduct> getHotProductList(@Param("offset") Integer offset,@Param("limit") Integer limit);
 
Example #22
Source File: PmsProductService.java    From macrozheng-mall with MIT License 2 votes vote down vote up
/**
 * 分页查询商品
 */
List<PmsProduct> list(PmsProductQueryParam productQueryParam, Integer pageSize, Integer pageNum);
 
Example #23
Source File: HomeDao.java    From mall with Apache License 2.0 2 votes vote down vote up
/**
 * 获取人气推荐
 */
List<PmsProduct> getHotProductList(@Param("offset") Integer offset,@Param("limit") Integer limit);
 
Example #24
Source File: HomeDao.java    From mall with Apache License 2.0 2 votes vote down vote up
/**
 * 获取新品推荐
 */
List<PmsProduct> getNewProductList(@Param("offset") Integer offset,@Param("limit") Integer limit);
 
Example #25
Source File: PortalBrandService.java    From mall with Apache License 2.0 2 votes vote down vote up
/**
 * 分页获取品牌关联商品
 */
CommonPage<PmsProduct> productList(Long brandId, Integer pageNum, Integer pageSize);
 
Example #26
Source File: HomeDao.java    From macrozheng with Apache License 2.0 2 votes vote down vote up
/**
 * 获取新品推荐
 */
List<PmsProduct> getNewProductList(@Param("offset") Integer offset,@Param("limit") Integer limit);
 
Example #27
Source File: HomeService.java    From macrozheng with Apache License 2.0 2 votes vote down vote up
/**
 * 首页商品推荐
 */
List<PmsProduct> recommendProductList(Integer pageSize, Integer pageNum);
 
Example #28
Source File: PmsProductService.java    From macrozheng with Apache License 2.0 2 votes vote down vote up
/**
 * 根据商品名称或者货号模糊查询
 */
List<PmsProduct> list(String keyword);
 
Example #29
Source File: PmsProductService.java    From macrozheng with Apache License 2.0 2 votes vote down vote up
/**
 * 分页查询商品
 */
List<PmsProduct> list(PmsProductQueryParam productQueryParam, Integer pageSize, Integer pageNum);
 
Example #30
Source File: PmsProductService.java    From macrozheng-mall with MIT License 2 votes vote down vote up
/**
 * 根据商品名称或者货号模糊查询
 */
List<PmsProduct> list(String keyword);