mirror of
https://codeup.aliyun.com/64f7d6b8ce01efaafef1e678/coal/coal.git
synced 2026-07-25 23:27:07 +08:00
feat(bizLog): 添加菜单全路径字段并优化实体类
- 在 BizLogDto、CreateBizLogDto 和 BizLogEntity 中添加菜单全路径字段 - 在 BizLogEntity 中添加 prePersist 和 preUpdate 方法,用于生成菜单全路径- 为 BizLogEntity 添加索引,提高查询效率
This commit is contained in:
@@ -26,6 +26,10 @@ public class BizLogDto extends OrgCommonDto {
|
||||
@Comment("五级菜单")
|
||||
private String level5;
|
||||
|
||||
|
||||
@Comment("菜单全路径")
|
||||
private String menuPath;
|
||||
|
||||
@Comment("功能点")
|
||||
private String functionPoint;
|
||||
|
||||
|
||||
@@ -26,6 +26,10 @@ public class CreateBizLogDto extends OrgCommonDto {
|
||||
@Comment("五级菜单")
|
||||
private String level5;
|
||||
|
||||
|
||||
@Comment("菜单全路径")
|
||||
private String menuPath;
|
||||
|
||||
@Comment("功能点")
|
||||
private String functionPoint;
|
||||
|
||||
|
||||
@@ -10,14 +10,17 @@ import lombok.Data;
|
||||
import org.hibernate.annotations.Comment;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@Data
|
||||
@Entity
|
||||
@Table(
|
||||
indexes =
|
||||
@jakarta.persistence.Index(
|
||||
name = "idx_bizLog_org_id",
|
||||
columnList = "organization_id"))
|
||||
indexes = {
|
||||
@jakarta.persistence.Index(name = "idx_bizLog_org_id", columnList = "organization_id"),
|
||||
@jakarta.persistence.Index(name = "idx_bizLog_createUserId", columnList = "create_user_id"),
|
||||
@jakarta.persistence.Index(name = "idx_bizLog_menuPath", columnList = "menu_path"),
|
||||
|
||||
})
|
||||
public class BizLogEntity extends OrgCommonEntity {
|
||||
|
||||
@Comment("一级菜单")
|
||||
@@ -34,6 +37,9 @@ public class BizLogEntity extends OrgCommonEntity {
|
||||
|
||||
@Comment("五级菜单")
|
||||
private String level5;
|
||||
|
||||
@Comment("菜单全路径")
|
||||
private String menuPath;
|
||||
|
||||
@Comment("功能点")
|
||||
private String functionPoint;
|
||||
@@ -67,4 +73,37 @@ public class BizLogEntity extends OrgCommonEntity {
|
||||
|
||||
@Comment("备用字段5")
|
||||
private String reverse5;
|
||||
|
||||
|
||||
@Override
|
||||
public void prePersist() {
|
||||
super.prePersist();
|
||||
this.setOperationTime(LocalDateTime.now());
|
||||
this.menuPath =
|
||||
Stream.of(
|
||||
this.getLevel1(),
|
||||
this.getLevel2(),
|
||||
this.getLevel3(),
|
||||
this.getLevel4(),
|
||||
this.getLevel5())
|
||||
.filter(s -> s != null && !s.isBlank())
|
||||
.reduce((a, b) -> a + "/" + b)
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preUpdate() {
|
||||
super.preUpdate();
|
||||
|
||||
this.menuPath =
|
||||
Stream.of(
|
||||
this.getLevel1(),
|
||||
this.getLevel2(),
|
||||
this.getLevel3(),
|
||||
this.getLevel4(),
|
||||
this.getLevel5())
|
||||
.filter(s -> s != null && !s.isBlank())
|
||||
.reduce((a, b) -> a + "/" + b)
|
||||
.orElse(null);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user