コード例 #1
0
ファイル: ContactService.java プロジェクト: britash/monk
  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;
  }
コード例 #2
0
ファイル: ContactService.java プロジェクト: britash/monk
  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;
  }