Spring 如何使用mybatis直接查询?
我想使用这个查询“ANALYZE TABLE{tableName}”,但我认为mybatis只支持CRUD。Spring 如何使用mybatis直接查询?,spring,mariadb,mybatis,Spring,Mariadb,Mybatis,我想使用这个查询“ANALYZE TABLE{tableName}”,但我认为mybatis只支持CRUD。 如何在mybatis中使用“分析表”?只需将其声明为普通选择,并指定Map作为返回类型 @Select(“分析表${tableName}”) 地图可分析(字符串表名); @测试 公共无效测试分析表(){ try(SqlSession SqlSession=sqlSessionFactory.openSession()){ Mapper Mapper=sqlSession.getMapp
如何在mybatis中使用“分析表”?只需将其声明为普通选择,并指定
Map
作为返回类型
@Select(“分析表${tableName}”)
地图可分析(字符串表名);
@测试
公共无效测试分析表(){
try(SqlSession SqlSession=sqlSessionFactory.openSession()){
Mapper Mapper=sqlSession.getMapper(Mapper.class);
映射结果=映射器。可分析(“用户”);
assertEquals(“test.users”,result.get(“Table”);
assertEquals(“分析”,result.get(“Op”);
assertEquals(“status”,result.get(“Msg_type”);
assertEquals(“OK”,result.get(“Msg_text”);
}
}
测试使用
- MariaDB 10.4.10
- MariaDB连接器/J 2.5.4