import { stringify } from 'qs';
import { request } from '@umijs/max';

import webpath from '@/utils/webPath';

export async function deleteByPrimaryKeyForProTableAuth(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/protableauth/delete?${stringify(params)}`);
}


export async function selectByPrimaryKeyForProTableAuth(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/protableauth/get?${stringify(params)}`);
}


export async function insertForProTableAuth(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/protableauth/insert`, {
        method: 'POST',
        data: {
            ...params,
            method: 'insert',
        },
    });
}


export async function updateForProTableAuth(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/protableauth/update`, {
        method: 'POST',
        data: {
            ...params,
            method: 'update',
        },
    });
}


export async function deleteByMapForProTableAuth(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/protableauth/deleteByMap`, {
        method: 'POST',
        data: {
            ...params,
            method: 'delete',
        },
    });
}


export async function updateByMapForProTableAuth(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/protableauth/updateByMap`, {
        method: 'POST',
        data: {
            ...params,
            method: 'update',
        },
    });
}


export async function getOneForProTableAuth(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/protableauth/getOne`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}



export async function getAllForProTableAuth(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/protableauth/getAll`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}


export async function queryPageForProTableAuth(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/protableauth/queryPage`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}


export async function countForProTableAuth(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/protableauth/count`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}

export async function insertBatchForProTableAuth(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/protableauth/insertBatch`, {
        method: 'POST',
        data: {
            ...params,
            method: 'insert',
        },
    });
}


export async function deleteBatchForProTableAuth(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/protableauth/deleteBatch`, {
        method: 'POST',
        data: {
            ...params,
            method: 'delete',
        },
    });
}


export async function updateBatchForProTableAuth(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/protableauth/updateBatch`, {
        method: 'POST',
        data: {
            ...params,
            method: 'update',
        },
    });
}


export async function getPageProTablesByAuthId(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/protableauth/getPageProTablesByAuthId`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}
export async function queryPageForProAuthority(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/proauthority/queryPage`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}

export async function queryPageForProTableChild(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/protables/queryPage`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}

export async function getAllForProTableChild(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/protables/getAll`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}

export async function getSelectedProTableByAuthId(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/protableauth/getSelectedProTablesByAuthId`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}
