mybatis多条件查询,动态sql,模糊查询

mapper.xml中:

DAO层:

//多条件查询,动态sql
    public List selectShareByName(String fileName,String username){
        System.out.println(fileName+username);
        List list = new ArrayList<>();
        DiaryMapper diaryMapper = sqlSession.getMapper(DiaryMapper.class);
        list = diaryMapper.selectShareByName(fileName,username);
        return list;
    }

配置springboot+mybaits输出sql语句

在application.properties中加入:

logging.level.com.example.demo.map=debug

可以看到:

你可能感兴趣的:(java,web,mybatis)