Package org.hibernate.criterion

Examples of org.hibernate.criterion.DetachedCriteria.createAlias()


 
  public Page<User> findUser(Page<User> page, User user) {
    User currentUser = UserUtils.getUser();
    DetachedCriteria dc = userDao.createDetachedCriteria();
   
    dc.createAlias("company", "company");
    if (user.getCompany() != null && StringUtils.isNotBlank(user.getCompany().getId())){
      dc.add(Restrictions.or(
        Restrictions.eq("company.id", user.getCompany().getId()),
        Restrictions.like("company.parentIds", "%," + user.getCompany().getId() + ",%")
      ));
View Full Code Here


        Restrictions.eq("company.id", user.getCompany().getId()),
        Restrictions.like("company.parentIds", "%," + user.getCompany().getId() + ",%")
      ));
    }
   
    dc.createAlias("office", "office");
    if (user.getOffice() != null && StringUtils.isNotBlank(user.getOffice().getId())){
      dc.add(Restrictions.or(
        Restrictions.eq("office.id", user.getOffice().getId()),
        Restrictions.like("office.parentIds", "%," + user.getOffice().getId() + ",%")
      ));
View Full Code Here

   
    List<Category> list = (List<Category>)UserUtils.getCache(CACHE_CATEGORY_LIST);
    if (list == null){
      User user = UserUtils.getUser();
      DetachedCriteria dc = categoryDao.createDetachedCriteria();
      dc.createAlias("office", "office").createAlias("createBy", "user");
      dc.add(dataScopeFilter(user, "office", "user"));
//      dc.add(Restrictions.or(Restrictions.isNull("href"),Restrictions.eq("href", "")));
      dc.add(Restrictions.eq("delFlag", Category.DEL_FLAG_NORMAL));
      dc.addOrder(Order.asc("site.id")).addOrder(Order.asc("sort"));
      list = categoryDao.find(dc);
View Full Code Here

  }
 
  public Page<Category> find(Page<Category> page, Category category) {
    DetachedCriteria dc = categoryDao.createDetachedCriteria();
    if (category.getSite()!=null && StringUtils.isNotBlank(category.getSite().getId())){
      dc.createAlias("site", "site");
      dc.add(Restrictions.eq("site.id", category.getSite().getId()));
    }
    if (category.getParent()!=null && StringUtils.isNotBlank(category.getParent().getId())){
      dc.createAlias("parent", "parent");
      dc.add(Restrictions.eq("parent.id", category.getParent().getId()));
View Full Code Here

    if (category.getSite()!=null && StringUtils.isNotBlank(category.getSite().getId())){
      dc.createAlias("site", "site");
      dc.add(Restrictions.eq("site.id", category.getSite().getId()));
    }
    if (category.getParent()!=null && StringUtils.isNotBlank(category.getParent().getId())){
      dc.createAlias("parent", "parent");
      dc.add(Restrictions.eq("parent.id", category.getParent().getId()));
    }
    if (StringUtils.isNotBlank(category.getInMenu()) && Category.SHOW.equals(category.getInMenu())){
      dc.add(Restrictions.eq("inMenu", category.getInMenu()));
    }
View Full Code Here

        && updateExpiredWeightDate.getTime() < new Date().getTime())){
      linkDao.updateExpiredWeight();
      CacheUtils.put("updateExpiredWeightDateByLink", DateUtils.addHours(new Date(), 6));
    }
    DetachedCriteria dc = linkDao.createDetachedCriteria();
    dc.createAlias("category", "category");
    dc.createAlias("category.site", "category.site");
    if (link.getCategory()!=null && StringUtils.isNotBlank(link.getCategory().getId()) && !Category.isRoot(link.getCategory().getId())){
      Category category = categoryDao.get(link.getCategory().getId());
      if (category!=null){
        dc.add(Restrictions.or(
View Full Code Here

      linkDao.updateExpiredWeight();
      CacheUtils.put("updateExpiredWeightDateByLink", DateUtils.addHours(new Date(), 6));
    }
    DetachedCriteria dc = linkDao.createDetachedCriteria();
    dc.createAlias("category", "category");
    dc.createAlias("category.site", "category.site");
    if (link.getCategory()!=null && StringUtils.isNotBlank(link.getCategory().getId()) && !Category.isRoot(link.getCategory().getId())){
      Category category = categoryDao.get(link.getCategory().getId());
      if (category!=null){
        dc.add(Restrictions.or(
            Restrictions.eq("category.id", category.getId()),
View Full Code Here

    }
    if (link.getCreateBy()!=null && StringUtils.isNotBlank(link.getCreateBy().getId())){
      dc.add(Restrictions.eq("createBy.id", link.getCreateBy().getId()));
    }
    if (isDataScopeFilter){
      dc.createAlias("category.office", "categoryOffice").createAlias("createBy", "createBy");
      dc.add(dataScopeFilter(UserUtils.getUser(), "categoryOffice", "createBy"));
    }
    dc.add(Restrictions.eq(Link.FIELD_DEL_FLAG, link.getDelFlag()));
    dc.addOrder(Order.desc("weight"));
    dc.addOrder(Order.desc("updateDate"));
View Full Code Here

    if(StringUtils.isNotBlank(leave.getLeaveType())) {
      dc.add(Restrictions.like("leaveType", leave.getLeaveType()));
    }
    dc.add(Restrictions.ne("processStatus","已完成"));
    dc.add(Restrictions.eq("delFlag", Leave.DEL_FLAG_NORMAL));
    dc.createAlias("createBy", "createBy");
    dc.createAlias("createBy.office", "office");
    dc.add(dataScopeFilter(UserUtils.getUser(), "office", "createBy"));
    dc.addOrder(Order.desc("id"));
    List<Leave> list = leaveDao.find(dc);
    List<Leave> result = Lists.newArrayList();
View Full Code Here

      dc.add(Restrictions.like("leaveType", leave.getLeaveType()));
    }
    dc.add(Restrictions.ne("processStatus","已完成"));
    dc.add(Restrictions.eq("delFlag", Leave.DEL_FLAG_NORMAL));
    dc.createAlias("createBy", "createBy");
    dc.createAlias("createBy.office", "office");
    dc.add(dataScopeFilter(UserUtils.getUser(), "office", "createBy"));
    dc.addOrder(Order.desc("id"));
    List<Leave> list = leaveDao.find(dc);
    List<Leave> result = Lists.newArrayList();
    //过滤出当前用户的任务
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.