IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[mps_new_weixin_subapp]') AND type = 'P')
DROP PROCEDURE [dbo].[mps_new_weixin_subapp]
GO
-- =============================================
-- Author:<Author,,Name>
-- Create date: <Create Date,,>
-- Description:<Description,,>
-- =============================================
CREATE procedure [dbo].[mps_new_weixin_subapp]
@cmpid int,
@roleid int,
@headerid int,
@groupid int
AS
BEGIN

SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
declare @order int
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
--获取序号
select @order=max(mn_order) from mps_menu where mn_cmpid=@cmpid and mn_roleid=@roleid and mn_group=@groupid
insert into mps_menu(mn_cmpid,mn_terminal,mn_roleid,mn_flag,mn_group,mn_title,mn_order,mn_sub) values(@cmpid,1,@roleid,'app_sub'+convert(varchar,@headerid),@groupid,'应用名称',@order+1,@headerid);
END