Пример #1
0
  public Integer count(ContactVo paramComponent) {
    log.debug("Enter criteria = {}", paramComponent);

    ContactEntityExample example = new ContactEntityExample();
    if (paramComponent != null) {
      example
          .addCriteriaOr()
          .addCriterion(example.createContentsLike(paramComponent.getContent()))
          .addCriterion(example.createStatusEquals(paramComponent.getStatus()))
          .addCriterion(example.createClientIdEquals(paramComponent.getClient().getId()))
          .addCriterion(example.createAdminIdEquals(paramComponent.getAdmin().getId()))
          .addCriterion(
              example.createCreationDateBetween(
                  paramComponent.getStart(), paramComponent.getEnd()));
    }

    Integer count = contactManager.countByExample(example);
    log.debug("Exit page = {}", count);
    return count;
  }
Пример #2
0
 public ContactEntity getDetail(ContactVo entity) {
   log.debug("Enter criteria = {}", entity);
   ContactEntity detail = contactManager.get(entity.getId());
   log.debug("Exit page = {}", detail);
   return detail;
 }
Пример #3
0
  public PageVo<ContactEntity> find(ContactVo paramComponent) {
    log.debug("Enter criteria = {}", paramComponent);

    PageVo<ContactEntity> page = new PageVo<>();
    List<ContactEntity> list = new ArrayList<>();

    ContactEntityExample example = new ContactEntityExample();
    if (paramComponent != null) {
      example
          .addCriteriaOr()
          .addCriterion(example.createContentsLike(paramComponent.getContent()))
          .addCriterion(example.createStatusEquals(paramComponent.getStatus()))
          .addCriterion(example.createClientIdEquals(paramComponent.getClient().getId()))
          .addCriterion(example.createAdminIdEquals(paramComponent.getAdmin().getId()))
          .addCriterion(
              example.createCreationDateBetween(
                  paramComponent.getStart(), paramComponent.getEnd()));
    }
    example.setOrderWithCreateTime(Constants.SQL_ORDER_DESC);
    example.setStart(paramComponent.getPageStart());
    example.setLimit(paramComponent.getPageLimit());

    Integer count = contactManager.countByExample(example);
    if (count == 0) {
      page = new PageVo<>(0, paramComponent.getPageSize(), paramComponent.getPageNo(), list);
    } else {
      list = contactManager.findByExample(example);
      page = new PageVo<>(count, paramComponent.getPageSize(), paramComponent.getPageNo(), list);
    }
    log.debug("Exit page = {}", page);
    return page;
  }