src/Leevel/Validate/UniqueRule.php
protected function parseExceptId(Select $select, array $parameter): void
    {
        if (isset($parameter[2]) && self::PLACEHOLDER !== $parameter[2]) {
            $withoutPrimary = true;

            if (!empty($parameter[3]) && self::PLACEHOLDER !== $parameter[3]) {
                $primaryKey = $parameter[3];
            } else {
                if (is_string($_ = $select->entity()->primaryKey())) {
                    $primaryKey = $_;
                } else {
                    $withoutPrimary = false;
                }
            }

            if ($withoutPrimary) {
                $select->where($primaryKey, '<>', $parameter[2]);
            }
        }
    }
protected function parseExceptId(Select $select, array $parameter): void
    {
        if (isset($parameter[2]) && self::PLACEHOLDER !== $parameter[2]) {
            $withoutPrimary = true;

            if (!empty($parameter[3]) && self::PLACEHOLDER !== $parameter[3]) {
                $primaryKey = $parameter[3];
            } else {
                if (is_string($_ = $select->entity()->primaryKey())) {
                    $primaryKey = $_;
                } else {
                    $withoutPrimary = false;
                }
            }

            if ($withoutPrimary) {
                $select->where($primaryKey, '<>', $parameter[2]);
            }
        }
    }
排除主键.

@param \Leevel\Database\Ddd\Select $select
@param array                       $parameter