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

com.mobaijun.core.service.StatusService Maven / Gradle / Ivy

/*
 * Copyright (C) 2022 [www.mobaijun.com]
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.mobaijun.core.service;

import com.mobaijun.base.entity.QueryStatusModel;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;

/**
 * Description: [状态修改接口]
 * Author: [mobaijun]
 * Date: [2024/8/15 17:15]
 * IntelliJ IDEA Version: [IntelliJ IDEA 2023.1.4]
 *
 * @param       实体类型
 * @param      实体id类型
 * @param  状态属性类型
 */
public interface StatusService {

    /**
     * 通用修改状态接口(同步版本)
     *
     * @param queryStatusModel 查询条件
     * @return 修改后的实体,如果实体不存在则返回Optional.empty()
     */
    Optional updateStatus(QueryStatusModel queryStatusModel);

    /**
     * 通用修改状态接口(异步版本)
     *
     * @param queryStatusModel 查询条件
     * @return CompletableFuture 包含修改后的实体
     */
    default CompletableFuture> updateStatusAsync(QueryStatusModel queryStatusModel) {
        return CompletableFuture.supplyAsync(() -> updateStatus(queryStatusModel));
    }
}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy