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

@@ -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,