using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using SqlSugar; namespace OrmTest { public class UCustom07 { public static void Init() { var db = NewUnitTest.Db; db.CodeFirst.InitTables(); var list = new List(); list.Add(new Building() { Address = "山东济南幸福家园小区", BuildingCode = "yfjy-1", BuildingId = Guid.NewGuid() + "", BuildingName = "幸福家园-1", CardNum = "kh123", CommunityId = "FG4PpbtA3yPXtXTONfxAV", CreateTime = DateTime.Now, HeatArea = 20000, OrganizationID = Guid.NewGuid(), Roomcount = 200, StartDate = "2022-8-17", State = 1, StationPartitionId =null }); list.Add(new Building() { Address = "山东济南幸福家园小区", BuildingCode = "yfjy-2", BuildingId = Guid.NewGuid()+"", BuildingName = "幸福家园-2", CardNum = "kh123", CommunityId = "FG4PpbtA3yPXtXTONfxAV", CreateTime = DateTime.Now, HeatArea = 20000, OrganizationID = Guid.NewGuid(), Roomcount = 200, StartDate = "2022-8-17", State = 1, StationPartitionId = null }); db.Utilities.PageEach(list, 200, page => { var x = db.Storageable(page).ToStorage(); x.BulkCopy(); }); } } /// /// 建筑表 /// [SugarTable("building111")] public class Building { /// /// 主键ID /// [SugarColumn(ColumnName = "buildingid", IsPrimaryKey = true, ColumnDataType = "varchar(51)")] public string BuildingId { get; set; } /// /// 供热站分区ID /// [SugarColumn(ColumnName = "stationpartitionid", IsNullable = true, ColumnDescription = "供热站分区ID", ColumnDataType = "varchar(21)")] public string StationPartitionId { get; set; } /// /// 小区ID /// [SugarColumn(ColumnName = "communityid", IsNullable = true, ColumnDescription = "小区ID", ColumnDataType = "varchar(21)")] public string CommunityId { get; set; } /// /// 所属公司ID /// [SugarColumn(ColumnName = "organizationid", IsNullable = true, ColumnDescription = "所属公司ID")] public Guid OrganizationID { get; set; } /// /// 楼栋编号 /// [SugarColumn(ColumnName = "buildingcode", IsNullable = true, ColumnDataType = "varchar(40)", ColumnDescription = "楼栋编号")] public string BuildingCode { get; set; } /// /// 楼栋名称 /// [SugarColumn(ColumnName = "buildingname", IsNullable = true, ColumnDataType = "varchar(80)", ColumnDescription = "楼栋名称")] public string BuildingName { get; set; } /// /// 卡号 /// [SugarColumn(ColumnName = "cardnum", IsNullable = true, ColumnDataType = "varchar(20)", ColumnDescription = "卡号")] public string CardNum { get; set; } /// /// 状态 /// [SugarColumn(ColumnName = "state", IsNullable = true, ColumnDescription = "状态")] public int State { get; set; } /// /// 地址 /// [SugarColumn(ColumnName = "address", IsNullable = true, ColumnDataType = "varchar(255)", ColumnDescription = "地址")] public string Address { get; set; } /// /// 户数 /// [SugarColumn(ColumnName = "roomcount", IsNullable = true, ColumnDescription = "户数")] public int Roomcount { get; set; } /// /// 供热面积 /// [SugarColumn(ColumnName = "heatarea", IsNullable = true, ColumnDescription = "供热面积")] public double HeatArea { get; set; } /// /// 接入日期 /// [SugarColumn(ColumnName = "startdate", IsNullable = true, ColumnDataType = "varchar(20)", ColumnDescription = "接入日期")] public string StartDate { get; set; } /// /// 创建时间 /// [SugarColumn(ColumnName = "createtime", IsNullable = true, ColumnDescription = "创建时间")] public DateTime CreateTime { get; set; } } }