com.github.antelopeframework.mybatis.shard.converter.DeleteSqlConverter Maven / Gradle / Ivy
package com.github.antelopeframework.mybatis.shard.converter;
import java.util.Map;
import com.github.antelopeframework.mybatis.shard.ShardContext.ShardOnPair;
import net.sf.jsqlparser.statement.Statement;
import net.sf.jsqlparser.statement.delete.Delete;
/**
* DELETE 语句表名替换.
*
* @author yangzhi.yzh
*
*/
class DeleteSqlConverter extends AbstractSqlConverter {
@Override
protected Statement doConvert(String sqlMapperId, Statement statement, Map shardOns) {
if (!(statement instanceof Delete)) {
throw new IllegalArgumentException("The argument statement must is instance of Delete.");
}
Delete delete = (Delete) statement;
String tableName = delete.getTable().getName();
delete.getTable().setName(convertTableName(sqlMapperId, tableName, shardOns));
return delete;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy