com.minlia.rocket.abstraction.endpoint.FindListByConditionEndpoint Maven / Gradle / Ivy
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.impl.SuccessResponseBody;
import io.swagger.annotations.ApiOperation;
import java.io.Serializable;
import java.util.List;
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 FindListByConditionEndpoint {
@Autowired
public abstract ConditionalService getConditionalService();
/**
* 使用 @Pretend(value = "**,-payload.items.code") 进行结果排除,不需要此字段在前端展示
*/
//TODO 添加权限点控制
@Loggable
@PostMapping(value = "/findList", produces = {MediaType.APPLICATION_JSON_UTF8_VALUE})
@ApiOperation(value = "Find all by conditions with list result")
public default ResponseEntity>> findList(
@RequestBody QUERY requestBody) {
return Responses.ok(SuccessResponseBody.builder()
.payload(getConditionalService().findAllByCondition(requestBody)).build());
}
}