const axios = require('axios')

export default {
    queryByTableName(tableName, callback) {
        axios.get('/api/metadict/byTableName/' + tableName).then((response) => {
            callback(response);
        })
    },
    queryByColName(colName, callback) {
        axios.get('/api/metadict/byColName/' + colName).then((response) => {
            callback(response);
        })
    },
    add(data, callback) {
        axios.post('/api/metadict/add', data).then((response) => {
            callback(response);
        }).catch((error) => {
            console.log(error)
        })
    },
    update(data, callback) {
        axios.put('/api/metadict/update', data).then((response) => {
            callback(response);
        }).catch((error) => {
            console.log(error)
        })
    },
    delete(data, callback) {
        axios.delete('/api/metadict/delete', {data: data}).then((response) => {
            callback(response);
        }).catch((error) => {
            console.log(error)
        })
    },
    deleteAll(data, callback) {
        axios.delete('/api/metadict/deleteAll', {data: data}).then((response) => {
            callback(response);
        }).catch((error) => {
            console.log(error)
        })
    },
    queryPageable(data, page, size, callback) {
        axios.post('/api/metadict/queryPageable/' + page + '/' + size, data).then((response) => {
            callback(response);
        })
    },
    getColumnNameList(callback) {
        axios.get('/api/metadict/getColumnNameList').then((response) => {
            callback(response);
        })
    },
    getTableNameList(callback) {
        axios.get('/api/metadict/getTableNameList').then((response) => {
            callback(response);
        })
    }

}