mybatisPlus使用new QueryWapper進行查詢(使用java8 lambda)


//單個數據使用selectOne,多條數據使用selectList   Entity放置你的實體   eq中放置你的查詢條件
mapper.selectOne(new QueryWrapper<Entity>().lambda().eq(Entity::getId, id).eq(Entity::getCustomerId, customerId));
//查詢用in的情況:   ids為你的id集合,后面可以繼續使用.eq添加查詢條件
mapper.selectList(new QueryWrapper<Entity>().lambda().in(Entity:: getId,ids).eq(Entity:: getCustomerId,customerId));

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM