From 5972f6be402c480fdccba28c2499ae1293c1e1ad Mon Sep 17 00:00:00 2001 From: njdaoyehu Date: Tue, 19 Nov 2024 12:23:16 +0800 Subject: [PATCH] fixed --- src/api/model/constant.ts | 95 +++++++++++++++++++++++++++++++++++ src/api/system/constantApi.ts | 82 ++++++++++++++++++++++++++++++ 2 files changed, 177 insertions(+) create mode 100644 src/api/model/constant.ts create mode 100644 src/api/system/constantApi.ts diff --git a/src/api/model/constant.ts b/src/api/model/constant.ts new file mode 100644 index 0000000..0cdc1c6 --- /dev/null +++ b/src/api/model/constant.ts @@ -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; + /** + * 编码 + */ + 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; + +export type ConstantPageResponse = ApiResponse; + +export type ConstantResponse = ApiResponse; diff --git a/src/api/system/constantApi.ts b/src/api/system/constantApi.ts new file mode 100644 index 0000000..d98c790 --- /dev/null +++ b/src/api/system/constantApi.ts @@ -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({ url: `${baseApi}/`, data: entity }); + +/** + * 更新 + */ +export const update = (entity: Constant, updateAllFields = false) => + defHttp.put({ url: `${baseApi}/`, data: entity, params: { updateAllFields } }); + +/** + * 删除 + */ +export const remove = (id: any) => + defHttp.delete({ url: `${baseApi}/${id}` }); + +/** + * 分页查询 + */ +export const search = (params?: ConstantParams) => + defHttp.get({ url: `${baseApi}/search`, params }); + +/** + * 列表查询 + */ +export const all = (params?: ConstantParams) => + defHttp.get({ url: `${baseApi}/all`, params }); + +/** + * 通过主键查询 + */ +export const getById = (id: any) => + defHttp.get({ url: `${baseApi}/${id}` }); + +/** + * 单个查询 + */ +export const getOne = (params?: ConstantParams) => + defHttp.get({ url: `${baseApi}/one`, params }); + +/** + * 批量删除 + */ +export const batchRemove = (idList: Array) => + defHttp.post({ url: `${baseApi}/batch-delete`, data: idList }); + +/** + * 批量新增 + */ +export const batchAdd = (entityList: Array) => + defHttp.post({ url: `${baseApi}/batch-save`, data: entityList }); + +/** + * 批量更新 + */ +export const batchUpdate = (entityList: Array) => + defHttp.post({ url: `${baseApi}/batch-update`, data: entityList }); + +/** + * 查询数量 + */ +export const count = (params?: ConstantParams) => + defHttp.get({ url: `${baseApi}/count`, params }); + +