diff --git a/Yi.Framework/Yi.Framework.ApiMicroservice/Startup.cs b/Yi.Framework/Yi.Framework.ApiMicroservice/Startup.cs index 653f3d23..a72da2aa 100644 --- a/Yi.Framework/Yi.Framework.ApiMicroservice/Startup.cs +++ b/Yi.Framework/Yi.Framework.ApiMicroservice/Startup.cs @@ -68,6 +68,11 @@ namespace Yi.Framework.ApiMicroservice #endregion services.AddSqliteService(); + #region + //MySql服务配置 + #endregion + services.AddMysqlService(); + #region //Redis服务配置 #endregion @@ -78,7 +83,7 @@ namespace Yi.Framework.ApiMicroservice #endregion //services.AddRabbitMQService(); - + } #region Autofac容器注入 diff --git a/Yi.Framework/Yi.Framework.ApiMicroservice/appsettings.json b/Yi.Framework/Yi.Framework.ApiMicroservice/appsettings.json index 275f5aad..abc37e3f 100644 --- a/Yi.Framework/Yi.Framework.ApiMicroservice/appsettings.json +++ b/Yi.Framework/Yi.Framework.ApiMicroservice/appsettings.json @@ -17,7 +17,7 @@ "Url": "Filename=YIDB.db" }, "MysqlConn": { - "Url": "server=192.168.2.128;port=3306;database=ECDB;user id=root;password=123456" + "Url": "server=118.195.191.41;port=3306;database=YIDB;user id=root;password=Qz52013142020." }, "JWTTokenOptions": { diff --git a/Yi.Framework/Yi.Framework.Model/DataContext.cs b/Yi.Framework/Yi.Framework.Model/DataContext.cs index 6bbc6f4f..0399156d 100644 --- a/Yi.Framework/Yi.Framework.Model/DataContext.cs +++ b/Yi.Framework/Yi.Framework.Model/DataContext.cs @@ -14,10 +14,10 @@ namespace Yi.Framework.Model //Update-Database yi-1 public partial class DataContext : DbContext { - private readonly IOptionsMonitor _optionsMonitor; + private readonly IOptionsMonitor _optionsMonitor; private readonly string _connStr; - public DataContext(IOptionsMonitor optionsMonitor) + public DataContext(IOptionsMonitor optionsMonitor) { _optionsMonitor = optionsMonitor; _connStr = _optionsMonitor.CurrentValue.Url; @@ -31,7 +31,9 @@ namespace Yi.Framework.Model { if (!optionsBuilder.IsConfigured) { - optionsBuilder.UseSqlite(_connStr); + //optionsBuilder.UseSqlite(_connStr); + var serverVersion = new MySqlServerVersion(new Version(8, 0, 21)); + optionsBuilder.UseMySql(_connStr, serverVersion); } } diff --git a/Yi.Framework/Yi.Framework.Model/Migrations/20211013073148_yi-1.Designer.cs b/Yi.Framework/Yi.Framework.Model/Migrations/20211013073148_yi-1.Designer.cs deleted file mode 100644 index 14b7641e..00000000 --- a/Yi.Framework/Yi.Framework.Model/Migrations/20211013073148_yi-1.Designer.cs +++ /dev/null @@ -1,218 +0,0 @@ -锘// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Yi.Framework.Model; - -namespace Yi.Framework.Model.Migrations -{ - [DbContext(typeof(DataContext))] - [Migration("20211013073148_yi-1")] - partial class yi1 - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "5.0.10"); - - modelBuilder.Entity("Yi.Framework.Model.Models.menu", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("icon") - .HasColumnType("TEXT"); - - b.Property("is_delete") - .HasColumnType("INTEGER"); - - b.Property("is_top") - .HasColumnType("INTEGER"); - - b.Property("menu_name") - .HasColumnType("TEXT"); - - b.Property("menuid") - .HasColumnType("INTEGER"); - - b.Property("mouldid") - .HasColumnType("INTEGER"); - - b.Property("router") - .HasColumnType("TEXT"); - - b.Property("sort") - .HasColumnType("INTEGER"); - - b.HasKey("id"); - - b.HasIndex("menuid"); - - b.HasIndex("mouldid"); - - b.ToTable("menu"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.mould", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("is_delete") - .HasColumnType("INTEGER"); - - b.Property("mould_name") - .HasColumnType("TEXT"); - - b.Property("url") - .HasColumnType("TEXT"); - - b.HasKey("id"); - - b.ToTable("mould"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.role", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("introduce") - .HasColumnType("TEXT"); - - b.Property("is_delete") - .HasColumnType("INTEGER"); - - b.Property("role_name") - .HasColumnType("TEXT"); - - b.HasKey("id"); - - b.ToTable("role"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.user", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("age") - .HasColumnType("INTEGER"); - - b.Property("email") - .HasColumnType("TEXT"); - - b.Property("icon") - .HasColumnType("TEXT"); - - b.Property("introduction") - .HasColumnType("TEXT"); - - b.Property("ip") - .HasColumnType("TEXT"); - - b.Property("is_delete") - .HasColumnType("INTEGER"); - - b.Property("nick") - .HasColumnType("TEXT"); - - b.Property("password") - .HasColumnType("TEXT"); - - b.Property("username") - .HasColumnType("TEXT"); - - b.HasKey("id"); - - b.ToTable("user"); - }); - - modelBuilder.Entity("menurole", b => - { - b.Property("menusid") - .HasColumnType("INTEGER"); - - b.Property("rolesid") - .HasColumnType("INTEGER"); - - b.HasKey("menusid", "rolesid"); - - b.HasIndex("rolesid"); - - b.ToTable("menurole"); - }); - - modelBuilder.Entity("roleuser", b => - { - b.Property("rolesid") - .HasColumnType("INTEGER"); - - b.Property("usersid") - .HasColumnType("INTEGER"); - - b.HasKey("rolesid", "usersid"); - - b.HasIndex("usersid"); - - b.ToTable("roleuser"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.menu", b => - { - b.HasOne("Yi.Framework.Model.Models.menu", null) - .WithMany("children") - .HasForeignKey("menuid"); - - b.HasOne("Yi.Framework.Model.Models.mould", "mould") - .WithMany() - .HasForeignKey("mouldid"); - - b.Navigation("mould"); - }); - - modelBuilder.Entity("menurole", b => - { - b.HasOne("Yi.Framework.Model.Models.menu", null) - .WithMany() - .HasForeignKey("menusid") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Yi.Framework.Model.Models.role", null) - .WithMany() - .HasForeignKey("rolesid") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("roleuser", b => - { - b.HasOne("Yi.Framework.Model.Models.role", null) - .WithMany() - .HasForeignKey("rolesid") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Yi.Framework.Model.Models.user", null) - .WithMany() - .HasForeignKey("usersid") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.menu", b => - { - b.Navigation("children"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Yi.Framework/Yi.Framework.Model/Migrations/20211017105828_yi-2.Designer.cs b/Yi.Framework/Yi.Framework.Model/Migrations/20211017105828_yi-2.Designer.cs deleted file mode 100644 index f21ffc24..00000000 --- a/Yi.Framework/Yi.Framework.Model/Migrations/20211017105828_yi-2.Designer.cs +++ /dev/null @@ -1,221 +0,0 @@ -锘// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Yi.Framework.Model; - -namespace Yi.Framework.Model.Migrations -{ - [DbContext(typeof(DataContext))] - [Migration("20211017105828_yi-2")] - partial class yi2 - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "5.0.11"); - - modelBuilder.Entity("Yi.Framework.Model.Models.menu", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("icon") - .HasColumnType("TEXT"); - - b.Property("is_delete") - .HasColumnType("INTEGER"); - - b.Property("is_show") - .HasColumnType("INTEGER"); - - b.Property("is_top") - .HasColumnType("INTEGER"); - - b.Property("menu_name") - .HasColumnType("TEXT"); - - b.Property("menuid") - .HasColumnType("INTEGER"); - - b.Property("mouldid") - .HasColumnType("INTEGER"); - - b.Property("router") - .HasColumnType("TEXT"); - - b.Property("sort") - .HasColumnType("INTEGER"); - - b.HasKey("id"); - - b.HasIndex("menuid"); - - b.HasIndex("mouldid"); - - b.ToTable("menu"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.mould", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("is_delete") - .HasColumnType("INTEGER"); - - b.Property("mould_name") - .HasColumnType("TEXT"); - - b.Property("url") - .HasColumnType("TEXT"); - - b.HasKey("id"); - - b.ToTable("mould"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.role", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("introduce") - .HasColumnType("TEXT"); - - b.Property("is_delete") - .HasColumnType("INTEGER"); - - b.Property("role_name") - .HasColumnType("TEXT"); - - b.HasKey("id"); - - b.ToTable("role"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.user", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("age") - .HasColumnType("INTEGER"); - - b.Property("email") - .HasColumnType("TEXT"); - - b.Property("icon") - .HasColumnType("TEXT"); - - b.Property("introduction") - .HasColumnType("TEXT"); - - b.Property("ip") - .HasColumnType("TEXT"); - - b.Property("is_delete") - .HasColumnType("INTEGER"); - - b.Property("nick") - .HasColumnType("TEXT"); - - b.Property("password") - .HasColumnType("TEXT"); - - b.Property("username") - .HasColumnType("TEXT"); - - b.HasKey("id"); - - b.ToTable("user"); - }); - - modelBuilder.Entity("menurole", b => - { - b.Property("menusid") - .HasColumnType("INTEGER"); - - b.Property("rolesid") - .HasColumnType("INTEGER"); - - b.HasKey("menusid", "rolesid"); - - b.HasIndex("rolesid"); - - b.ToTable("menurole"); - }); - - modelBuilder.Entity("roleuser", b => - { - b.Property("rolesid") - .HasColumnType("INTEGER"); - - b.Property("usersid") - .HasColumnType("INTEGER"); - - b.HasKey("rolesid", "usersid"); - - b.HasIndex("usersid"); - - b.ToTable("roleuser"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.menu", b => - { - b.HasOne("Yi.Framework.Model.Models.menu", null) - .WithMany("children") - .HasForeignKey("menuid"); - - b.HasOne("Yi.Framework.Model.Models.mould", "mould") - .WithMany() - .HasForeignKey("mouldid"); - - b.Navigation("mould"); - }); - - modelBuilder.Entity("menurole", b => - { - b.HasOne("Yi.Framework.Model.Models.menu", null) - .WithMany() - .HasForeignKey("menusid") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Yi.Framework.Model.Models.role", null) - .WithMany() - .HasForeignKey("rolesid") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("roleuser", b => - { - b.HasOne("Yi.Framework.Model.Models.role", null) - .WithMany() - .HasForeignKey("rolesid") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Yi.Framework.Model.Models.user", null) - .WithMany() - .HasForeignKey("usersid") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.menu", b => - { - b.Navigation("children"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Yi.Framework/Yi.Framework.Model/Migrations/20211017105828_yi-2.cs b/Yi.Framework/Yi.Framework.Model/Migrations/20211017105828_yi-2.cs deleted file mode 100644 index 379269ec..00000000 --- a/Yi.Framework/Yi.Framework.Model/Migrations/20211017105828_yi-2.cs +++ /dev/null @@ -1,23 +0,0 @@ -锘縰sing Microsoft.EntityFrameworkCore.Migrations; - -namespace Yi.Framework.Model.Migrations -{ - public partial class yi2 : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "is_show", - table: "menu", - type: "INTEGER", - nullable: true); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "is_show", - table: "menu"); - } - } -} diff --git a/Yi.Framework/Yi.Framework.Model/Migrations/20211020073819_yi-3.cs b/Yi.Framework/Yi.Framework.Model/Migrations/20211020073819_yi-3.cs deleted file mode 100644 index a55c374d..00000000 --- a/Yi.Framework/Yi.Framework.Model/Migrations/20211020073819_yi-3.cs +++ /dev/null @@ -1,87 +0,0 @@ -锘縰sing Microsoft.EntityFrameworkCore.Migrations; - -namespace Yi.Framework.Model.Migrations -{ - public partial class yi3 : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "address", - table: "user", - type: "TEXT", - nullable: true); - - migrationBuilder.AddColumn( - name: "phone", - table: "user", - type: "INTEGER", - nullable: true); - - migrationBuilder.AlterColumn( - name: "sort", - table: "menu", - type: "INTEGER", - nullable: false, - defaultValue: 0, - oldClrType: typeof(int), - oldType: "INTEGER", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "is_top", - table: "menu", - type: "INTEGER", - nullable: false, - defaultValue: 0, - oldClrType: typeof(int), - oldType: "INTEGER", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "is_show", - table: "menu", - type: "INTEGER", - nullable: false, - defaultValue: 0, - oldClrType: typeof(int), - oldType: "INTEGER", - oldNullable: true); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "address", - table: "user"); - - migrationBuilder.DropColumn( - name: "phone", - table: "user"); - - migrationBuilder.AlterColumn( - name: "sort", - table: "menu", - type: "INTEGER", - nullable: true, - oldClrType: typeof(int), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn( - name: "is_top", - table: "menu", - type: "INTEGER", - nullable: true, - oldClrType: typeof(int), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn( - name: "is_show", - table: "menu", - type: "INTEGER", - nullable: true, - oldClrType: typeof(int), - oldType: "INTEGER"); - } - } -} diff --git a/Yi.Framework/Yi.Framework.Model/Migrations/20211020073819_yi-3.Designer.cs b/Yi.Framework/Yi.Framework.Model/Migrations/20211022181627_yi-1.Designer.cs similarity index 75% rename from Yi.Framework/Yi.Framework.Model/Migrations/20211020073819_yi-3.Designer.cs rename to Yi.Framework/Yi.Framework.Model/Migrations/20211022181627_yi-1.Designer.cs index 9f3201f1..455f2d84 100644 --- a/Yi.Framework/Yi.Framework.Model/Migrations/20211020073819_yi-3.Designer.cs +++ b/Yi.Framework/Yi.Framework.Model/Migrations/20211022181627_yi-1.Designer.cs @@ -9,47 +9,48 @@ using Yi.Framework.Model; namespace Yi.Framework.Model.Migrations { [DbContext(typeof(DataContext))] - [Migration("20211020073819_yi-3")] - partial class yi3 + [Migration("20211022181627_yi-1")] + partial class yi1 { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder + .HasAnnotation("Relational:MaxIdentifierLength", 64) .HasAnnotation("ProductVersion", "5.0.11"); modelBuilder.Entity("Yi.Framework.Model.Models.menu", b => { b.Property("id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("icon") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("is_delete") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("is_show") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("is_top") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("menu_name") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("menuid") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("mouldid") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("router") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("sort") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.HasKey("id"); @@ -64,16 +65,16 @@ namespace Yi.Framework.Model.Migrations { b.Property("id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("is_delete") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("mould_name") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("url") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.HasKey("id"); @@ -84,16 +85,16 @@ namespace Yi.Framework.Model.Migrations { b.Property("id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("introduce") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("is_delete") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("role_name") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.HasKey("id"); @@ -104,40 +105,40 @@ namespace Yi.Framework.Model.Migrations { b.Property("id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("address") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("age") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("email") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("icon") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("introduction") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("ip") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("is_delete") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("nick") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("password") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("phone") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("username") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.HasKey("id"); @@ -147,10 +148,10 @@ namespace Yi.Framework.Model.Migrations modelBuilder.Entity("menurole", b => { b.Property("menusid") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("rolesid") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.HasKey("menusid", "rolesid"); @@ -162,10 +163,10 @@ namespace Yi.Framework.Model.Migrations modelBuilder.Entity("roleuser", b => { b.Property("rolesid") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("usersid") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.HasKey("rolesid", "usersid"); diff --git a/Yi.Framework/Yi.Framework.Model/Migrations/20211013073148_yi-1.cs b/Yi.Framework/Yi.Framework.Model/Migrations/20211022181627_yi-1.cs similarity index 50% rename from Yi.Framework/Yi.Framework.Model/Migrations/20211013073148_yi-1.cs rename to Yi.Framework/Yi.Framework.Model/Migrations/20211022181627_yi-1.cs index 4a4475f7..8b17bb96 100644 --- a/Yi.Framework/Yi.Framework.Model/Migrations/20211013073148_yi-1.cs +++ b/Yi.Framework/Yi.Framework.Model/Migrations/20211022181627_yi-1.cs @@ -1,4 +1,5 @@ -锘縰sing Microsoft.EntityFrameworkCore.Migrations; +锘縰sing Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; namespace Yi.Framework.Model.Migrations { @@ -6,71 +7,95 @@ namespace Yi.Framework.Model.Migrations { protected override void Up(MigrationBuilder migrationBuilder) { + migrationBuilder.AlterDatabase() + .Annotation("MySql:CharSet", "utf8mb4"); + migrationBuilder.CreateTable( name: "mould", columns: table => new { - id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - mould_name = table.Column(type: "TEXT", nullable: true), - url = table.Column(type: "TEXT", nullable: true), - is_delete = table.Column(type: "INTEGER", nullable: false) + id = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + mould_name = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + url = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + is_delete = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK_mould", x => x.id); - }); + }) + .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "role", columns: table => new { - id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - role_name = table.Column(type: "TEXT", nullable: true), - introduce = table.Column(type: "TEXT", nullable: true), - is_delete = table.Column(type: "INTEGER", nullable: false) + id = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + role_name = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + introduce = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + is_delete = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK_role", x => x.id); - }); + }) + .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "user", columns: table => new { - id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - username = table.Column(type: "TEXT", nullable: true), - password = table.Column(type: "TEXT", nullable: true), - icon = table.Column(type: "TEXT", nullable: true), - nick = table.Column(type: "TEXT", nullable: true), - email = table.Column(type: "TEXT", nullable: true), - ip = table.Column(type: "TEXT", nullable: true), - age = table.Column(type: "INTEGER", nullable: true), - introduction = table.Column(type: "TEXT", nullable: true), - is_delete = table.Column(type: "INTEGER", nullable: false) + id = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + username = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + password = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + icon = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + nick = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + email = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + ip = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + age = table.Column(type: "int", nullable: true), + introduction = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + address = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + phone = table.Column(type: "int", nullable: true), + is_delete = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK_user", x => x.id); - }); + }) + .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "menu", columns: table => new { - id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - icon = table.Column(type: "TEXT", nullable: true), - router = table.Column(type: "TEXT", nullable: true), - menu_name = table.Column(type: "TEXT", nullable: true), - mouldid = table.Column(type: "INTEGER", nullable: true), - menuid = table.Column(type: "INTEGER", nullable: true), - is_delete = table.Column(type: "INTEGER", nullable: false), - is_top = table.Column(type: "INTEGER", nullable: true), - sort = table.Column(type: "INTEGER", nullable: true) + id = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + icon = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + router = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + menu_name = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + mouldid = table.Column(type: "int", nullable: true), + menuid = table.Column(type: "int", nullable: true), + is_delete = table.Column(type: "int", nullable: false), + is_top = table.Column(type: "int", nullable: false), + sort = table.Column(type: "int", nullable: false), + is_show = table.Column(type: "int", nullable: false) }, constraints: table => { @@ -87,14 +112,15 @@ namespace Yi.Framework.Model.Migrations principalTable: "mould", principalColumn: "id", onDelete: ReferentialAction.Restrict); - }); + }) + .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "roleuser", columns: table => new { - rolesid = table.Column(type: "INTEGER", nullable: false), - usersid = table.Column(type: "INTEGER", nullable: false) + rolesid = table.Column(type: "int", nullable: false), + usersid = table.Column(type: "int", nullable: false) }, constraints: table => { @@ -111,14 +137,15 @@ namespace Yi.Framework.Model.Migrations principalTable: "user", principalColumn: "id", onDelete: ReferentialAction.Cascade); - }); + }) + .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "menurole", columns: table => new { - menusid = table.Column(type: "INTEGER", nullable: false), - rolesid = table.Column(type: "INTEGER", nullable: false) + menusid = table.Column(type: "int", nullable: false), + rolesid = table.Column(type: "int", nullable: false) }, constraints: table => { @@ -135,7 +162,8 @@ namespace Yi.Framework.Model.Migrations principalTable: "role", principalColumn: "id", onDelete: ReferentialAction.Cascade); - }); + }) + .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateIndex( name: "IX_menu_menuid", diff --git a/Yi.Framework/Yi.Framework.Model/Migrations/DataContextModelSnapshot.cs b/Yi.Framework/Yi.Framework.Model/Migrations/DataContextModelSnapshot.cs index 33dbad96..af015d91 100644 --- a/Yi.Framework/Yi.Framework.Model/Migrations/DataContextModelSnapshot.cs +++ b/Yi.Framework/Yi.Framework.Model/Migrations/DataContextModelSnapshot.cs @@ -14,40 +14,41 @@ namespace Yi.Framework.Model.Migrations { #pragma warning disable 612, 618 modelBuilder + .HasAnnotation("Relational:MaxIdentifierLength", 64) .HasAnnotation("ProductVersion", "5.0.11"); modelBuilder.Entity("Yi.Framework.Model.Models.menu", b => { b.Property("id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("icon") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("is_delete") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("is_show") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("is_top") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("menu_name") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("menuid") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("mouldid") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("router") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("sort") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.HasKey("id"); @@ -62,16 +63,16 @@ namespace Yi.Framework.Model.Migrations { b.Property("id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("is_delete") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("mould_name") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("url") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.HasKey("id"); @@ -82,16 +83,16 @@ namespace Yi.Framework.Model.Migrations { b.Property("id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("introduce") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("is_delete") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("role_name") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.HasKey("id"); @@ -102,40 +103,40 @@ namespace Yi.Framework.Model.Migrations { b.Property("id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("address") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("age") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("email") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("icon") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("introduction") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("ip") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("is_delete") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("nick") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("password") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("phone") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("username") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.HasKey("id"); @@ -145,10 +146,10 @@ namespace Yi.Framework.Model.Migrations modelBuilder.Entity("menurole", b => { b.Property("menusid") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("rolesid") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.HasKey("menusid", "rolesid"); @@ -160,10 +161,10 @@ namespace Yi.Framework.Model.Migrations modelBuilder.Entity("roleuser", b => { b.Property("rolesid") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("usersid") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.HasKey("rolesid", "usersid"); diff --git a/Yi.Framework/Yi.Framework.WebCore/MiddlewareExtend/MysqlExtension.cs b/Yi.Framework/Yi.Framework.WebCore/MiddlewareExtend/MysqlExtension.cs new file mode 100644 index 00000000..c8e799c0 --- /dev/null +++ b/Yi.Framework/Yi.Framework.WebCore/MiddlewareExtend/MysqlExtension.cs @@ -0,0 +1,20 @@ +锘縰sing Microsoft.AspNetCore.Builder; +using Microsoft.Extensions.DependencyInjection; +using System; +using System.IO; +using Yi.Framework.Common.IOCOptions; + +namespace Yi.Framework.WebCore.MiddlewareExtend +{ + /// + /// 鏁版嵁搴撴墿灞 + /// + public static class MysqlExtension + { + public static IServiceCollection AddMysqlService(this IServiceCollection services) + { + services.Configure(Appsettings.appConfiguration("MysqlConn")); + return services; + } + } +} diff --git a/Yi.Vue/src/views/AdmRole.vue b/Yi.Vue/src/views/AdmRole.vue index ad8d7578..48082341 100644 --- a/Yi.Vue/src/views/AdmRole.vue +++ b/Yi.Vue/src/views/AdmRole.vue @@ -12,106 +12,13 @@