添加表

This commit is contained in:
tanglong 2026-03-04 15:32:12 +08:00
parent b82d051280
commit a3c4f528ca
5 changed files with 8443 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,81 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace VOL.Core.Migrations
{
public partial class _20260304v1 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "YL_Device",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
SportStationId = table.Column<long>(type: "bigint", nullable: false),
Name = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
TenantName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
SerialNumber = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
AndroidId = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
IMEI = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
IMSI = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
IsCalibration = table.Column<int>(type: "int", nullable: false),
IsSynchronization = table.Column<int>(type: "int", nullable: false),
IsActive = table.Column<int>(type: "int", nullable: false),
IsOnline = table.Column<int>(type: "int", nullable: false),
LastOnlineTime = table.Column<DateTime>(type: "datetime2", nullable: true),
CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false),
UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: true),
Remark = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_YL_Device", x => x.Id);
});
migrationBuilder.CreateTable(
name: "YL_Train",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
DeviceSerial = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
DeviceType = table.Column<int>(type: "int", nullable: false),
UserSerial = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
TrainSerial = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
VideoSerial = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
TrainExam = table.Column<int>(type: "int", nullable: false),
QuizId = table.Column<int>(type: "int", nullable: true),
StandardCounts = table.Column<int>(type: "int", nullable: false),
UnStandardCounts = table.Column<int>(type: "int", nullable: false),
TimeKeeping = table.Column<double>(type: "float", nullable: true),
Duration = table.Column<int>(type: "int", nullable: false),
Distance = table.Column<double>(type: "float", nullable: true),
CourseId = table.Column<int>(type: "int", nullable: false),
StartTime = table.Column<DateTime>(type: "datetime2", nullable: false),
EndTime = table.Column<DateTime>(type: "datetime2", nullable: false),
Score = table.Column<double>(type: "float", nullable: true),
IsValid = table.Column<int>(type: "int", nullable: false),
UploadTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_YL_Train", x => x.Id);
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "YL_Device");
migrationBuilder.DropTable(
name: "YL_Train");
}
}
}

View File

@ -3226,6 +3226,127 @@ namespace VOL.Core.Migrations
b.ToTable("I_TrainRanking");
});
modelBuilder.Entity("VOL.Entity.DomainModels.JS_Class", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"), 1L, 1);
b.Property<string>("ClassName")
.IsRequired()
.HasColumnType("nvarchar(100)");
b.Property<string>("ClassNo")
.IsRequired()
.HasColumnType("nvarchar(100)");
b.Property<string>("Code")
.IsRequired()
.HasColumnType("nvarchar(100)");
b.Property<long>("GradeId")
.HasColumnType("bigint");
b.Property<string>("GradeName")
.IsRequired()
.HasColumnType("nvarchar(100)");
b.Property<string>("GradeNo")
.IsRequired()
.HasColumnType("nvarchar(100)");
b.Property<string>("SchoolCode")
.IsRequired()
.HasColumnType("nvarchar(100)");
b.Property<string>("TeacherName")
.HasColumnType("nvarchar(100)")
.HasComment("教师名称");
b.Property<string>("TeacherNo")
.HasColumnType("nvarchar(100)")
.HasComment("教师编号");
b.HasKey("Id");
b.HasIndex("GradeId");
b.ToTable("JS_Class");
});
modelBuilder.Entity("VOL.Entity.DomainModels.JS_Grade", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"), 1L, 1);
b.Property<string>("Code")
.IsRequired()
.HasColumnType("nvarchar(100)");
b.Property<string>("GradeName")
.IsRequired()
.HasColumnType("nvarchar(100)");
b.Property<string>("GradeNo")
.IsRequired()
.HasColumnType("nvarchar(100)");
b.Property<string>("SchoolCode")
.IsRequired()
.HasColumnType("nvarchar(100)");
b.Property<string>("TeacherName")
.HasColumnType("nvarchar(100)")
.HasComment("教师名称");
b.Property<string>("TeacherNo")
.HasColumnType("nvarchar(100)")
.HasComment("教师编号");
b.HasKey("Id");
b.ToTable("JS_Grade");
});
modelBuilder.Entity("VOL.Entity.DomainModels.JS_Teacher", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasComment("Id");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"), 1L, 1);
b.Property<string>("Code")
.HasColumnType("nvarchar(100)")
.HasComment("AI设备的唯一编码");
b.Property<string>("SchoolCode")
.HasColumnType("nvarchar(100)")
.HasComment("学校编号");
b.Property<string>("SchoolName")
.HasColumnType("nvarchar(100)")
.HasComment("学校名称");
b.Property<string>("TeacherName")
.HasColumnType("nvarchar(100)")
.HasComment("教师名称");
b.Property<string>("TeacherNo")
.HasColumnType("nvarchar(100)")
.HasComment("教师编号");
b.HasKey("Id");
b.ToTable("JS_Teacher");
});
modelBuilder.Entity("VOL.Entity.DomainModels.N_AreaCategory", b =>
{
b.Property<int>("Id")
@ -7170,6 +7291,159 @@ namespace VOL.Core.Migrations
b.ToTable("Y_StadiumVisiting");
});
modelBuilder.Entity("VOL.Entity.DomainModels.YiLu.YL_Device", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"), 1L, 1);
b.Property<string>("AndroidId")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<DateTime>("CreateTime")
.HasColumnType("datetime2");
b.Property<string>("IMEI")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("IMSI")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<int>("IsActive")
.HasColumnType("int");
b.Property<int>("IsCalibration")
.HasColumnType("int");
b.Property<int>("IsOnline")
.HasColumnType("int");
b.Property<int>("IsSynchronization")
.HasColumnType("int");
b.Property<DateTime?>("LastOnlineTime")
.HasColumnType("datetime2");
b.Property<string>("Name")
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("Remark")
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<string>("SerialNumber")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<long>("SportStationId")
.HasColumnType("bigint");
b.Property<string>("TenantName")
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<DateTime?>("UpdateTime")
.HasColumnType("datetime2");
b.HasKey("Id");
b.ToTable("YL_Device");
});
modelBuilder.Entity("VOL.Entity.DomainModels.YiLu.YL_Train", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"), 1L, 1);
b.Property<int>("CourseId")
.HasColumnType("int");
b.Property<DateTime>("CreateTime")
.HasColumnType("datetime2");
b.Property<string>("DeviceSerial")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<int>("DeviceType")
.HasColumnType("int");
b.Property<double?>("Distance")
.HasColumnType("float");
b.Property<int>("Duration")
.HasColumnType("int");
b.Property<DateTime>("EndTime")
.HasColumnType("datetime2");
b.Property<int>("IsValid")
.HasColumnType("int");
b.Property<int?>("QuizId")
.HasColumnType("int");
b.Property<double?>("Score")
.HasColumnType("float");
b.Property<int>("StandardCounts")
.HasColumnType("int");
b.Property<DateTime>("StartTime")
.HasColumnType("datetime2");
b.Property<double?>("TimeKeeping")
.HasColumnType("float");
b.Property<int>("TrainExam")
.HasColumnType("int");
b.Property<string>("TrainSerial")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<int>("UnStandardCounts")
.HasColumnType("int");
b.Property<DateTime>("UploadTime")
.HasColumnType("datetime2");
b.Property<string>("UserSerial")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("VideoSerial")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.HasKey("Id");
b.HasIndex("CourseId");
b.HasIndex("DeviceSerial");
b.HasIndex("TrainSerial")
.IsUnique();
b.HasIndex("UserSerial");
b.ToTable("YL_Train");
});
modelBuilder.Entity("VOL.Entity.Sys_Actions", b =>
{
b.Property<int>("Action_Id")
@ -7349,6 +7623,17 @@ namespace VOL.Core.Migrations
b.Navigation("TrainingData");
});
modelBuilder.Entity("VOL.Entity.DomainModels.JS_Class", b =>
{
b.HasOne("VOL.Entity.DomainModels.JS_Grade", "Grade")
.WithMany("Classes")
.HasForeignKey("GradeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Grade");
});
modelBuilder.Entity("VOL.Entity.DomainModels.S_HomeWorkStudents", b =>
{
b.HasOne("VOL.Entity.DomainModels.S_HomeWork", "HomeWork")
@ -7478,6 +7763,11 @@ namespace VOL.Core.Migrations
b.Navigation("TrainRankingData");
});
modelBuilder.Entity("VOL.Entity.DomainModels.JS_Grade", b =>
{
b.Navigation("Classes");
});
modelBuilder.Entity("VOL.Entity.DomainModels.S_HomeWork", b =>
{
b.Navigation("HomeWorkStudents");

View File

@ -0,0 +1,108 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VOL.Entity.SystemModels;
namespace VOL.Entity.DomainModels.YiLu
{
/// <summary>
/// 运动小站设备表
/// </summary>
[Table("YL_Device")]
[Entity(TableCnName = "壹路设备表", TableName = "YL_Device")]
public class YL_Device : BaseEntity
{
/// <summary>
/// 主键ID
/// </summary>
[Key]
public long Id { get; set; }
/// <summary>
/// 运动小站ID
/// </summary>
public long SportStationId { get; set; }
/// <summary>
/// 运动小站名称
/// </summary>
[MaxLength(100)]
public string Name { get; set; }
/// <summary>
/// 客户名称(租户名称)
/// </summary>
[MaxLength(100)]
public string TenantName { get; set; }
/// <summary>
/// 设备唯一序列号(唯一约束)
/// </summary>
[Required]
[MaxLength(64)]
public string SerialNumber { get; set; }
/// <summary>
/// Android Id(预留字段)
/// </summary>
[MaxLength(64)]
public string AndroidId { get; set; }
/// <summary>
/// IMEI(预留字段)
/// </summary>
[MaxLength(64)]
public string IMEI { get; set; }
/// <summary>
/// IMSI(预留字段)
/// </summary>
[MaxLength(64)]
public string IMSI { get; set; }
/// <summary>
/// 是否已标定 0=否 1=是
/// </summary>
public int IsCalibration { get; set; }
/// <summary>
/// 是否开启数据同步 0=否 1=是
/// </summary>
public int IsSynchronization { get; set; }
/// <summary>
/// 是否激活 0=未激活 1=已激活
/// </summary>
public int IsActive { get; set; }
/// <summary>
/// 是否在线 0=离线 1=在线
/// </summary>
public int IsOnline { get; set; }
/// <summary>
/// 最后一次在线时间
/// </summary>
public DateTime? LastOnlineTime { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 更新时间
/// </summary>
public DateTime? UpdateTime { get; set; }
/// <summary>
/// 备注
/// </summary>
[MaxLength(500)]
public string Remark { get; set; }
}
}

View File

@ -0,0 +1,134 @@
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VOL.Entity.SystemModels;
namespace VOL.Entity.DomainModels.YiLu
{
/// <summary>
/// 训练成绩表
/// </summary>
[Table("YL_Train")]
[Index(nameof(TrainSerial), IsUnique = true)] // 训练序列号唯一
[Index(nameof(DeviceSerial))]
[Index(nameof(UserSerial))]
[Index(nameof(CourseId))]
public class YL_Train : BaseEntity
{
/// <summary>
/// 主键ID
/// </summary>
[Key]
public long Id { get; set; }
/// <summary>
/// 设备序列号(设备唯一标识)
/// </summary>
[Required]
[MaxLength(64)]
public string DeviceSerial { get; set; }
/// <summary>
/// 设备类型
/// </summary>
public int DeviceType { get; set; }
/// <summary>
/// 人员编号
/// </summary>
[Required]
[MaxLength(64)]
public string UserSerial { get; set; }
/// <summary>
/// 单次训练唯一序列号(唯一字段)
/// </summary>
[Required]
[MaxLength(64)]
public string TrainSerial { get; set; }
/// <summary>
/// 视频序列号(多人共用,可重复)
/// </summary>
[Required]
[MaxLength(64)]
public string VideoSerial { get; set; }
/// <summary>
/// 是否测验任务 0=否 1=是
/// </summary>
public int TrainExam { get; set; }
/// <summary>
/// 测验任务ID(自由练习可为空)
/// </summary>
public int? QuizId { get; set; }
/// <summary>
/// 有效个数
/// </summary>
public int StandardCounts { get; set; }
/// <summary>
/// 不合格动作数
/// </summary>
public int UnStandardCounts { get; set; }
/// <summary>
/// 有效时长(秒)
/// 计时类课目使用,如悬垂
/// </summary>
public double? TimeKeeping { get; set; }
/// <summary>
/// 训练持续时间(秒)
/// </summary>
public int Duration { get; set; }
/// <summary>
/// 距离(米)
/// 跳远类课目使用
/// </summary>
public double? Distance { get; set; }
/// <summary>
/// 课目ID
/// </summary>
public int CourseId { get; set; }
/// <summary>
/// 开始时间
/// </summary>
public DateTime StartTime { get; set; }
/// <summary>
/// 结束时间
/// </summary>
public DateTime EndTime { get; set; }
/// <summary>
/// 成绩值(统一换算后的成绩,用于排序)
/// </summary>
public double? Score { get; set; }
/// <summary>
/// 是否有效成绩 0=否 1=是
/// </summary>
public int IsValid { get; set; }
/// <summary>
/// 数据上报时间
/// </summary>
public DateTime UploadTime { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
}
}