-- name: CreatePermission :one
INSERT INTO sys_permissions(type,code)
VALUES ($1,$2) RETURNING id;

-- name: UpdatePermission :exec
UPDATE sys_permissions
SET code = $2
WHERE id = $1;

-- name: DeletePermission :exec
DELETE
FROM sys_permissions
WHERE id = $1;

-- name: GetPermissionIDBySysApiID :one
SELECT permission_id
FROM sys_api_permission
WHERE api_id = $1;

-- name: GetPermissionIDBySysMenuID :one
SELECT permission_id
FROM sys_menu_permission
WHERE menu_id = $1;