SqlSugar/Src/Asp.NetCore2/SqlSeverTest/UserTestCases/UnitTest/Unitsdfa1231.cs
2024-08-25 15:45:09 +08:00

39 lines
1.0 KiB
C#

using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OrmTest
{
internal class Unitsdfa1231
{
public static void Init()
{
var db = NewUnitTest.Db;
db.CodeFirst.InitTables<CnDataDTO>();
var sql1 = db.Queryable<CnDataDTO>()
.Distinct()
.Select(it => new CnDataDTO()
{
time = SqlFunc.ToDate(it.time)
}, true)
.MergeTable()
.OrderBy(it => it.time)
.ToList();
}
[SugarTable("Unit1sacndata")]
public class CnDataDTO
{
[SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "序号")]
public int id { get; set; }
public string name { get; set; }
public string code { get; set; }
public string type { get; set; }
public DateTime time { get; set; }
}
}
}