import type { CommunityForm, CommunityQuery, CommunityVO } from './model'; import type { ID, IDS, PageResult } from '#/api/common'; import { commonExport } from '#/api/helper'; import { requestClient } from '#/api/request'; /** * 查询小区列表 * @param params * @returns 小区列表 */ export function communityList(params?: CommunityQuery) { return requestClient.get>( '/property/community/list', { params }, ); } /** * 查询小区树结构 * @param params * @returns 小区列表 */ export function communityTree(level: number) { return requestClient.get(`/property/community/tree/${level}`); } /** * 导出小区列表 * @param params * @returns 小区列表 */ export function communityExport(params?: CommunityQuery) { return commonExport('/property/community/export', params ?? {}); } /** * 查询小区详情 * @param id id * @returns 小区详情 */ export function communityInfo(id: ID) { return requestClient.get(`/property/community/${id}`); } /** * 新增小区 * @param data * @returns void */ export function communityAdd(data: CommunityForm) { return requestClient.postWithMsg('/property/community', data); } /** * 更新小区 * @param data * @returns void */ export function communityUpdate(data: CommunityForm) { return requestClient.putWithMsg('/property/community', data); } /** * 删除小区 * @param id id * @returns void */ export function communityRemove(id: ID | IDS) { return requestClient.deleteWithMsg(`/property/community/${id}`); }