Java学习 --- mybatis动态设置表名

一、mybatis动态设置表名

List selectByTableName(@Param("name")String name);
 
@Test
    public void test17() {
        SqlSession sqlSession = SqlSessionUtils.getSqlSession();
        UserMapper mapper = sqlSession.getMapper(UserMapper.class);
        List users = mapper.selectByTableName("t_user");
        users.forEach(user -> System.out.println("user = " + user));
    }

你可能感兴趣的:(mybatis,java)