mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-24 22:29:19 +08:00
feat(ecom-dmb): 新增商品类目模块,支持商品关联类目
后端: - 新增 ec_category 表(支持多级分类) - ec_product 表新增 category_id 字段(ON DELETE SET NULL) - CategoryController: CRUD + 分页 + 树形接口 - ProductServiceImpl 支持 categoryId 写入和 categoryName 读取 - sys_menu 新增类目管理菜单(配置管理下) 前端: - 新增类目管理 API 和页面(/ecommerce/config/category-config/) - ProductFormModal 新增类目选择器 - 商品列表视图新增类目列
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
import type { CategoryDTO, CategoryVO } from './types';
|
||||
|
||||
import type { PageQueryDTO, PageResultVO } from '#/types/common';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
/**
|
||||
* 商品类目管理API
|
||||
*/
|
||||
|
||||
/**
|
||||
* 创建类目
|
||||
*/
|
||||
export async function createCategoryApi(data: CategoryDTO.Create) {
|
||||
return requestClient.post<CategoryVO.Info>('/ec/category/create', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新类目
|
||||
*/
|
||||
export async function updateCategoryApi(id: number, data: CategoryDTO.Update) {
|
||||
return requestClient.put<CategoryVO.Info>(`/ec/category/update/${id}`, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除类目
|
||||
*/
|
||||
export async function deleteCategoryApi(id: number) {
|
||||
return requestClient.delete(`/ec/category/delete/${id}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页获取类目列表
|
||||
*/
|
||||
export async function getCategoryPageApi(params: PageQueryDTO<CategoryDTO.Filters>) {
|
||||
return requestClient.post<PageResultVO<CategoryVO.Info>>('/ec/category/page', params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取类目树形结构
|
||||
*/
|
||||
export async function getCategoryTreeApi() {
|
||||
return requestClient.get<CategoryVO.Info[]>('/ec/category/tree');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取类目扁平列表
|
||||
*/
|
||||
export async function getCategoryListApi() {
|
||||
return requestClient.get<CategoryVO.Info[]>('/ec/category/list');
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from './apis';
|
||||
export * from './types';
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from './types.dto';
|
||||
export * from './types.vo';
|
||||
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* 商品类目相关DTO类型定义
|
||||
*/
|
||||
|
||||
export namespace CategoryDTO {
|
||||
/** 创建类目参数 */
|
||||
export interface Create {
|
||||
/** 父级类目ID(顶级类目不传) */
|
||||
parentId?: number;
|
||||
/** 类目名称 */
|
||||
name: string;
|
||||
/** 排序 */
|
||||
sortOrder?: number;
|
||||
}
|
||||
|
||||
/** 更新类目参数 */
|
||||
export interface Update {
|
||||
/** 父级类目ID(设为null表示顶级) */
|
||||
parentId?: number | null;
|
||||
/** 类目名称 */
|
||||
name: string;
|
||||
/** 排序 */
|
||||
sortOrder?: number;
|
||||
}
|
||||
|
||||
/** 类目过滤条件 */
|
||||
export interface Filters {
|
||||
/** 类目名称(模糊查询) */
|
||||
name?: string;
|
||||
/** 父级类目ID(精确查询) */
|
||||
parentId?: number;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* 商品类目相关VO类型定义
|
||||
*/
|
||||
|
||||
export namespace CategoryVO {
|
||||
/** 类目信息 */
|
||||
export interface Info {
|
||||
/** 类目ID */
|
||||
id: number;
|
||||
/** 公司ID */
|
||||
companyId?: number;
|
||||
/** 父级类目ID */
|
||||
parentId?: number;
|
||||
/** 父级类目名称 */
|
||||
parentName?: string;
|
||||
/** 类目名称 */
|
||||
name: string;
|
||||
/** 排序 */
|
||||
sortOrder?: number;
|
||||
/** 创建时间 */
|
||||
createTime: string;
|
||||
/** 更新时间 */
|
||||
updateTime: string;
|
||||
/** 创建人ID */
|
||||
createBy?: number;
|
||||
/** 更新人ID */
|
||||
updateBy?: number;
|
||||
/** 子类目列表 */
|
||||
children?: Info[];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user