Class LampTenantLineInnerInterceptor
java.lang.Object
com.baomidou.mybatisplus.extension.parser.JsqlParserSupport
com.baomidou.mybatisplus.extension.plugins.inner.BaseMultiTableInnerInterceptor
top.tangyh.basic.database.plugins.LampTenantLineInnerInterceptor
- All Implemented Interfaces:
com.baomidou.mybatisplus.extension.plugins.inner.InnerInterceptor
public class LampTenantLineInnerInterceptor
extends com.baomidou.mybatisplus.extension.plugins.inner.BaseMultiTableInnerInterceptor
implements com.baomidou.mybatisplus.extension.plugins.inner.InnerInterceptor
- Version:
- v1.0
- Author:
- tangyh
-
Field Summary
Fields inherited from class com.baomidou.mybatisplus.extension.parser.JsqlParserSupport
logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidappendSelectItem(List<net.sf.jsqlparser.statement.select.SelectItem<?>> selectItems) 追加 SelectItemvoidbeforePrepare(org.apache.ibatis.executor.statement.StatementHandler sh, Connection connection, Integer transactionTimeout) voidbeforeQuery(org.apache.ibatis.executor.Executor executor, org.apache.ibatis.mapping.MappedStatement ms, Object parameter, org.apache.ibatis.session.RowBounds rowBounds, org.apache.ibatis.session.ResultHandler resultHandler, org.apache.ibatis.mapping.BoundSql boundSql) net.sf.jsqlparser.expression.ExpressionbuildTableExpression(net.sf.jsqlparser.schema.Table table, net.sf.jsqlparser.expression.Expression where, String whereSegment) 构建租户条件表达式protected net.sf.jsqlparser.schema.ColumngetAliasColumn(net.sf.jsqlparser.schema.Table table) 租户字段别名设置protected voidprocessDelete(net.sf.jsqlparser.statement.delete.Delete delete, int index, String sql, Object obj) delete 语句处理protected voidprocessInsert(net.sf.jsqlparser.statement.insert.Insert insert, int index, String sql, Object obj) protected voidprocessInsertSelect(net.sf.jsqlparser.statement.select.Select selectBody, String whereSegment) 处理 insert into selectprotected voidprocessSelect(net.sf.jsqlparser.statement.select.Select select, int index, String sql, Object obj) protected voidprocessUpdate(net.sf.jsqlparser.statement.update.Update update, int index, String sql, Object obj) update 语句处理voidsetProperties(Properties properties) Methods inherited from class com.baomidou.mybatisplus.extension.plugins.inner.BaseMultiTableInnerInterceptor
andExpression, appendExpression, builderExpression, canEqual, equals, getExpressionAppendMode, hashCode, processFunction, processOtherFromItem, processPlainSelect, processSelectBody, processSelectItem, processWhereSubSelect, setExpressionAppendMode, toStringMethods inherited from class com.baomidou.mybatisplus.extension.parser.JsqlParserSupport
parserMulti, parserSingle, processParserMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.baomidou.mybatisplus.extension.plugins.inner.InnerInterceptor
beforeGetBoundSql, beforeUpdate, willDoQuery, willDoUpdate
-
Constructor Details
-
LampTenantLineInnerInterceptor
public LampTenantLineInnerInterceptor()
-
-
Method Details
-
beforeQuery
public void beforeQuery(org.apache.ibatis.executor.Executor executor, org.apache.ibatis.mapping.MappedStatement ms, Object parameter, org.apache.ibatis.session.RowBounds rowBounds, org.apache.ibatis.session.ResultHandler resultHandler, org.apache.ibatis.mapping.BoundSql boundSql) throws SQLException - Specified by:
beforeQueryin interfacecom.baomidou.mybatisplus.extension.plugins.inner.InnerInterceptor- Throws:
SQLException
-
beforePrepare
public void beforePrepare(org.apache.ibatis.executor.statement.StatementHandler sh, Connection connection, Integer transactionTimeout) - Specified by:
beforePreparein interfacecom.baomidou.mybatisplus.extension.plugins.inner.InnerInterceptor
-
processSelect
protected void processSelect(net.sf.jsqlparser.statement.select.Select select, int index, String sql, Object obj) - Overrides:
processSelectin classcom.baomidou.mybatisplus.extension.parser.JsqlParserSupport
-
processInsert
protected void processInsert(net.sf.jsqlparser.statement.insert.Insert insert, int index, String sql, Object obj) - Overrides:
processInsertin classcom.baomidou.mybatisplus.extension.parser.JsqlParserSupport
-
processUpdate
protected void processUpdate(net.sf.jsqlparser.statement.update.Update update, int index, String sql, Object obj) update 语句处理- Overrides:
processUpdatein classcom.baomidou.mybatisplus.extension.parser.JsqlParserSupport
-
processDelete
protected void processDelete(net.sf.jsqlparser.statement.delete.Delete delete, int index, String sql, Object obj) delete 语句处理- Overrides:
processDeletein classcom.baomidou.mybatisplus.extension.parser.JsqlParserSupport
-
processInsertSelect
protected void processInsertSelect(net.sf.jsqlparser.statement.select.Select selectBody, String whereSegment) 处理 insert into select进入这里表示需要 insert 的表启用了多租户,则 select 的表都启动了
- Parameters:
selectBody- SelectBody
-
appendSelectItem
追加 SelectItem- Parameters:
selectItems- SelectItem
-
getAliasColumn
protected net.sf.jsqlparser.schema.Column getAliasColumn(net.sf.jsqlparser.schema.Table table) 租户字段别名设置tenantId 或 tableAlias.tenantId
- Parameters:
table- 表对象- Returns:
- 字段
-
setProperties
- Specified by:
setPropertiesin interfacecom.baomidou.mybatisplus.extension.plugins.inner.InnerInterceptor
-
buildTableExpression
public net.sf.jsqlparser.expression.Expression buildTableExpression(net.sf.jsqlparser.schema.Table table, net.sf.jsqlparser.expression.Expression where, String whereSegment) 构建租户条件表达式- Specified by:
buildTableExpressionin classcom.baomidou.mybatisplus.extension.plugins.inner.BaseMultiTableInnerInterceptor- Parameters:
table- 表对象where- 当前where条件whereSegment- 所属Mapper对象全路径(在原租户拦截器功能中,这个参数并不需要参与相关判断)- Returns:
- 租户条件表达式
- See Also:
-
BaseMultiTableInnerInterceptor.buildTableExpression(Table, Expression, String)
-