|
@@ -4,6 +4,9 @@ import com.baomidou.mybatisplus.core.plugins.InterceptorIgnoreHelper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.PluginUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.TableNameParser;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.inner.InnerInterceptor;
|
|
|
+import lombok.AllArgsConstructor;
|
|
|
+import lombok.Data;
|
|
|
+import lombok.NoArgsConstructor;
|
|
|
import org.apache.ibatis.executor.Executor;
|
|
|
import org.apache.ibatis.executor.statement.StatementHandler;
|
|
|
import org.apache.ibatis.mapping.BoundSql;
|
|
@@ -17,8 +20,12 @@ import java.sql.SQLException;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
+@Data
|
|
|
+@NoArgsConstructor
|
|
|
+@AllArgsConstructor
|
|
|
public class KindBaseSqlMybatisIntercepts implements InnerInterceptor {
|
|
|
|
|
|
+ private String dbname;
|
|
|
|
|
|
// 重写查询方法修改表名
|
|
|
@Override
|
|
@@ -56,7 +63,7 @@ public class KindBaseSqlMybatisIntercepts implements InnerInterceptor {
|
|
|
int start = name.getStart();
|
|
|
if (start != last) {
|
|
|
builder.append(sql, last, start);
|
|
|
- builder.append("vehicle.");
|
|
|
+ builder.append(dbname + ".");
|
|
|
builder.append(tname);
|
|
|
// builder.append("\"");
|
|
|
}
|