MyBatis-Plus BaseMapper和IService使用手冊

Mybatis-plus 文檔mybatis

註釋 mapper extends BaseMapper service extends IService 註釋
DDML 進一步封裝:採用 get 查詢單行, remove 刪除, list 查詢集合, page 分頁
int insert(T entity); boolean save(T entity); 選擇字段,策略插入
boolean saveBatch(Collection<T> entityList); 批量插入
boolean saveOrUpdateBatch(Collection<T> entityList);
int deleteById(Serializable id); boolean removeById(Serializable id);
根據 entity 條件刪除 int delete(Wrapper<T> wrapper); boolean remove(Wrapper<T> queryWrapper); 無對應記錄也返回true
columnMap 刪除條件 int deleteByMap(Map<String, Object> columnMap); boolean removeByMap(Map<String, Object> columnMap); columnMap 表字段 map 對象
int updateById(T entity); boolean updateById(T entity);
boolean saveOrUpdate(T entity);
T selectById(Serializable id); T getById(Serializable id);
columnMap查詢條件 List<T> selectByMap(Map<String, Object> columnMap); Collection<T> listByMap(Map<String, Object> columnMap);
若是邏輯非惟一須要<br> wrapper.last("limit 1") 設置惟一性 T selectOne(Wrapper<T> queryWrapper); T getOne(Wrapper<T> queryWrapper); 有多個取一個
Integer selectCount(Wrapper<T> queryWrapper); int count(Wrapper<T> queryWrapper);
List<T> selectList(Wrapper<T> queryWrapper); List<T> list(Wrapper<T> queryWrapper);
只能查詢一個字段<br>List<Object> cols;<br>List<String> l = (List)cols; List<Object> selectObjs(Wrapper<T> queryWrapper); List<Object> listObjs(Wrapper<T> queryWrapper); 根據 Wrapper 條件,查詢所有記錄
IPage<T> selectPage(IPage<T> page, Wrapper<T> queryWrapper); IPage<T> page(IPage<T> page, Wrapper<T> queryWrapper);
相關文章
相關標籤/搜索