mirror of
https://github.com/hs-web/hsweb-framework.git
synced 2026-06-20 19:46:05 +08:00
refactor: 优化
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package org.hswebframework.web.api.crud.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import reactor.util.context.Context;
|
||||
import reactor.util.context.ContextView;
|
||||
|
||||
/**
|
||||
* 记录修改信息的实体类,包括修改人和修改时间。
|
||||
@@ -63,4 +65,26 @@ public interface RecordModifierEntity extends Entity {
|
||||
default String getModifierIdProperty() {
|
||||
return modifierId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 标记不自动更新修改人相关内容
|
||||
*
|
||||
* @param ctx 上下文
|
||||
* @return 上下文
|
||||
*/
|
||||
static Context markDoNotUpdate(Context ctx) {
|
||||
return ctx.put(RecordModifierEntity.class, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断上下文是否不更新修改人相关内容
|
||||
*
|
||||
* @param ctx 上下文
|
||||
* @return 上下文
|
||||
*/
|
||||
static boolean isDoNotUpdate(ContextView ctx) {
|
||||
return Boolean.TRUE.equals(
|
||||
ctx.getOrDefault(RecordModifierEntity.class, false)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user