【Mybatis】【4】mybatis Example Criteria like 模糊查询

正文:

在Java中使用Mybatis自动生成的方法,like需要自己写通配符

public List<TableA> query(String name) {
    Example example = new Example(TableA.class);
    example.createCriteria()
            .andLike("name", "%"+ name +"%");
    example.setOrderByClause("CREATE_TIME DESC");

    return this.tableAMapper.selectByExample(example);
}

参考博客:

1,mybatis Example Criteria like 模糊查询 - c2223164136的专栏 - CSDN博客
https://blog.csdn.net/cao_j/article/details/46941095

原文地址:https://www.cnblogs.com/huashengweilong/p/10730449.html