com.github.fosin.cdp.mvc.controller.IDeleteController Maven / Gradle / Ivy
The newest version!
package com.github.fosin.cdp.mvc.controller;
import com.github.fosin.cdp.mvc.constant.MvcConstant;
import com.github.fosin.cdp.mvc.service.IDeleteService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.http.ResponseEntity;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import java.io.Serializable;
import java.util.Collection;
/**
* Description:
*
* @author fosin
* @date 2018.8.30
*/
@Api("删除数据类控制器")
public interface IDeleteController {
> S getService();
@DeleteMapping
@ApiOperation(value = "删除指定数据集")
@ApiImplicitParam(name = "entity",value = "需要删除的实体类数据")
default ResponseEntity> delete(@RequestBody E entity) {
Assert.notNull(entity, "更新数据的传入的实体类不能为空!");
return ResponseEntity.ok(getService().delete(entity));
}
@DeleteMapping(MvcConstant.PATH_ID)
@ApiOperation(value = "根据主键ID删除一条数据")
@ApiImplicitParam(name = "id",value = "实体类主键")
default ResponseEntity delete(@PathVariable ID id) {
Assert.notNull(id, "更新数据的传入的ID不能为空!");
return ResponseEntity.ok(getService().delete(id));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy