mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-10-15 18:55:07 +08:00
Update Subquery.ToList
This commit is contained in:
@@ -1510,15 +1510,18 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
var item = result[i];
|
var item = result[i];
|
||||||
var setValue = Activator.CreateInstance(itemProperty.PropertyType, true) as IList;
|
var setValue = Activator.CreateInstance(itemProperty.PropertyType, true) as IList;
|
||||||
var appindex = 0;
|
if (appendValue != null)
|
||||||
foreach (var appValue in appendValue)
|
|
||||||
{
|
{
|
||||||
if (appValue[0].Value.ObjToInt() == i)
|
var appindex = 0;
|
||||||
|
foreach (var appValue in appendValue)
|
||||||
{
|
{
|
||||||
var addItem = list[appindex];
|
if (appValue[0].Value.ObjToInt() == i)
|
||||||
setValue.Add(addItem);
|
{
|
||||||
|
var addItem = list[appindex];
|
||||||
|
setValue.Add(addItem);
|
||||||
|
}
|
||||||
|
appindex++;
|
||||||
}
|
}
|
||||||
appindex++;
|
|
||||||
}
|
}
|
||||||
var jobj = JObject.FromObject(item);
|
var jobj = JObject.FromObject(item);
|
||||||
var prop = jobj.Property(itemProperty.Name);
|
var prop = jobj.Property(itemProperty.Name);
|
||||||
|
@@ -850,6 +850,7 @@ namespace SqlSugar
|
|||||||
#region NoCopy
|
#region NoCopy
|
||||||
internal bool IsClone { get; set; }
|
internal bool IsClone { get; set; }
|
||||||
public bool NoCheckInclude { get; set; }
|
public bool NoCheckInclude { get; set; }
|
||||||
|
public virtual bool IsSelectNoAll { get; set; } = false;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private string GetTableName(string entityName)
|
private string GetTableName(string entityName)
|
||||||
|
@@ -111,7 +111,7 @@ namespace SqlSugar
|
|||||||
public bool Contains(string value)
|
public bool Contains(string value)
|
||||||
{
|
{
|
||||||
if (this.Result.Equals(value)) return true;
|
if (this.Result.Equals(value)) return true;
|
||||||
return (this.Result.ToString().Contains(value));
|
return (this.Result.ToString().ToLower().Contains(value?.ToLower()));
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void Insert(int index, string value)
|
internal void Insert(int index, string value)
|
||||||
|
@@ -45,8 +45,24 @@ namespace SqlSugar
|
|||||||
{;
|
{;
|
||||||
var exp = expression as MethodCallExpression;
|
var exp = expression as MethodCallExpression;
|
||||||
InitType(exp);
|
InitType(exp);
|
||||||
if (exp.Arguments.Count == 0)
|
var type=expression.Type;
|
||||||
|
if (type.FullName.IsCollectionsList()
|
||||||
|
&& exp.Arguments.Count == 0&& type.GenericTypeArguments.Length>0
|
||||||
|
&& this.Context.SugarContext!=null
|
||||||
|
&&this.Context.SugarContext.QueryBuilder.IsSelectNoAll)
|
||||||
|
{
|
||||||
|
var entity = type.GenericTypeArguments[0];
|
||||||
|
var columnNames=this.Context.SugarContext.Context.EntityMaintenance.GetEntityInfo(entity).Columns;
|
||||||
|
var columnsString = string.Join(",", columnNames
|
||||||
|
.Where(it => it.IsIgnore == false)
|
||||||
|
.Where(it => it.DbColumnName.HasValue())
|
||||||
|
.Select(it => this.Context.GetTranslationColumnName(it.DbColumnName)));
|
||||||
|
return $"{columnsString},@sugarIndex as sugarIndex";
|
||||||
|
}
|
||||||
|
else if (exp.Arguments.Count == 0)
|
||||||
|
{
|
||||||
return "*,@sugarIndex as sugarIndex";
|
return "*,@sugarIndex as sugarIndex";
|
||||||
|
}
|
||||||
var argExp = exp.Arguments[0];
|
var argExp = exp.Arguments[0];
|
||||||
var parametres = (argExp as LambdaExpression).Parameters;
|
var parametres = (argExp as LambdaExpression).Parameters;
|
||||||
if ((argExp as LambdaExpression).Body is UnaryExpression)
|
if ((argExp as LambdaExpression).Body is UnaryExpression)
|
||||||
|
@@ -50,6 +50,14 @@ namespace SqlSugar
|
|||||||
var result = base.GetTranslationColumnName(propertyName);
|
var result = base.GetTranslationColumnName(propertyName);
|
||||||
return result.ToUpper();
|
return result.ToUpper();
|
||||||
}
|
}
|
||||||
|
public override string RemoveParentheses(string sql)
|
||||||
|
{
|
||||||
|
if (sql.StartsWith("(") && sql.EndsWith(")"))
|
||||||
|
{
|
||||||
|
sql = sql.Substring(1, sql.Length - 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
return sql;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -9,6 +9,7 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
public class OracleQueryBuilder : QueryBuilder
|
public class OracleQueryBuilder : QueryBuilder
|
||||||
{
|
{
|
||||||
|
public override bool IsSelectNoAll { get; set; } = true;
|
||||||
public override bool IsComplexModel(string sql)
|
public override bool IsComplexModel(string sql)
|
||||||
{
|
{
|
||||||
return Regex.IsMatch(sql, @"AS ""\w+\.\w+""")|| Regex.IsMatch(sql, @"AS ""\w+\.\w+\.\w+""");
|
return Regex.IsMatch(sql, @"AS ""\w+\.\w+""")|| Regex.IsMatch(sql, @"AS ""\w+\.\w+\.\w+""");
|
||||||
|
@@ -148,6 +148,10 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
result = " DISTINCT " + result;
|
result = " DISTINCT " + result;
|
||||||
}
|
}
|
||||||
|
if (this.SubToListParameters != null && this.SubToListParameters.Any())
|
||||||
|
{
|
||||||
|
result = SubToListMethod(result);
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user