Exemplo n.º 1
0
  public Page<TaskDTO> pageQueryTask(
      TaskDTO queryVo, int currentPage, int pageSize, String currentUserId) {
    List<Object> conditionVals = new ArrayList<Object>();
    StringBuilder jpql = new StringBuilder("select _task from Task _task   where 1=1 ");
    if (queryVo.getTaskName() != null && !"".equals(queryVo.getTaskName())) {
      jpql.append(" and _task.taskName like ?");
      conditionVals.add(MessageFormat.format("%{0}%", queryVo.getTaskName()));
    }
    if (queryVo.getSendChannel() != null && !"".equals(queryVo.getSendChannel())) {
      jpql.append(" and _task.sendChannel like ?");
      conditionVals.add(MessageFormat.format("%{0}%", queryVo.getSendChannel()));
    }
    if (queryVo.getSetTime() != null && !"".equals(queryVo.getSetTime())) {
      jpql.append(" and _task.setTime like ?");
      conditionVals.add(MessageFormat.format("%{0}%", queryVo.getSetTime()));
    }
    if (queryVo.getTaskCreator() != null && !"".equals(queryVo.getTaskCreator())) {
      jpql.append(" and _task.taskCreator like ?");
      conditionVals.add(MessageFormat.format("%{0}%", queryVo.getTaskCreator()));
    }
    if (queryVo.getTaskCreatedTime() != null) {
      jpql.append(" and _task.taskCreatedTime between ? and ? ");
      conditionVals.add(queryVo.getTaskCreatedTime());
      conditionVals.add(queryVo.getTaskCreatedTimeEnd());
    }
    if (queryVo.getTaskStatus() != null && !"".equals(queryVo.getTaskStatus())) {
      jpql.append(" and _task.taskStatus like ?");
      conditionVals.add(MessageFormat.format("%{0}%", queryVo.getTaskStatus()));
    }
    if (queryVo.getPacketNum() != null && !"".equals(queryVo.getPacketNum())) {
      jpql.append(" and _task.packetNum like ?");
      conditionVals.add(MessageFormat.format("%{0}%", queryVo.getPacketNum()));
    }
    if (currentUserId != null) {
      jpql.append(" and _task.taskCreator = ?");
      conditionVals.add(currentUserId);
    }
    Page<Task> pages =
        getQueryChannelService()
            .createJpqlQuery(jpql.toString())
            .setParameters(conditionVals)
            .setPage(currentPage, pageSize)
            .pagedList();

    return new Page<TaskDTO>(
        pages.getStart(), pages.getResultCount(), pageSize, TaskAssembler.toDTOs(pages.getData()));
  }
Exemplo n.º 2
0
 public InvokeResult updateTask(TaskDTO taskDTO) {
   application.updateTask(TaskAssembler.toEntity(taskDTO));
   return InvokeResult.success();
 }
Exemplo n.º 3
0
 public List<TaskDTO> findAllTask() {
   return TaskAssembler.toDTOs(application.findAllTask());
 }
Exemplo n.º 4
0
 public InvokeResult getTask(Long id) {
   return InvokeResult.success(TaskAssembler.toDTO(application.getTask(id)));
 }