com.github.aidensuen.mongo.common.base.delete.DeleteByIdDao Maven / Gradle / Ivy
package com.github.aidensuen.mongo.common.base.delete;
import com.github.aidensuen.mongo.annotation.DeleteProvider;
import com.github.aidensuen.mongo.annotation.RegisterMongoDao;
import com.github.aidensuen.mongo.command.OperationType;
import com.github.aidensuen.mongo.provider.base.BaseDeleteProvider;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.repository.query.Param;
/**
* Generic Dao delete interface
*
* @param Can not be null
* @author aidensuen
*/
@RegisterMongoDao
public interface DeleteByIdDao {
/**
* delete by id
*
* @param id
* @return
*/
@Query("{'id': #{id}}")
@DeleteProvider(type = BaseDeleteProvider.class, operationType = OperationType.DELETE)
int deleteById(@Param("id") ID id);
/**
* delete by ids
*
* @param ids
* @return
*/
@Query("{'id': {'$in': #{ids}}}")
@DeleteProvider(type = BaseDeleteProvider.class, operationType = OperationType.DELETE)
int deleteByIds(@Param("ids") ID... ids);
}