mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-08-10 16:21:52 +08:00
适配 mall 模块的 openapi
This commit is contained in:
@@ -0,0 +1,133 @@
|
||||
package cn.iocoder.yudao.module.product.service.brand;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.brand.vo.ProductBrandCreateReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.brand.vo.ProductBrandPageReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.brand.vo.ProductBrandUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.brand.ProductBrandDO;
|
||||
import cn.iocoder.yudao.module.product.dal.mysql.brand.ProductBrandMapper;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
|
||||
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
|
||||
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
|
||||
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
|
||||
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId;
|
||||
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo;
|
||||
import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.BRAND_NOT_EXISTS;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
/**
|
||||
* {@link ProductBrandServiceImpl} 的单元测试类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Import(ProductBrandServiceImpl.class)
|
||||
public class ProductBrandServiceImplTest extends BaseDbUnitTest {
|
||||
|
||||
@Resource
|
||||
private ProductBrandServiceImpl brandService;
|
||||
|
||||
@Resource
|
||||
private ProductBrandMapper brandMapper;
|
||||
|
||||
@Test
|
||||
public void testCreateBrand_success() {
|
||||
// 准备参数
|
||||
ProductBrandCreateReqVO reqVO = randomPojo(ProductBrandCreateReqVO.class);
|
||||
|
||||
// 调用
|
||||
Long brandId = brandService.createBrand(reqVO);
|
||||
// 断言
|
||||
assertNotNull(brandId);
|
||||
// 校验记录的属性是否正确
|
||||
ProductBrandDO brand = brandMapper.selectById(brandId);
|
||||
assertPojoEquals(reqVO, brand);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateBrand_success() {
|
||||
// mock 数据
|
||||
ProductBrandDO dbBrand = randomPojo(ProductBrandDO.class);
|
||||
brandMapper.insert(dbBrand);// @Sql: 先插入出一条存在的数据
|
||||
// 准备参数
|
||||
ProductBrandUpdateReqVO reqVO = randomPojo(ProductBrandUpdateReqVO.class, o -> {
|
||||
o.setId(dbBrand.getId()); // 设置更新的 ID
|
||||
});
|
||||
|
||||
// 调用
|
||||
brandService.updateBrand(reqVO);
|
||||
// 校验是否更新正确
|
||||
ProductBrandDO brand = brandMapper.selectById(reqVO.getId()); // 获取最新的
|
||||
assertPojoEquals(reqVO, brand);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateBrand_notExists() {
|
||||
// 准备参数
|
||||
ProductBrandUpdateReqVO reqVO = randomPojo(ProductBrandUpdateReqVO.class);
|
||||
|
||||
// 调用, 并断言异常
|
||||
assertServiceException(() -> brandService.updateBrand(reqVO), BRAND_NOT_EXISTS);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteBrand_success() {
|
||||
// mock 数据
|
||||
ProductBrandDO dbBrand = randomPojo(ProductBrandDO.class);
|
||||
brandMapper.insert(dbBrand);// @Sql: 先插入出一条存在的数据
|
||||
// 准备参数
|
||||
Long id = dbBrand.getId();
|
||||
|
||||
// 调用
|
||||
brandService.deleteBrand(id);
|
||||
// 校验数据不存在了
|
||||
assertNull(brandMapper.selectById(id));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteBrand_notExists() {
|
||||
// 准备参数
|
||||
Long id = randomLongId();
|
||||
|
||||
// 调用, 并断言异常
|
||||
assertServiceException(() -> brandService.deleteBrand(id), BRAND_NOT_EXISTS);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetBrandPage() {
|
||||
// mock 数据
|
||||
ProductBrandDO dbBrand = randomPojo(ProductBrandDO.class, o -> { // 等会查询到
|
||||
o.setName("芋道源码");
|
||||
o.setStatus(CommonStatusEnum.ENABLE.getStatus());
|
||||
o.setCreateTime(buildTime(2022, 2, 1));
|
||||
});
|
||||
brandMapper.insert(dbBrand);
|
||||
// 测试 name 不匹配
|
||||
brandMapper.insert(cloneIgnoreId(dbBrand, o -> o.setName("源码")));
|
||||
// 测试 status 不匹配
|
||||
brandMapper.insert(cloneIgnoreId(dbBrand, o -> o.setStatus(CommonStatusEnum.DISABLE.getStatus())));
|
||||
// 测试 createTime 不匹配
|
||||
brandMapper.insert(cloneIgnoreId(dbBrand, o -> o.setCreateTime(buildTime(2022, 3, 1))));
|
||||
// 准备参数
|
||||
ProductBrandPageReqVO reqVO = new ProductBrandPageReqVO();
|
||||
reqVO.setName("芋道");
|
||||
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
|
||||
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2022, 1, 1), buildTime(2022, 2, 25)}));
|
||||
|
||||
// 调用
|
||||
PageResult<ProductBrandDO> pageResult = brandService.getBrandPage(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, pageResult.getTotal());
|
||||
assertEquals(1, pageResult.getList().size());
|
||||
assertPojoEquals(dbBrand, pageResult.getList().get(0));
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,145 @@
|
||||
package cn.iocoder.yudao.module.product.service.category;
|
||||
|
||||
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.category.vo.ProductCategoryCreateReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.category.vo.ProductCategoryListReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.category.vo.ProductCategoryUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.category.ProductCategoryDO;
|
||||
import cn.iocoder.yudao.module.product.dal.mysql.category.ProductCategoryMapper;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
|
||||
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
|
||||
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
|
||||
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId;
|
||||
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo;
|
||||
import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.CATEGORY_NOT_EXISTS;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
/**
|
||||
* {@link ProductCategoryServiceImpl} 的单元测试类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Import(ProductCategoryServiceImpl.class)
|
||||
public class ProductCategoryServiceImplTest extends BaseDbUnitTest {
|
||||
|
||||
@Resource
|
||||
private ProductCategoryServiceImpl productCategoryService;
|
||||
|
||||
@Resource
|
||||
private ProductCategoryMapper productCategoryMapper;
|
||||
|
||||
@Test
|
||||
public void testCreateCategory_success() {
|
||||
// 准备参数
|
||||
ProductCategoryCreateReqVO reqVO = randomPojo(ProductCategoryCreateReqVO.class);
|
||||
// mock 父类
|
||||
ProductCategoryDO parentProductCategory = randomPojo(ProductCategoryDO.class, o -> o.setId(reqVO.getParentId()));
|
||||
productCategoryMapper.insert(parentProductCategory);
|
||||
|
||||
// 调用
|
||||
Long categoryId = productCategoryService.createCategory(reqVO);
|
||||
// 断言
|
||||
assertNotNull(categoryId);
|
||||
// 校验记录的属性是否正确
|
||||
ProductCategoryDO category = productCategoryMapper.selectById(categoryId);
|
||||
assertPojoEquals(reqVO, category);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateCategory_success() {
|
||||
// mock 数据
|
||||
ProductCategoryDO dbCategory = randomPojo(ProductCategoryDO.class);
|
||||
productCategoryMapper.insert(dbCategory);// @Sql: 先插入出一条存在的数据
|
||||
// 准备参数
|
||||
ProductCategoryUpdateReqVO reqVO = randomPojo(ProductCategoryUpdateReqVO.class, o -> {
|
||||
o.setId(dbCategory.getId()); // 设置更新的 ID
|
||||
});
|
||||
// mock 父类
|
||||
ProductCategoryDO parentProductCategory = randomPojo(ProductCategoryDO.class, o -> o.setId(reqVO.getParentId()));
|
||||
productCategoryMapper.insert(parentProductCategory);
|
||||
|
||||
// 调用
|
||||
productCategoryService.updateCategory(reqVO);
|
||||
// 校验是否更新正确
|
||||
ProductCategoryDO category = productCategoryMapper.selectById(reqVO.getId()); // 获取最新的
|
||||
assertPojoEquals(reqVO, category);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateCategory_notExists() {
|
||||
// 准备参数
|
||||
ProductCategoryUpdateReqVO reqVO = randomPojo(ProductCategoryUpdateReqVO.class);
|
||||
|
||||
// 调用, 并断言异常
|
||||
assertServiceException(() -> productCategoryService.updateCategory(reqVO), CATEGORY_NOT_EXISTS);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteCategory_success() {
|
||||
// mock 数据
|
||||
ProductCategoryDO dbCategory = randomPojo(ProductCategoryDO.class);
|
||||
productCategoryMapper.insert(dbCategory);// @Sql: 先插入出一条存在的数据
|
||||
// 准备参数
|
||||
Long id = dbCategory.getId();
|
||||
|
||||
// 调用
|
||||
productCategoryService.deleteCategory(id);
|
||||
// 校验数据不存在了
|
||||
assertNull(productCategoryMapper.selectById(id));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteCategory_notExists() {
|
||||
// 准备参数
|
||||
Long id = randomLongId();
|
||||
|
||||
// 调用, 并断言异常
|
||||
assertServiceException(() -> productCategoryService.deleteCategory(id), CATEGORY_NOT_EXISTS);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetCategoryLevel() {
|
||||
// mock 数据
|
||||
ProductCategoryDO category1 = randomPojo(ProductCategoryDO.class,
|
||||
o -> o.setParentId(ProductCategoryDO.PARENT_ID_NULL));
|
||||
productCategoryMapper.insert(category1);
|
||||
ProductCategoryDO category2 = randomPojo(ProductCategoryDO.class,
|
||||
o -> o.setParentId(category1.getId()));
|
||||
productCategoryMapper.insert(category2);
|
||||
ProductCategoryDO category3 = randomPojo(ProductCategoryDO.class,
|
||||
o -> o.setParentId(category2.getId()));
|
||||
productCategoryMapper.insert(category3);
|
||||
|
||||
// 调用,并断言
|
||||
assertEquals(productCategoryService.getCategoryLevel(category1.getId()), 1);
|
||||
assertEquals(productCategoryService.getCategoryLevel(category2.getId()), 2);
|
||||
assertEquals(productCategoryService.getCategoryLevel(category3.getId()), 3);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetCategoryList() {
|
||||
// mock 数据
|
||||
ProductCategoryDO dbCategory = randomPojo(ProductCategoryDO.class, o -> { // 等会查询到
|
||||
o.setName("奥特曼");
|
||||
});
|
||||
productCategoryMapper.insert(dbCategory);
|
||||
// 测试 name 不匹配
|
||||
productCategoryMapper.insert(cloneIgnoreId(dbCategory, o -> o.setName("奥特块")));
|
||||
// 准备参数
|
||||
ProductCategoryListReqVO reqVO = new ProductCategoryListReqVO();
|
||||
reqVO.setName("特曼");
|
||||
|
||||
// 调用
|
||||
List<ProductCategoryDO> list = productCategoryService.getEnableCategoryList(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, list.size());
|
||||
assertPojoEquals(dbCategory, list.get(0));
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,171 @@
|
||||
package cn.iocoder.yudao.module.product.service.sku;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
||||
import cn.iocoder.yudao.framework.test.core.util.AssertUtils;
|
||||
import cn.iocoder.yudao.module.product.api.sku.dto.ProductSkuUpdateStockReqDTO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuCreateOrUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO;
|
||||
import cn.iocoder.yudao.module.product.dal.mysql.sku.ProductSkuMapper;
|
||||
import cn.iocoder.yudao.module.product.service.property.ProductPropertyService;
|
||||
import cn.iocoder.yudao.module.product.service.property.ProductPropertyValueService;
|
||||
import cn.iocoder.yudao.module.product.service.spu.ProductSpuService;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
|
||||
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
|
||||
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo;
|
||||
import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.SKU_NOT_EXISTS;
|
||||
import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.SKU_STOCK_NOT_ENOUGH;
|
||||
import static java.util.Collections.singletonList;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.ArgumentMatchers.argThat;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
/**
|
||||
* {@link ProductSkuServiceImpl} 的单元测试
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Import(ProductSkuServiceImpl.class)
|
||||
public class ProductSkuServiceTest extends BaseDbUnitTest {
|
||||
|
||||
@Resource
|
||||
private ProductSkuService productSkuService;
|
||||
|
||||
@Resource
|
||||
private ProductSkuMapper productSkuMapper;
|
||||
|
||||
@MockBean
|
||||
private ProductSpuService productSpuService;
|
||||
@MockBean
|
||||
private ProductPropertyService productPropertyService;
|
||||
@MockBean
|
||||
private ProductPropertyValueService productPropertyValueService;
|
||||
|
||||
@Test
|
||||
public void testUpdateSkuList() {
|
||||
// mock 数据
|
||||
ProductSkuDO sku01 = randomPojo(ProductSkuDO.class, o -> { // 测试更新
|
||||
o.setSpuId(1L);
|
||||
o.setProperties(singletonList(new ProductSkuDO.Property(10L, 20L)));
|
||||
});
|
||||
productSkuMapper.insert(sku01);
|
||||
ProductSkuDO sku02 = randomPojo(ProductSkuDO.class, o -> { // 测试删除
|
||||
o.setSpuId(1L);
|
||||
o.setProperties(singletonList(new ProductSkuDO.Property(10L, 30L)));
|
||||
});
|
||||
productSkuMapper.insert(sku02);
|
||||
// 准备参数
|
||||
Long spuId = 1L;
|
||||
String spuName = "测试商品";
|
||||
List<ProductSkuCreateOrUpdateReqVO> skus = Arrays.asList(
|
||||
randomPojo(ProductSkuCreateOrUpdateReqVO.class, o -> { // 测试更新
|
||||
o.setProperties(singletonList(new ProductSkuCreateOrUpdateReqVO.Property(10L, 20L)));
|
||||
o.setStatus(CommonStatusEnum.ENABLE.getStatus());
|
||||
}),
|
||||
randomPojo(ProductSkuCreateOrUpdateReqVO.class, o -> { // 测试新增
|
||||
o.setProperties(singletonList(new ProductSkuCreateOrUpdateReqVO.Property(10L, 40L)));
|
||||
o.setStatus(CommonStatusEnum.ENABLE.getStatus());
|
||||
})
|
||||
);
|
||||
|
||||
// 调用
|
||||
productSkuService.updateSkuList(spuId, spuName, skus);
|
||||
// 断言
|
||||
List<ProductSkuDO> dbSkus = productSkuMapper.selectListBySpuId(spuId);
|
||||
assertEquals(dbSkus.size(), 2);
|
||||
// 断言更新的
|
||||
assertEquals(dbSkus.get(0).getId(), sku01.getId());
|
||||
assertPojoEquals(dbSkus.get(0), skus.get(0), "properties");
|
||||
assertEquals(skus.get(0).getProperties().size(), 1);
|
||||
assertPojoEquals(dbSkus.get(0).getProperties().get(0), skus.get(0).getProperties().get(0));
|
||||
// 断言新增的
|
||||
assertNotEquals(dbSkus.get(1).getId(), sku02.getId());
|
||||
assertPojoEquals(dbSkus.get(1), skus.get(1), "properties");
|
||||
assertEquals(skus.get(1).getProperties().size(), 1);
|
||||
assertPojoEquals(dbSkus.get(1).getProperties().get(0), skus.get(1).getProperties().get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateSkuStock_incrSuccess() {
|
||||
// 准备参数
|
||||
ProductSkuUpdateStockReqDTO updateStockReqDTO = new ProductSkuUpdateStockReqDTO()
|
||||
.setItems(singletonList(new ProductSkuUpdateStockReqDTO.Item().setId(1L).setIncrCount(10)));
|
||||
// mock 数据
|
||||
productSkuMapper.insert(randomPojo(ProductSkuDO.class, o -> o.setId(1L).setSpuId(10L).setStock(20)));
|
||||
|
||||
// 调用
|
||||
productSkuService.updateSkuStock(updateStockReqDTO);
|
||||
// 断言
|
||||
ProductSkuDO sku = productSkuMapper.selectById(1L);
|
||||
assertEquals(sku.getStock(), 30);
|
||||
verify(productSpuService).updateSpuStock(argThat(spuStockIncrCounts -> {
|
||||
assertEquals(spuStockIncrCounts.size(), 1);
|
||||
assertEquals(spuStockIncrCounts.get(10L), 10);
|
||||
return true;
|
||||
}));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateSkuStock_decrSuccess() {
|
||||
// 准备参数
|
||||
ProductSkuUpdateStockReqDTO updateStockReqDTO = new ProductSkuUpdateStockReqDTO()
|
||||
.setItems(singletonList(new ProductSkuUpdateStockReqDTO.Item().setId(1L).setIncrCount(-10)));
|
||||
// mock 数据
|
||||
productSkuMapper.insert(randomPojo(ProductSkuDO.class, o -> o.setId(1L).setSpuId(10L).setStock(20)));
|
||||
|
||||
// 调用
|
||||
productSkuService.updateSkuStock(updateStockReqDTO);
|
||||
// 断言
|
||||
ProductSkuDO sku = productSkuMapper.selectById(1L);
|
||||
assertEquals(sku.getStock(), 10);
|
||||
verify(productSpuService).updateSpuStock(argThat(spuStockIncrCounts -> {
|
||||
assertEquals(spuStockIncrCounts.size(), 1);
|
||||
assertEquals(spuStockIncrCounts.get(10L), -10);
|
||||
return true;
|
||||
}));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateSkuStock_decrFail() {
|
||||
// 准备参数
|
||||
ProductSkuUpdateStockReqDTO updateStockReqDTO = new ProductSkuUpdateStockReqDTO()
|
||||
.setItems(singletonList(new ProductSkuUpdateStockReqDTO.Item().setId(1L).setIncrCount(-30)));
|
||||
// mock 数据
|
||||
productSkuMapper.insert(randomPojo(ProductSkuDO.class, o -> o.setId(1L).setSpuId(10L).setStock(20)));
|
||||
|
||||
// 调用并断言
|
||||
AssertUtils.assertServiceException(() -> productSkuService.updateSkuStock(updateStockReqDTO),
|
||||
SKU_STOCK_NOT_ENOUGH);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteSku_success() {
|
||||
// mock 数据
|
||||
ProductSkuDO dbSku = randomPojo(ProductSkuDO.class);
|
||||
productSkuMapper.insert(dbSku);// @Sql: 先插入出一条存在的数据
|
||||
// 准备参数
|
||||
Long id = dbSku.getId();
|
||||
|
||||
// 调用
|
||||
productSkuService.deleteSku(id);
|
||||
// 校验数据不存在了
|
||||
assertNull(productSkuMapper.selectById(id));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteSku_notExists() {
|
||||
// 准备参数
|
||||
Long id = 1L;
|
||||
|
||||
// 调用, 并断言异常
|
||||
assertServiceException(() -> productSkuService.deleteSku(id), SKU_NOT_EXISTS);
|
||||
}
|
||||
}
|
@@ -0,0 +1,359 @@
|
||||
package cn.iocoder.yudao.module.product.service.spu;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import cn.iocoder.yudao.framework.common.exception.ServiceException;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
||||
import cn.iocoder.yudao.framework.common.util.collection.SetUtils;
|
||||
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuCreateOrUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.spu.vo.ProductSpuCreateReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.spu.vo.ProductSpuPageReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.spu.vo.ProductSpuRespVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.spu.vo.ProductSpuUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.app.spu.vo.AppProductSpuPageReqVO;
|
||||
import cn.iocoder.yudao.module.product.convert.spu.ProductSpuConvert;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO;
|
||||
import cn.iocoder.yudao.module.product.dal.mysql.spu.ProductSpuMapper;
|
||||
import cn.iocoder.yudao.module.product.enums.spu.ProductSpuSpecTypeEnum;
|
||||
import cn.iocoder.yudao.module.product.enums.spu.ProductSpuStatusEnum;
|
||||
import cn.iocoder.yudao.module.product.service.brand.ProductBrandServiceImpl;
|
||||
import cn.iocoder.yudao.module.product.service.category.ProductCategoryServiceImpl;
|
||||
import cn.iocoder.yudao.module.product.service.property.ProductPropertyService;
|
||||
import cn.iocoder.yudao.module.product.service.property.ProductPropertyValueService;
|
||||
import cn.iocoder.yudao.module.product.service.sku.ProductSkuServiceImpl;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.Mockito;
|
||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
|
||||
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
|
||||
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
// TODO @芋艿:review 下单元测试
|
||||
|
||||
/**
|
||||
* {@link ProductSpuServiceImpl} 的单元测试类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Import(ProductSpuServiceImpl.class)
|
||||
@Disabled // TODO 芋艿:临时去掉
|
||||
public class ProductSpuServiceImplTest extends BaseDbUnitTest {
|
||||
|
||||
@Resource
|
||||
private ProductSpuServiceImpl productSpuService;
|
||||
|
||||
@Resource
|
||||
private ProductSpuMapper productSpuMapper;
|
||||
|
||||
@MockBean
|
||||
private ProductSkuServiceImpl productSkuService;
|
||||
@MockBean
|
||||
private ProductCategoryServiceImpl categoryService;
|
||||
@MockBean
|
||||
private ProductBrandServiceImpl brandService;
|
||||
@MockBean
|
||||
private ProductPropertyService productPropertyService;
|
||||
@MockBean
|
||||
private ProductPropertyValueService productPropertyValueService;
|
||||
|
||||
public String generateNo() {
|
||||
return DateUtil.format(new Date(), "yyyyMMddHHmmss") + RandomUtil.randomInt(100000, 999999);
|
||||
}
|
||||
|
||||
public Long generateId() {
|
||||
return RandomUtil.randomLong(100000, 999999);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateSpu_success() {
|
||||
// 准备参数
|
||||
ProductSpuCreateReqVO createReqVO = randomPojo(ProductSpuCreateReqVO.class, o -> {
|
||||
o.setSpecType(ProductSpuSpecTypeEnum.DISABLE.getType());
|
||||
o.setStatus(ProductSpuStatusEnum.ENABLE.getStatus());
|
||||
});
|
||||
|
||||
// 校验SKU
|
||||
List<ProductSkuCreateOrUpdateReqVO> skuCreateReqList = createReqVO.getSkus();
|
||||
|
||||
Long spu = productSpuService.createSpu(createReqVO);
|
||||
ProductSpuDO productSpuDO = productSpuMapper.selectById(spu);
|
||||
|
||||
createReqVO.setMarketPrice(CollectionUtils.getMaxValue(skuCreateReqList, ProductSkuCreateOrUpdateReqVO::getMarketPrice));
|
||||
// createReqVO.setMaxPrice(CollectionUtils.getMaxValue(skuCreateReqList, ProductSkuCreateOrUpdateReqVO::getPrice));
|
||||
// createReqVO.setMinPrice(CollectionUtils.getMinValue(skuCreateReqList, ProductSkuCreateOrUpdateReqVO::getPrice));
|
||||
// createReqVO.setTotalStock(CollectionUtils.getSumValue(skuCreateReqList, ProductSkuCreateOrUpdateReqVO::getStock, Integer::sum));
|
||||
|
||||
assertPojoEquals(createReqVO, productSpuDO);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateSpu_success() {
|
||||
// 准备参数
|
||||
ProductSpuDO createReqVO = randomPojo(ProductSpuDO.class);
|
||||
productSpuMapper.insert(createReqVO);
|
||||
// 准备参数
|
||||
ProductSpuUpdateReqVO reqVO = randomPojo(ProductSpuUpdateReqVO.class, o -> {
|
||||
o.setId(createReqVO.getId()); // 设置更新的 ID
|
||||
o.setSpecType(ProductSpuSpecTypeEnum.DISABLE.getType());
|
||||
o.setStatus(ProductSpuStatusEnum.DISABLE.getStatus());
|
||||
});
|
||||
// 调用
|
||||
productSpuService.updateSpu(reqVO);
|
||||
|
||||
List<ProductSkuCreateOrUpdateReqVO> skuCreateReqList = reqVO.getSkus();
|
||||
reqVO.setMarketPrice(CollectionUtils.getMaxValue(skuCreateReqList, ProductSkuCreateOrUpdateReqVO::getMarketPrice));
|
||||
// reqVO.setMaxPrice(CollectionUtils.getMaxValue(skuCreateReqList, ProductSkuCreateOrUpdateReqVO::getPrice));
|
||||
// reqVO.setMinPrice(CollectionUtils.getMinValue(skuCreateReqList, ProductSkuCreateOrUpdateReqVO::getPrice));
|
||||
// reqVO.setTotalStock(CollectionUtils.getSumValue(skuCreateReqList, ProductSkuCreateOrUpdateReqVO::getStock, Integer::sum));
|
||||
|
||||
// 校验是否更新正确
|
||||
ProductSpuDO spu = productSpuMapper.selectById(reqVO.getId()); // 获取最新的
|
||||
assertPojoEquals(reqVO, spu);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testValidateSpuExists_exception() {
|
||||
ProductSpuUpdateReqVO reqVO = randomPojo(ProductSpuUpdateReqVO.class, o -> {
|
||||
o.setSpecType(ProductSpuSpecTypeEnum.DISABLE.getType());
|
||||
o.setStatus(ProductSpuStatusEnum.DISABLE.getStatus());
|
||||
});
|
||||
// 调用
|
||||
Assertions.assertThrows(ServiceException.class, () -> productSpuService.updateSpu(reqVO));
|
||||
}
|
||||
|
||||
@Test
|
||||
void deleteSpu() {
|
||||
// 准备参数
|
||||
ProductSpuDO createReqVO = randomPojo(ProductSpuDO.class);
|
||||
productSpuMapper.insert(createReqVO);
|
||||
|
||||
// 调用
|
||||
productSpuService.deleteSpu(createReqVO.getId());
|
||||
|
||||
Assertions.assertNull(productSpuMapper.selectById(createReqVO.getId()));
|
||||
}
|
||||
|
||||
@Test
|
||||
void getSpu() {
|
||||
// 准备参数
|
||||
ProductSpuDO createReqVO = randomPojo(ProductSpuDO.class);
|
||||
productSpuMapper.insert(createReqVO);
|
||||
|
||||
ProductSpuDO spu = productSpuService.getSpu(createReqVO.getId());
|
||||
assertPojoEquals(createReqVO, spu);
|
||||
}
|
||||
|
||||
@Test
|
||||
void getSpuList() {
|
||||
// 准备参数
|
||||
ArrayList<ProductSpuDO> createReqVO = Lists.newArrayList(randomPojo(ProductSpuDO.class), randomPojo(ProductSpuDO.class));
|
||||
productSpuMapper.insertBatch(createReqVO);
|
||||
|
||||
// 调用
|
||||
List<ProductSpuDO> spuList = productSpuService.getSpuList(createReqVO.stream().map(ProductSpuDO::getId).collect(Collectors.toList()));
|
||||
Assertions.assertIterableEquals(createReqVO, spuList);
|
||||
}
|
||||
|
||||
@Test
|
||||
void getSpuPage_alarmStock_empty() {
|
||||
// 调用
|
||||
ProductSpuPageReqVO productSpuPageReqVO = new ProductSpuPageReqVO();
|
||||
productSpuPageReqVO.setAlarmStock(true);
|
||||
|
||||
PageResult<ProductSpuDO> spuPage = productSpuService.getSpuPage(productSpuPageReqVO);
|
||||
|
||||
PageResult<Object> result = PageResult.empty();
|
||||
Assertions.assertIterableEquals(result.getList(), spuPage.getList());
|
||||
assertEquals(spuPage.getTotal(), result.getTotal());
|
||||
}
|
||||
|
||||
@Test
|
||||
void getSpuPage_alarmStock() {
|
||||
// mock 数据
|
||||
Long brandId = generateId();
|
||||
Long categoryId = generateId();
|
||||
String code = generateNo();
|
||||
|
||||
// 准备参数
|
||||
ProductSpuDO createReqVO = randomPojo(ProductSpuDO.class, o->{
|
||||
o.setStatus(ProductSpuStatusEnum.ENABLE.getStatus());
|
||||
o.setTotalStock(500);
|
||||
o.setMinPrice(1);
|
||||
o.setMaxPrice(50);
|
||||
o.setMarketPrice(25);
|
||||
o.setSpecType(ProductSpuSpecTypeEnum.RECYCLE.getType());
|
||||
o.setBrandId(brandId);
|
||||
o.setCategoryId(categoryId);
|
||||
o.setClickCount(100);
|
||||
o.setCode(code);
|
||||
o.setDescription("测试商品");
|
||||
o.setPicUrls(new ArrayList<>());
|
||||
o.setName("测试");
|
||||
o.setSalesCount(100);
|
||||
o.setSellPoint("超级加倍");
|
||||
o.setShowStock(true);
|
||||
o.setVideoUrl("");
|
||||
});
|
||||
productSpuMapper.insert(createReqVO);
|
||||
|
||||
Set<Long> alarmStockSpuIds = SetUtils.asSet(createReqVO.getId());
|
||||
|
||||
List<ProductSkuDO> productSpuDOS = Arrays.asList(randomPojo(ProductSkuDO.class, o -> {
|
||||
o.setSpuId(createReqVO.getId());
|
||||
}), randomPojo(ProductSkuDO.class, o -> {
|
||||
o.setSpuId(createReqVO.getId());
|
||||
}));
|
||||
|
||||
Mockito.when(productSkuService.getSkuListByAlarmStock()).thenReturn(productSpuDOS);
|
||||
|
||||
// 调用
|
||||
ProductSpuPageReqVO productSpuPageReqVO = new ProductSpuPageReqVO();
|
||||
productSpuPageReqVO.setAlarmStock(true);
|
||||
PageResult<ProductSpuDO> spuPage = productSpuService.getSpuPage(productSpuPageReqVO);
|
||||
|
||||
PageResult<ProductSpuRespVO> result = ProductSpuConvert.INSTANCE.convertPage(productSpuMapper.selectPage(productSpuPageReqVO, alarmStockSpuIds));
|
||||
Assertions.assertIterableEquals(result.getList(), spuPage.getList());
|
||||
assertEquals(spuPage.getTotal(), result.getTotal());
|
||||
}
|
||||
|
||||
@Test
|
||||
void getSpuPage() {
|
||||
// mock 数据
|
||||
Long brandId = generateId();
|
||||
Long categoryId = generateId();
|
||||
|
||||
// 准备参数
|
||||
ProductSpuDO createReqVO = randomPojo(ProductSpuDO.class, o->{
|
||||
o.setStatus(ProductSpuStatusEnum.ENABLE.getStatus());
|
||||
o.setTotalStock(1);
|
||||
o.setMinPrice(1);
|
||||
o.setMaxPrice(1);
|
||||
o.setMarketPrice(1);
|
||||
o.setSpecType(ProductSpuSpecTypeEnum.RECYCLE.getType());
|
||||
o.setBrandId(brandId);
|
||||
o.setCategoryId(categoryId);
|
||||
o.setClickCount(1);
|
||||
o.setCode(generateNo());
|
||||
o.setDescription("测试商品");
|
||||
o.setPicUrls(new ArrayList<>());
|
||||
o.setName("测试");
|
||||
o.setSalesCount(1);
|
||||
o.setSellPoint("卖点");
|
||||
o.setShowStock(true);
|
||||
});
|
||||
|
||||
// 准备参数
|
||||
productSpuMapper.insert(createReqVO);
|
||||
// 测试 status 不匹配
|
||||
productSpuMapper.insert(cloneIgnoreId(createReqVO, o -> o.setStatus(ProductSpuStatusEnum.DISABLE.getStatus())));
|
||||
productSpuMapper.insert(cloneIgnoreId(createReqVO, o -> o.setStatus(ProductSpuStatusEnum.RECYCLE.getStatus())));
|
||||
// 测试 SpecType 不匹配
|
||||
productSpuMapper.insert(cloneIgnoreId(createReqVO, o -> o.setSpecType(ProductSpuSpecTypeEnum.DISABLE.getType())));
|
||||
// 测试 BrandId 不匹配
|
||||
productSpuMapper.insert(cloneIgnoreId(createReqVO, o -> o.setBrandId(generateId())));
|
||||
// 测试 CategoryId 不匹配
|
||||
productSpuMapper.insert(cloneIgnoreId(createReqVO, o -> o.setCategoryId(generateId())));
|
||||
|
||||
// 调用
|
||||
ProductSpuPageReqVO productSpuPageReqVO = new ProductSpuPageReqVO();
|
||||
productSpuPageReqVO.setAlarmStock(false);
|
||||
productSpuPageReqVO.setBrandId(brandId);
|
||||
productSpuPageReqVO.setStatus(ProductSpuStatusEnum.ENABLE.getStatus());
|
||||
productSpuPageReqVO.setCategoryId(categoryId);
|
||||
|
||||
PageResult<ProductSpuDO> spuPage = productSpuService.getSpuPage(productSpuPageReqVO);
|
||||
|
||||
PageResult<ProductSpuRespVO> result = ProductSpuConvert.INSTANCE.convertPage(productSpuMapper.selectPage(productSpuPageReqVO, (Set<Long>) null));
|
||||
assertEquals(result, spuPage);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testGetSpuPage() {
|
||||
// 准备参数
|
||||
ProductSpuDO createReqVO = randomPojo(ProductSpuDO.class, o -> {
|
||||
o.setCategoryId(2L);
|
||||
});
|
||||
productSpuMapper.insert(createReqVO);
|
||||
|
||||
// 调用
|
||||
AppProductSpuPageReqVO appSpuPageReqVO = new AppProductSpuPageReqVO();
|
||||
appSpuPageReqVO.setCategoryId(2L);
|
||||
|
||||
// PageResult<AppSpuPageItemRespVO> spuPage = productSpuService.getSpuPage(appSpuPageReqVO);
|
||||
//
|
||||
// PageResult<ProductSpuDO> result = productSpuMapper.selectPage(
|
||||
// ProductSpuConvert.INSTANCE.convert(appSpuPageReqVO));
|
||||
//
|
||||
// List<AppSpuPageItemRespVO> collect = result.getList()
|
||||
// .stream()
|
||||
// .map(ProductSpuConvert.INSTANCE::convertAppResp)
|
||||
// .collect(Collectors.toList());
|
||||
//
|
||||
// Assertions.assertIterableEquals(collect, spuPage.getList());
|
||||
// assertEquals(spuPage.getTotal(), result.getTotal());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 生成笛卡尔积
|
||||
*
|
||||
* @param data 数据
|
||||
* @return 笛卡尔积
|
||||
*/
|
||||
public static <T> List<List<T>> cartesianProduct(List<List<T>> data) {
|
||||
List<List<T>> res = null; // 结果集(当前为第N个List,则该处存放的就为前N-1个List的笛卡尔积集合)
|
||||
for (List<T> list : data) { // 遍历数据
|
||||
List<List<T>> temp = new ArrayList<>(); // 临时结果集,存放本次循环后生成的笛卡尔积集合
|
||||
if (res == null) { // 结果集为null表示第一次循环既list为第一个List
|
||||
for (T t : list) { // 便利第一个List
|
||||
// 利用stream生成List,第一个List的笛卡尔积集合约等于自己本身(需要创建一个List并把对象添加到当中),存放到临时结果集
|
||||
temp.add(Stream.of(t).collect(Collectors.toList()));
|
||||
}
|
||||
res = temp; // 将临时结果集赋值给结果集
|
||||
continue; // 跳过本次循环
|
||||
}
|
||||
// 不为第一个List,计算前面的集合(笛卡尔积)和当前List的笛卡尔积集合
|
||||
for (T t : list) { // 便利
|
||||
for (List<T> rl : res) { // 便利前面的笛卡尔积集合
|
||||
// 利用stream生成List
|
||||
temp.add(Stream.concat(rl.stream(), Stream.of(t)).collect(Collectors.toList()));
|
||||
}
|
||||
}
|
||||
res = temp; // 将临时结果集赋值给结果集
|
||||
}
|
||||
// 返回结果
|
||||
return res;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateSpuStock() {
|
||||
// 准备参数
|
||||
Map<Long, Integer> stockIncrCounts = MapUtil.builder(1L, 10).put(2L, -20).build();
|
||||
// mock 方法(数据)
|
||||
productSpuMapper.insert(randomPojo(ProductSpuDO.class, o -> o.setId(1L).setTotalStock(20)));
|
||||
productSpuMapper.insert(randomPojo(ProductSpuDO.class, o -> o.setId(2L).setTotalStock(30)));
|
||||
|
||||
// 调用
|
||||
productSpuService.updateSpuStock(stockIncrCounts);
|
||||
// 断言
|
||||
assertEquals(productSpuService.getSpu(1L).getTotalStock(), 30);
|
||||
assertEquals(productSpuService.getSpu(2L).getTotalStock(), 10);
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,50 @@
|
||||
spring:
|
||||
main:
|
||||
lazy-initialization: true # 开启懒加载,加快速度
|
||||
banner-mode: off # 单元测试,禁用 Banner
|
||||
|
||||
--- #################### 数据库相关配置 ####################
|
||||
|
||||
spring:
|
||||
# 数据源配置项
|
||||
datasource:
|
||||
name: ruoyi-vue-pro
|
||||
url: jdbc:h2:mem:testdb;MODE=MYSQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=value; # MODE 使用 MySQL 模式;DATABASE_TO_UPPER 配置表和字段使用小写
|
||||
driver-class-name: org.h2.Driver
|
||||
username: sa
|
||||
password:
|
||||
druid:
|
||||
async-init: true # 单元测试,异步初始化 Druid 连接池,提升启动速度
|
||||
initial-size: 1 # 单元测试,配置为 1,提升启动速度
|
||||
sql:
|
||||
init:
|
||||
schema-locations: classpath:/sql/create_tables.sql
|
||||
|
||||
# Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优
|
||||
redis:
|
||||
host: 127.0.0.1 # 地址
|
||||
port: 16379 # 端口(单元测试,使用 16379 端口)
|
||||
database: 0 # 数据库索引
|
||||
|
||||
mybatis-plus:
|
||||
lazy-initialization: true # 单元测试,设置 MyBatis Mapper 延迟加载,加速每个单元测试
|
||||
type-aliases-package: ${yudao.info.base-package}.module.*.dal.dataobject
|
||||
|
||||
--- #################### 定时任务相关配置 ####################
|
||||
|
||||
--- #################### 配置中心相关配置 ####################
|
||||
|
||||
--- #################### 服务保障相关配置 ####################
|
||||
|
||||
# Lock4j 配置项(单元测试,禁用 Lock4j)
|
||||
|
||||
# Resilience4j 配置项
|
||||
|
||||
--- #################### 监控相关配置 ####################
|
||||
|
||||
--- #################### 芋道相关配置 ####################
|
||||
|
||||
# 芋道配置项,设置当前项目所有自定义的配置
|
||||
yudao:
|
||||
info:
|
||||
base-package: cn.iocoder.yudao
|
@@ -0,0 +1,4 @@
|
||||
<configuration>
|
||||
<!-- 引用 Spring Boot 的 logback 基础配置 -->
|
||||
<include resource="org/springframework/boot/logging/logback/defaults.xml" />
|
||||
</configuration>
|
@@ -1,7 +1,4 @@
|
||||
DELETE FROM "product_sku";
|
||||
DELETE FROM "product_spu";
|
||||
DELETE FROM "product_brand";
|
||||
DELETE FROM "product_category";
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -21,6 +21,7 @@ CREATE TABLE IF NOT EXISTS `product_sku` (
|
||||
PRIMARY KEY (`id`)
|
||||
) COMMENT '商品sku';
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `product_spu` (
|
||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||
`tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '租户编号',
|
||||
@@ -66,3 +67,18 @@ CREATE TABLE IF NOT EXISTS `product_category` (
|
||||
`deleted` bit(1) NOT NULL DEFAULT 0 COMMENT '是否删除',
|
||||
PRIMARY KEY (`id`)
|
||||
) COMMENT '商品分类';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `product_brand` (
|
||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '品牌编号',
|
||||
`name` varchar(128) NOT NULL COMMENT '品牌名称',
|
||||
`pic_url` varchar DEFAULT NULL COMMENT '品牌图片',
|
||||
`sort` int NOT NULL DEFAULT '0' COMMENT '排序字段',
|
||||
`description` varchar(256) NOT NULL DEFAULT '0' COMMENT '品牌描述',
|
||||
`status` bit(1) DEFAULT NULL COMMENT '状态',
|
||||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`creator` varchar DEFAULT NULL COMMENT '创建人',
|
||||
`updater` varchar DEFAULT NULL COMMENT '更新人',
|
||||
`deleted` bit(1) NOT NULL DEFAULT 0 COMMENT '是否删除',
|
||||
PRIMARY KEY (`id`)
|
||||
) COMMENT '商品品牌';
|
||||
|
Reference in New Issue
Block a user