mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-11-09 10:55:02 +08:00
Exp To SqlBUG
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
using OrmTest.Demo;
|
using Models;
|
||||||
|
using OrmTest.Demo;
|
||||||
using OrmTest.Models;
|
using OrmTest.Models;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
using System;
|
using System;
|
||||||
@@ -32,7 +33,7 @@ namespace OrmTest.BugTest
|
|||||||
var buildId = "";
|
var buildId = "";
|
||||||
var unitId = "";
|
var unitId = "";
|
||||||
var keyword = "";
|
var keyword = "";
|
||||||
GetInstance().CodeFirst.InitTables(typeof(MainTable), typeof(SubTable));
|
GetInstance().CodeFirst.InitTables(typeof(MainTable), typeof(SubTable), typeof(Brand), typeof(VendorAndBrand));
|
||||||
GetInstance().Queryable<MainTable>().Where(u =>
|
GetInstance().Queryable<MainTable>().Where(u =>
|
||||||
(u.CommunityID == communityId || SqlFunc.IsNullOrEmpty(communityId)) &&
|
(u.CommunityID == communityId || SqlFunc.IsNullOrEmpty(communityId)) &&
|
||||||
(SqlFunc.Contains(u.BuildID, buildId) || SqlFunc.IsNullOrEmpty(buildId)) &&
|
(SqlFunc.Contains(u.BuildID, buildId) || SqlFunc.IsNullOrEmpty(buildId)) &&
|
||||||
@@ -67,6 +68,17 @@ SqlFunc.Contains(u.BuildName, keyword) || SqlFunc.IsNullOrEmpty(keyword)))
|
|||||||
|
|
||||||
GetInstance().Updateable<BugStudent>().Where(it => true).UpdateColumns(it => new BugStudent() { Float = 11 }).ExecuteCommand();
|
GetInstance().Updateable<BugStudent>().Where(it => true).UpdateColumns(it => new BugStudent() { Float = 11 }).ExecuteCommand();
|
||||||
var reslut = GetInstance().Queryable<BugStudent>().ToList();
|
var reslut = GetInstance().Queryable<BugStudent>().ToList();
|
||||||
|
|
||||||
|
var list2 = GetInstance().Queryable<Brand, VendorAndBrand>((b, vb) => new object[] {
|
||||||
|
JoinType.Left,b.Id == vb.BrandId
|
||||||
|
})
|
||||||
|
.Where((b) => b.BrandType == 1).Select((b) => b).ToList();
|
||||||
|
|
||||||
|
|
||||||
|
var list3 = GetInstance().Queryable<Brand, VendorAndBrand>((b, vb) =>
|
||||||
|
b.Id == vb.BrandId)
|
||||||
|
. Where((b) => b.BrandType == 1).Select((b) => b).ToList();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
139
Src/Asp.Net/SqlServerTest/Models/Brand.cs
Normal file
139
Src/Asp.Net/SqlServerTest/Models/Brand.cs
Normal file
@@ -0,0 +1,139 @@
|
|||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using SqlSugar;
|
||||||
|
|
||||||
|
namespace Models
|
||||||
|
{
|
||||||
|
///<summary>
|
||||||
|
///品牌
|
||||||
|
///</summary>
|
||||||
|
[SugarTable("Brand")]
|
||||||
|
public partial class Brand
|
||||||
|
{
|
||||||
|
public Brand(){
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:
|
||||||
|
/// Default:
|
||||||
|
/// Nullable:False
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsPrimaryKey=true,IsIdentity=true)]
|
||||||
|
public int Id {get;set;}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:名称
|
||||||
|
/// Default:
|
||||||
|
/// Nullable:False
|
||||||
|
/// </summary>
|
||||||
|
public string Name {get;set;}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:品牌别名
|
||||||
|
/// Default:
|
||||||
|
/// Nullable:True
|
||||||
|
/// </summary>
|
||||||
|
public string AliasName {get;set;}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:顺序
|
||||||
|
/// Default:0
|
||||||
|
/// Nullable:True
|
||||||
|
/// </summary>
|
||||||
|
public int? Sequence {get;set;}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:网址
|
||||||
|
/// Default:
|
||||||
|
/// Nullable:True
|
||||||
|
/// </summary>
|
||||||
|
public string Url {get;set;}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:Logo图片路径
|
||||||
|
/// Default:
|
||||||
|
/// Nullable:True
|
||||||
|
/// </summary>
|
||||||
|
public string LogoPath {get;set;}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:模板类型(0:默认)
|
||||||
|
/// Default:0
|
||||||
|
/// Nullable:True
|
||||||
|
/// </summary>
|
||||||
|
public int? Templet {get;set;}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:页面标题
|
||||||
|
/// Default:
|
||||||
|
/// Nullable:True
|
||||||
|
/// </summary>
|
||||||
|
public string PageTitle {get;set;}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:页面关键字
|
||||||
|
/// Default:
|
||||||
|
/// Nullable:True
|
||||||
|
/// </summary>
|
||||||
|
public string PageKeywords {get;set;}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:PageDesc页面描述
|
||||||
|
/// Default:
|
||||||
|
/// Nullable:True
|
||||||
|
/// </summary>
|
||||||
|
public string PageDesc {get;set;}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:详细说明
|
||||||
|
/// Default:
|
||||||
|
/// Nullable:True
|
||||||
|
/// </summary>
|
||||||
|
public string DetailedDesc {get;set;}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:状态(0正常,1暂停,3删除等)
|
||||||
|
/// Default:0
|
||||||
|
/// Nullable:True
|
||||||
|
/// </summary>
|
||||||
|
public short? Status {get;set;}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:
|
||||||
|
/// Default:DateTime.Now
|
||||||
|
/// Nullable:False
|
||||||
|
/// </summary>
|
||||||
|
public DateTime CreateTime {get;set;}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:
|
||||||
|
/// Default:
|
||||||
|
/// Nullable:True
|
||||||
|
/// </summary>
|
||||||
|
public string CreateUser {get;set;}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:ModifyTime
|
||||||
|
/// Default:DateTime.Now
|
||||||
|
/// Nullable:True
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? ModifyTime {get;set;}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:
|
||||||
|
/// Default:
|
||||||
|
/// Nullable:True
|
||||||
|
/// </summary>
|
||||||
|
public string ModifyUser {get;set;}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:
|
||||||
|
/// Default:
|
||||||
|
/// Nullable:True
|
||||||
|
/// </summary>
|
||||||
|
public int? BrandType {get;set;}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
48
Src/Asp.Net/SqlServerTest/Models/VendorAndBrand.cs
Normal file
48
Src/Asp.Net/SqlServerTest/Models/VendorAndBrand.cs
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using SqlSugar;
|
||||||
|
|
||||||
|
namespace Models
|
||||||
|
{
|
||||||
|
///<summary>
|
||||||
|
///
|
||||||
|
///</summary>
|
||||||
|
[SugarTable("VendorAndBrand")]
|
||||||
|
public partial class VendorAndBrand
|
||||||
|
{
|
||||||
|
public VendorAndBrand(){
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:
|
||||||
|
/// Default:
|
||||||
|
/// Nullable:False
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsPrimaryKey=true,IsIdentity=true)]
|
||||||
|
public long Id {get;set;}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:商户编号
|
||||||
|
/// Default:
|
||||||
|
/// Nullable:True
|
||||||
|
/// </summary>
|
||||||
|
public long? VendorId {get;set;}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:
|
||||||
|
/// Default:
|
||||||
|
/// Nullable:True
|
||||||
|
/// </summary>
|
||||||
|
public long? BrandId {get;set;}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:创建时间
|
||||||
|
/// Default:DateTime.Now
|
||||||
|
/// Nullable:True
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? CreateTime {get;set;}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -49,7 +49,9 @@
|
|||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="Models\Brand.cs" />
|
||||||
<Compile Include="BugTest\Bug1.cs" />
|
<Compile Include="BugTest\Bug1.cs" />
|
||||||
|
<Compile Include="Models\VendorAndBrand.cs" />
|
||||||
<Compile Include="Demos\F_VersionValidation.cs" />
|
<Compile Include="Demos\F_VersionValidation.cs" />
|
||||||
<Compile Include="Demos\G_Mapper.cs" />
|
<Compile Include="Demos\G_Mapper.cs" />
|
||||||
<Compile Include="Demos\H_ExtEntity.cs" />
|
<Compile Include="Demos\H_ExtEntity.cs" />
|
||||||
|
|||||||
@@ -32,6 +32,10 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
base.Context.Result.Replace(ExpressionConst.FormatSymbol, ExpressionConst.LeftParenthesis + ExpressionConst.FormatSymbol);
|
base.Context.Result.Replace(ExpressionConst.FormatSymbol, ExpressionConst.LeftParenthesis + ExpressionConst.FormatSymbol);
|
||||||
}
|
}
|
||||||
|
if (leftExpression is UnaryExpression&& (leftExpression as UnaryExpression).Operand is UnaryExpression)
|
||||||
|
{
|
||||||
|
leftExpression = (leftExpression as UnaryExpression).Operand;
|
||||||
|
}
|
||||||
parameter.LeftExpression = leftExpression;
|
parameter.LeftExpression = leftExpression;
|
||||||
parameter.RightExpression = rightExpression;
|
parameter.RightExpression = rightExpression;
|
||||||
base.Expression = leftExpression;
|
base.Expression = leftExpression;
|
||||||
|
|||||||
Reference in New Issue
Block a user