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

org.huiche.web.api.method.Update Maven / Gradle / Ivy

There is a newer version: 1.4.1
Show newest version
package org.huiche.web.api.method;

import org.huiche.data.entity.BaseEntity;
import org.huiche.web.ServiceProvider;
import org.huiche.web.api.Api;
import org.huiche.web.response.BaseResult;
import org.springframework.web.bind.annotation.PatchMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * restful 更新数据接口,部分更新
 *
 * @author Maning
 */
public interface Update> extends Api, ServiceProvider {
    /**
     * 更新,部分更新
     *
     * @param entity 实体
     * @param id     ID
     * @return ID
     */
    @PatchMapping("{id}")
    default BaseResult update(@RequestBody T entity, @PathVariable Long id) {
        return ok(service().update(entity.setId(id)));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy