MyBatis动态sql_trim自定义字符串截取
2023-05-11 11:34:11
Mybatis动态sql_trim自定义字符串截取
EmployeeMapperDynamicSQL.javapackage com.cn.mybatis.dao;import java.util.List;import com.cn.zhu.bean.Employee;public interface EmployeeMapperDynamicSQL {//public List
EmployeeMapperDynamicSQL.xml
MyBatisTest.java @Testpublic void testDynamicSql() throws IOException{SqlSessionFactory sqlSessionFactory=getSqlSessionFactory();SqlSession openSession=sqlSessionFactory.openSession();try {EmployeeMapperDynamicSQL mapper=openSession.getMapper(EmployeeMapperDynamicSQL.class);///测试if where Employee employee=new Employee(null, "%h%", null, null);List