From 6fc1e7f179acaeec4df755f72895b3b4fb50d4bb Mon Sep 17 00:00:00 2001 From: 101captain <237651143@qq.com> Date: 星期五, 14 一月 2022 13:15:59 +0800 Subject: [PATCH] Merge branch 'renhequ' into dev --- springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/config/MybatisHmkInterceptor.java | 24 ++++++++++++++++++++++++ 1 files changed, 24 insertions(+), 0 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/config/MybatisHmkInterceptor.java b/springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/config/MybatisHmkInterceptor.java new file mode 100644 index 0000000..9749d52 --- /dev/null +++ b/springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/config/MybatisHmkInterceptor.java @@ -0,0 +1,24 @@ +package com.panzhihua.service_grid.config; + +import com.baomidou.mybatisplus.core.toolkit.PluginUtils; +import com.baomidou.mybatisplus.extension.plugins.inner.InnerInterceptor; +import org.apache.ibatis.executor.Executor; +import org.apache.ibatis.mapping.BoundSql; +import org.apache.ibatis.mapping.MappedStatement; +import org.apache.ibatis.session.ResultHandler; +import org.apache.ibatis.session.RowBounds; + +import java.sql.SQLException; + +public class MybatisHmkInterceptor implements InnerInterceptor { + @Override + public void beforeQuery(Executor executor, MappedStatement ms, Object parameter, RowBounds rowBounds, ResultHandler resultHandler, BoundSql boundSql) throws SQLException { + String sql=boundSql.getSql(); + if(sql.contains("community_id = 10086")){ + sql=sql.replace("community_id = 10086","community_id in (30,31)"); + PluginUtils.mpBoundSql(boundSql).sql(sql); + } + InnerInterceptor.super.beforeQuery(executor, ms, parameter, rowBounds, resultHandler, boundSql); + } + +} -- Gitblit v1.7.1