123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231 |
- /**
- * Copyright (c) 2011-2020, hubin (jobob@qq.com).
- * <p>
- * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.baomidou.mybatisplus.mapper;
- import java.io.Serializable;
- import java.util.List;
- import java.util.Map;
- import org.apache.ibatis.annotations.Param;
- import org.apache.ibatis.session.RowBounds;
- /**
- * <p>
- * Mapper 继承该接口后,无需编写 mapper.xml 文件,即可获得CRUD功能
- * </p>
- * <p>
- * 这个 Mapper 支持 id 泛型
- * </p>
- *
- * @author hubin
- * @Date 2016-01-23
- */
- public interface BaseMapper<T> {
- /**
- * <p>
- * 插入一条记录
- * </p>
- *
- * @param entity 实体对象
- * @return int
- */
- Integer insert(T entity);
- /**
- * <p>
- * 插入一条记录
- * </p>
- *
- * @param entity 实体对象
- * @return int
- */
- Integer insertAllColumn(T entity);
- /**
- * <p>
- * 根据 ID 删除
- * </p>
- *
- * @param id 主键ID
- * @return int
- */
- Integer deleteById(Serializable id);
- /**
- * <p>
- * 根据 columnMap 条件,删除记录
- * </p>
- *
- * @param columnMap 表字段 map 对象
- * @return int
- */
- Integer deleteByMap(@Param("cm") Map<String, Object> columnMap);
- /**
- * <p>
- * 根据 entity 条件,删除记录
- * </p>
- *
- * @param wrapper 实体对象封装操作类(可以为 null)
- * @return int
- */
- Integer delete(@Param("ew") Wrapper<T> wrapper);
- /**
- * <p>
- * 删除(根据ID 批量删除)
- * </p>
- *
- * @param idList 主键ID列表
- * @return int
- */
- Integer deleteBatchIds(List<? extends Serializable> idList);
- /**
- * <p>
- * 根据 ID 修改
- * </p>
- *
- * @param entity 实体对象
- * @return int
- */
- Integer updateById(@Param("et") T entity);
- /**
- * <p>
- * 根据 ID 修改
- * </p>
- *
- * @param entity 实体对象
- * @return int
- */
- Integer updateAllColumnById(@Param("et") T entity);
- /**
- * <p>
- * 根据 whereEntity 条件,更新记录
- * </p>
- *
- * @param entity 实体对象
- * @param wrapper 实体对象封装操作类(可以为 null)
- * @return
- */
- Integer update(@Param("et") T entity, @Param("ew") Wrapper<T> wrapper);
- /**
- * <p>
- * 根据 ID 查询
- * </p>
- *
- * @param id 主键ID
- * @return T
- */
- T selectById(Serializable id);
- /**
- * <p>
- * 查询(根据ID 批量查询)
- * </p>
- *
- * @param idList 主键ID列表
- * @return List<T>
- */
- List<T> selectBatchIds(List<? extends Serializable> idList);
- /**
- * <p>
- * 查询(根据 columnMap 条件)
- * </p>
- *
- * @param columnMap 表字段 map 对象
- * @return List<T>
- */
- List<T> selectByMap(@Param("cm") Map<String, Object> columnMap);
- /**
- * <p>
- * 根据 entity 条件,查询一条记录
- * </p>
- *
- * @param entity 实体对象
- * @return T
- */
- T selectOne(@Param("ew") T entity);
- /**
- * <p>
- * 根据 Wrapper 条件,查询总记录数
- * </p>
- *
- * @param wrapper 实体对象
- * @return int
- */
- Integer selectCount(@Param("ew") Wrapper<T> wrapper);
- /**
- * <p>
- * 根据 entity 条件,查询全部记录
- * </p>
- *
- * @param wrapper 实体对象封装操作类(可以为 null)
- * @return List<T>
- */
- List<T> selectList(@Param("ew") Wrapper<T> wrapper);
- /**
- * <p>
- * 根据 Wrapper 条件,查询全部记录
- * </p>
- *
- * @param wrapper 实体对象封装操作类(可以为 null)
- * @return List<T>
- */
- List<Map<String, Object>> selectMaps(@Param("ew") Wrapper<T> wrapper);
- /**
- * <p>
- * 根据 Wrapper 条件,查询全部记录
- * </p>
- *
- * @param wrapper 实体对象封装操作类(可以为 null)
- * @return List<Object>
- */
- List<Object> selectObjs(@Param("ew") Wrapper<T> wrapper);
- /**
- * <p>
- * 根据 entity 条件,查询全部记录(并翻页)
- * </p>
- *
- * @param rowBounds 分页查询条件(可以为 RowBounds.DEFAULT)
- * @param wrapper 实体对象封装操作类(可以为 null)
- * @return List<T>
- */
- List<T> selectPage(RowBounds rowBounds, @Param("ew") Wrapper<T> wrapper);
- /**
- * <p>
- * 根据 Wrapper 条件,查询全部记录(并翻页)
- * </p>
- *
- * @param rowBounds 分页查询条件(可以为 RowBounds.DEFAULT)
- * @param wrapper 实体对象封装操作类
- * @return List<Map<String, Object>>
- */
- List<Map<String, Object>> selectMapsPage(RowBounds rowBounds, @Param("ew") Wrapper<T> wrapper);
- }
|