📖 CRM:code review CRM 产品分类

This commit is contained in:
YunaiV 2024-01-08 19:08:03 +08:00
parent dab0211385
commit 772b794374
3 changed files with 6 additions and 1 deletions

View File

@ -60,6 +60,7 @@ public interface LogRecordConstants {
// ======================= CRM_PRODUCT 产品 =======================
// TODO @hao可以把 CRM 产品 CRM 产品分类分开哈量程两个 type
String CRM_PRODUCT_TYPE = "CRM 产品";
String CRM_PRODUCT_CREATE_SUB_TYPE = "创建产品";
String CRM_PRODUCT_CREATE_SUCCESS = "创建了产品【{{#createReqVO.name}}】";

View File

@ -42,12 +42,14 @@ public class CrmProductCategoryServiceImpl implements CrmProductCategoryService
@Override
@LogRecord(type = CRM_PRODUCT_CATEGORY_TYPE, subType = CRM_PRODUCT_CATEGORY_CREATE_SUB_TYPE, bizNo = "{{#createReqVO.id}}",
success = CRM_PRODUCT_CATEGORY_CREATE_SUCCESS)
// TODO @hao产品分类应该没数据权限可以删除下哈
@CrmPermission(bizType = CrmBizTypeEnum.CRM_PRODUCT, bizId = "#createReqVO.id", level = CrmPermissionLevelEnum.WRITE)
public Long createProductCategory(CrmProductCategoryCreateReqVO createReqVO) {
// 1.1 校验父分类存在
validateParentProductCategory(createReqVO.getParentId());
// 1.2 分类名称是否存在
validateProductNameExists(null, createReqVO.getParentId(), createReqVO.getName());
// 2. 插入分类
CrmProductCategoryDO category = BeanUtils.toBean(createReqVO, CrmProductCategoryDO.class);
productCategoryMapper.insert(category);
@ -65,6 +67,7 @@ public class CrmProductCategoryServiceImpl implements CrmProductCategoryService
validateParentProductCategory(updateReqVO.getParentId());
// 1.3 分类名称是否存在
validateProductNameExists(updateReqVO.getId(), updateReqVO.getParentId(), updateReqVO.getName());
// 2. 更新分类
CrmProductCategoryDO updateObj = BeanUtils.toBean(updateReqVO, CrmProductCategoryDO.class);
productCategoryMapper.updateById(updateObj);

View File

@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.promotion.controller.admin.reward.vo;
import cn.hutool.core.collection.CollUtil;
import cn.iocoder.yudao.framework.common.validation.InEnum;
import cn.iocoder.yudao.module.promotion.enums.common.PromotionConditionTypeEnum;
import cn.iocoder.yudao.module.promotion.enums.common.PromotionProductScopeEnum;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@ -50,7 +51,7 @@ public class RewardActivityBaseVO {
@Schema(description = "商品范围", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "商品范围不能为空")
@InEnum(value = PromotionConditionTypeEnum.class, message = "商品范围必须是 {value}")
@InEnum(value = PromotionProductScopeEnum.class, message = "商品范围必须是 {value}")
private Integer productScope;
@Schema(description = "商品 SPU 编号的数组", example = "1,2,3")