Browse Source

Update 达梦

pull/30/head
sunkaixuan 2 years ago
parent
commit
eae35cd037
  1. 1
      Src/Asp.Net/DmTest/DmTest.csproj
  2. 1
      Src/Asp.Net/DmTest/UnitTest/Main.cs
  3. 58
      Src/Asp.Net/DmTest/UnitTest/UInsert3.cs
  4. 4
      Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/InsertBuilder.cs

1
Src/Asp.Net/DmTest/DmTest.csproj

@ -85,6 +85,7 @@
<Compile Include="UnitTest\Main.cs" /> <Compile Include="UnitTest\Main.cs" />
<Compile Include="UnitTest\UAdo.cs" /> <Compile Include="UnitTest\UAdo.cs" />
<Compile Include="UnitTest\UCodeFirst.cs" /> <Compile Include="UnitTest\UCodeFirst.cs" />
<Compile Include="UnitTest\UInsert3.cs" />
<Compile Include="UnitTest\UJson.cs" /> <Compile Include="UnitTest\UJson.cs" />
<Compile Include="UnitTest\Updateable.cs" /> <Compile Include="UnitTest\Updateable.cs" />
<Compile Include="UnitTest\UQueryable.cs" /> <Compile Include="UnitTest\UQueryable.cs" />

1
Src/Asp.Net/DmTest/UnitTest/Main.cs

@ -31,6 +31,7 @@ namespace OrmTest
} }
public static void Init() public static void Init()
{ {
UInsert3.Init();
Save(); Save();
CodeFirst(); CodeFirst();
Updateable(); Updateable();

58
Src/Asp.Net/DmTest/UnitTest/UInsert3.cs

@ -0,0 +1,58 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Data.SqlTypes;
using System.Linq;
using System.Security.Principal;
using System.Text;
using System.Threading.Tasks;
namespace OrmTest
{
internal class UInsert3
{
public static void Init()
{
var db = NewUnitTest.Db;
db.GetDate();
db.Insertable(new Order() { Name = "a" }).ExecuteCommand();
db.Insertable(new List<Order>() {
new Order() { Name = "a" },
new Order() { Name = "a" }
}).ExecuteCommand();
db.Insertable(new ORDER() { Name = "a" }).ExecuteCommand();
}
public class Order
{
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
public int Id { get; set; }
/// <summary>
/// 姓名
/// </summary>
public string Name { get; set; }
public decimal Price { get; set; }
[SugarColumn(InsertServerTime =true)]
public DateTime CreateTime { get; set; }
[SugarColumn(IsNullable = true)]
public int CustomId { get; set; }
}
public class ORDER
{
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
public int Id { get; set; }
/// <summary>
/// 姓名
/// </summary>
public string Name { get; set; }
public decimal Price { get; set; }
[SugarColumn(InsertSql = "'2020-1-1'")]
public DateTime CreateTime { get; set; }
[SugarColumn(IsNullable = true)]
public int CustomId { get; set; }
}
}
}

4
Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/InsertBuilder.cs

@ -162,7 +162,7 @@ namespace SqlSugar
string columnsString = string.Join(",", groupList.First().Select(it => Builder.GetTranslationColumnName(it.DbColumnName))); string columnsString = string.Join(",", groupList.First().Select(it => Builder.GetTranslationColumnName(it.DbColumnName)));
if (isSingle) if (isSingle)
{ {
string columnParametersString = string.Join(",", this.DbColumnInfoList.Select(it => Builder.SqlParameterKeyWord + it.DbColumnName)); string columnParametersString = string.Join(",", this.DbColumnInfoList.Select(it =>this.GetDbColumn(it, Builder.SqlParameterKeyWord + it.DbColumnName)));
return string.Format(SqlTemplate, GetTableNameString, columnsString, columnParametersString); return string.Format(SqlTemplate, GetTableNameString, columnsString, columnParametersString);
} }
else else
@ -191,7 +191,7 @@ namespace SqlSugar
{ {
batchInsetrSql.Append(SqlTemplateBatchUnion); batchInsetrSql.Append(SqlTemplateBatchUnion);
} }
batchInsetrSql.Append("\r\n SELECT " + string.Join(",", columns.Select(it => string.Format(SqlTemplateBatchSelect, FormatValue(it.Value),Builder.GetTranslationColumnName(it.DbColumnName))))); batchInsetrSql.Append("\r\n SELECT " + string.Join(",", columns.Select(it => string.Format(SqlTemplateBatchSelect,this.GetDbColumn(it, FormatValue(it.Value)),Builder.GetTranslationColumnName(it.DbColumnName)))));
++i; ++i;
} }
pageIndex++; pageIndex++;

Loading…
Cancel
Save