This commit is contained in:
njdaoyehu 2024-11-19 12:23:16 +08:00
parent 673bac2372
commit 5972f6be40
2 changed files with 177 additions and 0 deletions

95
src/api/model/constant.ts Normal file
View File

@ -0,0 +1,95 @@
/**
*
* @Author: xiongwei
* @Date: 2024-09-26 11:50:00
*/
import { BasePageParams, PageResult, ApiResponse } from './baseModel';
export interface ConstantParams extends BasePageParams {
/**
* ID系统自动生成
*/
id?: number;
/**
* ID系统自动生成 IN值List
*/
idList?: Array<number>;
/**
*
*/
code?: string;
/**
*
*/
name?: string;
/**
*
*/
description?: string;
/**
* create_time
*/
createTime?: Date;
/**
* ()
*/
createTimeFrom?: Date;
/**
* ()
*/
createTimeTo?: Date;
/**
* update_time
*/
updateTime?: Date;
/**
* ()
*/
updateTimeFrom?: Date;
/**
* ()
*/
updateTimeTo?: Date;
/**
*
*/
[key: string]: any;
}
export interface Constant {
/**
* ID系统自动生成
*/
id?: number;
/**
*
*/
code?: string;
/**
*
*/
name?: string;
/**
*
*/
description?: string;
/**
* create_time
*/
createTime?: Date;
/**
* update_time
*/
updateTime?: Date;
/**
*
*/
[key: string]: any;
}
export type ConstantPageResult = PageResult<Constant>;
export type ConstantPageResponse = ApiResponse<ConstantPageResult>;
export type ConstantResponse = ApiResponse<Constant>;

View File

@ -0,0 +1,82 @@
/**
*
* @Author: xiongwei
* @Date: 2024-09-26 11:50:00
*/
import { defHttp } from '@/utils/http/axios';
import {
Constant,
ConstantParams,
ConstantPageResult,
} from '../model/constant';
const baseApi = '/v1/system/constant';
/**
*
*/
export const add = (entity: Constant) =>
defHttp.post<Constant>({ url: `${baseApi}/`, data: entity });
/**
*
*/
export const update = (entity: Constant, updateAllFields = false) =>
defHttp.put<Constant>({ url: `${baseApi}/`, data: entity, params: { updateAllFields } });
/**
*
*/
export const remove = (id: any) =>
defHttp.delete<number>({ url: `${baseApi}/${id}` });
/**
*
*/
export const search = (params?: ConstantParams) =>
defHttp.get<ConstantPageResult>({ url: `${baseApi}/search`, params });
/**
*
*/
export const all = (params?: ConstantParams) =>
defHttp.get<Constant[]>({ url: `${baseApi}/all`, params });
/**
*
*/
export const getById = (id: any) =>
defHttp.get<Constant>({ url: `${baseApi}/${id}` });
/**
*
*/
export const getOne = (params?: ConstantParams) =>
defHttp.get<Constant>({ url: `${baseApi}/one`, params });
/**
*
*/
export const batchRemove = (idList: Array<any>) =>
defHttp.post<boolean>({ url: `${baseApi}/batch-delete`, data: idList });
/**
*
*/
export const batchAdd = (entityList: Array<Constant>) =>
defHttp.post<boolean>({ url: `${baseApi}/batch-save`, data: entityList });
/**
*
*/
export const batchUpdate = (entityList: Array<Constant>) =>
defHttp.post<boolean>({ url: `${baseApi}/batch-update`, data: entityList });
/**
*
*/
export const count = (params?: ConstantParams) =>
defHttp.get<number>({ url: `${baseApi}/count`, params });