feat:统一公共审计填充并调整系统枚举接口风格

This commit is contained in:
zhiye.sun
2026-05-21 13:10:33 +08:00
parent 1ada88c02a
commit 088853b098
10 changed files with 238 additions and 41 deletions

View File

@@ -0,0 +1,36 @@
package com.bruce.common.config;
import com.bruce.rag.entity.RagStore;
import org.apache.ibatis.reflection.SystemMetaObject;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
class EntityAuditMetaObjectHandlerTests {
@Test
void insertFillShouldPopulateAuditFields() {
EntityAuditMetaObjectHandler handler = new EntityAuditMetaObjectHandler();
RagStore entity = new RagStore();
handler.insertFill(SystemMetaObject.forObject(entity));
assertNotNull(entity.getCreateTime());
assertNotNull(entity.getUpdateTime());
assertEquals("system", entity.getCreateBy());
assertEquals("system", entity.getUpdateBy());
}
@Test
void updateFillShouldRefreshUpdateAuditFields() {
EntityAuditMetaObjectHandler handler = new EntityAuditMetaObjectHandler();
RagStore entity = new RagStore();
entity.setUpdateBy("oldUser");
handler.updateFill(SystemMetaObject.forObject(entity));
assertNotNull(entity.getUpdateTime());
assertEquals("system", entity.getUpdateBy());
}
}