Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8801a1e

Browse files
fix(crud): 修复设置不更新修改人相关内容失败 (#301)
1 parent48b6539 commit8801a1e

File tree

1 file changed

+25
-21
lines changed

1 file changed

+25
-21
lines changed

‎hsweb-commons/hsweb-commons-crud/src/main/java/org/hswebframework/web/crud/events/CreatorEventListener.java‎

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -72,23 +72,24 @@ protected void doApplyCreator(ContextView ctx, EventType type, EventContext cont
7272
if (instance !=null) {
7373
if (instanceinstanceofCollection) {
7474
applyCreator(auth,context, ((Collection<?>)instance),
75-
applyUpdate &&type !=MappingEventTypes.update_before);
75+
type !=MappingEventTypes.update_before,applyUpdate);
7676
}else {
7777
applyCreator(auth,context,instance,
78-
applyUpdate &&type !=MappingEventTypes.update_before);
78+
type !=MappingEventTypes.update_before,applyUpdate);
7979
}
8080
}
8181

8282
context
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

8888
publicvoidapplyCreator(Authenticationauth,
8989
EventContextcontext,
9090
Objectentity,
91-
booleanupdateCreator) {
91+
booleanupdateCreator,
92+
booleanupdateModifier) {
9293
longnow =System.currentTimeMillis();
9394
if (updateCreator) {
9495
if (entityinstanceofRecordCreationEntity) {
@@ -110,28 +111,31 @@ public void applyCreator(Authentication auth,
110111

111112

112113
}
113-
if (entityinstanceofRecordModifierEntity) {
114-
RecordModifierEntitye = (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-
}elseif (entityinstanceofMap) {
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 (entityinstanceofRecordModifierEntity) {
116+
RecordModifierEntitye = (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+
}elseif (entityinstanceofMap) {
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-
publicvoidapplyCreator(Authenticationauth,EventContextcontext,Collection<?>entities,booleanupdateCreator) {
136+
publicvoidapplyCreator(Authenticationauth,EventContextcontext,Collection<?>entities,booleanupdateCreator,booleanupdateModifier) {
133137
for (Objectentity :entities) {
134-
applyCreator(auth,context,entity,updateCreator);
138+
applyCreator(auth,context,entity,updateCreator,updateModifier);
135139
}
136140

137141
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp