fix: TODO pid 改成 parentId 字段

This commit is contained in:
jeromesoar
2022-05-12 16:57:33 +08:00
parent 1fc5c3c71c
commit ff307a4c86
7 changed files with 35 additions and 36 deletions

View File

@ -15,7 +15,7 @@ public class CategoryBaseVO {
@ApiModelProperty(value = "父分类编号", required = true, example = "1")
@NotNull(message = "父分类编号不能为空")
private Long pid;
private Long parentId;
@ApiModelProperty(value = "分类名称", required = true, example = "办公文具")
@NotBlank(message = "分类名称不能为空")

View File

@ -1,12 +1,11 @@
package cn.iocoder.yudao.module.product.controller.admin.category.vo;
import lombok.*;
import java.util.*;
import io.swagger.annotations.*;
import com.alibaba.excel.annotation.ExcelProperty;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
import java.util.Date;
/**
@ -21,7 +20,7 @@ public class CategoryExcelVO {
private Long id;
@ExcelProperty("父分类编号")
private Long pid;
private Long parentId;
@ExcelProperty("分类名称")
private String name;

View File

@ -28,8 +28,7 @@ public class CategoryDO extends BaseDO {
/**
* 父分类编号
*/
// TODO @JeromeSoar改成 parentId 字段
private Long pid;
private Long parentId;
/**
* 分类名称
*/

View File

@ -105,7 +105,7 @@ public class CategoryServiceImplTest extends BaseDbUnitTest {
public void testGetCategoryPage() {
// mock 数据
CategoryDO dbCategory = randomPojo(CategoryDO.class, o -> { // 等会查询到
o.setPid(null);
o.setParentId(null);
o.setName(null);
o.setIcon(null);
o.setBannerUrl(null);
@ -116,7 +116,7 @@ public class CategoryServiceImplTest extends BaseDbUnitTest {
});
categoryMapper.insert(dbCategory);
// 测试 pid 不匹配
categoryMapper.insert(cloneIgnoreId(dbCategory, o -> o.setPid(null)));
categoryMapper.insert(cloneIgnoreId(dbCategory, o -> o.setParentId(null)));
// 测试 name 不匹配
categoryMapper.insert(cloneIgnoreId(dbCategory, o -> o.setName(null)));
// 测试 icon 不匹配
@ -151,7 +151,7 @@ public class CategoryServiceImplTest extends BaseDbUnitTest {
public void testGetCategoryList() {
// mock 数据
CategoryDO dbCategory = randomPojo(CategoryDO.class, o -> { // 等会查询到
o.setPid(null);
o.setParentId(null);
o.setName(null);
o.setIcon(null);
o.setBannerUrl(null);
@ -162,7 +162,7 @@ public class CategoryServiceImplTest extends BaseDbUnitTest {
});
categoryMapper.insert(dbCategory);
// 测试 pid 不匹配
categoryMapper.insert(cloneIgnoreId(dbCategory, o -> o.setPid(null)));
categoryMapper.insert(cloneIgnoreId(dbCategory, o -> o.setParentId(null)));
// 测试 name 不匹配
categoryMapper.insert(cloneIgnoreId(dbCategory, o -> o.setName(null)));
// 测试 icon 不匹配

View File

@ -1,6 +1,6 @@
CREATE TABLE IF NOT EXISTS "product_category" (
"id" bigint(20) NOT NULL GENERATED BY DEFAULT AS IDENTITY,
"pid" bigint(20) NOT NULL,
"parent_id" bigint(20) NOT NULL,
"name" varchar(255) NOT NULL,
"icon" varchar(100),
"banner_url" varchar(255) NOT NULL,