mybatisplus中必须学会使用的几个类:
ServiceImpl<M extends BaseMapper,T> implements IService< T>
这个类封装了baseMapper sqlHelper, T 为绑定数据库的实体类,内部通过反射拿到@tableName 的注解数据库表,以此实现数据库相关操作,内部主要方法:
boolean saveOrUpdate(T entity)
boolean saveOrUpdateBatch(Collection<T> entityList)
boolean removeById(Serializable id)
boolean removeByIds(Collection<? extends Serializable> idList)
boolean removeByMap(Map<String, Object> columnMap)
boolean remove(Wrapper<T> queryWrapper)
boolean updateById(T entity)
boolean update(Wrapper<T> updateWrapper)
boolean updateBatchById(Collection<T> entityList, int batchSize)
T getOne(Wrapper<T> queryWrapper)
T getById(Serializable id)
List<T> listByIds(Collection<? extends Serializable> idList)
List<T> listByMap(Map<String, Object> columnMap)
T getOne(Wrapper<T> queryWrapper)
List<T> <