mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-19 18:22:23 +08:00
Update Simple join
This commit is contained in:
@@ -23,9 +23,21 @@ namespace OrmTest.UnitTest
|
|||||||
Q1();
|
Q1();
|
||||||
Q2();
|
Q2();
|
||||||
Q3();
|
Q3();
|
||||||
|
Q4();
|
||||||
}
|
}
|
||||||
base.End("Method Test");
|
base.End("Method Test");
|
||||||
}
|
}
|
||||||
|
private void Q4()
|
||||||
|
{
|
||||||
|
using (var db = GetInstance())
|
||||||
|
{
|
||||||
|
db.MappingTables.Add("School", "SchoolTable");
|
||||||
|
var join4 = db.Queryable<Student, School>((st, sc) => st.SchoolId == sc.Id).Select(st=>st).ToSql();
|
||||||
|
string sql = @"SELECT st.* FROM [STudent] st ,[SchoolTable] sc WHERE ( [st].[SchoolId] = [sc].[Id] ) ";
|
||||||
|
base.Check(sql, null, join4.Key, null, "join 4 Error");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void Q3()
|
private void Q3()
|
||||||
{
|
{
|
||||||
|
@@ -385,13 +385,14 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
if (this.EasyJoinInfos.IsValuable())
|
if (this.EasyJoinInfos.IsValuable())
|
||||||
{
|
{
|
||||||
|
|
||||||
if (this.TableWithString.IsValuable())
|
if (this.TableWithString.IsValuable())
|
||||||
{
|
{
|
||||||
result += "," + string.Join(",", this.EasyJoinInfos.Select(it => string.Format("{0} {1} {2} ", it.Value, it.Key, TableWithString)));
|
result += "," + string.Join(",", this.EasyJoinInfos.Select(it => string.Format("{0} {1} {2} ",GetTableName(it.Value), it.Key, TableWithString)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
result += "," + string.Join(",", this.EasyJoinInfos.Select(it => string.Format("{0} {1} ", it.Value, it.Key)));
|
result += "," + string.Join(",", this.EasyJoinInfos.Select(it => string.Format("{0} {1} ", GetTableName(it.Value), it.Key)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@@ -425,5 +426,11 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
private string GetTableName(string entityName)
|
||||||
|
{
|
||||||
|
var result = this.Context.EntityProvider.GetTableName(entityName);
|
||||||
|
return this.Builder.GetTranslationTableName(result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
|
|||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("4.1.1.0")]
|
[assembly: AssemblyVersion("4.1.1.1")]
|
||||||
[assembly: AssemblyFileVersion("4.1.1.0")]
|
[assembly: AssemblyFileVersion("4.1.1.1")]
|
||||||
|
Reference in New Issue
Block a user