set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER PROCEDURE [dbo].[RolePermissionBatchADD]
@RCode varchar(16)='',
@PCodeString varchar(8000)=''
AS
SET NOCOUNT ON
IF not exists(select * from Role where Code=@RCode)
BEGIN
SELECT -12
RETURN
END
DECLARE @TEMP TABLE(RCode varchar(16),RNAME VARCHAR(16),PCode varchar(16),PNAME VARCHAR(16),PCodeDepth int,TypeID tinyint,ACTIONURL VARCHAR(128),MENUTYPE tinyINT,OperateStauts varchar(32),STATUS INT,Sort int)
DECLARE @RNAME VARCHAR(16)
SELECT @RNAME = [NAME] FROM [ROLE] WHERE Code=@RCode
SET @PCodeString = REPLACE(@PCodeString,',',''',''')
INSERT INTO @TEMP(RCode,RNAME,PCode,PNAME,PCodeDepth,TypeID,ACTIONURL,MENUTYPE,STATUS,Sort)
SELECT @RCode,@RNAME,CODE,[NAME],CodeDepth,TypeID,ACTIONURL,MENUTYPE,STATUS,Sort FROM PERMISSION WHERE Code IN (@PCodeString)
delete from rolepermission where RCode=@RCode
insert into rolepermission(RCode,RNAME,PCode,PNAME,PCodeDepth,TypeID,ACTIONURL,MENUTYPE,OperateStauts,STATUS,Sort,Addtime,UpdateTime)
select *,getdate(),getdate() from @TEMP
SELECT @@ROWCOUNT
权限管理部分存储过程
最新推荐文章于 2023-06-01 18:19:04 发布