成人在线亚洲_国产日韩视频一区二区三区_久久久国产精品_99国内精品久久久久久久

您的位置:首頁(yè)技術(shù)文章
文章詳情頁(yè)

Mybatis plus實(shí)現(xiàn)Distinct去重功能

瀏覽:135日期:2023-10-20 14:09:39

不??攏?喜?/p>

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

PS:

順便一提,指明查詢出后的結(jié)果輸出類型,可以參考如下:

QueryWrapper<TablePo> queryWrapper = new QueryWrapper<>(); queryWrapper.select('DISTINCT no,name').orderByAsc('no'); return mapper.selectList(queryWrapper);distinct去重復(fù)查詢的使用

查詢的結(jié)果有時(shí)會(huì)有重復(fù)值,需要去除重復(fù)值,在sql查詢中使用distinct關(guān)鍵字很方便的達(dá)到效果。例如:

SELECT distinct ckbm,qy,hwbm FROM base_kf_hwxx WHERE ckbm = ’101’ AND qy = ’A’ AND isnull(hwxx_status,0)=0 AND qybs = 0

對(duì)應(yīng)的實(shí)現(xiàn)代碼:

emptyhw_wrapper.select('distinct ckbm,qy,hwbm') .eq('ckbm', ckbm) .eq('qy', qy) .apply('isnull(hwxx_status,0)=0') .eq('qybs', 0);

指定查詢的字段時(shí)加上distinct關(guān)鍵字: select(“distinct ckbm,qy,hwbm”) 。

到此這篇關(guān)于Mybatis plus實(shí)現(xiàn)Distinct去重功能的文章就介紹到這了,更多相關(guān)Mybatis plus Distinct去重內(nèi)容請(qǐng)搜索好吧啦網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持好吧啦網(wǎng)!

相關(guān)文章: