package com.sdtool.business.dao;

import com.dySweetFishPlugin.sql.dao.TableShardingStrategy;

/**
 * Created by jlutt on 2020-08-11
 *
 * @author jlutt
 */
public class OrderTableShardingStrategy implements TableShardingStrategy<String> {

    /**
     * 获得分表后的表名
     *
     */
    @Override
    public String getTargetTable(String table, String shardingParameter) {
        if (shardingParameter.contains("_")) {
            return table + shardingParameter.split("_")[0] + "_current";
        } else {
            return table + shardingParameter + "_current";
        }
    }
}
