使用UpdateColumns更新数据不成功 返回
话不多 发布于2026/1/27
数据库 mysql
使用sqlsugarcore版本5.1.4.201
ISqlSugarClient使用AddSingleton单例注册
在定时任务中更新数据
var db = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().CopyNew();
var count = await db.Updateable(orderList).UpdateColumns(w => new { w.ExpressPlatformCode, w.ModifyUserId, w.ModifyTime }).ExecuteCommandAsync();
2026-01-26 23:59:55.638 [Information] (ZhaoJin.Postal.AutoJob.Job.PostalPickupTimeSubmitJob) 开始推送保单:260126135456233584SJ,时间01/26/2026 23:59:55
2026-01-26 23:59:58.202 [Information] (ZhaoJin.Postal.AutoJob.Job.PostalPickupTimeSubmitJob) 订单ExpressPlatformCode:260126235955333
2026-01-26 23:59:58.208 [Information] (ZhaoJin.Postal.AutoJob.Job.PostalPickupTimeSubmitJob) 更新数据:{"BusinessId":"c61efac7-8beb-4591-bc54-ce73cf193c05","UserId":"1997910442177081344","OrderNo":"260126135456233584SJ","OrderStatus":2,"ReturnStatus":0,"InsuredAttribute":1,"InsurerTitle":"","InsurerCode":"","DeliverName":"","DeliverMobile":"+NpGds4pwWbIqLIQ2QdY/g==","DeliverProvince":"重庆市","DeliverCity":"重庆市","DeliverDistrict":"","DeliverStreet":"","ReceiverName":"","ReceiverMobile":"","ReceiverProvince":"广西壮族自治区","ReceiverCity":"北海市","ReceiverDistrict":"","ReceiverStreet":"","InsuranceCode":"","InsurancePhotoPath":"","InsuranceFileAddress":"","ActualMoney":60000.00,"InsuranceMoney":60000.00,"InsuranceRote":2.000,"InsurancePrice":12.00,"ServingFee":6.00,"InsuranceType":"银饰","InsuranceQuantity":1,"ExpressCompany":"顺丰快递","ExpressNo":"","ExpressStatus":1,"EnableMark":1,"PayType":"WechatPay_JBH","PayTime":"2026-01-26 13:55:15","PickupTime":"2026-01-26 00:00:00","InsureTime":"1900-01-01 00:00:00","SignTime":"1900-01-01 00:00:00","ExpressPlatformCode":"260126235955333","DeleteMark":0,"CreateUserId":"dd7f6093-9ee8-4169-9db2-f99dbe0fc50b","CreateTime":"2026-01-26 13:54:56","ModifyUserId":"a856810d-f548-42b9-a9f9-286d4eb31cdf","ModifyTime":"2026-01-26 23:59:58","Id":"2015664732954046464"}
这是其中一条数据 看到ExpressPlatformCode 和"ModifyTime"是有值的 但是数据库的ExpressPlatformCode 是空的 ModifyTime也没有赋值成功
热忱回答(1)
-
fate sta VIP0
2026/1/27https://www.donet5.com/Home/Doc?typeId=2366
按模版写DEMO自测。有疑问提供DEMO
0 回复