|
@@ -75,9 +75,11 @@ public class OptimisticLockerInterceptor implements Interceptor {
|
|
|
if (param instanceof MapperMethod.ParamMap) {
|
|
|
MapperMethod.ParamMap map = (MapperMethod.ParamMap) param;
|
|
|
Wrapper ew = null;
|
|
|
- if (map.containsKey(NAME_ENTITY_WRAPPER)) {//mapper.update(updEntity, EntityWrapper<>(whereEntity);
|
|
|
+ if (map.containsKey(NAME_ENTITY_WRAPPER)) {
|
|
|
+ // mapper.update(updEntity, EntityWrapper<>(whereEntity);
|
|
|
ew = (Wrapper) map.get(NAME_ENTITY_WRAPPER);
|
|
|
- }//else updateById(entity) -->> change updateById(entity) to updateById(@Param("et") entity)
|
|
|
+ }
|
|
|
+ //else updateById(entity) -->> change updateById(entity) to updateById(@Param("et") entity)
|
|
|
|
|
|
// TODO 待验证逻辑
|
|
|
// if mannual sql or updagteById(entity),unsupport OCC,proceed as usual unless use updateById(@Param("et") entity)
|
|
@@ -104,7 +106,8 @@ public class OptimisticLockerInterceptor implements Interceptor {
|
|
|
} else if (et != null) {
|
|
|
String methodId = ms.getId();
|
|
|
String updateMethodName = methodId.substring(ms.getId().lastIndexOf(".") + 1);
|
|
|
- if (PARAM_UPDATE_METHOD_NAME.equals(updateMethodName)) {//update(entityClass, null) -->> update all. ignore version
|
|
|
+ if (PARAM_UPDATE_METHOD_NAME.equals(updateMethodName)) {
|
|
|
+ // update(entityClass, null) -->> update all. ignore version
|
|
|
return invocation.proceed();
|
|
|
}
|
|
|
Class<?> entityClass = ClassUtils.getUserClass(et.getClass());
|
|
@@ -113,6 +116,11 @@ public class OptimisticLockerInterceptor implements Interceptor {
|
|
|
Object originalVersionVal;
|
|
|
if (versionField != null && (originalVersionVal = versionField.get(et)) != null) {
|
|
|
TableInfo tableInfo = TableInfoHelper.getTableInfo(entityClass);
|
|
|
+ // fixed github 299
|
|
|
+ while (null == tableInfo && null != entityClass) {
|
|
|
+ entityClass = ClassUtils.getUserClass(entityClass.getSuperclass());
|
|
|
+ tableInfo = TableInfoHelper.getTableInfo(entityClass);
|
|
|
+ }
|
|
|
Map<String, Object> entityMap = new HashMap<>();
|
|
|
List<EntityField> fields = getEntityFields(entityClass);
|
|
|
for (EntityField ef : fields) {
|