Vim实战——利用vim生成EntityBean(下)

接下来要做的就是将 ^I 替换成空格,将数据库中的数据类型替换成 java 中的数据类型

输入 :%s/^I/ /g                                         // ^I 替换成空格

       :%s/varchar2(1)/char/g                     // varchar2(1) 替换成 char

       :%s/number(10,4)/Double/g            // number(10,4) 替换成 Double

      :%s/number(19) /Long/g                  // number(19) 替换成 Long

      : %s/varchar2(32)/String/g            // varchar2(32) 替换成 String

现在再看一下,还有几个 varchar2 ()类型的没有替换,不管了全部替换成 String 类型

输入 : %s/varchar2(\d\{0,})/String/g              // 将剩下的 varchar2 ()都替换成 String

好了,现在剩下扫尾工作了,将属性前面加上限制条件 private, 后面加上 ;

输入 :g/./if line(“.”)%2= =0|s/^/private /g       // 属性前面加上限制条件 private

       : g/./if line(“.”)%2= =0|s/$/;/g                 // 属性后面加上 ;

       :%s/^@/\r@/g                                        // 每两行加一行空行

 

@Column(name="OBJECT_RRN")

private Long objectRrn;

 

@Column(name="ORG_RRN")

private Long orgRrn;

 

@Column(name="IS_ACTIVE")

private char isActive;

 

@Column(name="CREATED")

private date created;

 

@Column(name="CREATED_BY")

private Long createdBy;

 

@Column(name="UPDATED")

private date updated;

 

@Column(name="UPDATED_BY")

private Long updatedBy;

 

@Column(name="LOCK_VERSION")

private Long lockVersion;

 

@Column(name="MATERIAL_ID")

private String materialId;

 

@Column(name="NAME")

private String name;

 

@Column(name="DESCRIPTION")

private String description;

 

@Column(name="COMMENTS")

private String comments;

 

@Column(name="MATERIAL_CATEGORY")

private String materialCategory;

 

@Column(name="MATERIAL_TYPE")

private String materialType;

 

@Column(name="BOM_RRN")

private Long bomRrn;

 

@Column(name="REFERNECT_PRICE")

private Long refernectPrice;

 

@Column(name="SPECIFICATION")

private String specification;

 

@Column(name="MODEL")

private String model;

 

@Column(name="WEIGHT")

private Long weight;

 

@Column(name="VOLUME")

private Long volume;

 

@Column(name="INVENTORY_UOM")

private String inventoryUom;

 

@Column(name="PURCHASE_UOM")

private String purchaseUom;

 

@Column(name="QTY_MIN")

private Double qtyMin;

 

@Column(name="QTY_MAX")

private Double qtyMax;

 

@Column(name="INVENTORY_PROPERTY")

private String inventoryProperty;

 

@Column(name="ABC_CATEGORY")

private String abcCategory;

 

@Column(name="IS_LOT_CONTROL")

private char isLotControl;

 

@Column(name="LOT_TYPE")

private String lotType;

 

@Column(name="IS_JIT")

private char isJit;

 

@Column(name="IS_VIRTUAL")

private char isVirtual;

 

@Column(name="IS_PURCHASE")

private char isPurchase;

 

@Column(name="IS_MRP")

private char isMrp;

 

@Column(name="IS_ISSUE_MO")

private char isIssueMo;

 

@Column(name="STOCK_CAPABILITY")

private Long stockCapability;

 

@Column(name="QTY_INITIAL")

private Double qtyInitial;

 

@Column(name="QTY_IN")

private Double qtyIn;

 

@Column(name="QTY_OUT")

private Double qtyOut;

 

@Column(name="QTY_DIFFERENCE")

private Double qtyDifference;

 

@Column(name="QTY_TRANSIT")

private Double qtyTransit;

 

@Column(name="QTY_ALLOCATION")

private Double qtyAllocation;

 

@Column(name="REFERENCE_DOC")

private String referenceDoc;

 

@Column(name="PRODUCTION_CYCLE")

private String productionCycle;

 

@Column(name="WORKCENTER_RRN")

private Long workcenterRrn;

 

@Column(name="BUYER_ID")

private String buyerId;

 

@Column(name="PLANNER_ID")

private String plannerId;

 

@Column(name="KEEPER_ID")

private String keeperId;

 

@Column(name="IQC_ID")

private String iqcId;

 

@Column(name="STAND_COST")

private Long standCost;

 

@Column(name="ACTRUAL_COST")

private Long actrualCost;

 

@Column(name="BOM_VERSION")

private Long bomVersion;

 

@Column(name="STATE")

private String state;

 

@Column(name="BOM_ID")

private String bomId;

 

@Column(name="PUR_INV_CONVERSION")

private Double purInvConversion;

 

@Column(name="IS_SALE")

private char isSale;

 

@Column(name="IS_PRODUCT")

private char isProduct;

 

@Column(name="STAND_TIME")

private Long standTime;

 

@Column(name="PROCESS_NAME")

private String processName;

 

@Column(name="QTY_MIN_PRODUCT")

private Double qtyMinProduct;

 

@Column(name="IS_SHARE")

private char isShare;

 

 

放到 Eclipse 中去看一下效果吧

 

 

怎么样还不错吧?如果你其他什么好的方法,欢迎交流http://yadsun.iteye.com/

 

返回(上)

你可能感兴趣的:(eclipse,工作,Excel,vim)