Search in sources :

Example 1 with Address

use of com.github.lybgeek.mongodb.model.Address in project springboot-learning by lyb-geek.

the class MongodbApplicationTest method testList.

@Test
public void testList() {
    Address address = Address.builder().detailAddr("test1").build();
    User user = User.builder().userName("张三1").email("zhangsan1@qq.com").password("1234561").gender(Gender.MALE).address(address).build();
    List<User> users = userDao.listUsers(user);
    System.out.println(users);
}
Also used : User(com.github.lybgeek.mongodb.model.User) Address(com.github.lybgeek.mongodb.model.Address) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 2 with Address

use of com.github.lybgeek.mongodb.model.Address in project springboot-learning by lyb-geek.

the class MongodbApplicationTest method testAddUser.

@Test
public void testAddUser() {
    Address address = Address.builder().province("北京").city("北京").detailAddr("test1").build();
    UserDTO userDTO = UserDTO.builder().userName("张三1").realName("张三").email("zhangsan@qq.com").password("1234561").address(address).gender(1).build();
    UserDTO dto = userService.saveUser(userDTO);
    // User dto = userDao.saveUser(User.builder().userName("张三1").email("zhangsan1@qq.com").password("1234561").gender(
    // Gender.MALE).address(address).build());
    Assert.assertNotNull(dto);
    System.out.println(dto);
}
Also used : Address(com.github.lybgeek.mongodb.model.Address) UserDTO(com.github.lybgeek.mongodb.dto.UserDTO) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

Address (com.github.lybgeek.mongodb.model.Address)2 Test (org.junit.Test)2 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)2 UserDTO (com.github.lybgeek.mongodb.dto.UserDTO)1 User (com.github.lybgeek.mongodb.model.User)1