com.viiyue.plugins.mybatis.mapper.base.BaseDeleteMapper Maven / Gradle / Ivy
Show all versions of mybatis-mapper Show documentation
/**
* Copyright (C) 2017 the original author or authors.
*
* 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
*
* http://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.viiyue.plugins.mybatis.mapper.base;
import java.io.Serializable;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Param;
import com.viiyue.plugins.mybatis.mapper.Marker;
import com.viiyue.plugins.mybatis.mapper.special.LogicallyDeleteMapper;
import com.viiyue.plugins.mybatis.provider.DynamicProvider;
import com.viiyue.plugins.mybatis.provider.base.BaseDeleteProvider;
/**
* Basic delete api method interface definition
*
* @author tangxbai
* @since 1.0.0
*
* @param database entity type
* @param query data return entity type
* @param primary key type, must be a {@link Serializable} implementation class.
*/
public interface BaseDeleteMapper extends Marker {
/**
* Delete all data in the table
*
*
* Note: This operation is irreversible and belongs to physical
* deletion. If you want to operate the data safely, please use the
* {@link LogicallyDeleteMapper#logicallyDeleteAll() logicallyDeleteAll()}
* method instead.
*
*
* @return the number of rows affected
*/
@DeleteProvider( type = BaseDeleteProvider.class, method = DynamicProvider.dynamicSQL )
int deleteAll();
/**
* Selective deletion by entity object
*
*
* Note: This operation is irreversible and belongs to physical
* deletion. If you want to operate the data safely, please use the
* {@link LogicallyDeleteMapper#logicallyDelete(Object)
* logicallyDelete(Object)} method instead.
*
*
* @param param entity object
* @return the number of rows affected
*/
@DeleteProvider( type = BaseDeleteProvider.class, method = DynamicProvider.dynamicSQL )
int delete( DO param );
/**
* Delete specified data by primary key
*
*
* Note: This operation is irreversible and belongs to physical
* deletion. If you want to operate the data safely, please use the
* {@link LogicallyDeleteMapper#logicallyDeleteByPrimaryKey(Serializable)
* logicallyDeleteByPrimaryKey(PK)} method instead.
*
*
* @param primaryKey primary key value
* @return the number of rows affected
*/
@DeleteProvider( type = BaseDeleteProvider.class, method = DynamicProvider.dynamicSQL )
int deleteByPrimaryKey( PK primaryKey );
/**
* Batch delete by primary key array
*
*
* Note: This operation is irreversible and belongs to physical
* deletion. If you want to operate the data safely, please use the
* {@link LogicallyDeleteMapper#logicallyDeleteByPrimaryKeyGroup(Serializable...)
* logicallyDeleteByPrimaryKeyGroup(PK ...)} method instead.
*
*
* @param primaryKeys primary key array
* @return the number of rows affected
*/
@DeleteProvider( type = BaseDeleteProvider.class, method = DynamicProvider.dynamicSQL )
int deleteByPrimaryKeyGroup( @Param( "inArguments" ) PK ... primaryKeys );
/**
* In the case of multiple primary keys, specific data is deleted by
* specifying the primary key index and primary key value.
*
*
* Note: This operation is irreversible and belongs to physical
* deletion. If you want to operate the data safely, please use the
* {@link LogicallyDeleteMapper#logicallyDeleteByPrimaryKeyIndex(Integer, Serializable)
* logicallyDeleteByPrimaryKeyIndex(Integer, PK)} method instead.
*
*
* @param index the primary key index
* @param primaryKey primary key value
* @return the number of rows affected
*/
@DeleteProvider( type = BaseDeleteProvider.class, method = DynamicProvider.dynamicSQL )
int deleteByPrimaryKeyIndex( @Param( "index" ) Integer index, @Param( "pk" ) PK primaryKey );
/**
* Batch deletion by specifying a primary key index, suitable for scenarios
* with multiple primary keys.
*
*
* Note: This operation is irreversible and belongs to physical
* deletion. If you want to operate the data safely, please use the
* {@link LogicallyDeleteMapper#logicallyDeleteByPrimaryKeyIndexGroup(Integer, Serializable...)
* logicallyDeleteByPrimaryKeyIndexGroup(Integer, PK...)} method instead.
*
*
* @param index the primary key index
* @param primaryKeys primary key array
* @return the number of rows affected
*/
@DeleteProvider( type = BaseDeleteProvider.class, method = DynamicProvider.dynamicSQL )
int deleteByPrimaryKeyIndexGroup( @Param( "index" ) Integer index, @Param( "inArguments" ) PK ... primaryKeys );
}