Commit 12c82acc authored by 雍欢's avatar 雍欢

CreatorAndModifierListener的方法参数类型由AbstractEntity改为Object

parent 904024be
package com.huigou.data.domain.listener;
import java.lang.reflect.Field;
import javax.persistence.PrePersist;
import javax.persistence.PreUpdate;
import com.huigou.data.domain.model.Creator;
import com.huigou.data.domain.model.Modifier;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.util.ReflectionUtils;
import com.huigou.data.domain.model.AbstractEntity;
import com.huigou.data.domain.model.Creator;
import com.huigou.data.domain.model.Modifier;
import javax.persistence.PrePersist;
import javax.persistence.PreUpdate;
import java.lang.reflect.Field;
@Configurable
public class CreatorAndModifierListener {
......@@ -19,7 +16,7 @@ public class CreatorAndModifierListener {
private static String MODIFIER_FIELD_NAME = "modifier";
private void setCreatorInfo(AbstractEntity target) {
private void setCreatorInfo(Object target) {
Field field = ReflectionUtils.findField(target.getClass(), CREATOR_FIELD_NAME);
if (field != null) {
field.setAccessible(true);
......@@ -27,7 +24,7 @@ public class CreatorAndModifierListener {
}
}
private void setModifierInfo(AbstractEntity target) {
private void setModifierInfo(Object target) {
Field field = ReflectionUtils.findField(target.getClass(), MODIFIER_FIELD_NAME);
if (field != null) {
field.setAccessible(true);
......@@ -36,13 +33,13 @@ public class CreatorAndModifierListener {
}
@PrePersist
public void beforeCreate(AbstractEntity target) {
public void beforeCreate(Object target) {
setCreatorInfo(target);
setModifierInfo(target);
}
@PreUpdate
public void beforeUpdate(AbstractEntity target) {
public void beforeUpdate(Object target) {
setModifierInfo(target);
}
......
......@@ -45,5 +45,10 @@
<name>topsunit</name>
<url>http://nexus.local.topsunit.com/repository/huigou-repostitory/</url>
</repository>
<snapshotRepository>
<id>topsunit</id>
<name>topsunit SNAPSHOTS</name>
<url>http://nexus.local.topsunit.com/repository/huigou-snapshot/</url>
</snapshotRepository>
</distributionManagement>
</project>
......@@ -8,3 +8,4 @@
/bin
/lib
src/main/resource/rebel.xml
/.bpmn
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