同步单个枚举脚本

栏目:u9cloud知识作者:用友来源:用友发布:2024-08-20浏览:1

同步单个枚举脚本

注意:脚本中有逗号,引号为中文字符,拷贝后需批量替换使用

注意:脚本有风险,执行需谨慎

--适用场景:本地开发时,新建枚举后,运行态看不到枚举值

declare @FN varchar(550),

@ClsID bigint,

@UID varchar(50)

select @FN='UFIDA.U9.Cust.MKGDBE.ExportCustomer.CustFileStateEnum' --此处只需填入你要更新的枚举FullName,示例为标准产品的业务员类型枚举

select @ClsID=Local_ID,@UID=ID from UBF_MD_Class where FullName = @FN and ClassType=3

select @ClsID,@UID

--先删除已有的数据

delete from UBF_Sys_ExtEnumType_Trl where ID=@ClsID or ID in (select ID from ubf_sys_extenumtype where UID=@UID)

delete from ubf_sys_extenumtype where ID=@ClsID or UID=@UID

delete from UBF_Sys_ExtEnumValue_Trl where ID in (select ID from ubf_sys_extenumvalue where ExtEnumType=@ClsID or ExtEnumTypeUID=@UID)

delete from ubf_sys_extenumvalue where ExtEnumType=@ClsID or ExtEnumTypeUID=@UID

--下面为插入最新数据

insert into ubf_sys_extenumtype

 select local_id as id,'20101111','YonYou','20101111','YonYou',0,fullname as code,isextend,id as uid,0

 from ubf_md_class where Local_ID = @ClsID


 

insert into ubf_sys_extenumtype_trl

 select a.local_id as id,'zh-CN',b.[displayname] as [name],b.[Description]

 from ubf_md_class  a

 left join ubf_RES_resourcevalue b on cast(a.[iD] as varchar(50)) = cast(b.resourcename as varchar(50))

 where Local_ID = @ClsID


 

insert into ubf_sys_extenumvalue

 select a.local_id as id,'20101111','YonYou','20101111','YonYou',0,a.[Local_Class_ID] as ExtEnumType ,

 a.[name] as code,a.defaultvalue as evalue,issystem,md_class_id as ExtEnumTypeUID

 from ubf_md_attribute as a

 inner join ubf_md_class as b on cast(a.md_class_id as varchar(50))=cast(b.id as varchar(50))

 where b.Local_ID = @ClsID


 

insert into ubf_sys_extenumvalue_trl

 select a.local_id as id,'zh-CN',c.[displayname] as [name]

 from ubf_md_attribute as a

 inner join ubf_md_class as b on cast(a.md_class_id as varchar(50))=cast(b.id  as varchar(50))

 left join ubf_RES_resourcevalue c on  cast(a.[ID] as varchar(50)) = cast(c.resourcename as varchar(50))


 

where b.Local_ID = @ClsID

同步单个枚举脚本

注意:脚本中有逗号,引号为中文字符,拷贝后需批量替换使用注意:脚本有风险,执行需谨慎--适用场景:本地开发时,新建枚举后,运行态看不...
点击下载文档
标签: # U9C
分享:
确认删除?
回到顶部
客服QQ
  • 客服QQ点击这里给我发消息