class SuperServiceImpl<M extends BaseMapper<T>, T> extends ServiceImpl<M, T> implements ISuperService<T> {
    @Override
    public boolean saveIdempotency(T entity, DistributedLock locker, String lockKey, Wrapper<T> countWrapper, String msg) throws Exception {<FILL_FUNCTION_BODY>}

    @Override
    public boolean saveIdempotency(T entity, DistributedLock lock, String lockKey, Wrapper<T> countWrapper) throws Exception {
        return saveIdempotency(entity, lock, lockKey, countWrapper, null);
    }

    @Override
    public boolean saveOrUpdateIdempotency(T entity, DistributedLock lock, String lockKey, Wrapper<T> countWrapper, String msg) throws Exception {
        if (null != entity) {
            Class<?> cls = entity.getClass();
            TableInfo tableInfo = TableInfoHelper.getTableInfo(cls);
            if (null != tableInfo && StrUtil.isNotEmpty(tableInfo.getKeyProperty())) {
                Object idVal = ReflectionKit.getFieldValue(entity, tableInfo.getKeyProperty());
                if (StringUtils.checkValNull(idVal) || Objects.isNull(getById((Serializable) idVal))) {
                    if (StrUtil.isEmpty(msg)) {
                        msg = "已存在";
                    }
                    return this.saveIdempotency(entity, lock, lockKey, countWrapper, msg);
                } else {
                    return updateById(entity);
                }
            } else {
                throw ExceptionUtils.mpe("Error:  Can not execute. Could not find @TableId.");
            }
        }
        return false;
    }

    @Override
    public boolean saveOrUpdateIdempotency(T entity, DistributedLock lock, String lockKey, Wrapper<T> countWrapper) throws Exception {
        return this.saveOrUpdateIdempotency(entity, lock, lockKey, countWrapper, null);
    }
}

        if (locker == null) {
            throw new LockException("DistributedLock is null");
        }
        if (StrUtil.isEmpty(lockKey)) {
            throw new LockException("lockKey is null");
        }
        try (
                ZLock lock = locker.tryLock(lockKey, 10, 60, TimeUnit.SECONDS);
                ) {
            if (lock != null) {
                //判断记录是否已存在
                long count = super.count(countWrapper);
                if (count == 0) {
                    return super.save(entity);
                } else {
                    if (StrUtil.isEmpty(msg)) {
                        msg = "已存在";
                    }
                    throw new IdempotencyException(msg);
                }
            } else {
                throw new LockException("锁等待超时");
            }
        }
    
<methods>public void <init>() ,public M getBaseMapper() ,public Class<T> getEntityClass() ,public Map<java.lang.String,java.lang.Object> getMap(Wrapper<T>) ,public V getObj(Wrapper<T>, Function<? super java.lang.Object,V>) ,public T getOne(Wrapper<T>, boolean) ,public Optional<T> getOneOpt(Wrapper<T>, boolean) ,public boolean removeBatchByIds(Collection<?>, int) ,public boolean removeBatchByIds(Collection<?>, int, boolean) ,public boolean removeById(java.io.Serializable) ,public boolean removeById(java.io.Serializable, boolean) ,public boolean removeByIds(Collection<?>) ,public boolean saveBatch(Collection<T>, int) ,public boolean saveOrUpdate(T) ,public boolean saveOrUpdateBatch(Collection<T>, int) ,public boolean updateBatchById(Collection<T>, int) <variables>protected M baseMapper,private final org.springframework.core.convert.ConversionService conversionService,protected final Class<T> entityClass,protected final org.apache.ibatis.logging.Log log,protected final Class<M> mapperClass,private volatile org.apache.ibatis.session.SqlSessionFactory sqlSessionFactory,protected final Class<?>[] typeArguments