mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-22 20:13:41 +08:00
Join and UpdateColumns BUG
https://github.com/sunkaixuan/SqlSugar/issues/121
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using OrmTest.Demo;
|
||||
using OrmTest.Models;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -47,6 +48,20 @@ SqlFunc.Contains(u.BuildName, keyword) || SqlFunc.IsNullOrEmpty(keyword)))
|
||||
RoomID = SqlFunc.AggregateMax(ru.RoomID),
|
||||
Owner = SqlFunc.Subqueryable<SubTable>().Where(r => r.RoomID == ru.RoomID && SqlFunc.Equals(r.RoomUserType, "业主") && SqlFunc.Equals(r.RoomUserType, "业主")).Select(s => s.RoomerName)
|
||||
}).OrderBy((r) => r.RoomNumber, type: OrderByType.Desc).ToPageListAsync(1, 2).Wait();
|
||||
|
||||
GetInstance().Updateable<Student>().UpdateColumns(it =>
|
||||
new Student() {
|
||||
Name = "a".ToString(),
|
||||
CreateTime=DateTime.Now.AddDays(-1)
|
||||
|
||||
}
|
||||
).Where(it=>it.Id==1).ExecuteCommand();
|
||||
|
||||
|
||||
var list = GetInstance().Queryable<Student, School>((st, sc) => new object[] {
|
||||
JoinType.Left,st.SchoolId==sc.Id&&st.CreateTime==DateTime.Now.AddDays(-1)
|
||||
})
|
||||
.Where(st => st.Name == "jack").ToList();
|
||||
}
|
||||
public class MainTable
|
||||
{
|
||||
|
@@ -63,19 +63,28 @@ namespace SqlSugar
|
||||
{
|
||||
if (_Result == null) return null;
|
||||
if (IsUpper)
|
||||
return _Result.ToString().ToUpper().TrimEnd(',');
|
||||
return _Result.ToString().ToUpper().Replace(UtilConstants.ReplaceCommaKey,",").TrimEnd(',');
|
||||
else
|
||||
return _Result.ToString().TrimEnd(',');
|
||||
return _Result.ToString().Replace(UtilConstants.ReplaceCommaKey, ",").TrimEnd(',');
|
||||
}
|
||||
#region functions
|
||||
public string[] GetResultArray()
|
||||
{
|
||||
if (this._Result == null) return null;
|
||||
var reslut = new List<string>();
|
||||
|
||||
if (IsUpper)
|
||||
reslut= this.Result.ToString().ToUpper().TrimEnd(',').Split(',').ToList();
|
||||
else
|
||||
reslut= this.Result.ToString().TrimEnd(',').Split(',').ToList();
|
||||
|
||||
if (this.Result.ToString().Contains(UtilConstants.ReplaceCommaKey))
|
||||
{
|
||||
for (int i = 0; i < reslut.Count; i++)
|
||||
{
|
||||
reslut[i] = reslut[i].Replace(UtilConstants.ReplaceCommaKey, ",");
|
||||
}
|
||||
}
|
||||
return reslut.ToArray();
|
||||
}
|
||||
|
||||
@@ -84,12 +93,12 @@ namespace SqlSugar
|
||||
if (this._Result == null) return null;
|
||||
if (this._ResolveExpressType.IsIn(ResolveExpressType.SelectMultiple, ResolveExpressType.SelectSingle))
|
||||
{
|
||||
return this.Result.ToString().TrimEnd(',');
|
||||
return this.Result.ToString().Replace(UtilConstants.ReplaceCommaKey, ",").TrimEnd(',');
|
||||
}
|
||||
if (IsUpper)
|
||||
return this.Result.ToString().ToUpper();
|
||||
return this.Result.ToString().Replace(UtilConstants.ReplaceCommaKey, ",").ToUpper();
|
||||
else
|
||||
return this.Result.ToString();
|
||||
return this.Result.ToString().Replace(UtilConstants.ReplaceCommaKey, ",");
|
||||
}
|
||||
|
||||
public void TrimEnd()
|
||||
|
@@ -124,7 +124,7 @@ namespace SqlSugar
|
||||
{
|
||||
base.Expression = item;
|
||||
base.Start();
|
||||
parameter.Context.Result.Append(base.Context.GetEqString(memberName, parameter.CommonTempData.ObjToString()));
|
||||
parameter.Context.Result.Append(base.Context.GetEqString(memberName, parameter.CommonTempData.ObjToString().Replace(",", UtilConstants.ReplaceCommaKey)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -42,11 +42,11 @@ namespace SqlSugar
|
||||
{
|
||||
if (i > 0)
|
||||
{
|
||||
base.Context.Result.Append("," + parameter.CommonTempData.ObjToString() + ",");
|
||||
base.Context.Result.Append("," + parameter.CommonTempData.ObjToString().Replace(",",UtilConstants.ReplaceCommaKey) + ",");
|
||||
}
|
||||
else
|
||||
{
|
||||
base.Context.Result.Append(parameter.CommonTempData.ObjToString() + ",");
|
||||
base.Context.Result.Append(parameter.CommonTempData.ObjToString().Replace(",", UtilConstants.ReplaceCommaKey) + ",");
|
||||
}
|
||||
++i;
|
||||
}
|
||||
|
@@ -13,6 +13,7 @@ namespace SqlSugar
|
||||
internal const char SpaceChar =' ';
|
||||
internal const string AssemblyName = "SqlSugar";
|
||||
internal const string ReplaceKey = "{662E689B-17A1-4D06-9D27-F29EAB8BC3D6}";
|
||||
internal const string ReplaceCommaKey = "{112A689B-17A1-4A06-9D27-A39EAB8BC3D5}";
|
||||
|
||||
internal static Type IntType = typeof(int);
|
||||
internal static Type LongType = typeof(long);
|
||||
|
Reference in New Issue
Block a user