Skip to content

Commit de147ec

Browse files
committed
Formatting template
1 parent 92f7862 commit de147ec

File tree

10 files changed

+23
-17
lines changed

10 files changed

+23
-17
lines changed

src/SmartCode.CLI/OfficialRazorTemplates/Entity.cshtml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
using System;
1313
namespace @(project.Module).@buildTask.Module
1414
{
15-
@Html.Raw("///<summary>")
16-
@Html.Raw($"///{table.Description ?? table.ConvertedName}")
17-
@Html.Raw("///</summary>")
15+
@Html.PadLeft(4)@Html.Raw("///<summary>")
16+
@Html.PadLeft(4)@Html.Raw($"///{table.Description ?? table.ConvertedName}")
17+
@Html.PadLeft(4)@Html.Raw("///</summary>")
1818
public class @table.ConvertedName
1919
{
2020
@foreach (var column in table.Columns)
@@ -23,10 +23,10 @@ namespace @(project.Module)[email protected]
2323
@Html.PadLeft(8)@Html.NewLine()
2424
@Html.PadLeft(8)@Html.Raw($"///{column.Description ?? column.ConvertedName}")
2525
@Html.PadLeft(8)@Html.NewLine()
26-
@Html.PadLeft(8) @Html.Raw("///</summary>")
26+
@Html.PadLeft(8)@Html.Raw("///</summary>")
2727
@Html.PadLeft(8)@Html.NewLine()
28-
@Html.PadLeft(8)@Html.PadLeft(6)<text>public</text> <text>@column.LanguageType</text><text>@(column.IsNullable && column.LanguageType != "string" ? "?" : "")</text> <text>@column.ConvertedName</text> <text>{ get; set; }</text>
28+
@Html.PadLeft(8)<text>public</text> <text>@column.LanguageType</text><text>@(column.IsNullable && column.LanguageType != "string" ? "?" : "")</text> <text>@column.ConvertedName</text> <text>{ get; set; }</text>
2929
@Html.PadLeft(8)@Html.NewLine()
3030
}
3131
}
32-
}
32+
}

src/SmartCode.CLI/OfficialRazorTemplates/Repository.cshtml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
}
1111
@{ await Html.RenderPartialAsync("Copyright.cshtml", Model); }
12+
1213
using System;
1314
using System.Collections.Generic;
1415
using System.Data;
@@ -20,11 +21,11 @@ using @(project.Module).Entity;
2021
namespace @(project.Module).@buildTask.Module
2122
{
2223
public interface I@(table.ConvertedName)Repository : IRepository<@(table.ConvertedName), @(primaryKeyType)>
23-
{
24+
{
2425
@if (autoIncrement && primaryKeyType != "int")
2526
{
2627
@Html.PadLeft(8) <text>new @primaryKeyType Insert(@table.ConvertedName entity);</text>
2728
@Html.NewLine()
2829
}
29-
}
30-
}
30+
}
31+
}

src/SmartCode.CLI/OfficialRazorTemplates/SqlMap-Delete.cshtml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66
var dbSource = Model.GetDataSource<DbSource>();
77
var table = Model.GetCurrentTable();
88
var pkCol = table.PKColumn;
9+
var prefix = dbSource.DbProvider.ParameterPrefix;
910
}
1011

1112
<!--删除-->
1213
<Statement Id="Delete">
1314
Delete From @table.Name
14-
Where @pkCol.Name=@pkCol.ConvertedName
15+
Where @pkCol.Name=@prefix@pkCol.ConvertedName
1516
</Statement>

src/SmartCode.CLI/OfficialRazorTemplates/SqlMap-Insert.cshtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
var col = table.Columns.ElementAt(colIndex);
2424
@if (!col.AutoIncrement)
2525
{
26-
@col.Name@(colIndex == table.Columns.Count() - 1 ? "" : ",")
26+
@Html.PadLeft(6)@col.Name@(colIndex == table.Columns.Count() - 1 ? "" : ",")
2727
@Html.NewLine()
2828
}
2929
}
@@ -35,7 +35,7 @@
3535
var col = table.Columns.ElementAt(colIndex);
3636
@if (!col.AutoIncrement)
3737
{
38-
@[email protected]@(colIndex == table.Columns.Count() - 1 ? "" : ",")
38+
@Html.PadLeft(6)@[email protected]@(colIndex == table.Columns.Count() - 1 ? "" : ",")
3939
@Html.NewLine()
4040
}
4141
}

src/SmartCode.CLI/OfficialRazorTemplates/SqlMap-IsExist.cshtml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@
1212
<Statement Id="IsExist">
1313
Select Count(1) From @table.Name T
1414
<Include RefId="QueryParams" />
15-
</Statement>
15+
</Statement>
16+

src/SmartCode.CLI/OfficialRazorTemplates/SqlMap-MySql.cshtml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
@{ await Html.RenderPartialAsync("SqlMap-Delete.cshtml", Model); }
3131
@{ await Html.RenderPartialAsync("SqlMap-Update.cshtml", Model); }
3232
@{ await Html.RenderPartialAsync("SqlMap-Query.cshtml", Model); }
33+
3334
<!--获取分页数据-->
3435
<Statement Id="QueryByPage" @(queryStatementResultMap)>
3536
Select T.* From @table.Name As T
@@ -54,5 +55,6 @@
5455
Limit 1
5556
</Statement>
5657
@{ await Html.RenderPartialAsync("SqlMap-IsExist.cshtml", Model); }
58+
5759
</Statements>
5860
</SmartSqlMap>

src/SmartCode.CLI/OfficialRazorTemplates/SqlMap-PostgreSql.cshtml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,6 @@
5858
</Statement>
5959

6060
@{ await Html.RenderPartialAsync("SqlMap-IsExist.cshtml", Model); }
61+
6162
</Statements>
6263
</SmartSqlMap>

src/SmartCode.CLI/OfficialRazorTemplates/SqlMap-SqlServer.cshtml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,6 @@
5252
</Where>
5353
</Statement>
5454
@{ await Html.RenderPartialAsync("SqlMap-IsExist.cshtml", Model); }
55+
5556
</Statements>
5657
</SmartSqlMap>

src/SmartCode.CLI/OfficialRazorTemplates/SqlMap-Update.cshtml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
<!--更新-->
1818
<Statement Id="Update">
1919
UPDATE @table.Name
20-
SET
21-
<Dynamic>
20+
<Set>
2221
@foreach (var col in table.Columns)
2322
{
2423
if (!col.IsPrimaryKey)
@@ -28,6 +27,6 @@
2827
</IsProperty>
2928
}
3029
}
31-
</Dynamic>
30+
</Set>
3231
Where @pkCol.Name=@[email protected]
3332
</Statement>

src/SmartCode.CLI/SmartCode.CLI.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<RepositoryType>Github</RepositoryType>
2121
<PackageTags>SmartCode SmartSql</PackageTags>
2222
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
23-
<Version>1.4.0</Version>
23+
<Version>1.4.2</Version>
2424
<PackageIconUrl>https://raw.githubusercontent.com/Ahoo-Wang/SmartCode/master/doc/Logo.png</PackageIconUrl>
2525
</PropertyGroup>
2626

0 commit comments

Comments
 (0)