import http from '@/api'
import { DeptForm, DeptQuery, DeptVO } from '@/api/interface/system/dept'
/**
 * @name 查询部门列表
 * @param query 参数
 * @returns 返回列表
 */
export const listDeptApi = (query: DeptQuery) => {
  return http.get<any>('/system/dept/list', query, { loading: true })
}

/**
 * @name 查询部门详细
 * @param deptId deptId
 * @returns returns
 */
export const getDeptApi = (deptId: string | number) => {
  return http.get<DeptVO>(`/system/dept/${deptId}`)
}

/**
 * @name 新增部门
 * @param data data
 * @returns returns
 */
export const addDeptApi = (data: DeptForm) => {
  return http.post<any>('/system/dept', data, { loading: false })
}

/**
 * @name 修改部门
 * @param data data
 * @returns returns
 */
export const updateDeptApi = (data: DeptForm) => {
  return http.put<any>('/system/dept', data, { loading: false })
}

/**
 * @name 删除部门
 * @param deptId deptId
 * @returns returns
 */
export const delDeptApi = (deptId: number | string) => {
  return http.delete<any>(`/system/dept/${deptId}`)
}
