import request from '@/utils/request'
import {download} from '@/utils/request'

// 查询证书列表
export function listCertificate(query) {
    return request({
        url: '/tongzhou/certificate/certificate/list',
        method: 'get',
        params: query
    })
}

// 查询证书详细
export function getCertificate(certificateId) {
    return request({
        url: '/tongzhou/certificate/certificate/' + certificateId,
        method: 'get'
    })
}

// 新增证书
export function addCertificate(data) {
    return request({
        url: '/tongzhou/certificate/certificate',
        method: 'post',
        data: data
    })
}

// 修改证书
export function updateCertificate(data) {
    return request({
        url: '/tongzhou/certificate/certificate',
        method: 'put',
        data: data
    })
}

// 删除证书
export function delCertificate(certificateId) {
    return request({
        url: '/tongzhou/certificate/certificate/' + certificateId,
        method: 'delete'
    })
}

// 导出证书
export function downloadCertificate(data) {
    download(
        '/tongzhou/certificate/certificate/export',
        data,
        `certificate_${new Date().getTime()}.xlsx`)
}
