|
@@ -1,5 +1,6 @@
|
1
|
1
|
import com.mapper.AccountMapper;
|
2
|
2
|
import com.pojo.entity.AccountEntity;
|
|
3
|
+import com.pojo.entity.AccountRealEntity;
|
3
|
4
|
import org.apache.ibatis.io.Resources;
|
4
|
5
|
import org.apache.ibatis.session.SqlSession;
|
5
|
6
|
import org.apache.ibatis.session.SqlSessionFactory;
|
|
@@ -43,4 +44,13 @@ public class Test1 {
|
43
|
44
|
AccountMapper mapper = sqlSession.getMapper(AccountMapper.class);
|
44
|
45
|
List<AccountEntity> all = mapper.findAll(9);
|
45
|
46
|
}
|
|
47
|
+ // 测试resultMap
|
|
48
|
+ @Test
|
|
49
|
+ public void testResultMap() throws IOException {
|
|
50
|
+ InputStream resourceAsStream = Resources.getResourceAsStream("mybatisConfig.xml");
|
|
51
|
+ SqlSessionFactory sqlSessionFactoryBuilder = new SqlSessionFactoryBuilder().build(resourceAsStream);
|
|
52
|
+ SqlSession sqlSession = sqlSessionFactoryBuilder.openSession(true);
|
|
53
|
+ AccountMapper mapper = sqlSession.getMapper(AccountMapper.class);
|
|
54
|
+ AccountRealEntity byResultMap = mapper.findByResultMap();
|
|
55
|
+ }
|
46
|
56
|
}
|