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

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

The 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.DeleteMapping;
import org.springframework.web.bind.annotation.RequestBody;

@FunctionalInterface
public interface DeleteByConditionEndpoint {

  @Autowired
  public abstract ConditionalService getConditionalService();

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy