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

cn.handyplus.lib.db.BaseMapper Maven / Gradle / Ivy

The newest version!
package cn.handyplus.lib.db;

import cn.handyplus.lib.db.enter.Page;
import cn.handyplus.lib.db.param.FieldInfoParam;

import java.io.Serializable;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Optional;

/**
 * 基础方法
 *
 * @author handy
 */
public interface BaseMapper extends Serializable {

    /**
     * 插入一条记录
     *
     * @param obj 入参
     * @return id
     */
    int insert(T obj);

    /**
     * 批量插入
     *
     * @param objList 入参集合
     * @return true
     */
    boolean insertBatch(List objList);

    /**
     * 根据 entity 条件,查询一条记录
     *
     * @return T
     */
    Optional selectOne();

    /**
     * 查询总数-count(*)
     *
     * @return 总数
     */
    int count();

    /**
     * 查询总数-COUNT(DISTINCT `field`)
     *
     * @param field 过滤字段
     * @return 总数
     * @since 3.7.6
     */
    int count(String field);

    /**
     * 查询列表
     *
     * @return 列表
     */
    List list();

    /**
     * 分页
     *
     * @return 集合
     */
    Page page();

    /**
     * 删除
     *
     * @return 条数
     */
    int delete();

    /**
     * 更新
     *
     * @return 条数
     */
    int update();

    /**
     * 根据id查询
     *
     * @param id id
     * @return T
     */
    Optional selectById(Integer id);

    /**
     * 批量id查询
     *
     * @param ids ids
     * @return List
     */
    List selectBatchIds(List ids);

    /**
     * 根据id更新
     *
     * @param id id
     * @return 结果
     */
    int updateById(Integer id);

    /**
     * 根据id删除
     *
     * @param id id
     * @return 结果
     */
    int deleteById(Integer id);

    /**
     * 根据ids删除
     *
     * @param ids ids
     * @return 结果
     */
    int deleteBatchIds(List ids);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy