IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[mps_ding_addappslist]') AND type = 'P')
DROP PROCEDURE [dbo].[mps_ding_addappslist]
GO
create PROCEDURE [dbo].[mps_ding_addappslist]  
 @useruid int   
AS  
BEGIN  
 SET NOCOUNT ON;  
 declare @msg table(  
  msg_id int,  
  msg_type int,  
  msg_category nvarchar(50),  
  msg_title nvarchar(50),  
  msg_icon nvarchar(200),  
  msg_subcategory nvarchar(80),
  msg_class nvarchar(50)
 )  
 insert into @msg  
 select distinct(biz_id),1,biz_category,biz_title,biz_icon,biz_subcategory,'业务类' as biz_class
  from mps_biztype,mps_biztype_users   
  where  biz_hidemenu_mobile = 1 and biz_id = bp_bizid and (bp_type = 'bizview' or bp_type='biznew') and bp_cuid =@useruid  
  order by biz_category  
 insert into @msg  
  select distinct(rpt_id),2,rpt_category,rpt_title,rpt_icon,rpt_categorysub,'报表类' as biz_class 
  from mps_report,mps_report_users  
  where rpt_hidemenu_mobile = 1 and rpt_id = rptp_rptid and (rptp_type = 'rptview' or rptp_type='rptview') and rptp_cuid =@useruid  
  order by rpt_category  
  
  insert into @msg
  select distinct(pt_id),3,(select b.pt_caption from mps_programtype b where b.pt_id = a.pt_fid) as category,pt_caption,pt_icon0,'','自定义程序' as biz_class
   from mps_programtype a 
   where pt_program = 0 and pt_system =2 and pt_hidemenu_mobile = 1 and pt_widget=1 and pt_caption!='系统管理'
   order by pt_id 

  
 select * from @msg order by msg_type asc,msg_category,msg_subcategory  
 set nocount off;  
END