Esempio n. 1
0
  /** 根据查询条件获取对象列表 */
  public List getSearchActivity(Map map) {

    Date startDate = (Date) map.get("startDate");
    Date endDate = (Date) map.get("endDate");
    String actName = (String) map.get("actName");
    String actType = (String) map.get("actType");
    String relationProject = (String) map.get("relationProject");
    String responsiblePerson = (String) map.get("responsiblePerson");

    StringBuffer hql = new StringBuffer();
    hql.append(" from CrmActivity ra where 1=1 ");

    if (!StringUtil.isStrEmpty(actName)) {
      hql.append(" and ra.name like '")
          .append(StringUtil.replaceBackSpaceWithDelim(actName, "%"))
          .append("'");
    }
    if (!StringUtil.isStrEmpty(actType)) {
      hql.append(" and ra.activityType = '").append(actType).append("'");
    }
    if (!StringUtil.isStrEmpty(relationProject)) {
      hql.append(" and ra.itemId = '").append(relationProject).append("'");
    }
    if (!StringUtil.isStrEmpty(responsiblePerson)) {
      hql.append(" and ra.responsiblePerson.id = ").append(responsiblePerson);
    }
    if (startDate != null) {
      hql.append(" and ra.startDate >= '").append(OperateUtil.getSysDate(startDate)).append("'");
    }
    if (endDate != null) {
      hql.append(" and ra.startDate <= '").append(OperateUtil.getSysDate(endDate)).append("'");
    }
    hql.append(" order by ra.startDate desc,  ra.endDate desc");
    return queryManager.find(hql.toString());
  }
Esempio n. 2
0
  /**
   * 得到标签的活动列表
   *
   * @param map
   * @return
   */
  public List getActListTag(Map map) {
    Date startDate = (Date) map.get("startDate");
    Date endDate = (Date) map.get("endDate");
    String responDept = (String) map.get("responDept");
    String responUser = (String) map.get("responUser");
    String targetType = (String) map.get("targetType");
    String userId = (String) map.get("userId");
    String contacId = getActIdByContable(targetType, userId);

    StringBuffer hql = new StringBuffer();
    hql.append(" from CrmActivity ra where 1=1 ");
    if (!StringUtil.isStrEmpty(targetType)
        && !StringUtil.isStrEmpty(userId)
        && "123456".equals(targetType)) {
      hql.append(" and ra.itemId.id =").append(userId);
    }
    if (!StringUtil.isStrEmpty(contacId)) {
      hql.append(" and ra.id in (").append(contacId).append(")");
    } else {
      hql.append(" and ra.id in ( null )");
    }

    if (!StringUtil.isStrEmpty(responDept)) {
      hql.append(" and ra.departmentId =").append(responDept);
    }
    if (!StringUtil.isStrEmpty(responUser)) {
      hql.append(" and ra.responsiblePerson = ").append(responUser);
    }
    if (startDate != null) {
      hql.append(" and ra.startDate >= '").append(OperateUtil.getSysDate(startDate)).append("'");
    }
    if (endDate != null) {
      hql.append(" and ra.startDate <= '").append(OperateUtil.getSysDate(endDate)).append("'");
    }
    hql.append(" order by ra.startDate desc");
    return queryManager.find(hql.toString());
  }