Mapper代理_查询详情

//加载mybatis核心文件
String resoures =  "mybatis-config.xml";
InputStream resourceAsStream = Resources.getResourceAsStream(resoures);
SqlSessionFactory sessionFactory = new SqlSessionFactoryBuilder().build(resourceAsStream);
//获取sqlsessio对象执行sql
SqlSession sqlSession = sessionFactory.openSession();
//获取mapper代理接口
SelectAa mapper = sqlSession.getMapper(SelectAa.class);
Scanner sc = new Scanner(System.in);
int of = sc.nextInt();
List<Dimd> dimds = mapper.selectById(of);
System.out.println(dimds);

您可能还喜欢...