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

com.viiyue.plugins.mybatis.mapper.special.LogicallyDeleteMapper Maven / Gradle / Ivy

Go to download

Mybatis generic mapper plugin for solving most basic operations, simplifying sql syntax and improving dynamic execution efficiency

There is a newer version: 1.3.7
Show newest version
/**
 * 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.special;

import java.io.Serializable;

import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Param;

import com.viiyue.plugins.mybatis.condition.SelectExample;
import com.viiyue.plugins.mybatis.condition.WhereExample;
import com.viiyue.plugins.mybatis.mapper.Marker;
import com.viiyue.plugins.mybatis.mapper.base.BaseDeleteMapper;
import com.viiyue.plugins.mybatis.mapper.base.BaseExampleMapper;
import com.viiyue.plugins.mybatis.provider.DynamicProvider;
import com.viiyue.plugins.mybatis.provider.special.LogicallyDeleteProvider;

/**
 * Logically deletion api method interface definition
 * 
 * @author tangxbai
 * @since 1.1.0
 * 
 * @param  database entity type
 * @param  query data return entity type
 * @param  primary key type, must be a {@link Serializable} implementation class.
 */
public interface LogicallyDeleteMapper extends Marker {

	/**
	 * 

Delete all data in the table * *

Note: * This operation is reversible, just modify the data state, * and will not delete the data. If you want to completely delete the target * data, please use {@link BaseDeleteMapper#deleteAll() deleteAll()} * instead. *

* * @return the number of rows affected */ @DeleteProvider( type = LogicallyDeleteProvider.class, method = DynamicProvider.dynamicSQL ) int logicallyDeleteAll(); /** *

Selective deletion by entity object * *

Note: * This operation is reversible, just modify the data state, * and will not delete the data. If you want to completely delete the target * data, please use {@link BaseDeleteMapper#delete(Object) delete(Object)} * instead. *

* * @param param entity object * @return the number of rows affected */ @DeleteProvider( type = LogicallyDeleteProvider.class, method = DynamicProvider.dynamicSQL ) int logicallyDelete( DO param ); /** *

Delete specified data by primary key * *

Note: * This operation is reversible, just modify the data state, * and will not delete the data. If you want to completely delete the target * data, please use {@link BaseDeleteMapper#deleteByPrimaryKey(Serializable) * deleteByPrimaryKey(PK)} instead. *

* * @param primaryKey primary key value * @return the number of rows affected */ @DeleteProvider( type = LogicallyDeleteProvider.class, method = DynamicProvider.dynamicSQL ) int logicallyDeleteByPrimaryKey( PK primaryKey ); /** *

Batch delete by primary key array * *

Note: * This operation is reversible, just modify the data state, * and will not delete the data. If you want to completely delete the target * data, please use {@link BaseDeleteMapper#deleteByPrimaryKeyGroup(Serializable...) * deleteByPrimaryKeyGroup(PK...)} instead. *

* * @param primaryKeys primary key array * @return the number of rows affected */ @DeleteProvider( type = LogicallyDeleteProvider.class, method = DynamicProvider.dynamicSQL ) int logicallyDeleteByPrimaryKeyGroup( @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 reversible, just modify the data state, * and will not delete the data. If you want to completely delete the target * data, please use {@link BaseDeleteMapper#deleteByPrimaryKeyIndex(Integer, Serializable) * deleteByPrimaryKeyIndex(Integer, PK)} instead. *

* * @param index the primary key index * @param primaryKey primary key value * @return the number of rows affected */ @DeleteProvider( type = LogicallyDeleteProvider.class, method = DynamicProvider.dynamicSQL ) int logicallyDeleteByPrimaryKeyIndex( @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 reversible, just modify the data state, * and will not delete the data. If you want to completely delete the target * data, please use {@link BaseDeleteMapper#deleteByPrimaryKeyIndexGroup(Integer, Serializable...) * deleteByPrimaryKeyIndexGroup(Integer, PK...)} instead. *

* * @param index the primary key index * @param primaryKeys primary key array * @return the number of rows affected */ @DeleteProvider( type = LogicallyDeleteProvider.class, method = DynamicProvider.dynamicSQL ) int logicallyDeleteByPrimaryKeyIndexGroup( @Param( "index" ) Integer index, @Param( "inArguments" ) PK ... primaryKeys ); /** *

Delete data by Example object * *

	 * Example example = Example.query( Bean.class );
	 * example
	 *     .gt( "total", 10 )
	 *     .lt( "time", new Date() )
	 *     .like( "name", "mybatis-mapper" )
	 *     .startsWith( "name", "mybatis-" )
	 *     .xxx();
	 * deleteByExample( example );
	 * 
* *

Note: * This operation is reversible, just modify the data state, * and will not delete the data. If you want to completely delete the target * data, please use {@link BaseExampleMapper#deleteByExample(WhereExample) * deleteByExample(WhereExample)} instead. *

* * @param example the example object * @return the number of rows affected * @see WhereExample */ @DeleteProvider( type = LogicallyDeleteProvider.class, method = DynamicProvider.dynamicSQL ) int logicallyDeleteByExample( WhereExample example ); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy