2逆向工程简单测试(68-70)

SqlSessionFactory sqlSessionFactory=getSqlSessionFactory();

SqlSession session = sqlSessionFactory.openSession();

try {

EmployeeMapper mapper = session.getMapper(EmployeeMapper.class);

//where (emai like ? and gender=?) or (email like ? and gender=?)

EmployeeExample example=new EmployeeExample();

Criteria createCriteria = example.createCriteria();

createCriteria.andEmailLike("%3519%").andGenderEqualTo("1");

Criteria createCriteria2 = example.createCriteria();

createCriteria2.andGenderEqualTo("0");

example.or(createCriteria2);

List<Employee> selectByExample = mapper.selectByExample(example);

for(Employee e:selectByExample) {

System.out.println(e.getEmail()+e.getGender());

}

} finally {

session.close();

}

3mybatis工作原理(71-72)

mybatis学习系列--逆向工程简单使用及mybatis原理-LMLPHP

mybatis学习系列--逆向工程简单使用及mybatis原理-LMLPHP

05-06 18:17