mybatis逆向工程中复杂查询的调用步骤(利用example)

1.创建一个EmoloyeeExample对象
 EmployeeExample example = new EmployeeExample();
2.调用EmployeeExample对象的createCriteria()方法得到criteria对象
EmployeeExample.Criteria criteria = example.createCriteria();
3.把参数传入Criteria的对应方法中
criteria.andEmpIdIn(ids);
4.调用mapper中的具体方法并传入EmployeeExample对象
employeeMapper.deleteByExample(example);
两个例子:1.
EmployeeExample example = new EmployeeExample();
        EmployeeExample.Criteria criteria = example.createCriteria();
        criteria.andEmpIdIn(ids);
        employeeMapper.deleteByExample(example);
2.
mployeeExample example = new EmployeeExample();
        EmployeeExample.Criteria criteria = example.createCriteria();
        criteria.andEmpNameEqualTo(empName);
        return employeeMapper.countByExample(example) == 0;

你可能感兴趣的:(mybatis逆向工程中复杂查询的调用步骤(利用example))