com.macro.mall.model.PmsBrand Java Examples

The following examples show how to use com.macro.mall.model.PmsBrand. 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-swarm 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: RestTemplateDemoController.java    From mall with Apache License 2.0 5 votes vote down vote up
@ApiOperation("postForEntity jsonBody")
@RequestMapping(value = "/post2", method = RequestMethod.POST)
@ResponseBody
public Object postForObject(@RequestBody PmsBrand brand) {
    String url = HOST_MALL_ADMIN + "/brand/create";
    CommonResult commonResult = restTemplate.postForObject(url, brand, CommonResult.class);
    return commonResult;
}
 
Example #5
Source File: PmsBrandServiceImpl.java    From macrozheng-mall with MIT License 5 votes vote down vote up
@Override
public int updateShowStatus(List<Long> ids, Integer showStatus) {
    PmsBrand pmsBrand = new PmsBrand();
    pmsBrand.setShowStatus(showStatus);
    PmsBrandExample pmsBrandExample = new PmsBrandExample();
    pmsBrandExample.createCriteria().andIdIn(ids);
    return brandMapper.updateByExampleSelective(pmsBrand, pmsBrandExample);
}
 
Example #6
Source File: PmsBrandServiceImpl.java    From macrozheng-mall with MIT License 5 votes vote down vote up
@Override
public int updateFactoryStatus(List<Long> ids, Integer factoryStatus) {
    PmsBrand pmsBrand = new PmsBrand();
    pmsBrand.setFactoryStatus(factoryStatus);
    PmsBrandExample pmsBrandExample = new PmsBrandExample();
    pmsBrandExample.createCriteria().andIdIn(ids);
    return brandMapper.updateByExampleSelective(pmsBrand, pmsBrandExample);
}
 
Example #7
Source File: PmsBrandController.java    From mall with Apache License 2.0 5 votes vote down vote up
@ApiOperation(value = "根据品牌名称分页获取品牌列表")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<PmsBrand>> getList(@RequestParam(value = "keyword", required = false) String keyword,
                                                  @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                                  @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize) {
    List<PmsBrand> brandList = brandService.listBrand(keyword, pageNum, pageSize);
    return CommonResult.success(CommonPage.restPage(brandList));
}
 
Example #8
Source File: PortalBrandController.java    From mall with Apache License 2.0 5 votes vote down vote up
@ApiOperation("获取品牌详情")
@RequestMapping(value = "/detail/{brandId}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<PmsBrand> detail(@PathVariable Long brandId) {
    PmsBrand brand = homeBrandService.detail(brandId);
    return CommonResult.success(brand);
}
 
Example #9
Source File: PmsBrandServiceImpl.java    From mall-swarm with Apache License 2.0 5 votes vote down vote up
@Override
public List<PmsBrand> listBrand(String keyword, int pageNum, int pageSize) {
    PageHelper.startPage(pageNum, pageSize);
    PmsBrandExample pmsBrandExample = new PmsBrandExample();
    pmsBrandExample.setOrderByClause("sort desc");
    PmsBrandExample.Criteria criteria = pmsBrandExample.createCriteria();
    if (!StringUtils.isEmpty(keyword)) {
        criteria.andNameLike("%" + keyword + "%");
    }
    return brandMapper.selectByExample(pmsBrandExample);
}
 
Example #10
Source File: PmsBrandServiceImpl.java    From mall-swarm with Apache License 2.0 5 votes vote down vote up
@Override
public int updateFactoryStatus(List<Long> ids, Integer factoryStatus) {
    PmsBrand pmsBrand = new PmsBrand();
    pmsBrand.setFactoryStatus(factoryStatus);
    PmsBrandExample pmsBrandExample = new PmsBrandExample();
    pmsBrandExample.createCriteria().andIdIn(ids);
    return brandMapper.updateByExampleSelective(pmsBrand, pmsBrandExample);
}
 
Example #11
Source File: DemoController.java    From macrozheng with Apache License 2.0 5 votes vote down vote up
@ApiOperation(value = "分页获取品牌列表")
@RequestMapping(value = "/brand/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<PmsBrand>> listBrand(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                                    @RequestParam(value = "pageSize", defaultValue = "3") Integer pageSize) {
    List<PmsBrand> brandList = demoService.listBrand(pageNum, pageSize);
    return CommonResult.success(CommonPage.restPage(brandList));
}
 
Example #12
Source File: RestTemplateDemoController.java    From macrozheng with Apache License 2.0 5 votes vote down vote up
@ApiOperation("postForEntity jsonBody")
@RequestMapping(value = "/post", method = RequestMethod.POST)
@ResponseBody
public Object postForEntity(@RequestBody PmsBrand brand) {
    String url = HOST_MALL_ADMIN + "/brand/create";
    ResponseEntity<CommonResult> responseEntity = restTemplate.postForEntity(url, brand, CommonResult.class);
    return responseEntity.getBody();
}
 
Example #13
Source File: RestTemplateDemoController.java    From macrozheng with Apache License 2.0 5 votes vote down vote up
@ApiOperation("postForEntity jsonBody")
@RequestMapping(value = "/post2", method = RequestMethod.POST)
@ResponseBody
public Object postForObject(@RequestBody PmsBrand brand) {
    String url = HOST_MALL_ADMIN + "/brand/create";
    CommonResult commonResult = restTemplate.postForObject(url, brand, CommonResult.class);
    return commonResult;
}
 
Example #14
Source File: PmsBrandServiceImpl.java    From mall with Apache License 2.0 5 votes vote down vote up
@Override
public int updateShowStatus(List<Long> ids, Integer showStatus) {
    PmsBrand pmsBrand = new PmsBrand();
    pmsBrand.setShowStatus(showStatus);
    PmsBrandExample pmsBrandExample = new PmsBrandExample();
    pmsBrandExample.createCriteria().andIdIn(ids);
    return brandMapper.updateByExampleSelective(pmsBrand, pmsBrandExample);
}
 
Example #15
Source File: DemoServiceImpl.java    From macrozheng with Apache License 2.0 5 votes vote down vote up
@Override
public int updateBrand(Long id, PmsBrandDto pmsBrandDto) {
    PmsBrand pmsBrand = new PmsBrand();
    BeanUtils.copyProperties(pmsBrandDto,pmsBrand);
    pmsBrand.setId(id);
    return brandMapper.updateByPrimaryKeySelective(pmsBrand);
}
 
Example #16
Source File: PortalBrandController.java    From mall with Apache License 2.0 5 votes vote down vote up
@ApiOperation("分页获取推荐品牌")
@RequestMapping(value = "/recommendList", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<PmsBrand>> recommendList(@RequestParam(value = "pageSize", defaultValue = "6") Integer pageSize,
                                                  @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
    List<PmsBrand> brandList = homeBrandService.recommendList(pageNum, pageSize);
    return CommonResult.success(brandList);
}
 
Example #17
Source File: PmsBrandServiceImpl.java    From macrozheng-mall with MIT License 5 votes vote down vote up
@Override
public int createBrand(PmsBrandParam pmsBrandParam) {
    PmsBrand pmsBrand = new PmsBrand();
    BeanUtils.copyProperties(pmsBrandParam, pmsBrand);
    //如果创建时首字母为空,取名称的第一个为首字母
    if (StringUtils.isEmpty(pmsBrand.getFirstLetter())) {
        pmsBrand.setFirstLetter(pmsBrand.getName().substring(0, 1));
    }
    return brandMapper.insertSelective(pmsBrand);
}
 
Example #18
Source File: PmsBrandController.java    From macrozheng with Apache License 2.0 5 votes vote down vote up
@ApiOperation(value = "根据编号查询品牌信息")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
@PreAuthorize("hasAuthority('pms:brand:read')")
public CommonResult<PmsBrand> getItem(@PathVariable("id") Long id) {
    return CommonResult.success(brandService.getBrand(id));
}
 
Example #19
Source File: PmsBrandServiceImpl.java    From macrozheng with Apache License 2.0 5 votes vote down vote up
@Override
public int createBrand(PmsBrandParam pmsBrandParam) {
    PmsBrand pmsBrand = new PmsBrand();
    BeanUtils.copyProperties(pmsBrandParam, pmsBrand);
    //如果创建时首字母为空,取名称的第一个为首字母
    if (StringUtils.isEmpty(pmsBrand.getFirstLetter())) {
        pmsBrand.setFirstLetter(pmsBrand.getName().substring(0, 1));
    }
    return brandMapper.insertSelective(pmsBrand);
}
 
Example #20
Source File: PmsBrandServiceImpl.java    From macrozheng with Apache License 2.0 5 votes vote down vote up
@Override
public List<PmsBrand> listBrand(String keyword, int pageNum, int pageSize) {
    PageHelper.startPage(pageNum, pageSize);
    PmsBrandExample pmsBrandExample = new PmsBrandExample();
    pmsBrandExample.setOrderByClause("sort desc");
    PmsBrandExample.Criteria criteria = pmsBrandExample.createCriteria();
    if (!StringUtils.isEmpty(keyword)) {
        criteria.andNameLike("%" + keyword + "%");
    }
    return brandMapper.selectByExample(pmsBrandExample);
}
 
Example #21
Source File: PmsBrandServiceImpl.java    From mall with Apache License 2.0 5 votes vote down vote up
@Override
public List<PmsBrand> listBrand(String keyword, int pageNum, int pageSize) {
    PageHelper.startPage(pageNum, pageSize);
    PmsBrandExample pmsBrandExample = new PmsBrandExample();
    pmsBrandExample.setOrderByClause("sort desc");
    PmsBrandExample.Criteria criteria = pmsBrandExample.createCriteria();
    if (!StringUtils.isEmpty(keyword)) {
        criteria.andNameLike("%" + keyword + "%");
    }
    return brandMapper.selectByExample(pmsBrandExample);
}
 
Example #22
Source File: PmsBrandServiceImpl.java    From macrozheng with Apache License 2.0 5 votes vote down vote up
@Override
public int updateShowStatus(List<Long> ids, Integer showStatus) {
    PmsBrand pmsBrand = new PmsBrand();
    pmsBrand.setShowStatus(showStatus);
    PmsBrandExample pmsBrandExample = new PmsBrandExample();
    pmsBrandExample.createCriteria().andIdIn(ids);
    return brandMapper.updateByExampleSelective(pmsBrand, pmsBrandExample);
}
 
Example #23
Source File: DemoController.java    From mall with Apache License 2.0 5 votes vote down vote up
@ApiOperation(value = "分页获取品牌列表")
@RequestMapping(value = "/brand/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<PmsBrand>> listBrand(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                                    @RequestParam(value = "pageSize", defaultValue = "3") Integer pageSize) {
    List<PmsBrand> brandList = demoService.listBrand(pageNum, pageSize);
    return CommonResult.success(CommonPage.restPage(brandList));
}
 
Example #24
Source File: DemoController.java    From mall-swarm with Apache License 2.0 5 votes vote down vote up
@ApiOperation(value = "分页获取品牌列表")
@RequestMapping(value = "/brand/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<PmsBrand>> listBrand(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                                    @RequestParam(value = "pageSize", defaultValue = "3") Integer pageSize) {
    List<PmsBrand> brandList = demoService.listBrand(pageNum, pageSize);
    return CommonResult.success(CommonPage.restPage(brandList));
}
 
Example #25
Source File: PmsBrandController.java    From mall with Apache License 2.0 4 votes vote down vote up
@ApiOperation(value = "根据编号查询品牌信息")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<PmsBrand> getItem(@PathVariable("id") Long id) {
    return CommonResult.success(brandService.getBrand(id));
}
 
Example #26
Source File: PmsBrandServiceImpl.java    From mall with Apache License 2.0 4 votes vote down vote up
@Override
public List<PmsBrand> listAllBrand() {
    return brandMapper.selectByExample(new PmsBrandExample());
}
 
Example #27
Source File: DemoServiceImpl.java    From mall-swarm with Apache License 2.0 4 votes vote down vote up
@Override
public PmsBrand getBrand(Long id) {
    return brandMapper.selectByPrimaryKey(id);
}
 
Example #28
Source File: DemoServiceImpl.java    From macrozheng with Apache License 2.0 4 votes vote down vote up
@Override
public List<PmsBrand> listAllBrand() {
    return brandMapper.selectByExample(new PmsBrandExample());
}
 
Example #29
Source File: DemoServiceImpl.java    From mall with Apache License 2.0 4 votes vote down vote up
@Override
public List<PmsBrand> listBrand(int pageNum, int pageSize) {
    PageHelper.startPage(pageNum, pageSize);
    return brandMapper.selectByExample(new PmsBrandExample());
}
 
Example #30
Source File: PortalBrandServiceImpl.java    From mall with Apache License 2.0 4 votes vote down vote up
@Override
public List<PmsBrand> recommendList(Integer pageNum, Integer pageSize) {
    int offset = (pageNum - 1) * pageSize;
    return homeDao.getRecommendBrandList(offset, pageSize);
}