system及product启动调试商品分类,修改配置

This commit is contained in:
jiangweifan
2020-05-09 23:36:17 +08:00
parent 58d9b76d2d
commit 88a3cd8d02
12 changed files with 33 additions and 22 deletions

View File

@@ -3,6 +3,7 @@ package cn.iocoder.mall.product.biz.dao.product;
import cn.iocoder.mall.product.biz.dataobject.product.ProductBrandDO;
import cn.iocoder.mall.product.biz.dataobject.product.ProductCategoryDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;
/**

View File

@@ -1,6 +1,7 @@
package cn.iocoder.mall.product.biz.dataobject.product;
import cn.iocoder.mall.mybatis.dataobject.DeletableDO;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.experimental.Accessors;
@@ -9,6 +10,7 @@ import lombok.experimental.Accessors;
*/
@Data
@Accessors(chain = true)
@TableName("product_category")
public class ProductCategoryDO extends DeletableDO {
/**

View File

@@ -5,6 +5,8 @@ import cn.iocoder.mall.product.biz.dto.category.ProductCategoryAddDTO;
import cn.iocoder.mall.product.biz.dto.category.ProductCategoryDeleteDTO;
import cn.iocoder.mall.product.biz.dto.category.ProductCategoryUpdateDTO;
import cn.iocoder.mall.product.biz.dto.category.ProductCategoryUpdateStatusDTO;
import javax.validation.Valid;
import java.util.List;
@@ -26,26 +28,26 @@ public interface ProductCategoryService {
* @param productCategoryAddDTO
* @return
*/
ProductCategoryBO addProductCategory(ProductCategoryAddDTO productCategoryAddDTO);
ProductCategoryBO addProductCategory(@Valid ProductCategoryAddDTO productCategoryAddDTO);
/**
* 更新商品分类
* @param productCategoryUpdateDTO
* @return
*/
Boolean updateProductCategory(ProductCategoryUpdateDTO productCategoryUpdateDTO);
Boolean updateProductCategory(@Valid ProductCategoryUpdateDTO productCategoryUpdateDTO);
/**
* 更新商品分类状态
* @param productCategoryUpdateStatusDTO
* @return
*/
Boolean updateProductCategoryStatus(ProductCategoryUpdateStatusDTO productCategoryUpdateStatusDTO);
Boolean updateProductCategoryStatus(@Valid ProductCategoryUpdateStatusDTO productCategoryUpdateStatusDTO);
/**
* 删除商品分类
* @param productCategoryDeleteDTO
* @return
*/
Boolean deleteProductCategory(ProductCategoryDeleteDTO productCategoryDeleteDTO);
Boolean deleteProductCategory(@Valid ProductCategoryDeleteDTO productCategoryDeleteDTO);
}

View File

@@ -49,7 +49,7 @@ public class ProductCategoryServiceImpl implements ProductCategoryService {
* @return
*/
@Override
public ProductCategoryBO addProductCategory(@Valid ProductCategoryAddDTO productCategoryAddDTO) {
public ProductCategoryBO addProductCategory(ProductCategoryAddDTO productCategoryAddDTO) {
// 校验父分类
validParent(productCategoryAddDTO.getPid());
// 保存到数据库
@@ -69,7 +69,7 @@ public class ProductCategoryServiceImpl implements ProductCategoryService {
* @return
*/
@Override
public Boolean updateProductCategory(@Valid ProductCategoryUpdateDTO productCategoryUpdateDTO) {
public Boolean updateProductCategory(ProductCategoryUpdateDTO productCategoryUpdateDTO) {
// 校验当前分类是否存在
if (productCategoryMapper.selectById(productCategoryUpdateDTO.getId()) == null) {
throw ServiceExceptionUtil.exception(PRODUCT_CATEGORY_NOT_EXISTS);
@@ -98,7 +98,7 @@ public class ProductCategoryServiceImpl implements ProductCategoryService {
* @return
*/
@Override
public Boolean updateProductCategoryStatus(@Valid ProductCategoryUpdateStatusDTO productCategoryUpdateStatusDTO) {
public Boolean updateProductCategoryStatus(ProductCategoryUpdateStatusDTO productCategoryUpdateStatusDTO) {
Integer productCategoryId = productCategoryUpdateStatusDTO.getId();
Integer status = productCategoryUpdateStatusDTO.getStatus();
// 校验商品分类是否存在
@@ -128,7 +128,7 @@ public class ProductCategoryServiceImpl implements ProductCategoryService {
* @return
*/
@Override
public Boolean deleteProductCategory(@Valid ProductCategoryDeleteDTO productCategoryDeleteDTO) {
public Boolean deleteProductCategory(ProductCategoryDeleteDTO productCategoryDeleteDTO) {
Integer productCategoryId = productCategoryDeleteDTO.getId();
// 校验分类是否存在
ProductCategoryDO productCategory = productCategoryMapper.selectById(productCategoryId);
@@ -148,10 +148,7 @@ public class ProductCategoryServiceImpl implements ProductCategoryService {
}
// TODO 伟帆 补充只有不存在商品才可以删除
// 标记删除商品分类
ProductCategoryDO updateProductCategory = new ProductCategoryDO()
.setId(productCategoryId);
updateProductCategory.setDeleted(DeletedStatusEnum.DELETED_YES.getValue());
productCategoryMapper.updateById(updateProductCategory);
productCategoryMapper.deleteById(productCategoryId);
// TODO 伟帆 操作日志
return true;
}

View File

@@ -69,7 +69,7 @@ public class AdminsProductCategoryController {
@PostMapping("/add")
@ApiOperation(value = "创建商品分类")
public CommonResult<AdminsProductCategoryAddResponse> add(@RequestBody AdminsProductCategoryAddRequest adminsProductCategoryAddRequest) {
public CommonResult<AdminsProductCategoryAddResponse> add(AdminsProductCategoryAddRequest adminsProductCategoryAddRequest) {
// 转换 ProductCategoryAddDTO 对象
ProductCategoryAddDTO productCategoryAddDTO = ProductCategoryConvert.INSTANCE.convertToAddDTO(AdminSecurityContextHolder.getContext().getAdminId(), adminsProductCategoryAddRequest);
// 创建商品分类
@@ -80,7 +80,7 @@ public class AdminsProductCategoryController {
@PostMapping("/update")
@ApiOperation(value = "更新商品分类")
public CommonResult<Boolean> update(@RequestBody AdminsProductCategoryUpdateRequest adminsProductCategoryUpdateRequest) {
public CommonResult<Boolean> update(AdminsProductCategoryUpdateRequest adminsProductCategoryUpdateRequest) {
// 创建 ProductCategoryUpdateDTO 对象
ProductCategoryUpdateDTO productCategoryUpdateDTO = ProductCategoryConvert.INSTANCE.convertToUpdateDTO(AdminSecurityContextHolder.getContext().getAdminId(), adminsProductCategoryUpdateRequest);
// 更新商品分类
@@ -89,7 +89,7 @@ public class AdminsProductCategoryController {
@PostMapping("/update_status")
@ApiOperation(value = "更新商品分类状态")
public CommonResult<Boolean> updateStatus(@RequestBody AdminsProductCategoryUpdateStatusRequest adminsProductCategoryUpdateStatusRequest) {
public CommonResult<Boolean> updateStatus(AdminsProductCategoryUpdateStatusRequest adminsProductCategoryUpdateStatusRequest) {
// 创建 ProductCategoryUpdateStatusDTO 对象
ProductCategoryUpdateStatusDTO productCategoryUpdateStatusDTO = ProductCategoryConvert.INSTANCE.convertToUpdateStatusDTO(AdminSecurityContextHolder.getContext().getAdminId(),
adminsProductCategoryUpdateStatusRequest);