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

com.github.aidensuen.mongo.common.base.delete.DeleteByIdDao Maven / Gradle / Ivy

There is a newer version: 1.1.2
Show newest version
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);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy