mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-23 22:11:36 +08:00
Update mysql
This commit is contained in:
parent
6d6d85312d
commit
88989f13f3
@ -133,6 +133,7 @@
|
|||||||
<Compile Include="UnitTest\UCustom015.cs" />
|
<Compile Include="UnitTest\UCustom015.cs" />
|
||||||
<Compile Include="UnitTest\UCustom06.cs" />
|
<Compile Include="UnitTest\UCustom06.cs" />
|
||||||
<Compile Include="UnitTest\UInsert.cs" />
|
<Compile Include="UnitTest\UInsert.cs" />
|
||||||
|
<Compile Include="UnitTest\UInsert3.cs" />
|
||||||
<Compile Include="UnitTest\UnitCustom01.cs" />
|
<Compile Include="UnitTest\UnitCustom01.cs" />
|
||||||
<Compile Include="UnitTest\UnitSameKeyBug.cs" />
|
<Compile Include="UnitTest\UnitSameKeyBug.cs" />
|
||||||
<Compile Include="UnitTest\UnitSubToList.cs" />
|
<Compile Include="UnitTest\UnitSubToList.cs" />
|
||||||
|
@ -31,6 +31,7 @@ namespace OrmTest
|
|||||||
}
|
}
|
||||||
public static void Init()
|
public static void Init()
|
||||||
{
|
{
|
||||||
|
UInsert3.Init();
|
||||||
UnitSubToList.Init();
|
UnitSubToList.Init();
|
||||||
UCustom20.Init();
|
UCustom20.Init();
|
||||||
UCustom07.Init();
|
UCustom07.Init();
|
||||||
|
57
Src/Asp.Net/MySqlTest/UnitTest/UInsert3.cs
Normal file
57
Src/Asp.Net/MySqlTest/UnitTest/UInsert3.cs
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
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.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; }
|
||||||
|
}
|
||||||
|
[SugarTable("Order")]
|
||||||
|
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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -125,7 +125,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 =>base.GetDbColumn(it, Builder.SqlParameterKeyWord + it.DbColumnName)));
|
||||||
ActionMinDate();
|
ActionMinDate();
|
||||||
return string.Format(SqlTemplate, GetTableNameString, columnsString, columnParametersString);
|
return string.Format(SqlTemplate, GetTableNameString, columnsString, columnParametersString);
|
||||||
}
|
}
|
||||||
@ -140,7 +140,7 @@ namespace SqlSugar
|
|||||||
foreach (var item in groupList)
|
foreach (var item in groupList)
|
||||||
{
|
{
|
||||||
batchInsetrSql.Append("(");
|
batchInsetrSql.Append("(");
|
||||||
insertColumns = string.Join(",", item.Select(it => FormatValue(it.Value,it.PropertyName)));
|
insertColumns = string.Join(",", item.Select(it =>base.GetDbColumn(it, FormatValue(it.Value,it.PropertyName))));
|
||||||
batchInsetrSql.Append(insertColumns);
|
batchInsetrSql.Append(insertColumns);
|
||||||
if (groupList.Last() == item)
|
if (groupList.Last() == item)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user