Skip to content

Commit

Permalink
支持多表同时生成
Browse files Browse the repository at this point in the history
支持多表同时生成
  • Loading branch information
supperlitt committed Mar 17, 2021
1 parent f62464f commit e4771fd
Show file tree
Hide file tree
Showing 27 changed files with 1,237 additions and 1,738 deletions.
Binary file modified WebAutoCodeOnline.v12.suo
Binary file not shown.
376 changes: 23 additions & 353 deletions WinGenerateCodeDB/Cache/PageCache.cs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ public string CreateQueryListMethod()
display_{1} result = new display_{1}();
result.item_count = count;
result.page_count = (int)Math.Ceiling((double)count / model.pageSize);
result.page_count =if ((action & (int)Math.Ceiling((double)count / model.pageSize);
result.list.AddRange(list);
return result_info<display_{1}>.Success(result);
Expand Down
4 changes: 3 additions & 1 deletion WinGenerateCodeDB/Code/AspNetCore/ModelHelper_DefaultCore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public ModelHelper_DefaultCore(string name_space, string model_suffix)
this.model_suffix = model_suffix;
}

public string CreateModel(string table_name, List<SqlColumnInfo> colList, bool add_display_model = false, bool isCodeSplit = true)
public string CreateModel(string table_name, List<SqlColumnInfo> colList, bool add_display_model = false)
{
this.model_name = table_name + model_suffix;

Expand All @@ -37,11 +37,13 @@ public string CreateModel(string table_name, List<SqlColumnInfo> colList, bool a

content.AppendFormat("\tpublic class {0}\r\n", model_name);
content.AppendLine("\t{");
bool isCodeSplit = false;
for (int i = 0; i < colList.Count; i++)
{
var item = colList[i];
if (!string.IsNullOrEmpty(item.Comment))
{
isCodeSplit = true;
content.Append(CommentTool.CreateComment(item.Comment, 2));
}

Expand Down
36 changes: 18 additions & 18 deletions WinGenerateCodeDB/Code/Aspx/AspxHelper_Bootstrap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ private static string CreateSearchContent(int action, List<SqlColumnInfo> colLis
{
StringBuilder searchContent = new StringBuilder();
int index = 0;
if ((action | (int)action_type.query_list) == (int)action_type.query_list)
if ((action & (int)action_type.query_list) == (int)action_type.query_list)
{
foreach (var item in colList.ToNotMainIdList())
{
Expand Down Expand Up @@ -175,49 +175,49 @@ private static string CreateCmdToolBar(int action)
{
int itemCount = 0;
StringBuilder toolBarContent = new StringBuilder();
if ((action | (int)action_type.add) == (int)action_type.add)
if ((action & (int)action_type.add) == (int)action_type.add)
{
toolBarContent.Append(@"
<input type=""button"" value=""新增"" onclick='newModel();' />");
itemCount++;
}

if ((action | (int)action_type.edit) == (int)action_type.edit)
if ((action & (int)action_type.edit) == (int)action_type.edit)
{
toolBarContent.Append(@"
<input type=""button"" value=""编辑"" onclick='editModel();' />");
itemCount++;
}

if ((action | (int)action_type.bat_edit) == (int)action_type.bat_edit)
if ((action & (int)action_type.bat_edit) == (int)action_type.bat_edit)
{
toolBarContent.Append(@"
<input type=""button"" value=""批量编辑"" onclick='batEditModel();' />");
itemCount++;
}

if ((action | (int)action_type.real_delete) == (int)action_type.real_delete)
if ((action & (int)action_type.real_delete) == (int)action_type.real_delete)
{
toolBarContent.Append(@"
<input type=""button"" value=""删除"" onclick='destroyModel();' />");
itemCount++;
}

if ((action | (int)action_type.bat_real_delete) == (int)action_type.bat_real_delete)
if ((action & (int)action_type.bat_real_delete) == (int)action_type.bat_real_delete)
{
toolBarContent.Append(@"
<input type=""button"" value=""删除选中"" onclick='destroyBatModel();' />");
itemCount++;
}

if ((action | (int)action_type.export_select) == (int)action_type.export_select)
if ((action & (int)action_type.export_select) == (int)action_type.export_select)
{
toolBarContent.Append(@"
<input type=""button"" value=""选中导出"" onclick='selectExport();' />");
itemCount++;
}

if ((action | (int)action_type.export_all) == (int)action_type.export_all)
if ((action & (int)action_type.export_all) == (int)action_type.export_all)
{
toolBarContent.Append(@"
<input type=""button"" value=""导出全部"" onclick='exportAll();' />");
Expand Down Expand Up @@ -282,7 +282,7 @@ private static string CreateDialog(int action, List<SqlColumnInfo> colList)
StringBuilder dialogContent = new StringBuilder();
int addWidth = 400;
#region 添加
if ((action | (int)action_type.add) == (int)action_type.add)
if ((action & (int)action_type.add) == (int)action_type.add)
{
// 行数过多,分成两行
string template = @"
Expand Down Expand Up @@ -442,7 +442,7 @@ private static string CreateDialog(int action, List<SqlColumnInfo> colList)

int editWidth = 400;
#region 编辑
if ((action | (int)action_type.edit) == (int)action_type.edit)
if ((action & (int)action_type.edit) == (int)action_type.edit)
{
// 行数过多,分成两行
string template = @"
Expand Down Expand Up @@ -608,7 +608,7 @@ private static string CreateDialog(int action, List<SqlColumnInfo> colList)

int batEditWidth = 400;
#region 批量编辑
if ((action | (int)action_type.bat_edit) == (int)action_type.bat_edit)
if ((action & (int)action_type.bat_edit) == (int)action_type.bat_edit)
{
// 行数过多,分成两行
string template = @"
Expand Down Expand Up @@ -802,7 +802,7 @@ private static string CreateJsOperation(int action, List<SqlColumnInfo> colList,
<script type=""text/javascript"">");

#region edit
if ((action | (int)action_type.edit) == (int)action_type.edit)
if ((action & (int)action_type.edit) == (int)action_type.edit)
{
// 定义变量
StringBuilder editDefineVarContent = new StringBuilder();
Expand Down Expand Up @@ -901,7 +901,7 @@ function saveEditModel() {{
#endregion

#region add
if ((action | (int)action_type.add) == (int)action_type.add)
if ((action & (int)action_type.add) == (int)action_type.add)
{
StringBuilder addContent = new StringBuilder();
StringBuilder addPostDataContent = new StringBuilder("var postData = ");
Expand Down Expand Up @@ -961,7 +961,7 @@ function saveAddModel() {{
#endregion

#region del
if ((action | (int)action_type.real_delete) == (int)action_type.real_delete)
if ((action & (int)action_type.real_delete) == (int)action_type.real_delete)
{
string template = string.Format(@"
Expand Down Expand Up @@ -1016,7 +1016,7 @@ function destroyModel() {{
#endregion

#region bat edit
if ((action | (int)action_type.bat_edit) == (int)action_type.bat_edit)
if ((action & (int)action_type.bat_edit) == (int)action_type.bat_edit)
{
StringBuilder batEditContent = new StringBuilder();
batEditContent.AppendFormat("var txtBatEdit{0} = $(\"#txtBatEdit{0}\").val();\r\n", colList.ToKeyId());
Expand Down Expand Up @@ -1088,7 +1088,7 @@ function saveBatEditModel() {{

#region export all

if ((action | (int)action_type.export_all) == (int)action_type.export_all)
if ((action & (int)action_type.export_all) == (int)action_type.export_all)
{
int index = 0;
StringBuilder coditionContent = new StringBuilder();
Expand Down Expand Up @@ -1137,7 +1137,7 @@ function exportAll() {{

#region export part

if ((action | (int)action_type.export_select) == (int)action_type.export_select)
if ((action & (int)action_type.export_select) == (int)action_type.export_select)
{
int index = 0;
StringBuilder coditionContent = new StringBuilder();
Expand Down Expand Up @@ -1315,7 +1315,7 @@ function changesize() {{
int index = 0;
StringBuilder coditionContent = new StringBuilder();
StringBuilder pagePost = new StringBuilder();
if ((action | (int)action_type.query_list) == (int)action_type.query_list)
if ((action & (int)action_type.query_list) == (int)action_type.query_list)
{
foreach (var item in colList.ToNotMainIdList())
{
Expand Down
38 changes: 19 additions & 19 deletions WinGenerateCodeDB/Code/Aspx/AspxHelper_EasyUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ private static string CreateSearchContent(int action, List<SqlColumnInfo> colLis
</div>
";
StringBuilder searchContent = new StringBuilder();
if ((action | (int)action_type.query_list) == (int)action_type.query_list)
if ((action & (int)action_type.query_list) == (int)action_type.query_list)
{
foreach (var attr in colList.ToNotMainIdList())
{
Expand All @@ -101,37 +101,37 @@ private static string CreateCmdToolBar(int action)
StringBuilder toolBarContent = new StringBuilder(@"
<div id=""toolbar"">
");
if ((action | (int)action_type.add) == (int)action_type.add)
if ((action & (int)action_type.add) == (int)action_type.add)
{
toolBarContent.Append(@"<a href=""javascript:void(0)"" class=""easyui-linkbutton"" iconcls=""icon-add"" plain=""true"" onclick=""newModel()"">新增</a>");
}

if ((action | (int)action_type.edit) == (int)action_type.edit)
if ((action & (int)action_type.edit) == (int)action_type.edit)
{
toolBarContent.Append(@"<a href=""javascript:void(0)"" class=""easyui-linkbutton"" iconcls=""icon-edit"" plain=""true"" onclick=""editModel()"">编辑</a>");
}

if ((action | (int)action_type.bat_edit) == (int)action_type.bat_edit)
if ((action & (int)action_type.bat_edit) ==(int)action_type.bat_edit)
{
toolBarContent.Append(@"<a href=""javascript:void(0)"" class=""easyui-linkbutton"" iconcls=""icon-edit"" plain=""true"" onclick=""batEditModel()"">批量编辑</a>");
}

if ((action | (int)action_type.delete) == (int)action_type.delete)
if ((action & (int)action_type.delete) ==(int)action_type.delete)
{
toolBarContent.Append(@"<a href=""javascript:void(0)"" class=""easyui-linkbutton"" iconcls=""icon-remove"" plain=""true"" onclick=""destroyModel()"">删除</a>");
}

if ((action | (int)action_type.bat_delete) == (int)action_type.bat_delete)
if ((action & (int)action_type.bat_delete) ==(int)action_type.bat_delete)
{
toolBarContent.Append(@"<a href=""javascript:void(0)"" class=""easyui-linkbutton"" iconcls=""icon-remove"" plain=""true"" onclick=""destroyBatModel()"">删除</a>");
}

if ((action | (int)action_type.export_all) == (int)action_type.export_all)
if ((action & (int)action_type.export_all) ==(int)action_type.export_all)
{
toolBarContent.Append(@"<a href=""javascript:void(0)"" class=""easyui-linkbutton"" iconcls=""icon-remove"" plain=""true"" onclick=""exportAll()"">导出全部</a>");
}

if ((action | (int)action_type.export_select) == (int)action_type.export_select)
if ((action & (int)action_type.export_select) ==(int)action_type.export_select)
{
toolBarContent.Append(@"<a href=""javascript:void(0)"" class=""easyui-linkbutton"" iconcls=""icon-remove"" plain=""true"" onclick=""selectExport()"">导出选中</a>");
}
Expand All @@ -145,7 +145,7 @@ private static string CreateCmdToolBar(int action)
private static string CreateDataGrid(int action, List<SqlColumnInfo> colList, string table_name)
{
// singleselect=""true""
if ((action | (int)action_type.query_list) == (int)action_type.query_list)
if ((action & (int)action_type.query_list) ==(int)action_type.query_list)
{
string template = @"
<table id=""dg"" class=""easyui-datagrid"" style=""width: 1200px; height: auto"" url="""" pagination=""true""
Expand Down Expand Up @@ -182,7 +182,7 @@ private static string CreateDialog(int action, List<SqlColumnInfo> colList, stri
StringBuilder dialogContent = new StringBuilder();

#region 添加
if ((action | (int)action_type.add) == (int)action_type.add)
if ((action & (int)action_type.add) ==(int)action_type.add)
{
// 行数过多,分成两行
string template = @"
Expand Down Expand Up @@ -220,7 +220,7 @@ 取 消</a>
#endregion

#region 编辑
if ((action | (int)action_type.edit) == (int)action_type.edit)
if ((action & (int)action_type.edit) ==(int)action_type.edit)
{
// 行数过多,分成两行
string template = @"
Expand Down Expand Up @@ -259,7 +259,7 @@ 取 消</a>
#endregion

#region 批量编辑
if ((action | (int)action_type.bat_edit) == (int)action_type.bat_edit)
if ((action & (int)action_type.bat_edit) ==(int)action_type.bat_edit)
{
string template = @"
<div id=""dlg-batedit"" class=""easyui-dialog"" style=""width: 400px; height: 240px; padding: 10px 20px""
Expand Down Expand Up @@ -350,7 +350,7 @@ private static string CreateJsOperation(int action, List<SqlColumnInfo> colList,
<script type=""text/javascript"">");

#region edit
if ((action | (int)action_type.edit) == (int)action_type.edit)
if ((action & (int)action_type.edit) ==(int)action_type.edit)
{
StringBuilder editSubmitContent = new StringBuilder();

Expand Down Expand Up @@ -434,7 +434,7 @@ function saveEditModel(){{
#endregion

#region add
if ((action | (int)action_type.add) == (int)action_type.add)
if ((action & (int)action_type.add) ==(int)action_type.add)
{
StringBuilder addContent = new StringBuilder();
StringBuilder postDataContent = new StringBuilder("var postData = ");
Expand Down Expand Up @@ -501,7 +501,7 @@ function saveAddModel() {{
#endregion

#region del
if ((action | (int)action_type.real_delete) == (int)action_type.real_delete)
if ((action & (int)action_type.real_delete) ==(int)action_type.real_delete)
{
string template = string.Format(@"
Expand Down Expand Up @@ -538,7 +538,7 @@ function destroyUser() {{

#region bat edit

if ((action | (int)action_type.bat_real_delete) == (int)action_type.bat_real_delete)
if ((action & (int)action_type.bat_real_delete) ==(int)action_type.bat_real_delete)
{
StringBuilder batEditContent = new StringBuilder();
batEditContent.AppendFormat("\t\t\tvar txtBatEdit{0} = $(\"#txtBatEdit{0}\").textbox(\"getValue\");\r\n", colList.ToKeyId());
Expand Down Expand Up @@ -616,7 +616,7 @@ function saveBatEditModel() {{

#region export

if ((action | (int)action_type.export_all) == (int)action_type.export_all)
if ((action & (int)action_type.export_all) ==(int)action_type.export_all)
{
int index = 0;
StringBuilder coditionContent = new StringBuilder();
Expand Down Expand Up @@ -663,7 +663,7 @@ function exportAll() {{
#endregion

#region select export
if ((action | (int)action_type.export_select) == (int)action_type.export_select)
if ((action & (int)action_type.export_select) ==(int)action_type.export_select)
{
int index = 0;
StringBuilder coditionContent = new StringBuilder();
Expand Down Expand Up @@ -762,7 +762,7 @@ function LoadData(page_Number, page_Size) {
int index = 0;
StringBuilder coditionContent = new StringBuilder();
StringBuilder pagePost = new StringBuilder();
if ((action | (int)action_type.query_list) == (int)action_type.query_list)
if ((action & (int)action_type.query_list) ==(int)action_type.query_list)
{
foreach (var item in colList.ToNotMainIdList())
{
Expand Down
Loading

0 comments on commit e4771fd

Please sign in to comment.