This commit is contained in:
sunkaixuan
2019-04-20 19:10:41 +08:00
parent 4ba7e62740
commit ba34eb58ac

View File

@@ -21,6 +21,11 @@ namespace OrmTest.BugTest
DbType = DbType.SqlServer, DbType = DbType.SqlServer,
IsAutoCloseConnection = true IsAutoCloseConnection = true
}); });
db.Aop.OnLogExecuting = (sql, pars) =>
{
Console.WriteLine(sql + "\r\n" + db.Utilities.SerializeObject(pars.ToDictionary(it => it.ParameterName, it => it.Value)));
Console.WriteLine();
};
return db; return db;
} }
} }
@@ -108,7 +113,7 @@ namespace OrmTest.BugTest
Guid newCarTypePictureId = Guid.Empty; Guid newCarTypePictureId = Guid.Empty;
Guid carTypePictureId = Guid.Empty; Guid carTypePictureId = Guid.Empty;
DB.CodeFirst.InitTables(typeof(Picture)); DB.CodeFirst.InitTables(typeof(Picture),typeof(JobPlan));
DB.Updateable<Picture>() DB.Updateable<Picture>()
.UpdateColumns(p => p.Value == SqlFunc.Subqueryable<Picture>() .UpdateColumns(p => p.Value == SqlFunc.Subqueryable<Picture>()
.Where(pp => pp.ID == newCarTypePictureId) .Where(pp => pp.ID == newCarTypePictureId)
@@ -120,8 +125,40 @@ namespace OrmTest.BugTest
.Select(pp => pp.Value)) .Select(pp => pp.Value))
.Where(p => p.ID == carTypePictureId).ExecuteCommand(); .Where(p => p.ID == carTypePictureId).ExecuteCommand();
var list = new List<JobPlan>()
{
new JobPlan() { },
new JobPlan() { }
};
DB.Updateable(new JobPlan() { })
.WhereColumns(s => new { s.CmdNo })
.UpdateColumns(s => new
{
s.HeatNo,
s.CmdNo
}).ExecuteCommand();
} }
} }
/// <summary>
/// 表示作业计划表,保存用户确认的作业计划。
/// </summary>
[SugarTable("PL_JOB_PLAN")]
public class JobPlan
{
public long Id { get; set; }
/// <summary>
/// 获取或设置炉次号。
/// </summary>
public string HeatNo { get; set; }
/// <summary>
/// 获取或设置制造命令号。
/// </summary>
[SugarColumn(ColumnName = "PONO")]
public string CmdNo { get; set; }
}
public partial class Picture public partial class Picture
{ {
public Picture() public Picture()