All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.minlia.rocket.abstraction.endpoint.CountByConditionEndpoint Maven / Gradle / Ivy

There is a newer version: 2.0.4.1.RELEASE
Show newest version
package com.minlia.rocket.abstraction.endpoint;

import com.minlia.rocket.abstraction.service.ConditionalService;
import com.minlia.rocket.data.body.AbstractQueryRequestBody;
import com.minlia.rocket.loggable.annotation.Loggable;
import com.minlia.rocket.stateful.Responses;
import com.minlia.rocket.stateful.body.StatefulBody;
import com.minlia.rocket.stateful.body.WithResultBody;
import com.minlia.rocket.stateful.body.impl.SuccessResponseBody;
import io.swagger.annotations.ApiOperation;
import java.io.Serializable;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

@FunctionalInterface
public interface CountByConditionEndpoint {

  @Autowired
  public abstract ConditionalService getConditionalService();

  //TODO 添加权限点控制
  @Loggable
  @PostMapping(value = "/count", produces = {MediaType.APPLICATION_JSON_UTF8_VALUE})
  @ApiOperation(value = "Count by conditions")
  public default ResponseEntity>> count(
      @RequestBody QUERY requestBody) {
    WithResultBody body = new WithResultBody();
    body.setResult(getConditionalService().countByCondition(requestBody));
    return Responses.ok(SuccessResponseBody.builder()
        .payload(body).build());
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy