当前位置: 首页>>代码示例>>Java>>正文


Java Criteria.orOperator方法代码示例

本文整理汇总了Java中org.springframework.data.mongodb.core.query.Criteria.orOperator方法的典型用法代码示例。如果您正苦于以下问题:Java Criteria.orOperator方法的具体用法?Java Criteria.orOperator怎么用?Java Criteria.orOperator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.data.mongodb.core.query.Criteria的用法示例。


在下文中一共展示了Criteria.orOperator方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: countMyPosts

import org.springframework.data.mongodb.core.query.Criteria; //导入方法依赖的package包/类
/** 자신의 글 숫자를 셈 (자기가 보낸 쪽지는 제외).
 * @param publicTags
 * @param privateAndMassageTags
 * @param writer
 * @param search
 * @param sort
 * @return
 */
public long countMyPosts(List<String> publicTags,List<String> privateAndMassageTags, Weaver writer, 
		String search, String sort) {
	Criteria criteria = new Criteria();

	if(privateAndMassageTags != null)
		criteria.orOperator(Criteria.where("writer").is(writer).and("kind").ne(3),
				Criteria.where("tags").in(privateAndMassageTags));
	else
		criteria.orOperator(Criteria.where("writer").is(writer).and("kind").ne(3));

	if (search != null)
		criteria.andOperator(new Criteria().orOperator(
				Criteria.where("title").regex(search),
				Criteria.where("content").regex(search)));

	if (publicTags != null)
		criteria.and("tags").all(publicTags);

	this.filter(criteria, sort);

	return mongoTemplate.count(new Query(criteria), Post.class);
}
 
开发者ID:forweaver,项目名称:forweaver2.0,代码行数:31,代码来源:PostDao.java

示例2: countCodes

import org.springframework.data.mongodb.core.query.Criteria; //导入方法依赖的package包/类
/** 검색한 코드의 갯수를 셈.
 * @param tags
 * @param search
 * @param writer
 * @param sort
 * @return
 */
public long countCodes(
		Weaver writer,
		List<String> tags,
		String search,
		String sort) {
	Criteria criteria = new Criteria();
	
	if(search != null && search.length()>0)
		criteria.orOperator(new Criteria("name").regex(search),
				new Criteria("content").regex(search),
				new Criteria("readme").regex(search));
	
	if(tags != null)
		criteria.and("tags").all(tags);
	
	if(writer != null)
		criteria.and("writer").is(writer);
		
	this.filter(criteria, sort);

	return mongoTemplate.count(new Query(criteria), Code.class);
}
 
开发者ID:forweaver,项目名称:forweaver2.0,代码行数:30,代码来源:CodeDao.java

示例3: getPostsAsAdmin

import org.springframework.data.mongodb.core.query.Criteria; //导入方法依赖的package包/类
/** 관리자가 글을 불러올 때
 * @param tags
 * @param search
 * @param writer
 * @param sort
 * @param page
 * @param size
 * @return
 */
public List<Post> getPostsAsAdmin(List<String> tags, String search, Weaver writer, String sort,
		int page, int size) {
	Criteria criteria = new Criteria();

	if (search != null)
		criteria.orOperator(new Criteria("title").regex(search),
				new Criteria("content").regex(search));

	if (tags != null)
		criteria.and("tags").all(tags);
	if (writer != null)
		criteria.and("writer").is(writer);

	this.filter(criteria, sort);

	Query query = new Query(criteria);

	query.with(new PageRequest(page - 1, size));
	this.sorting(query, sort);

	return mongoTemplate.find(query, Post.class);
}
 
开发者ID:forweaver,项目名称:forweaver2.0,代码行数:32,代码来源:PostDao.java

示例4: getPostsWhenNotLogin

import org.springframework.data.mongodb.core.query.Criteria; //导入方法依赖的package包/类
/**  로그인하지 않은 회원이 글을 검색
 * @param tags
 * @param search
 * @param writer
 * @param sort
 * @param page
 * @param size
 * @return
 */
public List<Post> getPostsWhenNotLogin(List<String> tags, String search, Weaver writer, String sort,
		int page, int size) {
	Criteria criteria = new Criteria();

	if (search != null)
		criteria.orOperator(new Criteria("title").regex(search),
				new Criteria("content").regex(search));

	criteria.and("kind").is(1);

	if (tags != null)
		criteria.and("tags").all(tags);
	if (writer != null)
		criteria.and("writer").is(writer);

	this.filter(criteria, sort);

	Query query = new Query(criteria);
	query.with(new PageRequest(page - 1, size));

	this.sorting(query, sort);
	return mongoTemplate.find(query, Post.class);
}
 
开发者ID:forweaver,项目名称:forweaver2.0,代码行数:33,代码来源:PostDao.java

示例5: countPostsAsWriter

import org.springframework.data.mongodb.core.query.Criteria; //导入方法依赖的package包/类
/** 로그인한 회원이 다른 사용자의 글을 검색할때 숫자를 셈.
 * @param publicTags
 * @param loginWeaverprivateAndMassageTags
 * @param writer
 * @param loginWeaver
 * @param search
 * @param sort
 * @return
 */
public long countPostsAsWriter(
		List<String> publicTags, List<String> loginWeaverprivateAndMassageTags,
		Weaver writer, Weaver loginWeaver, String search, String sort) {
	Criteria criteria = new Criteria();

	criteria.orOperator(
			Criteria.where("kind").is(1).and("writer").is(writer),
			Criteria.where("tags").in(loginWeaverprivateAndMassageTags)
			.and("writer").is(writer));

	if (search != null)
		criteria.andOperator(new Criteria().orOperator(
				Criteria.where("title").regex(search),
				Criteria.where("content").regex(search)));

	if (publicTags != null)
		criteria.and("tags").all(publicTags);

	this.filter(criteria, sort);

	return mongoTemplate.count(new Query(criteria), Post.class);
}
 
开发者ID:forweaver,项目名称:forweaver2.0,代码行数:32,代码来源:PostDao.java

示例6: getMyPosts

import org.springframework.data.mongodb.core.query.Criteria; //导入方法依赖的package包/类
/** 자기글과 자기한테 온 메세지를 검색함.(자기가 보낸 쪽지는 제외)
 * @param publicTags
 * @param privateAndMassageTags
 * @param writer
 * @param search
 * @param sort
 * @param page
 * @param size
 * @return
 */
public List<Post> getMyPosts(List<String> publicTags,List<String> privateAndMassageTags,  Weaver writer, String search,
		String sort, int page, int size) {
	Criteria criteria = new Criteria();

	if(privateAndMassageTags != null)
		criteria.orOperator(Criteria.where("writer").is(writer).and("kind").ne(3),
				Criteria.where("tags").in(privateAndMassageTags));
	else
		criteria.orOperator(Criteria.where("writer").is(writer).and("kind").ne(3));
	if (search != null)
		criteria.andOperator(new Criteria().orOperator(
				Criteria.where("title").regex(search),
				Criteria.where("content").regex(search)));

	if (publicTags != null)
		criteria.and("tags").all(publicTags);

	this.filter(criteria, sort);

	Query query = new Query(criteria);
	query.with(new PageRequest(page - 1, size));

	this.sorting(query, sort);
	return mongoTemplate.find(query, Post.class);
}
 
开发者ID:forweaver,项目名称:forweaver2.0,代码行数:36,代码来源:PostDao.java

示例7: countRepositories

import org.springframework.data.mongodb.core.query.Criteria; //导入方法依赖的package包/类
/** 저장소를 검색하고 수를 셈.
 * @param tags
 * @param search
 * @param creator
 * @param sort
 * @return
 */
public long countRepositories(
		List<String> tags,
		String search,
		String sort) {
	Criteria criteria = new Criteria();
	
	if(search != null && search.length()>0)
		criteria.orOperator(new Criteria("name").regex(search),
				new Criteria("description").regex(search));
	
	if(tags != null)
		criteria.and("tags").all(tags);
		
	this.filter(criteria, sort);

	return mongoTemplate.count(new Query(criteria), Repository.class);
}
 
开发者ID:forweaver,项目名称:forweaver2.0,代码行数:25,代码来源:RepositoryDao.java

示例8: getRepositories

import org.springframework.data.mongodb.core.query.Criteria; //导入方法依赖的package包/类
/** 저장소를 검색
 * @param tags
 * @param search
 * @param creator
 * @param sort
 * @param page
 * @param size
 * @return
 */
public List<Repository> getRepositories( 
		List<String> tags,
		String search,
		String sort,
		int page, 
		int size) {
	Criteria criteria = new Criteria();
	
	if(search != null && search.length()>0)
		criteria.orOperator(new Criteria("name").regex(search),
				new Criteria("description").regex(search));
	
	if(tags != null)
		criteria.and("tags").all(tags);
	
	this.filter(criteria, sort);
	
	Query query = new Query(criteria);
	query.with(new PageRequest(page-1, size));

	this.sorting(query, sort);
	return mongoTemplate.find(query, Repository.class);
}
 
开发者ID:forweaver,项目名称:forweaver2.0,代码行数:33,代码来源:RepositoryDao.java

示例9: loopTitle

import org.springframework.data.mongodb.core.query.Criteria; //导入方法依赖的package包/类
/**
 *
 * @Description: 查询所有存活的title
 * @param
 * @return  List<PageData>
 * @throws Exception
 * @Data: 2017/3/30 下午4:47
 *
 */
private List<PageData> loopTitle(PageData pd){
	BasicDBObject fieldsObject=new BasicDBObject();
	//指定返回的字段
	fieldsObject.put("TITLE_ID", true);
	fieldsObject.put("USER_ID", true);
	fieldsObject.put("USER_NAME", true);
	fieldsObject.put("USER_PHOTO", true);
	fieldsObject.put("CREATE_TIME", true);
	fieldsObject.put("_id", false);

	Criteria criteria = new Criteria();
	criteria.orOperator(Criteria.where("HANDLER_ID").is(pd.getString("HANDLER_ID")),Criteria.where("STATUS").is("1"));
	Query query = new Query(criteria);
	List<PageData> allTitle=mongoTemplate.find(query,PageData.class,"IM_TITLE");
	return allTitle;
}
 
开发者ID:noseparte,项目名称:Spring-Boot-Server,代码行数:26,代码来源:AppCustomerRestful.java

示例10: getCodes

import org.springframework.data.mongodb.core.query.Criteria; //导入方法依赖的package包/类
/** 코드를 검색함.
 * @param tags
 * @param search
 * @param writer
 * @param sort
 * @param page
 * @param size
 * @return
 */
public List<Code> getCodes(
		List<String> tags,
		String search,
		Weaver writer,
		String sort,
		int page, 
		int size) {
	Criteria criteria = new Criteria();
	
	if(search != null && search.length()>0)
		criteria.orOperator(new Criteria("name").regex(search),
				new Criteria("content").regex(search),
				new Criteria("readme").regex(search));
	
	if(tags != null)
		criteria.and("tags").all(tags);
	if(writer != null)
		criteria.and("writer").is(writer);
	
	this.filter(criteria, sort);
	
	Query query = new Query(criteria);
	query.with(new PageRequest(page-1, size));

	this.sorting(query, sort);
	return mongoTemplate.find(query, Code.class);
}
 
开发者ID:forweaver,项目名称:forweaver2.0,代码行数:37,代码来源:CodeDao.java

示例11: countPostsWhenLogin

import org.springframework.data.mongodb.core.query.Criteria; //导入方法依赖的package包/类
/** 로그인한 회원이 글을 검색할때 숫자를 셈.
 * @param publicTags
 * @param privateAndMassageTags
 * @param writer
 * @param search
 * @param sort
 * @return
 */
public long countPostsWhenLogin(List<String> publicTags, List<String> privateAndMassageTags,
		Weaver writer, String search, String sort) {
	Criteria criteria = new Criteria();


	if(privateAndMassageTags != null)
		criteria.orOperator(Criteria.where("kind").is(1),
				Criteria.where("writer").is(writer),
				Criteria.where("tags").in(privateAndMassageTags));

	else
		criteria.orOperator(Criteria.where("kind").is(1),
				Criteria.where("writer").is(writer));

	if (search != null)
		criteria.andOperator(new Criteria().orOperator(
				Criteria.where("title").regex(search),
				Criteria.where("content").regex(search)));

	if (publicTags != null)
		criteria.and("tags").all(publicTags);

	this.filter(criteria, sort);

	return mongoTemplate.count(new Query(criteria), Post.class);
}
 
开发者ID:forweaver,项目名称:forweaver2.0,代码行数:35,代码来源:PostDao.java

示例12: getPostsWhenLogin

import org.springframework.data.mongodb.core.query.Criteria; //导入方法依赖的package包/类
/** 로그인한 회원이 글을 검색함.
 * @param publicTags
 * @param privateAndMassageTags
 * @param writer
 * @param search
 * @param sort
 * @param page
 * @param size
 * @return
 */
public List<Post> getPostsWhenLogin(
		List<String> publicTags, List<String> privateAndMassageTags,
		Weaver writer, String search, String sort, int page, int size) {

	Criteria criteria = new Criteria();

	if(privateAndMassageTags != null)
		criteria.orOperator(Criteria.where("kind").is(1),
				Criteria.where("writer").is(writer),
				Criteria.where("tags").in(privateAndMassageTags));
	else
		criteria.orOperator(Criteria.where("kind").is(1),
				Criteria.where("writer").is(writer));

	if (search != null)
		criteria.andOperator(new Criteria().orOperator(
				Criteria.where("title").regex(search),
				Criteria.where("content").regex(search)));

	if (publicTags != null)
		criteria.and("tags").all(publicTags);

	this.filter(criteria, sort);

	Query query = new Query(criteria);

	query.with(new PageRequest(page - 1, size));

	this.sorting(query, sort);
	return mongoTemplate.find(query, Post.class);
}
 
开发者ID:forweaver,项目名称:forweaver2.0,代码行数:42,代码来源:PostDao.java

示例13: getPostsAsWriter

import org.springframework.data.mongodb.core.query.Criteria; //导入方法依赖的package包/类
/** 로그인한 회원이 다른 사용자의 글을 검색함.
 * @param publicTags
 * @param loginWeaverprivateAndMassageTags
 * @param writer
 * @param loginWeaver
 * @param search
 * @param sort
 * @param page
 * @param size
 * @return
 */
public List<Post> getPostsAsWriter(
		List<String> publicTags, List<String> loginWeaverprivateAndMassageTags,
		Weaver writer, Weaver loginWeaver, String search, String sort,
		int page, int size) {
	Criteria criteria = new Criteria();
	criteria.orOperator(
			Criteria.where("kind").is(1).and("writer").is(writer), //다른 사용자의 일반글.
			Criteria.where("tags").in(loginWeaverprivateAndMassageTags) //로그인한 회원의 태그를 기반으로 다른 사용자의 글을 검색.
			.and("writer").is(writer));

	if (search != null)
		criteria.andOperator(new Criteria().orOperator(
				Criteria.where("title").regex(search),
				Criteria.where("content").regex(search)));

	if (publicTags != null)
		criteria.and("tags").all(publicTags);

	this.filter(criteria, sort);

	Query query = new Query(criteria);
	query.with(new PageRequest(page - 1, size));

	this.sorting(query, sort);
	return mongoTemplate.find(query, Post.class);
}
 
开发者ID:forweaver,项目名称:forweaver2.0,代码行数:38,代码来源:PostDao.java

示例14: closeTitle

import org.springframework.data.mongodb.core.query.Criteria; //导入方法依赖的package包/类
/**
 *
 * @Description:关闭回话
 * @param pd
 * @return
 * @return PageData
 * @throws
 */
@RequestMapping(value = "/closeTitle")
public PageData closeTitle(@RequestBody PageData pd){
	String titleId=pd.getString("TITLE_ID");
	if(StringUtils.isNotBlank(titleId)){
		Criteria criteria = new Criteria();
		criteria.orOperator(Criteria.where("TITLE_ID").is(pd.get("TITLE_ID")));
		mongoTemplate.updateFirst(new Query(criteria), Update.update("STATUS","0"),"IM_TITLE");
		redisTemplate.delete(String.join("_",customerCounter,titleId));
		return WebResult.requestSuccess();
	}else{
		return WebResult.requestFailed(504,"参数不正确",null);
	}
}
 
开发者ID:noseparte,项目名称:Spring-Boot-Server,代码行数:22,代码来源:AppCustomerRestful.java

示例15: customerOffline

import org.springframework.data.mongodb.core.query.Criteria; //导入方法依赖的package包/类
/**
 *
 * @Description: 客服人员下线
 * @param pd----->USER_ID
 * @return
 * @return PageData
 * @throws
 */
@RequestMapping(value = "/customerOffline")
public PageData customerOffline(@RequestBody PageData pd){
	String handlerId=pd.getString("HANDLER_ID");
	if(StringUtils.isNotBlank(handlerId)){
		Criteria criteria = new Criteria();
		criteria.orOperator(Criteria.where("_id").is(handlerId));
		mongoTemplate.remove(new Query(criteria),"IM_INCUSTOMER");
		redisTemplate.delete(String.join("_",customerCounter,"HANDLER",handlerId));
		return WebResult.requestSuccess();
	}else{
		return WebResult.requestFailed(504,"参数不正确",null);
	}
}
 
开发者ID:noseparte,项目名称:Spring-Boot-Server,代码行数:22,代码来源:AppCustomerRestful.java


注:本文中的org.springframework.data.mongodb.core.query.Criteria.orOperator方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。