package com.central.common.service;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.extension.service.IService;
import com.central.common.lock.DistributedLock;
/**
* service接口父类
*
* @author zlt
* @date 2019/1/10
*
* Blog: https://zlt2000.gitee.io
* Github: https://github.com/zlt2000
*/
public interface ISuperService extends IService {
/**
* 幂等性新增记录
* 例子如下:
* String username = sysUser.getUsername();
* boolean result = super.saveIdempotency(sysUser, lock
* , LOCK_KEY_USERNAME+username
* , new QueryWrapper().eq("username", username));
*
* @param entity 实体对象
* @param locker 锁实例
* @param lockKey 锁的key
* @param countWrapper 判断是否存在的条件
* @param msg 对象已存在提示信息
* @return
*/
boolean saveIdempotency(T entity, DistributedLock locker, String lockKey, Wrapper countWrapper, String msg) throws Exception;
boolean saveIdempotency(T entity, DistributedLock locker, String lockKey, Wrapper countWrapper) throws Exception;
/**
* 幂等性新增或更新记录
* 例子如下:
* String username = sysUser.getUsername();
* boolean result = super.saveOrUpdateIdempotency(sysUser, lock
* , LOCK_KEY_USERNAME+username
* , new QueryWrapper().eq("username", username));
*
* @param entity 实体对象
* @param locker 锁实例
* @param lockKey 锁的key
* @param countWrapper 判断是否存在的条件
* @param msg 对象已存在提示信息
* @return
*/
boolean saveOrUpdateIdempotency(T entity, DistributedLock locker, String lockKey, Wrapper countWrapper, String msg) throws Exception;
boolean saveOrUpdateIdempotency(T entity, DistributedLock locker, String lockKey, Wrapper countWrapper) throws Exception;
}