package com.changhong.autoform.entity.sql.create;
|
|
import java.util.Map;
|
|
|
public class CreateTable extends Create{
|
|
public CreateTable(String tableName, Map<String, Object> fields) {
|
super(tableName, fields);
|
this.tableName=tableName;
|
}
|
|
private String tableName;
|
|
public String getSql() {
|
StringBuilder sql = new StringBuilder();
|
sql.append(" CREATE TABLE ").append(getTableName()).append("(")
|
.append("DATAROWNUM INT NOT NULL AUTO_INCREMENT,")
|
.append("TENANTID CHAR (50) NOT NULL,")
|
.append("PARENTDATAROWNUM INT NOT NULL,")
|
.append("DELETEFLG CHAR (1) COMMENT '0未删除,1删除',")
|
.append("CREATEUSER VARCHAR (50),")
|
.append("CREATEDATETIME TIMESTAMP NOT NULL DEFAULT now(),")
|
.append("UPDATEUSER VARCHAR (50),")
|
.append("UPDATEDATETIME TIMESTAMP NOT NULL DEFAULT now() ON UPDATE now(),")
|
.append("PROCESSINSTID decimal(20),")
|
.append("orderCode varchar(50),")
|
.append("orderStatus varchar(2) DEFAULT '20',")
|
.append("processState varchar(2) DEFAULT '10',")
|
.append("processLog varchar(255),")
|
.append("processTask varchar(255),")
|
.append("processUser varchar(20),")
|
.append("processFlag varchar(20),")
|
.append("htmlUrl varchar(128),")
|
.append("solidification longtext,")
|
.append("voucherCode varchar(20)");
|
if(getFields() != null && !getFields().isEmpty()){
|
sql.append(',');
|
}
|
sql.append(super.getSql());
|
sql.append("PRIMARY KEY (DATAROWNUM,TENANTID,PARENTDATAROWNUM)");
|
sql.append(");");
|
return sql.toString();
|
}
|
|
public String getTableName() {
|
return tableName;
|
}
|
|
public void setTableName(String tableName) {
|
this.tableName = tableName;
|
}
|
|
}
|