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

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


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


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

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

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

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

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


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

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

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

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

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

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

export async function getProDeptTreeByLevelCodeForProDept(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/prodept/getProDeptTreeByLevelCode`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}
export async function getPageProUserByDeptCodeForProUserDept(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/prodept/getPageProUserByDeptCode`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}

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


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

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

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