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));

 

posted @ 2020-05-22 14:37  阿里戈多  阅读(2198)  评论(0)    收藏  举报