import requestAuth from '@/utils/requestAuth'

export function fetchList(query) {
  return requestAuth({
    url:  '/sysOrgRes/list',
    method: 'get',
    params: query
  })
}

export function fetchListNew(query){
  return requestAuth({
    url:"/sysOrgRes/list",
    method:'get',
    params:query
  })
}

// 新增
export function createRes(data) {
  return requestAuth({
    url:  '/sysOrgRes/save',
    method: 'post',
    data: data
  })
}
// 通过ID查询
export function getResInfo(id) {
  return requestAuth({
    url:  '/sysOrgRes/info/' + id,
    method: 'get'
  })
}

// 更新
export function updateRes(data) {
  return requestAuth({
    url:  '/sysOrgRes/update',
    method: 'post',
    data: data
  })
}
// 删除
export function deleteRes(data) {
  return requestAuth({
    url:  '/sysOrgRes/delete',
    method: 'delete',
    params: data
  })
}

/**
 * 获取资源树
 */
export function dynamicTree(query){
	return requestAuth({
    url:  '/sysOrgRes/tree',
    method: 'get',
    params: query
  })
}

//code是否存在
export function checkCodeExist(code,resId){
	let query={
		"code":code,
		"resId":resId
	};
	return requestAuth({
    url:  '/sysOrgRes/checkCodeExist',
    method: 'get',
    params: query
  })
}
