Package com.thinkgem.jeesite.common.persistence

Examples of com.thinkgem.jeesite.common.persistence.Parameter


        new Parameter(Category.DEL_FLAG_NORMAL, module));
  }
 
  public List<Category> findByParentId(String parentId, String isMenu){
    return find("from Category where delFlag=:p1 and parent.id=:p2 and inMenu=:p3 order by site.id, sort",
        new Parameter(Category.DEL_FLAG_NORMAL, parentId, isMenu));
  }
View Full Code Here


        new Parameter(Category.DEL_FLAG_NORMAL, parentId, isMenu));
  }

  public List<Category> findByParentIdAndSiteId(String parentId, String siteId){
    return find("from Category where delFlag=:p1 and parent.id=:p2 and site.id=:p3 order by site.id, sort",
        new Parameter(Category.DEL_FLAG_NORMAL, parentId, siteId));
  }
View Full Code Here

    return find("from Category where delFlag=:p1 and parent.id=:p2 and site.id=:p3 order by site.id, sort",
        new Parameter(Category.DEL_FLAG_NORMAL, parentId, siteId));
  }
 
  public List<Category> findByIdIn(String[] ids){
    return find("from Category where id in (:p1)", new Parameter(new Object[]{ids}));
  }
View Full Code Here

*/
@Repository
public class ArticleDao extends BaseDao<Article> {
 
  public List<Article> findByIdIn(String[] ids){
    return find("from Article where id in (:p1)", new Parameter(new Object[]{ids}));
  }
View Full Code Here

  public List<Article> findByIdIn(String[] ids){
    return find("from Article where id in (:p1)", new Parameter(new Object[]{ids}));
  }
 
  public int updateHitsAddOne(String id){
    return update("update Article set hits=hits+1 where id = :p1", new Parameter(id));
  }
View Full Code Here

  private ArticleDao articleDao;
 
  public List<Map<String, Object>> article(Map<String, Object> paramMap) {
   
    StringBuilder ql = new StringBuilder();
    Parameter pm = new Parameter();
   
    ql.append("select new map(max(c.id) as categoryId, max(c.name) as categoryName, max(cp.id) as categoryParentId, max(cp.name) as categoryParentName,");
    ql.append("   count(*) as cnt, sum(a.hits) as hits, max(a.updateDate) as updateDate, max(o.id) as officeId, max(o.name) as officeName) ");
    ql.append(" from Article a join a.category c join c.office o join c.parent cp where c.site.id = ");
    ql.append(Site.getCurrentSiteId());
   
    Date beginDate = DateUtils.parseDate(paramMap.get("beginDate"));
    if (beginDate == null){
      beginDate = DateUtils.setDays(new Date(), 1);
      paramMap.put("beginDate", DateUtils.formatDate(beginDate, "yyyy-MM-dd"));
    }
    Date endDate = DateUtils.parseDate(paramMap.get("endDate"));
    if (endDate == null){
      endDate = DateUtils.addDays(DateUtils.addMonths(beginDate, 1), -1);
      paramMap.put("endDate", DateUtils.formatDate(endDate, "yyyy-MM-dd"));
    }
   
    String categoryId = ObjectUtils.toString(paramMap.get("categoryId"));
    if (StringUtils.isNotBlank(categoryId)){
      ql.append(" and (c.id = :id or c.parentIds like :parentIds)");
      pm.put("id", categoryId);
      pm.put("parentIds", "%,"+categoryId+",%");
    }
   
    String officeId = ObjectUtils.toString(paramMap.get("officeId"));
    if (StringUtils.isNotBlank(officeId)){
      ql.append(" and (o.id = :officeId or o.parentIds like :officeParentIds)");
      pm.put("officeId", officeId);
      pm.put("officeParentIds", "%,"+officeId+",%");
    }
   
    ql.append(" and a.updateDate between :beginDate and :endDate");
    pm.put("beginDate", beginDate);
    pm.put("endDate", DateUtils.addDays(endDate, 1));

    ql.append(" and c.delFlag = :delFlag");
    pm.put("delFlag", Article.DEL_FLAG_NORMAL);
   
    ql.append(" group by cp.sort, cp.id, c.sort, c.id");
    ql.append(" order by cp.sort, cp.id, c.sort, c.id");
    List<Map<String, Object>> list = articleDao.find(ql.toString(), pm);
    return list;
View Full Code Here

TOP

Related Classes of com.thinkgem.jeesite.common.persistence.Parameter

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.