【填坑篇】如果将MySQL数据库中的表生成PDM

凯哥java 2023-08-08 22:08:42

在上一篇【已解决】如果将MySQL数据库中的表生成PDM 凯哥讲解了,怎么通过MySQL数据库生成PDM文件。但是这篇文章中有个坑:这个时候生成的数据库模型,是没有中文注释的。本文就是对这篇文章进行填坑的。

填坑一:添加中文注释。步骤如下:

①:在PowerDesigner的导航栏中找到tools>> Execute Commands>>Edit/Run Script。如下图:

注:快捷键是:Ctrl + Shift + X

②:添加VB脚本。具体代码如下:

Option   Explicit ValidationMode   =   True InteractiveMode   =   im_BatchDim   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   IfPrivate   sub   ProcessFolder(folder) On Error Resume Next      Dim   Tab   'running     table       for   each   Tab   in   folder.tables             if   not   tab.isShortcut   then                   Dim   col   '   running   column                   for   each   col   in   tab.columns                   if col.comment="" then                  else                        col.name=   col.comment                   end if                  next             end   if       next      Dim   view   'running   view       for   each   view   in   folder.Views             if   not   view.isShortcut   then                      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

添加后的脚本如下图所示:

点击Run之后如下图:

这样就生成了中文注册的PDM了。

填坑二:pdm同时显示中文和英文

步骤如下:

①:在PowerDesigner的导航栏中找到tools>> Displayy Preferences...>>table。如下图:

②:选择Table后,点击Advanced

③:点击进行选择显示的内容。如上图中的放大镜

④:选择code并且置顶。就可以正常显示中英文的PDM啦

点击OK,在点击OK,接着点击OK之后,就可以看到。如下图的:中文英文都添加了。

至此Mysql数据库导出PDM文件方法一介绍完成了。还不快手动试试?如果有问题随时联系凯哥(kaigejava)

0 阅读:1