mybatis-plus

mybatis-plus基本入门

1,导包(不需要mybatis的包)

 
  com.baomidou
  mybatis-plus
  2.0.8

2,配置文件










    
    
    




    
    
    
    
    
    
    




    
    
    
    




    
    


db.master.url=jdbc:mysql://127.0.0.1:3306/appmanager?    useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&useSSL=false
db.master.user=root
db.master.password=12345678

3,dao层如下

public interface UserMapper extends BaseMapper {
}

4,service如下
public interface UserService extends IService {
}

public class UserServiceImpl extends extends ServiceImpl implements UserService {
} 

6,测试如下

public class MyTest {
@Test
public void test1() throws IOException {
   ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring-mybatis.xml");
    UserMapper mapper = context.getBean(UserMapper.class);
   /* User user=new User("admin","123456");
    User user1 = mapper.selectOne(user);
    System.out.println(user1);*/
   /* Wrapper wrapper= new Wrapper() {
        @Override
        public  T unwrap(Class iface) throws SQLException {
            return null;
        }

        @Override
        public boolean isWrapperFor(Class iface) throws SQLException {
            return false;
        }
    };*/
    List users = mapper.selectList(new EntityWrapper());
    System.out.println(users);
}
}

你可能感兴趣的:(mybatis-plus)