private void btnBean_Click(object sender, EventArgs e) { try { if (!verifyInfo()) { return; } if (!varifySet(txtSet.Text)) { return; } if (!isHours) { Global.ShowSysInfo("请先打卡!"); return; } List <ColumnTable> pColumnTables = SqlBaseProvider.GetColumnTable(pTable.DBID, pTable.TableCode); txtResult.Text = PublicTools.WriteTab(0) + "package com." + txtPackage.Text + ".entity"; if (!String.IsNullOrEmpty(txtCatalog.Text.Trim())) { txtResult.Text += PublicTools.WriteTab(0) + "." + txtCatalog.Text.Trim().ToLower(); } txtResult.Text += ";" + PublicTools.WriteEnter(2); string tablename = pTable.TableName.Substring(pTable.TableName.IndexOf('-') + 1).Replace("参数", "").Replace("表", ""); txtResult.Text += PublicTools.WriteTab(0) + "@ApiModel(value=\"" + txtClassName.Text + "\", description=\"" + tablename + "\")" + PublicTools.WriteEnter(1); txtResult.Text += PublicTools.WriteTab(0) + "public class " + txtClassName.Text + "{" + PublicTools.WriteEnter(2); foreach (ColumnTable c in pColumnTables) { string example = ""; if (PublicTools.GetJavaType(c.GetColType()).Equals("int")) { example = ", example=\"0\""; } txtResult.Text += PublicTools.WriteTab(1) + "@ApiModelProperty(value=\"" + c.ColumnName.ToLower() + "\"" + example + ")" + PublicTools.WriteEnter(1); string propertyname = ""; string[] columns = c.DisplayColumn.Split('_'); for (int i = 0; i < columns.Length; i++) { propertyname += columns[i].Substring(0, 1).ToUpper() + columns[i].Substring(1).ToLower(); } propertyname = propertyname.Substring(0, 1).ToLower() + propertyname.Substring(1); txtResult.Text += PublicTools.WriteTab(1) + "private " + PublicTools.GetJavaType(c.GetColType()) + " " + propertyname + ";" + PublicTools.WriteEnter(2); } txtResult.Text += PublicTools.WriteTab(1) + "public " + txtClassName.Text + "() {" + PublicTools.WriteEnter(1); foreach (ColumnTable c in pColumnTables) { string propertyname = ""; string[] columns = c.DisplayColumn.Split('_'); for (int i = 0; i < columns.Length; i++) { propertyname += columns[i].Substring(0, 1).ToUpper() + columns[i].Substring(1).ToLower(); } propertyname = propertyname.Substring(0, 1).ToLower() + propertyname.Substring(1); txtResult.Text += PublicTools.WriteTab(2) + "this." + propertyname + " = " + PublicTools.GetInitType(c.GetColType()) + ";" + PublicTools.WriteEnter(1); } txtResult.Text += PublicTools.WriteTab(1) + "}" + PublicTools.WriteEnter(2); foreach (ColumnTable c in pColumnTables) { string propertyname = ""; string[] columns = c.DisplayColumn.Split('_'); for (int i = 0; i < columns.Length; i++) { propertyname += columns[i].Substring(0, 1).ToUpper() + columns[i].Substring(1).ToLower(); } propertyname = propertyname.Substring(0, 1).ToLower() + propertyname.Substring(1); txtResult.Text += PublicTools.WriteTab(1) + "public " + PublicTools.GetJavaType(c.GetColType()) + " get" + propertyname.Substring(0, 1).ToUpper() + propertyname.Substring(1) + "() {" + PublicTools.WriteEnter(1); txtResult.Text += PublicTools.WriteTab(2) + "return " + propertyname + ";" + PublicTools.WriteEnter(1); txtResult.Text += PublicTools.WriteTab(1) + "}" + PublicTools.WriteEnter(2); txtResult.Text += PublicTools.WriteTab(1) + "public void set" + propertyname.Substring(0, 1).ToUpper() + propertyname.Substring(1) + "(" + PublicTools.GetJavaType(c.GetColType()) + " " + propertyname + ") {" + PublicTools.WriteEnter(1); txtResult.Text += PublicTools.WriteTab(2) + "this." + propertyname + "=" + propertyname + ";" + PublicTools.WriteEnter(1); txtResult.Text += PublicTools.WriteTab(1) + "}" + PublicTools.WriteEnter(2); } txtResult.Text += "}" + PublicTools.WriteEnter(2); } catch (Exception ex) { Global.ShowSysInfo(ex.Message); } }