mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-09-12 16:57:12 +08:00
1.MySQL数据库>建表规约>第9条: 【强制】表必备三字段:id,create_time,update_time。 说明:其中 id 必为主键,类型为 bigint unsigned、单表时自增、步长为 1。create_time,update_time 的类型均为datetime 类型,如果要记录时区信息,那么类型设置为 timestamp。 个人理解:简化列名的目的是为了后续能抽取更多公共能力 2.MySQL数据库>SQL语句>第10条: 【推荐】SQL 语句中表的别名前加 as,并且以 t1、t2、t3、...的顺序依次命名。 说明: 1)别名可以是表的简称,或者是依照表在 SQL 语句中出现的顺序,以 t1、t2、t3 的方式命名。 2)别名前加 as 使别名更容易识别。 正例:select t1.name from first_table as t1 , second_table as t2 where t1.id = t2.id;
58 lines
1.1 KiB
TypeScript
58 lines
1.1 KiB
TypeScript
import axios from 'axios';
|
|
import qs from 'query-string';
|
|
|
|
const BASE_URL = '/system/menu';
|
|
|
|
export interface MenuRecord {
|
|
id?: string;
|
|
title: string;
|
|
parentId?: string;
|
|
type: number;
|
|
path?: string;
|
|
name?: string;
|
|
component?: string;
|
|
icon?: string;
|
|
isExternal: boolean;
|
|
isCache: boolean;
|
|
isHidden: boolean;
|
|
permission?: string;
|
|
sort: number;
|
|
status?: number;
|
|
createUserString?: string;
|
|
createTime?: string;
|
|
updateUserString?: string;
|
|
updateTime?: string;
|
|
children?: Array<MenuRecord>;
|
|
parentName?: string;
|
|
}
|
|
|
|
export interface MenuParam {
|
|
name?: string;
|
|
status?: number;
|
|
}
|
|
|
|
export function listMenu(params: MenuParam) {
|
|
return axios.get<MenuRecord[]>(`${BASE_URL}/tree`, {
|
|
params,
|
|
paramsSerializer: (obj) => {
|
|
return qs.stringify(obj);
|
|
},
|
|
});
|
|
}
|
|
|
|
export function getMenu(id: string) {
|
|
return axios.get<MenuRecord>(`${BASE_URL}/${id}`);
|
|
}
|
|
|
|
export function addMenu(req: MenuRecord) {
|
|
return axios.post(BASE_URL, req);
|
|
}
|
|
|
|
export function updateMenu(req: MenuRecord) {
|
|
return axios.put(BASE_URL, req);
|
|
}
|
|
|
|
export function deleteMenu(ids: string | Array<string>) {
|
|
return axios.delete(`${BASE_URL}/${ids}`);
|
|
}
|