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

import webpath from '@/utils/webPath';

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

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


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

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


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

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


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


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

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

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

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

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

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

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

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

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


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

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

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

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