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

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

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

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

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

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

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

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

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

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

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

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

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

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

export async function uploadSingleForEbookArticle(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/ebookarticle/uploadSingleForEbookArticle`, {
        method: 'POST',
        data: params.formdata
    })
}

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