IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[mps_new_loginrole]') AND type = 'P')
DROP PROCEDURE [dbo].[mps_new_loginrole]
GO




-- =============================================
-- Author:<Author,,Name>
-- Create date: <Create Date,,>
-- Description:<Description,,>
-- =============================================
CREATE proc [dbo].[mps_new_loginrole]
(@mcuid bigint)
as
begin
set nocount on

insert into mps_login_role(lgu_cuid,lgu_name,lgu_bcid,lgu_branch,lgu_dpid,lgu_depart,lgu_otid,lgu_title,lgu_function,lgu_otlevel,lgu_managelevel,lgu_professionlevel) 
select cu_id,cu_name,cu_bcid,cu_branch,cu_dpid,cu_depart,cu_otid,cu_title,cu_function,cu_otlevel,cu_managelevel,cu_professionlevel
from mps_employee
where cu_id=@mcuid

select * from mps_login_role where lgu_id=@@IDENTITY
-- 更新登录表中的代岗位信息 author:f
exec mps_update_logindeparttitles @mcuid
end