use of diboot.core.test.binder.vo.EntityListComplexVO in project diboot by dibo-software.
the class TestEntityListBinder method testComplexBinder.
/**
* 验证通过中间表间接关联的绑定
*/
@Test
public void testComplexBinder() {
// 加载测试数据
LambdaQueryWrapper<User> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.in(User::getId, 1001L, 1002L);
List<User> userList = userService.getEntityList(queryWrapper);
// 自动绑定
List<EntityListComplexVO> voList = Binder.convertAndBindRelations(userList, EntityListComplexVO.class);
// 验证绑定结果
Assert.assertTrue(V.notEmpty(voList));
for (EntityListComplexVO vo : voList) {
// 验证通过中间表间接关联的绑定
Assert.assertTrue(V.notEmpty(vo.getRoleList()));
System.out.println(JSON.stringify(vo));
}
}
Aggregations