@@ -72,23 +72,24 @@ protected void doApplyCreator(ContextView ctx, EventType type, EventContext cont
7272if (instance !=null ) {
7373if (instance instanceof Collection ) {
7474applyCreator (auth ,context , ((Collection <?>)instance ),
75- applyUpdate && type !=MappingEventTypes .update_before );
75+ type !=MappingEventTypes .update_before , applyUpdate );
7676 }else {
7777applyCreator (auth ,context ,instance ,
78- applyUpdate && type !=MappingEventTypes .update_before );
78+ type !=MappingEventTypes .update_before , applyUpdate );
7979 }
8080 }
8181
8282context
8383 .get (MappingContextKeys .updateColumnInstance )
84- .ifPresent (map ->applyCreator (auth ,context ,map ,type !=MappingEventTypes .update_before ));
84+ .ifPresent (map ->applyCreator (auth ,context ,map ,type !=MappingEventTypes .update_before , applyUpdate ));
8585
8686 }
8787
8888public void applyCreator (Authentication auth ,
8989EventContext context ,
9090Object entity ,
91- boolean updateCreator ) {
91+ boolean updateCreator ,
92+ boolean updateModifier ) {
9293long now =System .currentTimeMillis ();
9394if (updateCreator ) {
9495if (entity instanceof RecordCreationEntity ) {
@@ -110,28 +111,31 @@ public void applyCreator(Authentication auth,
110111
111112
112113 }
113- if (entity instanceof RecordModifierEntity ) {
114- RecordModifierEntity e = (RecordModifierEntity )entity ;
115- if (ObjectUtils .isEmpty (e .getModifierId ())) {
116- e .setModifierId (auth .getUser ().getId ());
117- e .setModifierName (auth .getUser ().getName ());
118- }
119- if (e .getModifyTime () ==null ) {
120- e .setModifyTime (now );
121- }
122- }else if (entity instanceof Map ) {
123- @ SuppressWarnings ("all" )
124- Map <Object ,Object >map = ((Map <Object ,Object >)entity );
125- map .putIfAbsent ("modifier_id" ,auth .getUser ().getId ());
126- map .putIfAbsent ("modifier_name" ,auth .getUser ().getName ());
127- map .putIfAbsent ("modify_time" ,now );
114+ if (updateModifier ){
115+ if (entity instanceof RecordModifierEntity ) {
116+ RecordModifierEntity e = (RecordModifierEntity )entity ;
117+ if (ObjectUtils .isEmpty (e .getModifierId ())) {
118+ e .setModifierId (auth .getUser ().getId ());
119+ e .setModifierName (auth .getUser ().getName ());
120+ }
121+ if (e .getModifyTime () ==null ) {
122+ e .setModifyTime (now );
123+ }
124+ }else if (entity instanceof Map ) {
125+ @ SuppressWarnings ("all" )
126+ Map <Object ,Object >map = ((Map <Object ,Object >)entity );
127+ map .putIfAbsent ("modifier_id" ,auth .getUser ().getId ());
128+ map .putIfAbsent ("modifier_name" ,auth .getUser ().getName ());
129+ map .putIfAbsent ("modify_time" ,now );
128130
131+ }
129132 }
133+
130134 }
131135
132- public void applyCreator (Authentication auth ,EventContext context ,Collection <?>entities ,boolean updateCreator ) {
136+ public void applyCreator (Authentication auth ,EventContext context ,Collection <?>entities ,boolean updateCreator , boolean updateModifier ) {
133137for (Object entity :entities ) {
134- applyCreator (auth ,context ,entity ,updateCreator );
138+ applyCreator (auth ,context ,entity ,updateCreator , updateModifier );
135139 }
136140
137141 }