package com.utic.center.utic.stat.server.dao.repository;

import com.utic.center.common.annotation.SqlOperation;
import com.utic.center.utic.stat.server.dao.mapper.UticStatTableManagerMapper;
import com.utic.center.utic.stat.server.dto.TableExistDto;
import lombok.RequiredArgsConstructor;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

@Repository
@RequiredArgsConstructor
public class UticStatTableManagerRepository {

    private final UticStatTableManagerMapper mapper;

    @SqlOperation(type = SqlOperation.SqlType.SELECT, table = "USER_TABLES", param = "tableName")
    public TableExistDto findTableExist(@Param("tableName") String tableName) {
        return this.mapper.findTableExist(tableName);
    }

    @SqlOperation(type = SqlOperation.SqlType.UPDATE, table = "DROP TABLE", param = "tableName")
    public int dropTable(String tableName) {
        return this.mapper.dropTable(tableName);
    }

    @SqlOperation(type = SqlOperation.SqlType.UPDATE, table = "TABLE COMMENT", param = "tableName", param2 = "tableComment")
    public int addTableComment(String tableName, String tableComment) {
        return this.mapper.addTableComment(tableName, tableComment);
    }

    @SqlOperation(type = SqlOperation.SqlType.UPDATE, table = "COLUMN COMMENT", param = "tableName", param2 = "columnName")
    public int addColumnComment(String tableName, String columnName, String columnComment) {
        return this.mapper.addColumnComment(tableName, columnName, columnComment);
    }

    @SqlOperation(type = SqlOperation.SqlType.UPDATE, table = "TRAFFIC_CENTER_", param = "crtMonth", param2 = "create table")
    public int createTrafficCenterHistTable(String crtMonth) {
        return this.mapper.createTrafficCenterHistTable(crtMonth);
    }

    @SqlOperation(type = SqlOperation.SqlType.UPDATE, table = "TRAFFIC_CENTER_", param = "crtMonth", param2 = "add constraints")
    public int addTrafficCenterHistPrimaryKey(String crtMonth) {
        return this.mapper.addTrafficCenterHistPrimaryKey(crtMonth);
    }

    @SqlOperation(type = SqlOperation.SqlType.UPDATE, table = "RCV_LINK_TRAFFIC_", param = "crtMonth", param2 = "create table")
    public int createRcvLinkTrafficTable(String crtMonth) {
        return this.mapper.createRcvLinkTrafficTable(crtMonth);
    }

    @SqlOperation(type = SqlOperation.SqlType.UPDATE, table = "RCV_LINK_TRAFFIC_", param = "crtMonth", param2 = "add constraints")
    public int addRcvLinkTrafficCenterPrimaryKey(String crtMonth) {
        return this.mapper.addRcvLinkTrafficPrimaryKey(crtMonth);
    }

    @SqlOperation(type = SqlOperation.SqlType.UPDATE, table = "tableName", param = "create table", param2 = "dataSpace")
    public int createPatnHistTable(String tableName, String dataSpace) {
        return this.mapper.createPatnHistTable(tableName, dataSpace);
    }

    @SqlOperation(type = SqlOperation.SqlType.UPDATE, table = "tableName", param = "add constraints", param2 = "indexSpace")
    public int addPatnHistPrimaryKey(String tableName, String indexSpace) {
        return this.mapper.addPatnHistPrimaryKey(tableName, indexSpace);
    }

    @SqlOperation(type = SqlOperation.SqlType.UPDATE, table = "STAT_LOCAL_LOG_", param = "crtMonth", param2 = "create table")
    public int createStatLocalLogTable(@Param("crtMonth") String crtMonth) {
        return this.mapper.createStatLocalLogTable(crtMonth);
    }

    @SqlOperation(type = SqlOperation.SqlType.UPDATE, table = "STAT_LOCAL_LOG_", param = "crtMonth", param2 = "add constraints")
    public int addStatLocalLogPrimaryKey(@Param("crtMonth") String crtMonth) {
        return this.mapper.addStatLocalLogPrimaryKey(crtMonth);
    }

    @SqlOperation(type = SqlOperation.SqlType.UPDATE, table = "LINK_FILTER_LOG_", param = "crtMonth", param2 = "create table")
    public int createLinkFilterLogTable(@Param("crtMonth") String crtMonth) {
        return this.mapper.createLinkFilterLogTable(crtMonth);
    }

    @SqlOperation(type = SqlOperation.SqlType.UPDATE, table = "LINK_FILTER_LOG_", param = "crtMonth", param2 = "add constraints")
    public int addLinkFilterLogPrimaryKey(@Param("crtMonth") String crtMonth) {
        return this.mapper.addLinkFilterLogPrimaryKey(crtMonth);
    }

    @SqlOperation(type = SqlOperation.SqlType.UPDATE, table = "tableName", param = "create table")
    public int createStatTable(@Param("tableName") String tableName) {
        return this.mapper.createStatTable(tableName);
    }

    @SqlOperation(type = SqlOperation.SqlType.UPDATE, table = "tableName", param = "add constraints")
    public int addStatPrimaryKey(@Param("tableName") String tableName) {
        return this.mapper.addStatPrimaryKey(tableName);
    }

}
