import request from '@/utils/request'

// 查询部门列表
export function listCategory(query) {
  return request({
    url: '/system/category/list',
    method: 'get',
    params: query
  })
}

// 查询部门列表（排除节点）
export function listCategoryExcludeChild(categoryId) {
  return request({
    url: '/system/category/list/exclude/' + categoryId,
    method: 'get'
  })
}

// 查询部门详细
export function getCategory(categoryId) {
  return request({
    url: '/system/category/get?id=' + categoryId,
    method: 'get'
  })
}

// 获取部门精简信息列表
export function listSimpleCategorys() {
  return request({
    url: '/system/category/list-all-simple',
    method: 'get'
  })
}

// 新增部门
export function addCategory(data) {
  return request({
    url: '/system/category/create',
    method: 'post',
    data: data
  })
}

// 修改部门
export function updateCategory(data) {
  return request({
    url: '/system/category/update',
    method: 'put',
    data: data
  })
}

// 删除部门
export function delCategory(id) {
  return request({
    url: '/system/category/delete?id=' + id,
    method: 'delete'
  })
}
