|
|
@@ -1,25 +1,24 @@
|
|
|
package com.sckw.core.aspect;
|
|
|
|
|
|
-import com.sckw.core.model.auth.context.LoginUserHolder;
|
|
|
import com.sckw.core.model.constant.Global;
|
|
|
import com.sckw.core.utils.BeanUtils;
|
|
|
import com.sckw.core.utils.CollectionUtils;
|
|
|
import com.sckw.core.utils.IdWorker;
|
|
|
-import jakarta.servlet.http.HttpServletRequest;
|
|
|
+import com.sckw.core.web.context.LoginUserHolder;
|
|
|
import org.aspectj.lang.ProceedingJoinPoint;
|
|
|
import org.aspectj.lang.annotation.Around;
|
|
|
import org.aspectj.lang.annotation.Aspect;
|
|
|
import org.aspectj.lang.annotation.Pointcut;
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
-import org.springframework.web.context.request.RequestContextHolder;
|
|
|
-import org.springframework.web.context.request.ServletRequestAttributes;
|
|
|
+
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Objects;
|
|
|
|
|
|
/**
|
|
|
* DAO切面,插入创建人,创建时间,修改人,修改时间
|
|
|
+ *
|
|
|
* @author zk
|
|
|
* @date Oct 29, 2018
|
|
|
*/
|
|
|
@@ -56,11 +55,11 @@ public class DaoAspect {
|
|
|
if (objects != null) {
|
|
|
for (Object arg : objects) {
|
|
|
List<Object> objs = CollectionUtils.objectCastList(arg, Object.class);
|
|
|
- if (CollectionUtils.isEmpty(objs)){
|
|
|
+ if (CollectionUtils.isEmpty(objs)) {
|
|
|
objs.add(arg);
|
|
|
}
|
|
|
Long userId = LoginUserHolder.getUserId();
|
|
|
- objs.forEach(obj->{
|
|
|
+ objs.forEach(obj -> {
|
|
|
if (isProperty(obj, UPDATE_BY) && Objects.isNull(BeanUtils.getProperty(obj, UPDATE_BY)) && userId != null) {
|
|
|
BeanUtils.setProperty(obj, UPDATE_BY, userId);
|
|
|
}
|
|
|
@@ -84,7 +83,7 @@ public class DaoAspect {
|
|
|
if (objects != null) {
|
|
|
for (Object arg : objects) {
|
|
|
List<Object> objs = CollectionUtils.objectCastList(arg, Object.class);
|
|
|
- if (CollectionUtils.isEmpty(objs)){
|
|
|
+ if (CollectionUtils.isEmpty(objs)) {
|
|
|
objs.add(arg);
|
|
|
}
|
|
|
Date date = new Date();
|