/**
* 根据提供的后台名查找代理商
*/
@Override
public List<CommercialDistributor> getCommercialDistributorByBackName(
String backName) {
// TODO Auto-generated method stub
/**
* find(new Query(
* new Criteria().orOperator(
* Criteria.where("name").is("张三5"),
* Criteria.where("pwd").is("111")
* )
* ), Customer.class);
*/
//Criteria.where(CommercialDistributor.DISTRIBUTOR_BACK_NAME).regex(".*\\/"+backName+"$").orOperator(criteria);
return mongoTemplate.find(new Query(
new Criteria().orOperator(
Criteria.where(CommercialDistributor.DISTRIBUTOR_BACK_NAME).regex("^"+backName+"\\/"),// 开头
Criteria.where(CommercialDistributor.DISTRIBUTOR_BACK_NAME).regex(".*\\/"+backName+".*\\/"),//中间
Criteria.where(CommercialDistributor.DISTRIBUTOR_BACK_NAME).regex(".*\\/"+backName+"$")//结尾
)),
CommercialDistributor.class);
}
mongodb Query 多正则表达式查询
最新推荐文章于 2022-03-19 23:31:52 发布