import service from '@/utils/request'

// @Summary 获取部门树
// @Produce  application/json
// @Router /organize/getTree [get]
export const getOrganizeTree = () => {
  return service({
    url: '/organize/getTree',
    method: 'get',
  })
}

// @Tags 部门
// @Summary 根据id获取部门
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param id int true "根据id获取"
// @Success 200 {string} json "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /organize/get [get]
export const getOrganizeById = (params) => {
  return service({
    url: '/organize/get',
    method: 'get',
    params
  })
}

// @Summary 新增部门
// @Produce  application/json
// @Param Object
// @Router /organize/add [post]
export const addOrganize = (data) => {
  return service({
    url: '/organize/add',
    method: 'post',
    data
  })
}

// @Summary 删除部门
// @Produce  application/json
// @Param ID int
// @Router /organize/delete [delete]
export const deleteOrganize = (data) => {
  return service({
    url: '/organize/delete',
    method: 'delete',
    data
  })
}

// @Summary 修改部门
// @Produce  application/json
// @Param Object
// @Router /organize/update [put]
export const updateOrganize = (data) => {
  return service({
    url: '/organize/update',
    method: 'put',
    data
  })
}
