|
|
|
@ -20,6 +20,7 @@ import org.springframework.core.annotation.Order; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
|
|
|
import java.sql.Connection; |
|
|
|
import java.util.Collection; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Properties; |
|
|
|
|
|
|
|
@ -89,6 +90,11 @@ public class MybatisLoginUserInterceptor implements Interceptor { |
|
|
|
} |
|
|
|
return; |
|
|
|
} |
|
|
|
// 存储过程的 params 是 List。MyBatis 对集合/数组调用 hasSetter 会抛 UnsupportedOperationException, |
|
|
|
// 请求在 exec 之前就失败。登录名也不能塞进过程实参,否则会多出一个参数。 |
|
|
|
if (bean instanceof Collection || bean.getClass().isArray()) { |
|
|
|
return; |
|
|
|
} |
|
|
|
MetaObject metaObject = SystemMetaObject.forObject(bean); |
|
|
|
if (metaObject.hasSetter(LOGIN_USER_PARAM) && metaObject.getValue(LOGIN_USER_PARAM) == null) { |
|
|
|
metaObject.setValue(LOGIN_USER_PARAM, loginUserName); |
|
|
|
|