com.macro.mall.model.PmsProductAttribute Java Examples

The following examples show how to use com.macro.mall.model.PmsProductAttribute. 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: PmsProductAttributeServiceImpl.java    From macrozheng-mall with MIT License 6 votes vote down vote up
@Override
public int delete(List<Long> ids) {
    //获取分类
    PmsProductAttribute pmsProductAttribute = productAttributeMapper.selectByPrimaryKey(ids.get(0));
    Integer type = pmsProductAttribute.getType();
    PmsProductAttributeCategory pmsProductAttributeCategory = productAttributeCategoryMapper.selectByPrimaryKey(pmsProductAttribute.getProductAttributeCategoryId());
    PmsProductAttributeExample example = new PmsProductAttributeExample();
    example.createCriteria().andIdIn(ids);
    int count = productAttributeMapper.deleteByExample(example);
    //删除完成后修改数量
    if(type==0){
        if(pmsProductAttributeCategory.getAttributeCount()>=count){
            pmsProductAttributeCategory.setAttributeCount(pmsProductAttributeCategory.getAttributeCount()-count);
        }else{
            pmsProductAttributeCategory.setAttributeCount(0);
        }
    }else if(type==1){
        if(pmsProductAttributeCategory.getParamCount()>=count){
            pmsProductAttributeCategory.setParamCount(pmsProductAttributeCategory.getParamCount()-count);
        }else{
            pmsProductAttributeCategory.setParamCount(0);
        }
    }
    productAttributeCategoryMapper.updateByPrimaryKey(pmsProductAttributeCategory);
    return count;
}
 
Example #2
Source File: PmsProductAttributeServiceImpl.java    From macrozheng with Apache License 2.0 6 votes vote down vote up
@Override
public int delete(List<Long> ids) {
    //获取分类
    PmsProductAttribute pmsProductAttribute = productAttributeMapper.selectByPrimaryKey(ids.get(0));
    Integer type = pmsProductAttribute.getType();
    PmsProductAttributeCategory pmsProductAttributeCategory = productAttributeCategoryMapper.selectByPrimaryKey(pmsProductAttribute.getProductAttributeCategoryId());
    PmsProductAttributeExample example = new PmsProductAttributeExample();
    example.createCriteria().andIdIn(ids);
    int count = productAttributeMapper.deleteByExample(example);
    //删除完成后修改数量
    if(type==0){
        if(pmsProductAttributeCategory.getAttributeCount()>=count){
            pmsProductAttributeCategory.setAttributeCount(pmsProductAttributeCategory.getAttributeCount()-count);
        }else{
            pmsProductAttributeCategory.setAttributeCount(0);
        }
    }else if(type==1){
        if(pmsProductAttributeCategory.getParamCount()>=count){
            pmsProductAttributeCategory.setParamCount(pmsProductAttributeCategory.getParamCount()-count);
        }else{
            pmsProductAttributeCategory.setParamCount(0);
        }
    }
    productAttributeCategoryMapper.updateByPrimaryKey(pmsProductAttributeCategory);
    return count;
}
 
Example #3
Source File: PmsProductAttributeServiceImpl.java    From mall-swarm with Apache License 2.0 6 votes vote down vote up
@Override
public int delete(List<Long> ids) {
    //获取分类
    PmsProductAttribute pmsProductAttribute = productAttributeMapper.selectByPrimaryKey(ids.get(0));
    Integer type = pmsProductAttribute.getType();
    PmsProductAttributeCategory pmsProductAttributeCategory = productAttributeCategoryMapper.selectByPrimaryKey(pmsProductAttribute.getProductAttributeCategoryId());
    PmsProductAttributeExample example = new PmsProductAttributeExample();
    example.createCriteria().andIdIn(ids);
    int count = productAttributeMapper.deleteByExample(example);
    //删除完成后修改数量
    if(type==0){
        if(pmsProductAttributeCategory.getAttributeCount()>=count){
            pmsProductAttributeCategory.setAttributeCount(pmsProductAttributeCategory.getAttributeCount()-count);
        }else{
            pmsProductAttributeCategory.setAttributeCount(0);
        }
    }else if(type==1){
        if(pmsProductAttributeCategory.getParamCount()>=count){
            pmsProductAttributeCategory.setParamCount(pmsProductAttributeCategory.getParamCount()-count);
        }else{
            pmsProductAttributeCategory.setParamCount(0);
        }
    }
    productAttributeCategoryMapper.updateByPrimaryKey(pmsProductAttributeCategory);
    return count;
}
 
Example #4
Source File: PmsProductAttributeServiceImpl.java    From mall with Apache License 2.0 6 votes vote down vote up
@Override
public int delete(List<Long> ids) {
    //获取分类
    PmsProductAttribute pmsProductAttribute = productAttributeMapper.selectByPrimaryKey(ids.get(0));
    Integer type = pmsProductAttribute.getType();
    PmsProductAttributeCategory pmsProductAttributeCategory = productAttributeCategoryMapper.selectByPrimaryKey(pmsProductAttribute.getProductAttributeCategoryId());
    PmsProductAttributeExample example = new PmsProductAttributeExample();
    example.createCriteria().andIdIn(ids);
    int count = productAttributeMapper.deleteByExample(example);
    //删除完成后修改数量
    if(type==0){
        if(pmsProductAttributeCategory.getAttributeCount()>=count){
            pmsProductAttributeCategory.setAttributeCount(pmsProductAttributeCategory.getAttributeCount()-count);
        }else{
            pmsProductAttributeCategory.setAttributeCount(0);
        }
    }else if(type==1){
        if(pmsProductAttributeCategory.getParamCount()>=count){
            pmsProductAttributeCategory.setParamCount(pmsProductAttributeCategory.getParamCount()-count);
        }else{
            pmsProductAttributeCategory.setParamCount(0);
        }
    }
    productAttributeCategoryMapper.updateByPrimaryKey(pmsProductAttributeCategory);
    return count;
}
 
Example #5
Source File: PmsProductAttributeController.java    From macrozheng with Apache License 2.0 5 votes vote down vote up
@ApiOperation("根据分类查询属性列表或参数列表")
@ApiImplicitParams({@ApiImplicitParam(name = "type", value = "0表示属性,1表示参数", required = true, paramType = "query", dataType = "integer")})
@RequestMapping(value = "/list/{cid}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<PmsProductAttribute>> getList(@PathVariable Long cid,
                                                             @RequestParam(value = "type") Integer type,
                                                             @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
                                                             @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
    List<PmsProductAttribute> productAttributeList = productAttributeService.getList(cid, type, pageSize, pageNum);
    return CommonResult.success(CommonPage.restPage(productAttributeList));
}
 
Example #6
Source File: PmsProductAttributeController.java    From macrozheng-mall with MIT License 5 votes vote down vote up
@ApiOperation("根据分类查询属性列表或参数列表")
@ApiImplicitParams({@ApiImplicitParam(name = "type", value = "0表示属性,1表示参数", required = true, paramType = "query", dataType = "integer")})
@RequestMapping(value = "/list/{cid}", method = RequestMethod.GET)
@ResponseBody
public Object getList(@PathVariable Long cid,
                      @RequestParam(value = "type") Integer type,
                      @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
                      @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
    List<PmsProductAttribute> productAttributeList = productAttributeService.getList(cid, type, pageSize, pageNum);
    return new CommonResult().pageSuccess(productAttributeList);
}
 
Example #7
Source File: PmsProductAttributeController.java    From macrozheng-mall with MIT License 5 votes vote down vote up
@ApiOperation("查询单个商品属性")
@RequestMapping(value = "/{id}",method = RequestMethod.GET)
@ResponseBody
public Object getItem(@PathVariable Long id){
    PmsProductAttribute productAttribute = productAttributeService.getItem(id);
    return new CommonResult().success(productAttribute);
}
 
Example #8
Source File: PmsProductAttributeServiceImpl.java    From macrozheng-mall with MIT License 5 votes vote down vote up
@Override
public List<PmsProductAttribute> getList(Long cid, Integer type, Integer pageSize, Integer pageNum) {
    PageHelper.startPage(pageNum, pageSize);
    PmsProductAttributeExample example = new PmsProductAttributeExample();
    example.setOrderByClause("sort desc");
    example.createCriteria().andProductAttributeCategoryIdEqualTo(cid).andTypeEqualTo(type);
    return productAttributeMapper.selectByExample(example);
}
 
Example #9
Source File: PmsProductAttributeServiceImpl.java    From macrozheng-mall with MIT License 5 votes vote down vote up
@Override
public int create(PmsProductAttributeParam pmsProductAttributeParam) {
    PmsProductAttribute pmsProductAttribute = new PmsProductAttribute();
    BeanUtils.copyProperties(pmsProductAttributeParam, pmsProductAttribute);
    int count = productAttributeMapper.insertSelective(pmsProductAttribute);
    //新增商品属性以后需要更新商品属性分类数量
    PmsProductAttributeCategory pmsProductAttributeCategory = productAttributeCategoryMapper.selectByPrimaryKey(pmsProductAttribute.getProductAttributeCategoryId());
    if(pmsProductAttribute.getType()==0){
        pmsProductAttributeCategory.setAttributeCount(pmsProductAttributeCategory.getAttributeCount()+1);
    }else if(pmsProductAttribute.getType()==1){
        pmsProductAttributeCategory.setParamCount(pmsProductAttributeCategory.getParamCount()+1);
    }
    productAttributeCategoryMapper.updateByPrimaryKey(pmsProductAttributeCategory);
    return count;
}
 
Example #10
Source File: PmsProductAttributeController.java    From mall-swarm with Apache License 2.0 5 votes vote down vote up
@ApiOperation("根据分类查询属性列表或参数列表")
@ApiImplicitParams({@ApiImplicitParam(name = "type", value = "0表示属性,1表示参数", required = true, paramType = "query", dataType = "integer")})
@RequestMapping(value = "/list/{cid}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<PmsProductAttribute>> getList(@PathVariable Long cid,
                                                             @RequestParam(value = "type") Integer type,
                                                             @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
                                                             @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
    List<PmsProductAttribute> productAttributeList = productAttributeService.getList(cid, type, pageSize, pageNum);
    return CommonResult.success(CommonPage.restPage(productAttributeList));
}
 
Example #11
Source File: PmsProductAttributeController.java    From mall-swarm with Apache License 2.0 5 votes vote down vote up
@ApiOperation("查询单个商品属性")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<PmsProductAttribute> getItem(@PathVariable Long id) {
    PmsProductAttribute productAttribute = productAttributeService.getItem(id);
    return CommonResult.success(productAttribute);
}
 
Example #12
Source File: PmsProductAttributeServiceImpl.java    From macrozheng-mall with MIT License 5 votes vote down vote up
@Override
public int update(Long id, PmsProductAttributeParam productAttributeParam) {
    PmsProductAttribute pmsProductAttribute = new PmsProductAttribute();
    pmsProductAttribute.setId(id);
    BeanUtils.copyProperties(productAttributeParam, pmsProductAttribute);
    return productAttributeMapper.updateByPrimaryKeySelective(pmsProductAttribute);
}
 
Example #13
Source File: PmsProductAttributeServiceImpl.java    From mall-swarm with Apache License 2.0 5 votes vote down vote up
@Override
public int create(PmsProductAttributeParam pmsProductAttributeParam) {
    PmsProductAttribute pmsProductAttribute = new PmsProductAttribute();
    BeanUtils.copyProperties(pmsProductAttributeParam, pmsProductAttribute);
    int count = productAttributeMapper.insertSelective(pmsProductAttribute);
    //新增商品属性以后需要更新商品属性分类数量
    PmsProductAttributeCategory pmsProductAttributeCategory = productAttributeCategoryMapper.selectByPrimaryKey(pmsProductAttribute.getProductAttributeCategoryId());
    if(pmsProductAttribute.getType()==0){
        pmsProductAttributeCategory.setAttributeCount(pmsProductAttributeCategory.getAttributeCount()+1);
    }else if(pmsProductAttribute.getType()==1){
        pmsProductAttributeCategory.setParamCount(pmsProductAttributeCategory.getParamCount()+1);
    }
    productAttributeCategoryMapper.updateByPrimaryKey(pmsProductAttributeCategory);
    return count;
}
 
Example #14
Source File: PmsProductAttributeServiceImpl.java    From mall-swarm with Apache License 2.0 5 votes vote down vote up
@Override
public int update(Long id, PmsProductAttributeParam productAttributeParam) {
    PmsProductAttribute pmsProductAttribute = new PmsProductAttribute();
    pmsProductAttribute.setId(id);
    BeanUtils.copyProperties(productAttributeParam, pmsProductAttribute);
    return productAttributeMapper.updateByPrimaryKeySelective(pmsProductAttribute);
}
 
Example #15
Source File: PmsProductAttributeServiceImpl.java    From mall with Apache License 2.0 5 votes vote down vote up
@Override
public int update(Long id, PmsProductAttributeParam productAttributeParam) {
    PmsProductAttribute pmsProductAttribute = new PmsProductAttribute();
    pmsProductAttribute.setId(id);
    BeanUtils.copyProperties(productAttributeParam, pmsProductAttribute);
    return productAttributeMapper.updateByPrimaryKeySelective(pmsProductAttribute);
}
 
Example #16
Source File: PmsProductAttributeServiceImpl.java    From mall with Apache License 2.0 5 votes vote down vote up
@Override
public int create(PmsProductAttributeParam pmsProductAttributeParam) {
    PmsProductAttribute pmsProductAttribute = new PmsProductAttribute();
    BeanUtils.copyProperties(pmsProductAttributeParam, pmsProductAttribute);
    int count = productAttributeMapper.insertSelective(pmsProductAttribute);
    //新增商品属性以后需要更新商品属性分类数量
    PmsProductAttributeCategory pmsProductAttributeCategory = productAttributeCategoryMapper.selectByPrimaryKey(pmsProductAttribute.getProductAttributeCategoryId());
    if(pmsProductAttribute.getType()==0){
        pmsProductAttributeCategory.setAttributeCount(pmsProductAttributeCategory.getAttributeCount()+1);
    }else if(pmsProductAttribute.getType()==1){
        pmsProductAttributeCategory.setParamCount(pmsProductAttributeCategory.getParamCount()+1);
    }
    productAttributeCategoryMapper.updateByPrimaryKey(pmsProductAttributeCategory);
    return count;
}
 
Example #17
Source File: PmsProductAttributeServiceImpl.java    From mall with Apache License 2.0 5 votes vote down vote up
@Override
public List<PmsProductAttribute> getList(Long cid, Integer type, Integer pageSize, Integer pageNum) {
    PageHelper.startPage(pageNum, pageSize);
    PmsProductAttributeExample example = new PmsProductAttributeExample();
    example.setOrderByClause("sort desc");
    example.createCriteria().andProductAttributeCategoryIdEqualTo(cid).andTypeEqualTo(type);
    return productAttributeMapper.selectByExample(example);
}
 
Example #18
Source File: PmsProductAttributeController.java    From mall with Apache License 2.0 5 votes vote down vote up
@ApiOperation("查询单个商品属性")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<PmsProductAttribute> getItem(@PathVariable Long id) {
    PmsProductAttribute productAttribute = productAttributeService.getItem(id);
    return CommonResult.success(productAttribute);
}
 
Example #19
Source File: PmsProductAttributeController.java    From mall with Apache License 2.0 5 votes vote down vote up
@ApiOperation("根据分类查询属性列表或参数列表")
@ApiImplicitParams({@ApiImplicitParam(name = "type", value = "0表示属性,1表示参数", required = true, paramType = "query", dataType = "integer")})
@RequestMapping(value = "/list/{cid}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<PmsProductAttribute>> getList(@PathVariable Long cid,
                                                             @RequestParam(value = "type") Integer type,
                                                             @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
                                                             @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
    List<PmsProductAttribute> productAttributeList = productAttributeService.getList(cid, type, pageSize, pageNum);
    return CommonResult.success(CommonPage.restPage(productAttributeList));
}
 
Example #20
Source File: PmsProductAttributeServiceImpl.java    From macrozheng with Apache License 2.0 5 votes vote down vote up
@Override
public int update(Long id, PmsProductAttributeParam productAttributeParam) {
    PmsProductAttribute pmsProductAttribute = new PmsProductAttribute();
    pmsProductAttribute.setId(id);
    BeanUtils.copyProperties(productAttributeParam, pmsProductAttribute);
    return productAttributeMapper.updateByPrimaryKeySelective(pmsProductAttribute);
}
 
Example #21
Source File: PmsProductAttributeServiceImpl.java    From macrozheng with Apache License 2.0 5 votes vote down vote up
@Override
public int create(PmsProductAttributeParam pmsProductAttributeParam) {
    PmsProductAttribute pmsProductAttribute = new PmsProductAttribute();
    BeanUtils.copyProperties(pmsProductAttributeParam, pmsProductAttribute);
    int count = productAttributeMapper.insertSelective(pmsProductAttribute);
    //新增商品属性以后需要更新商品属性分类数量
    PmsProductAttributeCategory pmsProductAttributeCategory = productAttributeCategoryMapper.selectByPrimaryKey(pmsProductAttribute.getProductAttributeCategoryId());
    if(pmsProductAttribute.getType()==0){
        pmsProductAttributeCategory.setAttributeCount(pmsProductAttributeCategory.getAttributeCount()+1);
    }else if(pmsProductAttribute.getType()==1){
        pmsProductAttributeCategory.setParamCount(pmsProductAttributeCategory.getParamCount()+1);
    }
    productAttributeCategoryMapper.updateByPrimaryKey(pmsProductAttributeCategory);
    return count;
}
 
Example #22
Source File: PmsProductAttributeServiceImpl.java    From macrozheng with Apache License 2.0 5 votes vote down vote up
@Override
public List<PmsProductAttribute> getList(Long cid, Integer type, Integer pageSize, Integer pageNum) {
    PageHelper.startPage(pageNum, pageSize);
    PmsProductAttributeExample example = new PmsProductAttributeExample();
    example.setOrderByClause("sort desc");
    example.createCriteria().andProductAttributeCategoryIdEqualTo(cid).andTypeEqualTo(type);
    return productAttributeMapper.selectByExample(example);
}
 
Example #23
Source File: PmsProductAttributeController.java    From macrozheng with Apache License 2.0 5 votes vote down vote up
@ApiOperation("查询单个商品属性")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<PmsProductAttribute> getItem(@PathVariable Long id) {
    PmsProductAttribute productAttribute = productAttributeService.getItem(id);
    return CommonResult.success(productAttribute);
}
 
Example #24
Source File: PmsProductAttributeServiceImpl.java    From mall-swarm with Apache License 2.0 5 votes vote down vote up
@Override
public List<PmsProductAttribute> getList(Long cid, Integer type, Integer pageSize, Integer pageNum) {
    PageHelper.startPage(pageNum, pageSize);
    PmsProductAttributeExample example = new PmsProductAttributeExample();
    example.setOrderByClause("sort desc");
    example.createCriteria().andProductAttributeCategoryIdEqualTo(cid).andTypeEqualTo(type);
    return productAttributeMapper.selectByExample(example);
}
 
Example #25
Source File: CartProduct.java    From mall with Apache License 2.0 4 votes vote down vote up
public void setProductAttributeList(List<PmsProductAttribute> productAttributeList) {
    this.productAttributeList = productAttributeList;
}
 
Example #26
Source File: PmsProductAttributeCategoryItem.java    From macrozheng-mall with MIT License 4 votes vote down vote up
public void setProductAttributeList(List<PmsProductAttribute> productAttributeList) {
    this.productAttributeList = productAttributeList;
}
 
Example #27
Source File: PmsProductAttributeServiceImpl.java    From macrozheng-mall with MIT License 4 votes vote down vote up
@Override
public PmsProductAttribute getItem(Long id) {
    return productAttributeMapper.selectByPrimaryKey(id);
}
 
Example #28
Source File: CartProduct.java    From macrozheng-mall with MIT License 4 votes vote down vote up
public List<PmsProductAttribute> getProductAttributeList() {
    return productAttributeList;
}
 
Example #29
Source File: CartProduct.java    From macrozheng-mall with MIT License 4 votes vote down vote up
public void setProductAttributeList(List<PmsProductAttribute> productAttributeList) {
    this.productAttributeList = productAttributeList;
}
 
Example #30
Source File: PmsProductAttributeServiceImpl.java    From mall with Apache License 2.0 4 votes vote down vote up
@Override
public PmsProductAttribute getItem(Long id) {
    return productAttributeMapper.selectByPrimaryKey(id);
}