| | |
| | | StringBuffer sql = new StringBuffer("create table if not exists "); |
| | | sql.append(oaWorkflowFormDtos.get(0).getTableName()); |
| | | sql.append(" ("); |
| | | sql.append("id varchar(30) NOT NULL PRIMARY KEY COMMENT '主键ID',"); |
| | | boolean isVarchar = false; |
| | | JSONObject validate = null; |
| | | for (int componentIndex = 0; componentIndex < components.size(); componentIndex++) { |
| | |
| | | sql.append("("); |
| | | sql.append(validate.getIntValue("maxLength")); |
| | | sql.append(") "); |
| | | } else if (isVarchar) { |
| | | } |
| | | if (isVarchar && !validate.containsKey("maxLength")) { |
| | | sql.append("(64) "); |
| | | } |
| | | if (validate.containsKey("required") && validate.getBoolean("required")) { |
| | | sql.append(" not null "); |
| | | } |
| | | } |
| | | if (!component.containsKey("validate") && isVarchar) { |
| | | sql.append("(64) "); |
| | | } |
| | | |
| | | sql.append(" comment '"); |
| | | sql.append(component.getString("label")); |
| | | sql.append("'"); |
| | | |
| | | if (componentIndex != components.size() - 1) { |
| | | sql.append(","); |
| | | } |
| | | sql.append("',"); |
| | | } |
| | | sql.append(" )"); |
| | | sql.append("create_time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',"); |
| | | sql.append("status_cd varchar(2) NOT NULL DEFAULT '0' COMMENT '数据状态,详细参考c_status表,S 保存,0, 在用 1失效'"); |
| | | sql.append(")"); |
| | | logger.debug("部署表单sql" + sql.toString()); |
| | | int count = oaWorkflowFormInnerServiceSMOImpl.createTable(sql.toString()); |
| | | if (count < 1) { // 已经部署过不用再部署 |
| | | throw new IllegalArgumentException("部署表单失败"); |
| | | } |
| | | oaWorkflowFormInnerServiceSMOImpl.createTable(sql.toString()); |
| | | |
| | | // int count = oaWorkflowFormInnerServiceSMOImpl.createTable(sqlStr); |
| | | // if (count < 1) { // 已经部署过不用再部署 |
| | | // throw new IllegalArgumentException("部署表单失败"); |
| | | // } |
| | | } |
| | | |
| | | @Override |