Skip to content

Commit

Permalink
Modify map file
Browse files Browse the repository at this point in the history
  • Loading branch information
xiangxiren committed Dec 22, 2022
1 parent 27e7289 commit 81133bf
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 19 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
/.vs/SmartSql.CAP
/samples/Sample.RabbitMQ.MySql/bin
/samples/Sample.RabbitMQ.MySql/obj
/.vs/ProjectEvaluation
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Config SmartSqlMapConfig.xml
``` xml
<SmartSqlMaps>
<SmartSqlMap Path="Maps" Type="Directory"/>
<SmartSqlMap Path="SmartSql.CAP.Maps.CapMySql.xml,SmartSql.CAP" Type="Embedded" />
<SmartSqlMap Path="SmartSql.CAP.Maps.CapMySql8.xml,SmartSql.CAP" Type="Embedded" />
</SmartSqlMaps>
```

Expand Down
8 changes: 4 additions & 4 deletions samples/Sample.RabbitMQ.MySql/Maps/Person.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@
?Id,
?Name
)
;Select Last_Insert_Id();
;SELECT Last_Insert_Id();
</Statement>

<!--获取表映射实体-->
<Statement Id="GetEntity" AutoConverter="PascalConverter">
Select T.id, T.name
From person As T
SELECT T.id, T.name
FROM person As T
<Where Min="1">
<IsNotEmpty Prepend="And" Property="Id">
T.id= ?Id
</IsNotEmpty>
</Where>
Limit 1
LIMIT 1
</Statement>
</Statements>

Expand Down
3 changes: 3 additions & 0 deletions samples/Sample.RabbitMQ.MySql/Program.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using AspectCore.Configuration;
using AspectCore.Extensions.Hosting;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;

Expand All @@ -14,6 +16,7 @@ public static void Main(string[] args)

public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureServices(services => services.AddSingleton<IAspectConfiguration>(new AspectConfiguration { ThrowAspectException = true }))
.UseDynamicProxy()
.ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup<Startup>(); })
.ConfigureLogging(builder =>
Expand Down
4 changes: 2 additions & 2 deletions src/SmartSql.CAP/Maps/CapMySql.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,15 @@
</Statement>

<Statement Id="QueryMessages" >
Select * From `<Placeholder Property="tableName" />`
SELECT * FROM `<Placeholder Property="tableName" />`
<Include RefId="QueryParams" />
ORDER BY Added DESC
LIMIT ?limit OFFSET ?offset
</Statement>

<!--获取记录数-->
<Statement Id="GetRecord">
Select Count(1) From `<Placeholder Property="tableName" />`
SELECT COUNT(1) FROM `<Placeholder Property="tableName" />`
<Include RefId="QueryParams" />
</Statement>

Expand Down
4 changes: 2 additions & 2 deletions src/SmartSql.CAP/Maps/CapMySql8.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,15 @@
</Statement>

<Statement Id="QueryMessages" >
Select * From `<Placeholder Property="tableName" />`
SELECT * FROM `<Placeholder Property="tableName" />`
<Include RefId="QueryParams" />
ORDER BY Added DESC
LIMIT ?limit OFFSET ?offset
</Statement>

<!--获取记录数-->
<Statement Id="GetRecord">
Select Count(1) From `<Placeholder Property="tableName" />`
SELECT COUNT(1) FROM `<Placeholder Property="tableName" />`
<Include RefId="QueryParams" />
</Statement>

Expand Down
4 changes: 2 additions & 2 deletions src/SmartSql.CAP/Maps/CapPostgreSql.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@
</Statement>

<Statement Id="QueryMessages" >
Select * From <Placeholder Property="tableName" />
SELECT * FROM <Placeholder Property="tableName" />
<Include RefId="QueryParams" />
ORDER BY "Added" DESC
OFFSET @offset LIMIT @limit
</Statement>

<!--获取记录数-->
<Statement Id="GetRecord">
Select Count(1) From <Placeholder Property="tableName" />
SELECT COUNT(1) FROM <Placeholder Property="tableName" />
<Include RefId="QueryParams" />
</Statement>

Expand Down
6 changes: 3 additions & 3 deletions src/SmartSql.CAP/Maps/CapSqlServer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
</Statement>

<Statement Id="GetTimelineStats">
WITH aggr as (
WITH aggr AS (
SELECT FORMAT(Added,'yyyy-MM-dd-HH') AS [Key],
COUNT(Id) AS [Count]
FROM <Placeholder Property="tableName" />
Expand Down Expand Up @@ -96,15 +96,15 @@
</Statement>

<Statement Id="QueryMessages" >
SELECT * From <Placeholder Property="tableName" />
SELECT * FROM <Placeholder Property="tableName" />
<Include RefId="QueryParams" />
ORDER BY Added DESC
OFFSET @offset ROWS FETCH NEXT @limit ROWS ONLY
</Statement>

<!--获取记录数-->
<Statement Id="GetRecord">
Select Count(1) From <Placeholder Property="tableName" />
SELECT COUNT(1) FROM <Placeholder Property="tableName" />
<Include RefId="QueryParams" />
</Statement>

Expand Down
4 changes: 2 additions & 2 deletions src/SmartSql.CAP/Maps/CapSqlServer2008.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,15 @@
<Statement Id="QueryMessages" >
SELECT * FROM
(
SELECT T.*, ROW_NUMBER() OVER(ORDER BY T.Added DESC) AS row_number From <Placeholder Property="tableName" /> AS T
SELECT T.*, ROW_NUMBER() OVER(ORDER BY T.Added DESC) AS row_number FROM <Placeholder Property="tableName" /> AS T
<Include RefId="QueryParams" />
) AS tbl
WHERE tbl.row_number BETWEEN @offset and @offset + @limit
</Statement>

<!--获取记录数-->
<Statement Id="GetRecord">
Select Count(1) From <Placeholder Property="tableName" />
SELECT COUNT(1) FROM <Placeholder Property="tableName" />
<Include RefId="QueryParams" />
</Statement>

Expand Down
5 changes: 2 additions & 3 deletions src/SmartSql.CAP/SmartSql.CAP.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@
<Nullable>enable</Nullable>
<NoWarn>1701;1702;1591</NoWarn>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<Version>1.0.5</Version>
<Version>1.0.6</Version>
<Authors>xiangxiren</Authors>
<Company>xiangxiren</Company>
<RepositoryUrl>https://github.com/xiangxiren/SmartSql.CAP</RepositoryUrl>
<Description>Support CAP extension for SmartSql</Description>
<RepositoryType>git</RepositoryType>
<PackageTags>CAP;SmartSql</PackageTags>
<PackageProjectUrl>https://github.com/xiangxiren/SmartSql.CAP</PackageProjectUrl>
<PackageReleaseNotes>fix transaction bug</PackageReleaseNotes>

<PackageReleaseNotes>Support DotNetCore.CAP Version 7.0.0</PackageReleaseNotes>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit 81133bf

Please sign in to comment.