QBC 多条件模糊查询 或(OR) 查询

public Page findByPage(Page page,String search){
		Criteria criteria = memberDao.createCriteria();
		criteria.add(Restrictions.eq("deleteStatusCode", DictInfo.delete_status_usable));
		if(StringUtils.isNotBlank(search)){
			Disjunction disjunction = Restrictions.disjunction();
			disjunction.add(Restrictions.like("username", "%"+search+"%"));
			disjunction.add(Restrictions.like("realName", "%"+search+"%"));
			disjunction.add(Restrictions.like("nickName", "%"+search+"%"));
			disjunction.add(Restrictions.like("email", "%"+search+"%"));
			criteria.add(disjunction);
		}
		page = memberDao.findByPage(page,criteria);
		return page;
	}

你可能感兴趣的:(java,Java,hibernate)