Mybatis plus实现Distinct去重功能

不啰嗦,上菜

	QueryWrapper queryWrapper = new QueryWrapper();
	queryWrapper.select("DISTINCT no,name").orderByAsc("no");
	return mapper.selectList(queryWrapper);

PS:
顺便一提,指明查询出后的结果输出类型,可以参考如下:

	QueryWrapper<TablePo> queryWrapper = new QueryWrapper<>();
	queryWrapper.select("DISTINCT no,name").orderByAsc("no");
	return mapper.selectList(queryWrapper);

你可能感兴趣的:(C1-Java,F2-MybatisPlus)