From 127cc65a15b8747a48f9e67ad4d82826bf206a3b Mon Sep 17 00:00:00 2001
From: sunkaixuan <610262374@qq.com>
Date: Thu, 18 Aug 2022 19:18:18 +0800
Subject: [PATCH] Add unit test
---
Src/Asp.Net/PgSqlTest/PgSqlTest.csproj | 1 +
Src/Asp.Net/PgSqlTest/UnitTest/Main.cs | 1 +
Src/Asp.Net/PgSqlTest/UnitTest/UCustom07.cs | 146 ++++++++++++++++++++
3 files changed, 148 insertions(+)
create mode 100644 Src/Asp.Net/PgSqlTest/UnitTest/UCustom07.cs
diff --git a/Src/Asp.Net/PgSqlTest/PgSqlTest.csproj b/Src/Asp.Net/PgSqlTest/PgSqlTest.csproj
index 513b78940..01a38b576 100644
--- a/Src/Asp.Net/PgSqlTest/PgSqlTest.csproj
+++ b/Src/Asp.Net/PgSqlTest/PgSqlTest.csproj
@@ -100,6 +100,7 @@
+
diff --git a/Src/Asp.Net/PgSqlTest/UnitTest/Main.cs b/Src/Asp.Net/PgSqlTest/UnitTest/Main.cs
index 2c951a30a..8cf4fbff2 100644
--- a/Src/Asp.Net/PgSqlTest/UnitTest/Main.cs
+++ b/Src/Asp.Net/PgSqlTest/UnitTest/Main.cs
@@ -31,6 +31,7 @@ namespace OrmTest
}
public static void Init()
{
+ UCustom07.Init();
UCustom016.Init();
UCustom08.Init();
UCustom012.Init();
diff --git a/Src/Asp.Net/PgSqlTest/UnitTest/UCustom07.cs b/Src/Asp.Net/PgSqlTest/UnitTest/UCustom07.cs
new file mode 100644
index 000000000..331cba5f2
--- /dev/null
+++ b/Src/Asp.Net/PgSqlTest/UnitTest/UCustom07.cs
@@ -0,0 +1,146 @@
+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; }
+ }
+}