public class SuperServiceImpl<M extends SuperMapper<T>,T extends BaseEntity> extends com.baomidou.mybatisplus.extension.service.impl.ServiceImpl<M,T> implements ISuperService<T>
| Constructor and Description |
|---|
SuperServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
changeStatus(@NotEmpty List<Long> ids,
Integer status)
变更状态
|
boolean |
deleteLogic(@NotEmpty List<Long> ids)
逻辑删除
|
boolean |
save(T entity) |
boolean |
saveBatch(Collection<T> entityList,
int batchSize) |
boolean |
saveIdempotency(T entity,
DistributedLock lock,
String lockKey,
com.baomidou.mybatisplus.core.conditions.Wrapper<T> countWrapper) |
boolean |
saveIdempotency(T entity,
DistributedLock locker,
String lockKey,
com.baomidou.mybatisplus.core.conditions.Wrapper<T> countWrapper,
String msg)
幂等性新增记录
例子如下:
String username = sysUser.getUsername();
boolean result = super.saveIdempotency(sysUser, lock
, LOCK_KEY_USERNAME+username
, new QueryWrapper
|
boolean |
saveIgnore(T entity)
插入如果中已经存在相同的记录,则忽略当前新数据
|
boolean |
saveIgnoreBatch(Collection<T> entityList,
int batchSize)
插入(批量),插入如果中已经存在相同的记录,则忽略当前新数据
|
boolean |
saveOrUpdate(T entity) |
boolean |
saveOrUpdateBatch(Collection<T> entityList,
int batchSize) |
boolean |
saveOrUpdateIdempotency(T entity,
DistributedLock lock,
String lockKey,
com.baomidou.mybatisplus.core.conditions.Wrapper<T> countWrapper) |
boolean |
saveOrUpdateIdempotency(T entity,
DistributedLock lock,
String lockKey,
com.baomidou.mybatisplus.core.conditions.Wrapper<T> countWrapper,
String msg)
幂等性新增或更新记录
例子如下:
String username = sysUser.getUsername();
boolean result = super.saveOrUpdateIdempotency(sysUser, lock
, LOCK_KEY_USERNAME+username
, new QueryWrapper
|
boolean |
saveReplace(T entity)
表示插入替换数据,需求表中有PrimaryKey,或者unique索引,如果数据库已经存在数据,则用新数据替换,如果没有数据效果则和insert into一样;
|
boolean |
saveReplaceBatch(Collection<T> entityList,
int batchSize)
插入(批量),表示插入替换数据,需求表中有PrimaryKey,或者unique索引,如果数据库已经存在数据,则用新数据替换,如果没有数据效果则和insert into一样;
|
boolean |
updateBatchById(Collection<T> entityList,
int batchSize) |
boolean |
updateById(T entity) |
getBaseMapper, getEntityClass, getMap, getObj, getOne, removeBatchByIds, removeBatchByIds, removeById, removeById, removeByIdsequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitsaveReplaceBatchcount, count, getBaseMapper, getById, getEntityClass, getMap, getObj, getOne, getOne, ktQuery, ktUpdate, lambdaQuery, lambdaUpdate, list, list, listByIds, listByMap, listMaps, listMaps, listObjs, listObjs, listObjs, listObjs, page, page, pageMaps, pageMaps, query, remove, removeBatchByIds, removeBatchByIds, removeBatchByIds, removeBatchByIds, removeById, removeById, removeById, removeByIds, removeByIds, removeByMap, saveBatch, saveOrUpdate, saveOrUpdateBatch, update, update, update, updateBatchByIdpublic boolean saveIdempotency(T entity, DistributedLock locker, String lockKey, com.baomidou.mybatisplus.core.conditions.Wrapper<T> countWrapper, String msg) throws Exception
ISuperServicesaveIdempotency in interface ISuperService<T extends BaseEntity>entity - 实体对象locker - 锁实例lockKey - 锁的keycountWrapper - 判断是否存在的条件msg - 对象已存在提示信息Exceptionpublic boolean saveIdempotency(T entity, DistributedLock lock, String lockKey, com.baomidou.mybatisplus.core.conditions.Wrapper<T> countWrapper) throws Exception
saveIdempotency in interface ISuperService<T extends BaseEntity>Exceptionpublic boolean saveOrUpdateIdempotency(T entity, DistributedLock lock, String lockKey, com.baomidou.mybatisplus.core.conditions.Wrapper<T> countWrapper, String msg) throws Exception
ISuperServicesaveOrUpdateIdempotency in interface ISuperService<T extends BaseEntity>entity - 实体对象lock - 锁实例lockKey - 锁的keycountWrapper - 判断是否存在的条件msg - 对象已存在提示信息Exceptionpublic boolean saveOrUpdateIdempotency(T entity, DistributedLock lock, String lockKey, com.baomidou.mybatisplus.core.conditions.Wrapper<T> countWrapper) throws Exception
saveOrUpdateIdempotency in interface ISuperService<T extends BaseEntity>Exceptionpublic boolean save(T entity)
save in interface com.baomidou.mybatisplus.extension.service.IService<T extends BaseEntity>public boolean saveBatch(Collection<T> entityList, int batchSize)
saveBatch in interface com.baomidou.mybatisplus.extension.service.IService<T extends BaseEntity>saveBatch in class com.baomidou.mybatisplus.extension.service.impl.ServiceImpl<M extends SuperMapper<T>,T extends BaseEntity>public boolean updateById(T entity)
updateById in interface com.baomidou.mybatisplus.extension.service.IService<T extends BaseEntity>public boolean updateBatchById(Collection<T> entityList, int batchSize)
updateBatchById in interface com.baomidou.mybatisplus.extension.service.IService<T extends BaseEntity>updateBatchById in class com.baomidou.mybatisplus.extension.service.impl.ServiceImpl<M extends SuperMapper<T>,T extends BaseEntity>public boolean saveOrUpdate(T entity)
saveOrUpdate in interface com.baomidou.mybatisplus.extension.service.IService<T extends BaseEntity>saveOrUpdate in class com.baomidou.mybatisplus.extension.service.impl.ServiceImpl<M extends SuperMapper<T>,T extends BaseEntity>public boolean saveOrUpdateBatch(Collection<T> entityList, int batchSize)
saveOrUpdateBatch in interface com.baomidou.mybatisplus.extension.service.IService<T extends BaseEntity>saveOrUpdateBatch in class com.baomidou.mybatisplus.extension.service.impl.ServiceImpl<M extends SuperMapper<T>,T extends BaseEntity>@Transactional(rollbackFor=java.lang.Exception.class) public boolean deleteLogic(@NotEmpty @NotEmpty List<Long> ids)
ISuperServicedeleteLogic in interface ISuperService<T extends BaseEntity>ids - id 集合public boolean changeStatus(@NotEmpty
@NotEmpty List<Long> ids,
Integer status)
ISuperServicechangeStatus in interface ISuperService<T extends BaseEntity>ids - id 集合status - 状态值public boolean saveIgnore(T entity)
ISuperServicesaveIgnore in interface ISuperService<T extends BaseEntity>entity - entitypublic boolean saveReplace(T entity)
ISuperServicesaveReplace in interface ISuperService<T extends BaseEntity>entity - entity@Transactional(rollbackFor=java.lang.Exception.class) public boolean saveIgnoreBatch(Collection<T> entityList, int batchSize)
ISuperServicesaveIgnoreBatch in interface ISuperService<T extends BaseEntity>entityList - 实体对象集合batchSize - 批次大小@Transactional(rollbackFor=java.lang.Exception.class) public boolean saveReplaceBatch(Collection<T> entityList, int batchSize)
ISuperServicesaveReplaceBatch in interface ISuperService<T extends BaseEntity>entityList - 实体对象集合batchSize - 批次大小Copyright © 2023. All rights reserved.