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

com.github.fosin.cdp.mvc.controller.IUpdateController Maven / Gradle / Ivy

package com.github.fosin.cdp.mvc.controller;

import com.github.fosin.cdp.mvc.service.IUpdateService;
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.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.io.Serializable;

/**
 * Description:
 *
 * @author fosin
 * @date 2018.8.30
 */
@Api("修改数据类控制器")
public interface IUpdateController {
    > S getService();

    @PutMapping
    @ApiOperation(value = "根据实体类更新一条数据")
    @ApiImplicitParam(name = "entity",value = "更新数据的实体类数据")
    default ResponseEntity update(@RequestBody @Validated E entity) {
        Assert.notNull(entity,"更新数据的传入的实体类不能为空!");
        return ResponseEntity.ok(getService().update(entity));
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy