Browse Source

Expression Bug

pull/12/MERGE
sunkaixuan 7 years ago
parent
commit
036b6288f4
  1. 517
      Src/Asp.Net/SqlServerTest/Models/CapitalEntity.cs
  2. 1
      Src/Asp.Net/SqlServerTest/SqlServerTest.csproj
  3. 13
      Src/Asp.Net/SqlServerTest/UnitTest/Query/SingleQuery.cs
  4. 6
      Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve.cs

517
Src/Asp.Net/SqlServerTest/Models/CapitalEntity.cs

@ -0,0 +1,517 @@
using SqlSugar;
using System;
using System.Linq;
using System.Text;
namespace OrmTest.Models
{
[SugarTable("RENT_CAPITAL")]
public partial class CapitalEntity
{
public CapitalEntity()
{
}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:False
/// </summary>
[SugarColumn(IsPrimaryKey=true)]
public string QrfId {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public string RiseId {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public string Quart {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public string Rise {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public string Flat {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public string QrfCode {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public string QrfName {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public string ComProp {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public string HallProp {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public string FlatProp {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public string Flatsrc {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public string Flatbus {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public string Flatfund {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public decimal? Keynum {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public decimal? Areas {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public string FlatStatus {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public string FlatstatusFix {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public string FlatstatusAllo {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public string FlatalloProp {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public string FaceProp {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public decimal? Facepara {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public decimal? Floorpara {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public string Prcbymode {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public decimal? PrcBase {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public decimal? PrcLimt {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public decimal? PrcWelf {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public decimal? PrcProf {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public decimal? PrcDiff {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public decimal? PrcGgzl {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public decimal? PrcMark {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public decimal? PrcPabl {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public decimal? PrcPbrh {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public decimal? PrcBack {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public int? IsWatsew {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public string Elecapty {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public int? IsCenair {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public int? IsPipgas {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public string GassUserno {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public string RentType {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public string WatAcctName {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public string WatBankno {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public string WatAccts {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public decimal? Flatlayer {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public string FlatCode {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public string Acces {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public string Descs {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public DateTime? SynDate {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public DateTime? CreateTime {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public string CreateUser {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public DateTime? EditTime {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public string EditUser {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public int? IsVaild {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public int? IsProxy {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public int? IsBused {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public int? IsMfee {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public string MFeeStDate {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public int? IsFfee {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public string FFeeStDate {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public decimal? FeeManage {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public decimal? FeeFixfund {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public string ZapProp {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public string ZapUser {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public DateTime? ZapTime {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public DateTime? EndfixTime {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public string Zfsx {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public int? IsProprec {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public string EsriLocationx {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public string EsriLocationy {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:False
/// </summary>
public string CompanyId {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:False
/// </summary>
public int IsSysData {get;set;}
/// <summary>
/// Desc:-
/// Default:-
/// Nullable:True
/// </summary>
public string Remark {get;set;}
}
}

1
Src/Asp.Net/SqlServerTest/SqlServerTest.csproj

@ -47,6 +47,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Models\CapitalEntity.cs" />
<Compile Include="Config.cs" />
<Compile Include="Demos\5_CodeFirst.cs" />
<Compile Include="Demos\6_ComplexModel.cs" />

13
Src/Asp.Net/SqlServerTest/UnitTest/Query/SingleQuery.cs

@ -132,6 +132,19 @@ namespace OrmTest.UnitTest
new List<SugarParameter>() {
new SugarParameter("@Name0","a")
}, t14.Key, t14.Value, "single t14 error ");
var t15 = db.Queryable<CapitalEntity>()
.Select(x => new
{
TGYArea = SqlFunc.AggregateSum(SqlFunc.IIF(x.FlatProp == "1", x.Areas, 0))
}).ToSql();
base.Check("SELECT SUM(( CASE WHEN ( [FlatProp] = @FlatProp0 ) THEN [Areas] ELSE @MethodConst1 END )) AS [TGYArea] FROM [RENT_CAPITAL] ", new List<SugarParameter>()
{
new SugarParameter("@FlatProp0","1"),
new SugarParameter("@MethodConst1",0)
}, t15.Key, t15.Value, "single t15 error");
}
}
}

6
Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve.cs

@ -231,7 +231,11 @@ namespace SqlSugar
{
foreach (var item in args)
{
AppendItem(parameter, name, args, model, item);
var expItem = item;
if (item is UnaryExpression) {
expItem = (item as UnaryExpression).Operand;
}
AppendItem(parameter, name, args, model, expItem);
}
if (appendArgs != null)
{

Loading…
Cancel
Save