Commit 25ebaacd authored by 李秀明's avatar 李秀明

Merge remote-tracking branch 'origin/develop_dl_bugfix' into develop_dl_bugfix

parents 0ec7035d 7474492a
...@@ -24,12 +24,13 @@ import java.util.Properties; ...@@ -24,12 +24,13 @@ import java.util.Properties;
@Intercepts({ @Intercepts({
@Signature(type = Executor.class, method = "query", args = {MappedStatement.class, Object.class, RowBounds.class, ResultHandler.class}), @Signature(type = Executor.class, method = "query", args = {MappedStatement.class, Object.class, RowBounds.class, ResultHandler.class}),
@Signature(type = Executor.class, method = "query", args = {MappedStatement.class, Object.class, RowBounds.class, ResultHandler.class, CacheKey.class, BoundSql.class}), @Signature(type = Executor.class, method = "query", args = {MappedStatement.class, Object.class, RowBounds.class, ResultHandler.class, CacheKey.class, BoundSql.class}),
} }
) )
public class PluginInterceptor implements Interceptor { public class PluginInterceptor implements Interceptor {
/** /**
* 进行拦截的时候要执行的方法 * 进行拦截的时候要执行的方法
*
* @param invocation * @param invocation
* @return * @return
* @throws Throwable * @throws Throwable
...@@ -62,19 +63,19 @@ public class PluginInterceptor implements Interceptor { ...@@ -62,19 +63,19 @@ public class PluginInterceptor implements Interceptor {
//获取到原始sql语句 //获取到原始sql语句
String sql = boundSql.getSql(); String sql = boundSql.getSql();
if("com.yeejoin.amos.boot.module.common.api.mapper.OrgUsrMapper.selectPersonListCount".equals(id) || if ("com.yeejoin.amos.boot.module.common.api.mapper.OrgUsrMapper.selectPersonListCount".equals(id) ||
"com.yeejoin.amos.boot.module.common.api.mapper.OrgUsrMapper.selectPersonList".equals(id)) { "com.yeejoin.amos.boot.module.common.api.mapper.OrgUsrMapper.selectPersonList".equals(id)) {
HashMap par = new HashMap(); HashMap par = new HashMap();
if(parameter instanceof HashMap) { if (parameter instanceof HashMap) {
par = (HashMap)((HashMap<?, ?>) parameter).get("map"); par = (HashMap) ((HashMap<?, ?>) parameter).get("map");
} }
LinkedHashMap<String,String> fieldsValue = (LinkedHashMap<String, String>) par.get("fieldsValue"); LinkedHashMap<String, String> fieldsValue = (LinkedHashMap<String, String>) par.get("fieldsValue");
Iterator<String> iterator = fieldsValue.keySet().stream().iterator(); Iterator<String> iterator = fieldsValue.keySet().stream().iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
String next = iterator.next(); String next = iterator.next();
sql = sql.replaceFirst("item",next).replaceFirst("ietmValue", new StringBuffer().append("'").append(fieldsValue.get(next)).append("'").toString()); sql = sql.replaceFirst("item", next).replaceFirst("ietmValue", new StringBuffer().append("'").append(fieldsValue.get(next)).append("'").toString());
} }
//通过反射修改sql语句 //通过反射修改sql语句
......
...@@ -22,12 +22,13 @@ import java.util.Properties; ...@@ -22,12 +22,13 @@ import java.util.Properties;
@Intercepts({ @Intercepts({
@Signature(type = Executor.class, method = "query", args = {MappedStatement.class, Object.class, RowBounds.class, ResultHandler.class}), @Signature(type = Executor.class, method = "query", args = {MappedStatement.class, Object.class, RowBounds.class, ResultHandler.class}),
@Signature(type = Executor.class, method = "query", args = {MappedStatement.class, Object.class, RowBounds.class, ResultHandler.class, CacheKey.class, BoundSql.class}), @Signature(type = Executor.class, method = "query", args = {MappedStatement.class, Object.class, RowBounds.class, ResultHandler.class, CacheKey.class, BoundSql.class}),
} }
) )
public class PluginInterceptor implements Interceptor { public class PluginInterceptor implements Interceptor {
/** /**
* 进行拦截的时候要执行的方法 * 进行拦截的时候要执行的方法
*
* @param invocation * @param invocation
* @return * @return
* @throws Throwable * @throws Throwable
...@@ -60,11 +61,11 @@ public class PluginInterceptor implements Interceptor { ...@@ -60,11 +61,11 @@ public class PluginInterceptor implements Interceptor {
//获取到原始sql语句 //获取到原始sql语句
String sql = boundSql.getSql(); String sql = boundSql.getSql();
if("com.yeejoin.equipmanage.mapper.FormInstanceMapper.queryForMapList".equals(id)) { if ("com.yeejoin.equipmanage.mapper.FormInstanceMapper.queryForMapList".equals(id)) {
//执行结果 //执行结果
HashMap<String,String> par = new LinkedHashMap<>(); HashMap<String, String> par = new LinkedHashMap<>();
if(parameter instanceof HashMap) { if (parameter instanceof HashMap) {
par = (HashMap<String, String>)((HashMap<?, ?>) parameter).get("params"); par = (HashMap<String, String>) ((HashMap<?, ?>) parameter).get("params");
} }
...@@ -72,7 +73,7 @@ public class PluginInterceptor implements Interceptor { ...@@ -72,7 +73,7 @@ public class PluginInterceptor implements Interceptor {
while (iterator.hasNext()) { while (iterator.hasNext()) {
String next = iterator.next(); String next = iterator.next();
sql = sql.replace("item",next); sql = sql.replace("item", next);
} }
//通过反射修改sql语句 //通过反射修改sql语句
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment