Search in sources :

Example 1 with City

use of com.baomidou.mybatisplus.samples.reduce.springmvc.entity.City in project mybatis-plus-samples by baomidou.

the class ReduceTest method testGeneratedMapper.

@Test
public void testGeneratedMapper() {
    String cityMapperClassName = "cityMapper";
    BaseMapper cityMapper = (BaseMapper) context.getBean(cityMapperClassName);
    City city = (City) cityMapper.selectById(1);
    Assertions.assertEquals(city.getId().longValue(), 1L);
    String districtMapperClassName = "districtMapper";
    boolean isContained = context.containsBean(districtMapperClassName);
    Assertions.assertFalse(isContained);
    // BaseMapper districtMapper =(BaseMapper) context.getBean(districtMapperClassName);
    // District district = (District) districtMapper.selectById(1);
    // Assertions.assertEquals(district.getId().longValue(),1L);
    String userMapperClassName = "userMapper";
    BaseMapper userMapper = (BaseMapper) context.getBean(userMapperClassName);
    userMapper.selectById(1);
    User user = (User) userMapper.selectById(1);
    Assertions.assertEquals(user.getId().longValue(), 1L);
}
Also used : User(com.baomidou.mybatisplus.samples.reduce.springmvc.entity.User) BaseMapper(com.baomidou.mybatisplus.core.mapper.BaseMapper) City(com.baomidou.mybatisplus.samples.reduce.springmvc.entity.City) Test(org.junit.Test)

Aggregations

BaseMapper (com.baomidou.mybatisplus.core.mapper.BaseMapper)1 City (com.baomidou.mybatisplus.samples.reduce.springmvc.entity.City)1 User (com.baomidou.mybatisplus.samples.reduce.springmvc.entity.User)1 Test (org.junit.Test)1