zoukankan      html  css  js  c++  java
  • PowerDesigner VB 脚本

    shift+ctrl+x执行

    批量添加字段(无则添加)

    Option Explicit
    
    Dim mdl ' the current model   
    Set mdl = ActiveModel 
    Dim Tab 'running table   
    Dim col_create_date, col_update_date,col_create_by,col_update_by,col_is_delete
    ' 定义属性变量
    for each Tab in mdl.Tables
    	Dim col
    	Dim has_create_date,has_update_date,has_create_by,has_update_by
    	has_create_date=0
    	has_update_date=0
    	has_create_by=0
    	has_update_by=0
    
    	For Each col In Tab.columns
    		If (col.code = "create_date") Then
    		    has_create_date = 1
    		End If
    		If (col.code = "update_date") Then
    		    has_update_date = 1
    		End If
    		If (col.code = "create_by") Then
    		    has_create_by = 1
    		End If
    		If (col.code = "update_by") Then
    		    has_update_by = 1
    		End If
    	Next
    
    
    	If (has_create_date=0) Then
    
    	       Set col_create_date = Tab.Columns.CreateNew
    	         col_create_date.name = "创建时间"
    		 col_create_date.code = "create_date"
    		 col_create_date.comment = "创建时间"
    		 col_create_date.DataType = "DateTime"
    	End If
    	If (has_update_date=0) Then
    
    	        set col_update_date = Tab.Columns.CreateNew
    		  col_update_date.name = "修改时间"
    		 col_update_date.code = "update_date"
    		 col_update_date.comment = "修改时间"
    		 col_update_date.DataType = "DateTime"
    	End If
    	If (has_create_by=0) Then
    
    	         set col_create_by = Tab.Columns.CreateNew
    		 col_create_by.name = "创建人"
    		 col_create_by.code = "create_by"
    		 col_create_by.comment = "创建人"
    		 col_create_by.DataType = "VARCHAR(32)"
    	End If
    
    	If (has_update_by=0) Then
    
    	       set col_update_by = Tab.Columns.CreateNew
    	        col_update_by.name = "更新人"
    		 col_update_by.code = "update_by"
    		 col_update_by.comment = "更新人"
    		 col_update_by.DataType = "VARCHAR(32)"
    	End If
    next
    

      

  • 相关阅读:
    springboot-配置多数据源(AOP实现)(HikariCP + MybatisPlus + mysql + SqlServer)
    CentOS7安装Oracle 11g数据库
    原型模式
    建造者模式
    单例模式
    抽象工厂模式
    SpringMVC_处理器方法的返回值
    配置文件占位符
    linux不同服务器SSH连接与数据传送
    RestTemplate的三种请求方式
  • 原文地址:https://www.cnblogs.com/china2k/p/9882543.html
Copyright © 2011-2022 走看看