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
    

      

  • 相关阅读:
    JAVA并发编程学习笔记之ReentrantLock
    服务架构演进
    Java集群优化——dubbo+zookeeper构建高可用分布式集群
    Dubbo实例
    hessian学习
    JAVA分布式事务原理及应用
    了解AngularJS $resource
    AngularJS Resource:与 RESTful API 交互
    Hibernate解决高并发问题之:悲观锁 VS 乐观锁
    互联网金融高并发方案
  • 原文地址:https://www.cnblogs.com/china2k/p/9882543.html
Copyright © 2011-2022 走看看