当前位置:网站首页>使用powerDesigner反向工程生成Entity
使用powerDesigner反向工程生成Entity
2022-07-31 05:20:00 【CarinaYang】
由于业务需要将数据库里面的表导出来生成pdm数据模型,于是查找了一下方法,总结步骤如下:
1、打开plSQL,上方工具栏tools->ExportUser Objects
2、选中你需要导出的表,选择文件位置,导出SQL文件

3、打开powerDesigner,新建模型

4、选择Model types ->Physical Data Modal ->Physical Diagram,自行修改文件名,保存

5、打开File->Reverse Engineer->Database
6、看到如下弹窗,点击确定

7、 添加SQL文件,点击运行

8、完成

9、 如果数据库中的表有字段备注,希望直接用备注作为名称,可以打开Tools->Execute Comments->Edit/Run Script

10、 复制以下代码到编辑器中:
Option Explicit
ValidationMode = True
InteractiveMode = im_Batch
Dim mdl ' the current model
' get the current active model
Set mdl = ActiveModel
If (mdl Is Nothing) Then
MsgBox "There is no current Model"
ElseIf Not mdl.IsKindOf(PdPDM.cls_Model) Then
MsgBox "The current model is not an Physical Data model."
Else
ProcessFolder mdl
End If
' This routine copy name into code for each table, each column and each view
' of the current folder
Private sub ProcessFolder(folder)
Dim Tab 'running table
for each Tab in folder.tables
if not tab.isShortcut then
if tab.comment ="" then
else
tab.name=tab.comment
on error resume next
end if
Dim col ' running column
for each col in tab.columns
if col.comment="" then
col.name=col.name
else
col.name=col.comment
on error resume next
end if
next
end if
next
Dim view 'running view
for each view in folder.Views
if not view.isShortcut then
if view.comment="" then
view.name=view.name
else
view.name=view.comment
on error resume next
end if
end if
next
' go into the sub-packages
Dim f ' running folder
For Each f In folder.Packages
if not f.IsShortcut then
ProcessFolder f
end if
Next
end sub

11、运行,搞定
边栏推荐
猜你喜欢
随机推荐
JDBC的使用
英语学习笔记
堆和栈的区别
第一次实践——计算器
vs2022 xlua 集成第三方库编译报错Generator Visual Studio 15 2017 could not find any instance of Visual Studio.
ES6-Map、Set与Arrary的转换
emby,jellyfin,kodi系列
Openssl一键自签证书
编辑时过滤当前节点及根据限制的层数过滤数据
Oracle入门 05 - VirtualBox的虚拟机安装配置
Webrtc从理论到实践一:初识
2021-10-10
【博学谷学习记录】超强总结,用心分享 | 软件测试 抓包
APP测试:测试流程及常规测试内容
哪吒监控安装脚本
成员内部类使用方式(工作)
递归访问目录,定义嵌套函数,打印斐波那契数列,对列表进行排序,map函数计算列表,filter函数过滤,reduce计算1~100的和
UE5 最新动态虚幻引擎全新版本引爆互联网
三本毕业,中途转行软件测试,顶着这些光环从月薪7k干到20k+,感觉还不错
DNS域名解析服务









