Update DateOnly

This commit is contained in:
sunkaixuan
2024-08-04 21:55:34 +08:00
parent ab576f2367
commit adbef253c1

View File

@@ -736,6 +736,7 @@ namespace SqlSugar
var addItem = readerValues[info]; var addItem = readerValues[info];
if (addItem == DBNull.Value) if (addItem == DBNull.Value)
addItem = null; addItem = null;
var underType = UtilMethods.GetUnderType(prop.PropertyType);
if (prop.PropertyType == UtilConstants.IntType) if (prop.PropertyType == UtilConstants.IntType)
{ {
addItem = addItem.ObjToInt(); addItem = addItem.ObjToInt();
@@ -752,6 +753,10 @@ namespace SqlSugar
{ {
addItem = addItem.ObjToInt(); addItem = addItem.ObjToInt();
} }
else if (addItem!=null&&underType?.FullName == "System.DateOnly")
{
addItem = Convert.ToDateTime(addItem).ToString("yyyy-MM-dd");
}
else if (UtilMethods.GetUnderType(prop.PropertyType).IsEnum() && addItem is decimal) else if (UtilMethods.GetUnderType(prop.PropertyType).IsEnum() && addItem is decimal)
{ {
if (prop.PropertyType.IsEnum() == false && addItem == null) if (prop.PropertyType.IsEnum() == false && addItem == null)