feat: 展示 AI 资源创建人信息

- 为 Bot、工作流、知识库、插件列表补充创建人名称回填

- 在卡片中展示创建者与创建时间

- 补充后端与前端对应测试
This commit is contained in:
2026-04-13 14:58:14 +08:00
parent ae10383f17
commit 855e93ecbf
17 changed files with 642 additions and 3 deletions

View File

@@ -0,0 +1,54 @@
package tech.easyflow.system.service.impl;
import com.mybatisflex.core.query.QueryWrapper;
import org.junit.Test;
import tech.easyflow.system.entity.SysAccount;
import java.math.BigInteger;
import java.util.List;
import java.util.Map;
import static org.junit.Assert.assertEquals;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
/**
* {@link SysAccountServiceImpl} 测试。
*/
public class SysAccountServiceImplTest {
/**
* 验证展示名解析优先级与缺失数据回退。
*/
@Test
public void shouldResolveDisplayNameByNicknameThenLoginNameThenId() {
SysAccountServiceImpl service = spy(new SysAccountServiceImpl());
SysAccount nicknameAccount = new SysAccount();
nicknameAccount.setId(BigInteger.ONE);
nicknameAccount.setNickname("管理员");
nicknameAccount.setLoginName("admin");
SysAccount loginNameAccount = new SysAccount();
loginNameAccount.setId(BigInteger.valueOf(2));
loginNameAccount.setNickname(" ");
loginNameAccount.setLoginName("operator");
doReturn(List.of(nicknameAccount, loginNameAccount))
.when(service)
.list(any(QueryWrapper.class));
Map<BigInteger, String> displayNameMap = service.resolveDisplayNameMap(
List.of(BigInteger.ONE, BigInteger.valueOf(2), BigInteger.valueOf(3))
);
assertEquals("管理员", displayNameMap.get(BigInteger.ONE));
assertEquals("operator", displayNameMap.get(BigInteger.valueOf(2)));
assertEquals("3", displayNameMap.get(BigInteger.valueOf(3)));
verify(service, times(1)).list(any(QueryWrapper.class));
}
}