Package com.github.cleverage.elasticsearch

Examples of com.github.cleverage.elasticsearch.Index$Finder


  }

  private Finder byChannelPaths(String[] paths, Integer[] siteIds,
      Integer[] typeIds, Boolean titleImg, Boolean recommend,
      String title, int orderBy) {
    Finder f = Finder.create();
    f.append("select bean from Content bean join bean.channel channel");
    f.append(" join bean.contentExt as ext");
    int len = paths.length;
    if (len == 1) {
      f.append(" where channel.path=:path").setParam("path", paths[0]);
    } else {
      f.append(" where channel.path in (:paths)");
      f.setParamList("paths", paths);
    }
    if (siteIds != null) {
      len = siteIds.length;
      if (len == 1) {
        f.append(" and channel.site.id=:siteId");
        f.setParam("siteId", siteIds[0]);
      } else if (len > 1) {
        f.append(" and channel.site.id in (:siteIds)");
        f.setParamList("siteIds", siteIds);
      }
    }
    if (titleImg != null) {
      f.append(" and bean.hasTitleImg=:titleImg");
      f.setParam("titleImg", titleImg);
    }
    if (recommend != null) {
      f.append(" and bean.recommend=:recommend");
      f.setParam("recommend", recommend);
    }
    appendReleaseDate(f);
    appendTypeIds(f, typeIds);
    f.append(" and bean.status=" + ContentCheck.CHECKED);
    if (!StringUtils.isBlank(title)) {
      f.append(" and bean.contentExt.title like :title");
      f.setParam("title", "%" + title + "%");
    }
    appendOrder(f, orderBy);
    return f;
  }
View Full Code Here


  }

  private Finder byTopicId(Integer topicId, Integer[] siteIds,
      Integer[] channelIds, Integer[] typeIds, Boolean titleImg,
      Boolean recommend, String title, int orderBy) {
    Finder f = Finder.create();
    f.append("select bean from Content bean join bean.topics topic");
    f.append(" join bean.contentExt as ext");
    f.append(" where topic.id=:topicId").setParam("topicId", topicId);
    if (titleImg != null) {
      f.append(" and bean.hasTitleImg=:titleImg");
      f.setParam("titleImg", titleImg);
    }
    if (recommend != null) {
      f.append(" and bean.recommend=:recommend");
      f.setParam("recommend", recommend);
    }
    appendReleaseDate(f);
    appendTypeIds(f, typeIds);
    appendChannelIds(f, channelIds);
    appendSiteIds(f, siteIds);
    f.append(" and bean.status=" + ContentCheck.CHECKED);
    if (!StringUtils.isBlank(title)) {
      f.append(" and bean.contentExt.title like :title");
      f.setParam("title", "%" + title + "%");
    }
    appendOrder(f, orderBy);
    return f;
  }
View Full Code Here

  }

  private Finder byTagIds(Integer[] tagIds, Integer[] siteIds,
      Integer[] channelIds, Integer[] typeIds, Integer excludeId,
      Boolean titleImg, Boolean recommend, String title, int orderBy) {
    Finder f = Finder.create();
    int len = tagIds.length;
    if (len == 1) {
      f.append("select bean from Content bean join bean.tags tag");
      f.append(" join bean.contentExt as ext");
      f.append(" where tag.id=:tagId").setParam("tagId", tagIds[0]);
    } else {
      f.append("select distinct bean from Content bean");
      f.append(" join bean.contentExt as ext");
      f.append(" join bean.tags tag");
      f.append(" where tag.id in(:tagIds)");
      f.setParamList("tagIds", tagIds);
    }
    if (titleImg != null) {
      f.append(" and bean.hasTitleImg=:titleImg");
      f.setParam("titleImg", titleImg);
    }
    if (recommend != null) {
      f.append(" and bean.recommend=:recommend");
      f.setParam("recommend", recommend);
    }
    appendReleaseDate(f);
    appendTypeIds(f, typeIds);
    appendChannelIds(f, channelIds);
    appendSiteIds(f, siteIds);
    if (excludeId != null) {
      f.append(" and bean.id<>:excludeId");
      f.setParam("excludeId", excludeId);
    }
    f.append(" and bean.status=" + ContentCheck.CHECKED);
    if (!StringUtils.isBlank(title)) {
      f.append(" and bean.contentExt.title like :title");
      f.setParam("title", "%" + title + "%");
    }
    appendOrder(f, orderBy);
    return f;
  }
View Full Code Here

public class CmsTopicDaoImpl extends HibernateBaseDao<CmsTopic, Integer>
    implements CmsTopicDao {
  @SuppressWarnings("unchecked")
  public List<CmsTopic> getList(Integer channelId, boolean recommend,
      Integer count, boolean cacheable) {
    Finder f = Finder.create("from CmsTopic bean where 1=1");
    if (channelId != null) {
      f.append(" and bean.channel.id=:channelId");
      f.setParam("channelId", channelId);
    }
    if (recommend) {
      f.append(" and bean.recommend=true");
    }
    f.append(" order by bean.priority asc,bean.id desc");
    if (count != null) {
      f.setMaxResults(count);
    }
    f.setCacheable(cacheable);
    return find(f);
  }
View Full Code Here

    return find(f);
  }

  public Pagination getPage(Integer channelId, boolean recommend, int pageNo,
      int pageSize, boolean cacheable) {
    Finder f = Finder.create("from CmsTopic bean where 1=1");
    if (channelId != null) {
      f.append(" and bean.channel.id=:channelId");
      f.setParam("channelId", channelId);
    }
    if (recommend) {
      f.append(" and bean.recommend=true");
    }
    f.append(" order by bean.priority asc,bean.id desc");
    return find(f, pageNo, pageSize);
  }
View Full Code Here

@Repository
public class CmsLogDaoImpl extends HibernateBaseDao<CmsLog, Integer> implements
    CmsLogDao {
  public Pagination getPage(Integer category, Integer siteId, Integer userId,
      String title, String ip, int pageNo, int pageSize) {
    Finder f = Finder.create("from CmsLog bean where 1=1");
    if (category != null) {
      f.append(" and bean.category=:category");
      f.setParam("category", category);
    }
    if (siteId != null) {
      f.append(" and bean.site.id=:siteId");
      f.setParam("siteId", siteId);
    }
    if (userId != null) {
      f.append(" and bean.user.id=:userId");
      f.setParam("userId", userId);
    }
    if (StringUtils.isNotBlank(title)) {
      f.append(" and bean.title like :title");
      f.setParam("title", "%" + title + "%");
    }
    if (StringUtils.isNotBlank(ip)) {
      f.append(" and bean.ip like :ip");
      f.setParam("ip", ip + "%");
    }
    f.append(" order by bean.id desc");
    return find(f, pageNo, pageSize);
  }
View Full Code Here

    }
    return entity;
  }

  public int deleteBatch(Integer category, Integer siteId, Date before) {
    Finder f = Finder.create("delete CmsLog bean where 1=1");
    if (category != null) {
      f.append(" and bean.category=:category");
      f.setParam("category", category);
    }
    if (siteId != null) {
      f.append(" and bean.site.id=:siteId");
      f.setParam("siteId", siteId);
    }
    if (before != null) {
      f.append(" and bean.time<=:before");
      f.setParam("before", before);
    }
    Query q = f.createQuery(getSession());
    return q.executeUpdate();
  }
View Full Code Here

    return query.list();
  }

  public Pagination getPage(String name, int pageNo, int pageSize,
      boolean cacheable) {
    Finder f = Finder.create("from ContentTag bean");
    if (!StringUtils.isBlank(name)) {
      f.append(" where bean.name like :name");
      f.setParam("name", "%" + name + "%");
    }
    f.append(" order by bean.count desc");
    f.setCacheable(cacheable);
    return find(f, pageNo, pageSize);
  }
View Full Code Here

public class CmsAppInfoDaoImpl extends HibernateBaseDao<CmsAppInfo, Integer>
    implements CmsAppInfoDao {
  @SuppressWarnings("unchecked")
  public List<CmsAppInfo> getList(boolean containDisabled) {
    System.out.println("进入了com.jeecms.cms.dao.main.impl.CmsAppInfoDaoImpl");
    Finder f = Finder.create("from CmsAppInfo bean");
    if (!containDisabled) {
      f.append(" where bean.disabled=false");
    }
    f.append(" order by bean.priority");
    return find(f);
  }
View Full Code Here

@Repository
public class CmsModelDaoImpl extends HibernateBaseDao<CmsModel, Integer>
    implements CmsModelDao {
  @SuppressWarnings("unchecked")
  public List<CmsModel> getList(boolean containDisabled) {
    Finder f = Finder.create("from CmsModel bean");
    if (!containDisabled) {
      f.append(" where bean.disabled=false");
    }
    f.append(" order by bean.priority");
    return find(f);
  }
View Full Code Here

TOP

Related Classes of com.github.cleverage.elasticsearch.Index$Finder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.