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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    appendSelectItem(List<net.sf.jsqlparser.statement.select.SelectItem<?>> selectItems)
    追加 SelectItem
    void
    beforePrepare(org.apache.ibatis.executor.statement.StatementHandler sh, Connection connection, Integer transactionTimeout)
     
    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)
     
    net.sf.jsqlparser.expression.Expression
    buildTableExpression(net.sf.jsqlparser.schema.Table table, net.sf.jsqlparser.expression.Expression where, String whereSegment)
    构建租户条件表达式
    protected net.sf.jsqlparser.schema.Column
    getAliasColumn(net.sf.jsqlparser.schema.Table table)
    租户字段别名设置
    protected void
    processDelete(net.sf.jsqlparser.statement.delete.Delete delete, int index, String sql, Object obj)
    delete 语句处理
    protected void
    processInsert(net.sf.jsqlparser.statement.insert.Insert insert, int index, String sql, Object obj)
     
    protected void
    processInsertSelect(net.sf.jsqlparser.statement.select.Select selectBody, String whereSegment)
    处理 insert into select
    protected void
    processSelect(net.sf.jsqlparser.statement.select.Select select, int index, String sql, Object obj)
     
    protected void
    processUpdate(net.sf.jsqlparser.statement.update.Update update, int index, String sql, Object obj)
    update 语句处理
    void
     

    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, toString

    Methods inherited from class com.baomidou.mybatisplus.extension.parser.JsqlParserSupport

    parserMulti, parserSingle, processParser

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods 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:
      beforeQuery in interface com.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:
      beforePrepare in interface com.baomidou.mybatisplus.extension.plugins.inner.InnerInterceptor
    • processSelect

      protected void processSelect(net.sf.jsqlparser.statement.select.Select select, int index, String sql, Object obj)
      Overrides:
      processSelect in class com.baomidou.mybatisplus.extension.parser.JsqlParserSupport
    • processInsert

      protected void processInsert(net.sf.jsqlparser.statement.insert.Insert insert, int index, String sql, Object obj)
      Overrides:
      processInsert in class com.baomidou.mybatisplus.extension.parser.JsqlParserSupport
    • processUpdate

      protected void processUpdate(net.sf.jsqlparser.statement.update.Update update, int index, String sql, Object obj)
      update 语句处理
      Overrides:
      processUpdate in class com.baomidou.mybatisplus.extension.parser.JsqlParserSupport
    • processDelete

      protected void processDelete(net.sf.jsqlparser.statement.delete.Delete delete, int index, String sql, Object obj)
      delete 语句处理
      Overrides:
      processDelete in class com.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

      protected void appendSelectItem(List<net.sf.jsqlparser.statement.select.SelectItem<?>> selectItems)
      追加 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

      public void setProperties(Properties properties)
      Specified by:
      setProperties in interface com.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:
      buildTableExpression in class com.baomidou.mybatisplus.extension.plugins.inner.BaseMultiTableInnerInterceptor
      Parameters:
      table - 表对象
      where - 当前where条件
      whereSegment - 所属Mapper对象全路径(在原租户拦截器功能中,这个参数并不需要参与相关判断)
      Returns:
      租户条件表达式
      See Also:
      • BaseMultiTableInnerInterceptor.buildTableExpression(Table, Expression, String)