Selaa lähdekoodia

add: category model and api

dev
powersir 1 vuosi sitten
vanhempi
commit
5417cf7fa5
3 muutettua tiedostoa jossa 103 lisäystä ja 0 poistoa
  1. +54
    -0
      src/models/category.data.ts
  2. +1
    -0
      src/models/index.ts
  3. +48
    -0
      src/request/service/category.ts

+ 54
- 0
src/models/category.data.ts Näytä tiedosto

@@ -0,0 +1,54 @@

/**
* CategoryVO,管理后台 - 类目 Response VO
*/
export interface CategoryVO {
/**
* 类目名称,最大长度不能超过125
*/
categoryName: string;
/**
* 类目英文名称,最大长度255
*/
categoryNameEn: string;
/**
* 创建时间
*/
createTime: Date;
/**
* 主键
*/
id: number;
/**
* 是否叶子节点,(1: 是, 2:不是)
*/
isLeaf?: string;
/**
* 目录级别
*/
level?: string;
/**
* 父类目id
*/
parentId?: number;
/**
* 备注,最大长度255
*/
remark?: string;
}


export interface CategoryPageReqVO extends PageParam {
/**
* 类目名称
*/
categoryName?: string;
/**
* 类目英文名称
*/
categoryNameEn?: string;
/**
* 创建时间
*/
createTime?: string[];
}

+ 1
- 0
src/models/index.ts Näytä tiedosto

@@ -12,6 +12,7 @@ export * from './redis.data.ts'
export * from './api-log.data.ts'
export * from './oauth2.data.ts'
export * from './platform.data.ts'
export * from './category.data.ts'

export interface ResponseDTO<T>{
code: number;


+ 48
- 0
src/request/service/category.ts Näytä tiedosto

@@ -0,0 +1,48 @@
import request from '@/request';
import { CategoryVO, CategoryPageReqVO, PageData } from '@/models';

const BASE_URL = '/admin-api/main/category';

export default {

// 修改类目
updateCategoryApi: (data: CategoryVO) => {
return request.put(`${BASE_URL}/update`, data);
},

// 创建类目
createCategoryApi: (data: CategoryVO) => {
return request.post(`${BASE_URL}/create`, data);
},


// 获得类目分页
getCategoryPageApi: () => {
return request.get<PageData<CategoryVO>>(`${BASE_URL}/page`);
},

// 获得所有类目(树结构)
getCategoryTreeApi: (params: CategoryPageReqVO) => {
return request.get<CategoryVO[]>(`${BASE_URL}/categoryAllTree`, { params })
},

// 查询类目详情
getCategoryApi: (id: number) => {
return request.get(`${BASE_URL}/get?id=${id}`);
},

// 删除类目
deleteCategoryApi: (id: number) => {
return request.delete(`${BASE_URL}/delete?id=${id}`);
},

// 类目名称唯一校验
categoryNameVerifyUnique: (categoryName: string) => {
return request.delete(`${BASE_URL}/categoryNameVerifyUnique?categoryName=${categoryName}`);
},

// 类目英文名称唯一校验
categoryNameEnVerifyUnique: (categoryNameEn: string) => {
return request.delete(`${BASE_URL}/categoryNameEnVerifyUnique?categoryNameEn=${categoryNameEn}`);
},
};

Loading…
Peruuta
Tallenna