
-- 1、角色                      T_FM_ROLE
-- 2、表单授权表             T_FM_ROLE_MENU_PERM
-- 3、角色授权表单按钮   T_FM_ROLE_MENU_PERM_BTN



--角色
--1、T_FM_ROLE
--修改
update T_FM_ROLE set 
 [CODE]=tb.[CODE], [NAME]=tb.[NAME] , [NAME_ACRONYM]=tb.[NAME_ACRONYM] , [PLATFORM_TYPE]=tb.[PLATFORM_TYPE] , [ROLE_TYPE]=tb.[ROLE_TYPE] , [ENABLE_STATUS]=tb.[ENABLE_STATUS] , [REMARK]=tb.[REMARK] , [IS_CHECK_MESSAGE]=tb.[IS_CHECK_MESSAGE] , [IS_DELETED]=tb.[IS_DELETED] , [ORG_ID]='D9871BA8-0EEC-9E4A-BB87-7D5A540D8913' , [ENTITY_ORG_TPYE]=tb.[ENTITY_ORG_TPYE] , [FORM_ID]=tb.[FORM_ID] , [FLOW_STATUS]=tb.[FLOW_STATUS] , [FLOW_SEND_STATUS]=tb.[FLOW_SEND_STATUS] , [FLOW_ID]=tb.[FLOW_ID] , [CREATE_TIME]='2022-12-20 00:00:00' , [MODIFY_TIME]=tb.[MODIFY_TIME] , [CREATER_ID]=tb.[CREATER_ID] , [MODIFIER_ID]=tb.[MODIFIER_ID]
from (
 select * from mh_db.dbo.T_FM_ROLE  
 ) tb where T_FM_ROLE.ID=tb.ID
 
--新增
insert into T_FM_ROLE
 select 
[ID], [CODE], [NAME], [NAME_ACRONYM], [PLATFORM_TYPE], [ROLE_TYPE], [ENABLE_STATUS], [REMARK], [IS_CHECK_MESSAGE], [IS_DELETED],'D9871BA8-0EEC-9E4A-BB87-7D5A540D8913' [ORG_ID], [ENTITY_ORG_TPYE], [FORM_ID], [FLOW_STATUS], [FLOW_SEND_STATUS], [FLOW_ID], '2022-12-20 00:00:00' [CREATE_TIME], [MODIFY_TIME], [CREATER_ID], [MODIFIER_ID]
 from mh_db.dbo.T_FM_ROLE where ID not in ( select ID from T_FM_ROLE)


--表单授权表          
-- 2、T_FM_ROLE_MENU_PERM
--修改
update T_FM_ROLE_MENU_PERM set 
 [ROLE_ID]=tb.[ROLE_ID] ,[IS_PERMISSION]=tb.[IS_PERMISSION] ,[PERMISSION_FORM_ID]=tb.[PERMISSION_FORM_ID] ,[MENU_ID]=tb.[MENU_ID] ,[IS_DELETED]=tb.[IS_DELETED] ,[ORG_ID]='D9871BA8-0EEC-9E4A-BB87-7D5A540D8913' ,[ENTITY_ORG_TPYE]=tb.[ENTITY_ORG_TPYE] ,[FORM_ID]=tb.[FORM_ID] ,[FLOW_STATUS]=tb.[FLOW_STATUS] ,[FLOW_SEND_STATUS]=tb.[FLOW_SEND_STATUS] ,[FLOW_ID]=tb.[FLOW_ID] ,[CREATE_TIME]='2022-12-20 00:00:00'  ,[MODIFY_TIME]=tb.[MODIFY_TIME] ,[CREATER_ID]=tb.[CREATER_ID] ,[MODIFIER_ID]=tb.[MODIFIER_ID]
from (
 select * from mh_db.dbo.T_FM_ROLE_MENU_PERM  
 ) tb where T_FM_ROLE_MENU_PERM.ID=tb.ID
 
--新增
insert into T_FM_ROLE_MENU_PERM
 select 
 [ID], [ROLE_ID], [IS_PERMISSION], [PERMISSION_FORM_ID], [MENU_ID], [IS_DELETED],'D9871BA8-0EEC-9E4A-BB87-7D5A540D8913' [ORG_ID], [ENTITY_ORG_TPYE], [FORM_ID], [FLOW_STATUS], [FLOW_SEND_STATUS], [FLOW_ID],'2022-12-20 00:00:00' [CREATE_TIME], [MODIFY_TIME], [CREATER_ID], [MODIFIER_ID]
 from mh_db.dbo.T_FM_ROLE_MENU_PERM where ID not in ( select ID from T_FM_ROLE_MENU_PERM)


--角色授权表单按钮         
-- 3、T_FM_ROLE_MENU_PERM_BTN 
--修改
update T_FM_ROLE_MENU_PERM_BTN set 
 [ROLE_MENU_PERMISSION_ID]=tb.[ROLE_MENU_PERMISSION_ID] ,[BTN_ID]=tb.[BTN_ID] ,[MENU_ID]=tb.[MENU_ID] ,[ROLE_ID]=tb.[ROLE_ID] ,[IS_DELETED]=tb.[IS_DELETED] ,[ORG_ID]='D9871BA8-0EEC-9E4A-BB87-7D5A540D8913' ,[ENTITY_ORG_TPYE]=tb.[ENTITY_ORG_TPYE] ,[FORM_ID]=tb.[FORM_ID] ,[FLOW_STATUS]=tb.[FLOW_STATUS] ,[FLOW_SEND_STATUS]=tb.[FLOW_SEND_STATUS] ,[FLOW_ID]=tb.[FLOW_ID] ,[CREATE_TIME]='2022-12-20 00:00:00' ,[MODIFY_TIME]=tb.[MODIFY_TIME] ,[CREATER_ID]=tb.[CREATER_ID] ,[MODIFIER_ID]=tb.[MODIFIER_ID] 
from (
 select * from mh_db.dbo.T_FM_ROLE_MENU_PERM_BTN  
 ) tb where T_FM_ROLE_MENU_PERM_BTN.ID=tb.ID
 
--新增
insert into T_FM_ROLE_MENU_PERM_BTN
 select 
[ID], [ROLE_MENU_PERMISSION_ID], [BTN_ID], [MENU_ID], [ROLE_ID], [IS_DELETED],'D9871BA8-0EEC-9E4A-BB87-7D5A540D8913'  [ORG_ID], [ENTITY_ORG_TPYE], [FORM_ID], [FLOW_STATUS], [FLOW_SEND_STATUS], [FLOW_ID],'2022-12-20 00:00:00' [CREATE_TIME], [MODIFY_TIME], [CREATER_ID], [MODIFIER_ID]
 from mh_db.dbo.T_FM_ROLE_MENU_PERM_BTN where ID not in ( select ID from T_FM_ROLE_MENU_PERM_BTN)




