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

net.guerlab.cloud.server.BaseUpdateService Maven / Gradle / Ivy

There is a newer version: 2024.11.0
Show newest version
/*
 * Copyright 2018-2024 guerlab.net and other contributors.
 *
 * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE, Version 3 (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.gnu.org/licenses/lgpl-3.0.html
 *
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package net.guerlab.cloud.server;

import java.util.Collection;
import java.util.List;

import net.guerlab.cloud.commons.api.UpdateById;
import net.guerlab.cloud.commons.entity.IBaseEntity;
import net.guerlab.cloud.searchparams.SearchParams;

/**
 * 基本更新服务接口.
 *
 * @param  数据类型
 * @param  搜索参数类型
 * @author guer
 */
@SuppressWarnings({"UnusedReturnValue", "unused"})
public interface BaseUpdateService extends UpdateById {

	/**
	 * 根据条件更新.
	 *
	 * @param entity       实体
	 * @param searchParams 搜索条件
	 * @return 是否更新成功
	 */
	boolean update(E entity, Q searchParams);

	/**
	 * 批量更新.
	 *
	 * @param collection 待更新列表
	 * @return 已更新列表
	 */
	default List batchUpdateById(Collection collection) {
		return batchUpdateById(collection, false);
	}

	/**
	 * 批量更新.
	 *
	 * @param collection                 待更新列表
	 * @param ignoreBeforeCheckException 是否忽略前置检查异常
	 * @return 已更新列表
	 */
	List batchUpdateById(Collection collection, boolean ignoreBeforeCheckException);

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy