diff --git a/Src/Asp.Net/SqlServerTest/Demos/CS_TeacherStudent.cs b/Src/Asp.Net/SqlServerTest/Demos/CS_TeacherStudent.cs new file mode 100644 index 000000000..272ae4df2 --- /dev/null +++ b/Src/Asp.Net/SqlServerTest/Demos/CS_TeacherStudent.cs @@ -0,0 +1,88 @@ +using System; +using System.Linq; +using System.Text; + +namespace OrmTest.Demo +{ + public class CS_TeacherStudent + { + + /// + /// Desc:- + /// Default:(newid()) + /// Nullable:False + /// + public Guid tabId {get;set;} + + /// + /// Desc:教师Id + /// Default:- + /// Nullable:False + /// + public string teacherId {get;set;} + + /// + /// Desc:教师课程Id(对应TeacherCourse.tabId) + /// Default:- + /// Nullable:False + /// + public string teacherCourseId {get;set;} + + /// + /// Desc:教学头内的序号 + /// Default:- + /// Nullable:True + /// + public int? ordInTC {get;set;} + + /// + /// Desc:学号 + /// Default:- + /// Nullable:False + /// + public string stuId {get;set;} + + /// + /// Desc:学生姓名 + /// Default:- + /// Nullable:True + /// + public string stuName {get;set;} + + /// + /// Desc:性别 + /// Default:- + /// Nullable:True + /// + public string stuSex {get;set;} + + /// + /// Desc:所属院系Id + /// Default:- + /// Nullable:True + /// + public string deptId {get;set;} + + /// + /// Desc:所属班级Id + /// Default:- + /// Nullable:True + /// + public string classId {get;set;} + + /// + /// Desc:不能对应班级代码的班级名称时源班级名称 + /// Default:- + /// Nullable:True + /// + public string sclassName {get;set;} + + /// + /// Desc:- + /// Default:((1)) + /// Nullable:True + /// + public int? validFlag {get;set;} + + } +} diff --git a/Src/Asp.Net/SqlServerTest/SqlServerTest.csproj b/Src/Asp.Net/SqlServerTest/SqlServerTest.csproj index 5e005b75c..c8ca32a48 100644 --- a/Src/Asp.Net/SqlServerTest/SqlServerTest.csproj +++ b/Src/Asp.Net/SqlServerTest/SqlServerTest.csproj @@ -54,6 +54,7 @@ + diff --git a/Src/Asp.Net/SqlServerTest/UnitTest/Update.cs b/Src/Asp.Net/SqlServerTest/UnitTest/Update.cs index bde5ffe24..62a1fa491 100644 --- a/Src/Asp.Net/SqlServerTest/UnitTest/Update.cs +++ b/Src/Asp.Net/SqlServerTest/UnitTest/Update.cs @@ -116,10 +116,10 @@ namespace OrmTest.UnitTest string name = "x"; var t10 = db.Updateable().UpdateColumns(it => new Student() { Name =name, SchoolId=updateObj.SchoolId }).Where(it=>it.Id==11).ToSql(); base.Check(@"UPDATE [STudent] SET - [SchoolId] = @Const0 , [Name] = @const3 WHERE ( [ID] = @Id1 )", new List() { - new SugarParameter("@const3","x"), - new SugarParameter("@Const0",18), - new SugarParameter("@Id1",11)}, + [SchoolId] = @Const1 , [Name] = @Const0 WHERE ( [ID] = @Id2 )", new List() { + new SugarParameter("@Const1",18), + new SugarParameter("@Const0","x"), + new SugarParameter("@Id2",11)}, t10.Key, t10.Value, "Update 10 error" diff --git a/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MemberInitExpressionResolve.cs b/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MemberInitExpressionResolve.cs index 0e0811bd9..32abdfdd2 100644 --- a/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MemberInitExpressionResolve.cs +++ b/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MemberInitExpressionResolve.cs @@ -59,9 +59,10 @@ namespace SqlSugar { base.Expression = item; base.Start(); - string parameterName = this.Context.SqlParameterKeyWord + "const" + this.ContentIndex; + string parameterName = this.Context.SqlParameterKeyWord + ExpressionConst.Const+ this.Context.ParameterIndex; parameter.Context.Result.Append(base.Context.GetEqString(memberName, parameterName)); this.Context.Parameters.Add(new SugarParameter(parameterName, parameter.CommonTempData)); + this.Context.ParameterIndex++; } else if (item is MethodCallExpression) { @@ -79,7 +80,6 @@ namespace SqlSugar base.Expression = item; base.Start(); parameter.IsAppendResult(); - string parameterName = this.Context.SqlParameterKeyWord + "const" + +this.ContentIndex; ; parameter.Context.Result.Append(base.Context.GetEqString(memberName, parameter.CommonTempData.ObjToString())); base.Context.Result.CurrentParameter = null; }