添加了数据模型,写了新闻模块栏目的接口

main
SummerLost 3 years ago
parent 103c0bbd86
commit 14727f660f
  1. BIN
      .vs/QualityControlPlatform/v17/.suo
  2. 31
      QualityControlPlatform/Controllers/NewController.cs
  3. 49
      QualityControlPlatform/Controllers/WeatherForecastController.cs
  4. 54
      QualityControlPlatform/Helpers/Pagination/PageHelper.cs
  5. 24
      QualityControlPlatform/Models/DbContext/Attached.cs
  6. 17
      QualityControlPlatform/Models/DbContext/AttachedNews.cs
  7. 24
      QualityControlPlatform/Models/DbContext/Disease.cs
  8. 23
      QualityControlPlatform/Models/DbContext/Hospital.cs
  9. 23
      QualityControlPlatform/Models/DbContext/Menu.cs
  10. 26
      QualityControlPlatform/Models/DbContext/News.cs
  11. 22
      QualityControlPlatform/Models/DbContext/Part.cs
  12. 346
      QualityControlPlatform/Models/DbContext/QualityControlPlatformContext.cs
  13. 21
      QualityControlPlatform/Models/DbContext/Report.cs
  14. 24
      QualityControlPlatform/Models/DbContext/ReportTemplate.cs
  15. 24
      QualityControlPlatform/Models/DbContext/Role.cs
  16. 17
      QualityControlPlatform/Models/DbContext/RoleMenu.cs
  17. 33
      QualityControlPlatform/Models/DbContext/User.cs
  18. 17
      QualityControlPlatform/Models/DbContext/UserRole.cs
  19. 15
      QualityControlPlatform/Models/WeatherForecast.cs
  20. 7
      QualityControlPlatform/QualityControlPlatform.csproj
  21. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/BouncyCastle.Crypto.dll
  22. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/Google.Protobuf.dll
  23. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/Humanizer.dll
  24. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/K4os.Compression.LZ4.Streams.dll
  25. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/K4os.Compression.LZ4.dll
  26. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/K4os.Hash.xxHash.dll
  27. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/Microsoft.AspNetCore.Razor.Language.dll
  28. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/Microsoft.CodeAnalysis.CSharp.Workspaces.dll
  29. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/Microsoft.CodeAnalysis.CSharp.dll
  30. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/Microsoft.CodeAnalysis.Razor.dll
  31. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/Microsoft.CodeAnalysis.Workspaces.dll
  32. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/Microsoft.CodeAnalysis.dll
  33. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/Microsoft.EntityFrameworkCore.Abstractions.dll
  34. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/Microsoft.EntityFrameworkCore.Design.dll
  35. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/Microsoft.EntityFrameworkCore.Relational.dll
  36. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/Microsoft.EntityFrameworkCore.dll
  37. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Caching.Abstractions.dll
  38. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Caching.Memory.dll
  39. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Configuration.Abstractions.dll
  40. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/Microsoft.Extensions.DependencyInjection.Abstractions.dll
  41. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/Microsoft.Extensions.DependencyInjection.dll
  42. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Logging.Abstractions.dll
  43. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Logging.dll
  44. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Options.dll
  45. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Primitives.dll
  46. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/Microsoft.VisualStudio.Web.CodeGeneration.Contracts.dll
  47. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/Microsoft.VisualStudio.Web.CodeGeneration.Core.dll
  48. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/Microsoft.VisualStudio.Web.CodeGeneration.EntityFrameworkCore.dll
  49. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/Microsoft.VisualStudio.Web.CodeGeneration.Templating.dll
  50. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/Microsoft.VisualStudio.Web.CodeGeneration.Utils.dll
  51. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/Microsoft.VisualStudio.Web.CodeGeneration.dll
  52. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/Microsoft.VisualStudio.Web.CodeGenerators.Mvc.dll
  53. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/MySql.Data.EntityFrameworkCore.dll
  54. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/MySql.Data.dll
  55. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/MySqlConnector.dll
  56. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/Newtonsoft.Json.dll
  57. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/NuGet.Frameworks.dll
  58. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/Pomelo.EntityFrameworkCore.MySql.dll
  59. 2972
      QualityControlPlatform/bin/Debug/netcoreapp3.1/QualityControlPlatform.deps.json
  60. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/QualityControlPlatform.dll
  61. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/QualityControlPlatform.pdb
  62. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/Renci.SshNet.dll
  63. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/SshNet.Security.Cryptography.dll
  64. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/System.Collections.Immutable.dll
  65. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/System.ComponentModel.Annotations.dll
  66. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/System.Composition.AttributedModel.dll
  67. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/System.Composition.Convention.dll
  68. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/System.Composition.Hosting.dll
  69. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/System.Composition.Runtime.dll
  70. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/System.Composition.TypedParts.dll
  71. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/System.Configuration.ConfigurationManager.dll
  72. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/System.Diagnostics.DiagnosticSource.dll
  73. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/System.Security.Cryptography.ProtectedData.dll
  74. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/System.Xml.XPath.XmlDocument.dll
  75. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/Ubiety.Dns.Core.dll
  76. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/Zstandard.Net.dll
  77. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/cs/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll
  78. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/cs/Microsoft.CodeAnalysis.CSharp.resources.dll
  79. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/cs/Microsoft.CodeAnalysis.Workspaces.resources.dll
  80. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/cs/Microsoft.CodeAnalysis.resources.dll
  81. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/de/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll
  82. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/de/Microsoft.CodeAnalysis.CSharp.resources.dll
  83. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/de/Microsoft.CodeAnalysis.Workspaces.resources.dll
  84. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/de/Microsoft.CodeAnalysis.resources.dll
  85. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/dotnet-aspnet-codegenerator-design.dll
  86. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/es/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll
  87. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/es/Microsoft.CodeAnalysis.CSharp.resources.dll
  88. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/es/Microsoft.CodeAnalysis.Workspaces.resources.dll
  89. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/es/Microsoft.CodeAnalysis.resources.dll
  90. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/fr/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll
  91. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/fr/Microsoft.CodeAnalysis.CSharp.resources.dll
  92. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/fr/Microsoft.CodeAnalysis.Workspaces.resources.dll
  93. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/fr/Microsoft.CodeAnalysis.resources.dll
  94. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/it/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll
  95. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/it/Microsoft.CodeAnalysis.CSharp.resources.dll
  96. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/it/Microsoft.CodeAnalysis.Workspaces.resources.dll
  97. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/it/Microsoft.CodeAnalysis.resources.dll
  98. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/ja/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll
  99. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/ja/Microsoft.CodeAnalysis.CSharp.resources.dll
  100. BIN
      QualityControlPlatform/bin/Debug/netcoreapp3.1/ja/Microsoft.CodeAnalysis.Workspaces.resources.dll
  101. Some files were not shown because too many files have changed in this diff Show More

@ -0,0 +1,31 @@

using System;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using QualityControlPlatform.Helpers.Pagination;
using QualityControlPlatform.Helpers.Response;
using System.Linq;
using QualityControlPlatform.Models.DbContext;
namespace QualityControlPlatform.Controllers
{
/// <summary>
/// 新闻相关接口
/// </summary>
[Route("api/[controller]/[action]")]
[ApiController]
public class NewController : ControllerBase
{
private readonly QualityControlPlatformContext _db = new QualityControlPlatformContext();
/// <summary>
/// 获取所有栏目
/// </summary>
/// <returns></returns>
public ActionResult PartList(int? page)
{
return ResponseHelper.Success(
PageHelper.Pagination(_db.Parts.ToList(), Convert.ToInt32(page), 8));
}
}
}

@ -1,49 +0,0 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using QualityControlPlatform.Models;
namespace QualityControlPlatform.Controllers
{
/// <summary>
/// 测试
/// </summary>
[ApiController]
[Route("[controller]")]
public class WeatherForecastController : ControllerBase
{
private static readonly string[] Summaries = new[]
{
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
};
private readonly ILogger<WeatherForecastController> _logger;
/// <summary>
/// 测试
/// </summary>
/// <param name="logger"></param>
public WeatherForecastController(ILogger<WeatherForecastController> logger)
{
_logger = logger;
}
/// <summary>
/// 初始框架测试接口
/// </summary>
/// <returns></returns>
[HttpGet]
public IEnumerable<WeatherForecast> Get()
{
var rng = new Random();
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
{
Date = DateTime.Now.AddDays(index),
TemperatureC = rng.Next(-20, 55),
Summary = Summaries[rng.Next(Summaries.Length)]
})
.ToArray();
}
}
}

@ -0,0 +1,54 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace LisWeb.Helper.Pagination
{
public class PageHelper
{
/*
* 1. list.Skip(x).Take(y);
* 2.(x,y)(0,list.Count)list为空[],()
*/
/// <summary>
/// 分页
/// </summary>
/// <typeparam name="T">数据类型</typeparam>
/// <param name="list">数据</param>
/// <param name="page">页码</param>
/// <param name="size">数据量/页</param>
/// <returns></returns>
public static Data Pagination<T>(List<T> list, int page, int size)
{
if (list == null)
return new Data(0, page, null);
if (list.Count != 0 && list.Count >= size)
return new Data(list.Count, page <= 0 ? 0 : page,
list.Skip(Convert.ToInt32((page <= 0 ? 0 : page - 1) * size)).Take(size).ToList());
return new Data(list.Count, page, list);
}
}
public class Data
{
/// <summary>
/// 总数
/// </summary>
public int? Total { get; set; }
/// <summary>
/// 当前页码
/// </summary>
public int? Current { get; set; }
/// <summary>
/// 数据
/// </summary>
public object List { get; set; }
public Data(int? total, int? current, object list)
{
Total = total ?? 0;
Current = current;
List = list;
}
}
}

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
#nullable disable
namespace QualityControlPlatform.Models.DbContext
{
public partial class Attached
{
public Attached()
{
Attachednews = new HashSet<Attachednews>();
}
public int AttachedId { get; set; }
public int? UserId { get; set; }
public string FileName { get; set; }
public DateTime? AttachedTime { get; set; }
public string FileSize { get; set; }
public virtual User User { get; set; }
public virtual ICollection<Attachednews> Attachednews { get; set; }
}
}

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
#nullable disable
namespace QualityControlPlatform.Models.DbContext
{
public partial class Attachednews
{
public int AttachedNewId { get; set; }
public int? NewId { get; set; }
public int? AttachedId { get; set; }
public virtual Attached Attached { get; set; }
public virtual News New { get; set; }
}
}

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
#nullable disable
namespace QualityControlPlatform.Models.DbContext
{
public partial class Disease
{
public Disease()
{
Reports = new HashSet<Report>();
Reporttemplates = new HashSet<Reporttemplate>();
}
public int DiseasesId { get; set; }
public string DiseasesName { get; set; }
public string DiseasesCode { get; set; }
public string Description { get; set; }
public virtual ICollection<Report> Reports { get; set; }
public virtual ICollection<Reporttemplate> Reporttemplates { get; set; }
}
}

@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
#nullable disable
namespace QualityControlPlatform.Models.DbContext
{
public partial class Hospital
{
public Hospital()
{
Users = new HashSet<User>();
}
public int HospitalId { get; set; }
public string HospitalName { get; set; }
public string HospitalCode { get; set; }
public string Address { get; set; }
public string Phone { get; set; }
public virtual ICollection<User> Users { get; set; }
}
}

@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
#nullable disable
namespace QualityControlPlatform.Models.DbContext
{
public partial class Menu
{
public Menu()
{
Rolemenus = new HashSet<Rolemenu>();
}
public int MenuId { get; set; }
public string MenuName { get; set; }
public string MenuCode { get; set; }
public string Description { get; set; }
public int? ParentId { get; set; }
public virtual ICollection<Rolemenu> Rolemenus { get; set; }
}
}

@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
#nullable disable
namespace QualityControlPlatform.Models.DbContext
{
public partial class News
{
public News()
{
Attachednews = new HashSet<Attachednews>();
}
public int NewId { get; set; }
public int? UserId { get; set; }
public int? PartId { get; set; }
public string Title { get; set; }
public string Content { get; set; }
public DateTime? Time { get; set; }
public virtual Part Part { get; set; }
public virtual User User { get; set; }
public virtual ICollection<Attachednews> Attachednews { get; set; }
}
}

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
#nullable disable
namespace QualityControlPlatform.Models.DbContext
{
public partial class Part
{
public Part()
{
News = new HashSet<News>();
}
public int PartId { get; set; }
public string PartName { get; set; }
public string PartCode { get; set; }
public string Description { get; set; }
public virtual ICollection<News> News { get; set; }
}
}

@ -0,0 +1,346 @@
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;
#nullable disable
namespace QualityControlPlatform.Models.DbContext
{
/// <summary>
/// EF上下文
/// </summary>
public partial class QualityControlPlatformContext : Microsoft.EntityFrameworkCore.DbContext
{
/// <summary>
/// 私有化
/// </summary>
public QualityControlPlatformContext()
{
}
/// <summary>
///
/// </summary>
/// <param name="options"></param>
public QualityControlPlatformContext(DbContextOptions<QualityControlPlatformContext> options)
: base(options)
{
}
/// <summary>
/// 附件表
/// </summary>
public virtual DbSet<Attached> Attacheds { get; set; }
/// <summary>
/// 附件新闻表
/// </summary>
public virtual DbSet<Attachednews> Attachednews { get; set; }
/// <summary>
/// 病种表
/// </summary>
public virtual DbSet<Disease> Diseases { get; set; }
/// <summary>
/// 医院基础信息表
/// </summary>
public virtual DbSet<Hospital> Hospitals { get; set; }
/// <summary>
/// 菜单表
/// </summary>
public virtual DbSet<Menu> Menus { get; set; }
/// <summary>
/// 新闻表
/// </summary>
public virtual DbSet<News> News { get; set; }
/// <summary>
/// 栏目表
/// </summary>
public virtual DbSet<Part> Parts { get; set; }
/// <summary>
/// 内容上报表
/// </summary>
public virtual DbSet<Report> Reports { get; set; }
/// <summary>
/// 内容上报问题表
/// </summary>
public virtual DbSet<Reporttemplate> Reporttemplates { get; set; }
/// <summary>
/// 角色表
/// </summary>
public virtual DbSet<Role> Roles { get; set; }
/// <summary>
/// 角色菜单表
/// </summary>
public virtual DbSet<Rolemenu> Rolemenus { get; set; }
/// <summary>
/// 用户表
/// </summary>
public virtual DbSet<User> Users { get; set; }
/// <summary>
/// 用户角色表
/// </summary>
public virtual DbSet<Userrole> UserRoles { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (!optionsBuilder.IsConfigured)
{
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see http://go.microsoft.com/fwlink/?LinkId=723263.
optionsBuilder.UseMySql("server=10.20.10.120;userid=root;pwd=000626;port=3306;database=qualitycontrolplatform;sslmode=none", Microsoft.EntityFrameworkCore.ServerVersion.Parse("8.0.28-mysql"));
}
}
/// <summary>
/// 实体映射关系
/// </summary>
/// <param name="modelBuilder"></param>
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.HasCharSet("utf8mb4")
.UseCollation("utf8mb4_0900_ai_ci");
modelBuilder.Entity<Attached>(entity =>
{
entity.ToTable("attacheds");
entity.HasIndex(e => e.UserId, "FK_Reference_8");
entity.Property(e => e.AttachedTime).HasColumnType("datetime");
entity.Property(e => e.FileName).HasMaxLength(200);
entity.Property(e => e.FileSize).HasMaxLength(20);
entity.HasOne(d => d.User)
.WithMany(p => p.Attacheds)
.HasForeignKey(d => d.UserId)
.HasConstraintName("FK_Reference_8");
});
modelBuilder.Entity<Attachednews>(entity =>
{
entity.HasKey(e => e.AttachedNewId)
.HasName("PRIMARY");
entity.ToTable("attachednews");
entity.HasIndex(e => e.NewId, "FK_Reference_6");
entity.HasIndex(e => e.AttachedId, "FK_Reference_7");
entity.HasOne(d => d.Attached)
.WithMany(p => p.Attachednews)
.HasForeignKey(d => d.AttachedId)
.HasConstraintName("FK_Reference_7");
entity.HasOne(d => d.New)
.WithMany(p => p.Attachednews)
.HasForeignKey(d => d.NewId)
.HasConstraintName("FK_Reference_6");
});
modelBuilder.Entity<Disease>(entity =>
{
entity.HasKey(e => e.DiseasesId)
.HasName("PRIMARY");
entity.ToTable("diseases");
entity.Property(e => e.Description).HasMaxLength(500);
entity.Property(e => e.DiseasesCode).HasMaxLength(100);
entity.Property(e => e.DiseasesName).HasMaxLength(100);
});
modelBuilder.Entity<Hospital>(entity =>
{
entity.ToTable("hospitals");
entity.Property(e => e.Address).HasMaxLength(50);
entity.Property(e => e.HospitalCode).HasMaxLength(30);
entity.Property(e => e.HospitalName).HasMaxLength(100);
entity.Property(e => e.Phone).HasMaxLength(30);
});
modelBuilder.Entity<Menu>(entity =>
{
entity.ToTable("menus");
entity.Property(e => e.Description).HasMaxLength(100);
entity.Property(e => e.MenuCode).HasMaxLength(30);
entity.Property(e => e.MenuName).HasMaxLength(20);
});
modelBuilder.Entity<News>(entity =>
{
entity.HasKey(e => e.NewId)
.HasName("PRIMARY");
entity.ToTable("news");
entity.HasIndex(e => e.PartId, "FK_Reference_13");
entity.HasIndex(e => e.UserId, "FK_Reference_5");
entity.Property(e => e.Content).HasColumnType("text");
entity.Property(e => e.Time).HasColumnType("datetime");
entity.Property(e => e.Title).HasMaxLength(200);
entity.HasOne(d => d.Part)
.WithMany(p => p.News)
.HasForeignKey(d => d.PartId)
.HasConstraintName("FK_Reference_13");
entity.HasOne(d => d.User)
.WithMany(p => p.News)
.HasForeignKey(d => d.UserId)
.HasConstraintName("FK_Reference_5");
});
modelBuilder.Entity<Part>(entity =>
{
entity.ToTable("parts");
entity.Property(e => e.Description).HasMaxLength(200);
entity.Property(e => e.PartCode).HasMaxLength(30);
entity.Property(e => e.PartName).HasMaxLength(30);
});
modelBuilder.Entity<Report>(entity =>
{
entity.ToTable("reports");
entity.HasIndex(e => e.DiseasesId, "FK_Reference_10");
entity.HasIndex(e => e.ReportTemplateId, "FK_Reference_11");
entity.HasIndex(e => e.UserId, "FK_Reference_12");
entity.Property(e => e.ReportContent).HasMaxLength(500);
entity.Property(e => e.ReportTime).HasColumnType("datetime");
entity.HasOne(d => d.Diseases)
.WithMany(p => p.Reports)
.HasForeignKey(d => d.DiseasesId)
.HasConstraintName("FK_Reference_10");
entity.HasOne(d => d.ReportTemplate)
.WithMany(p => p.Reports)
.HasForeignKey(d => d.ReportTemplateId)
.HasConstraintName("FK_Reference_11");
entity.HasOne(d => d.User)
.WithMany(p => p.Reports)
.HasForeignKey(d => d.UserId)
.HasConstraintName("FK_Reference_12");
});
modelBuilder.Entity<Reporttemplate>(entity =>
{
entity.ToTable("reporttemplates");
entity.HasIndex(e => e.DiseasesId, "FK_Reference_9");
entity.Property(e => e.IfMust).HasColumnType("bit(1)");
entity.Property(e => e.Question).HasMaxLength(300);
entity.Property(e => e.Type)
.HasMaxLength(20)
.HasComment("int 整型\r\n decimal 小数\r\n date 时间\r\n string 文本");
entity.HasOne(d => d.Diseases)
.WithMany(p => p.Reporttemplates)
.HasForeignKey(d => d.DiseasesId)
.HasConstraintName("FK_Reference_9");
});
modelBuilder.Entity<Role>(entity =>
{
entity.ToTable("roles");
entity.Property(e => e.Description).HasMaxLength(300);
entity.Property(e => e.RoleCode).HasMaxLength(20);
entity.Property(e => e.RoleName).HasMaxLength(20);
});
modelBuilder.Entity<Rolemenu>(entity =>
{
entity.ToTable("rolemenu");
entity.HasIndex(e => e.RoleId, "FK_Reference_3");
entity.HasIndex(e => e.MenuId, "FK_Reference_4");
entity.HasOne(d => d.Menu)
.WithMany(p => p.Rolemenus)
.HasForeignKey(d => d.MenuId)
.HasConstraintName("FK_Reference_4");
entity.HasOne(d => d.Role)
.WithMany(p => p.Rolemenus)
.HasForeignKey(d => d.RoleId)
.HasConstraintName("FK_Reference_3");
});
modelBuilder.Entity<User>(entity =>
{
entity.ToTable("users");
entity.HasIndex(e => e.HospitalId, "FK_Reference_14");
entity.Property(e => e.DepartCode).HasMaxLength(20);
entity.Property(e => e.Department).HasMaxLength(20);
entity.Property(e => e.Password).HasMaxLength(16);
entity.Property(e => e.Phone).HasMaxLength(20);
entity.Property(e => e.UserCode).HasMaxLength(30);
entity.Property(e => e.UserName).HasMaxLength(30);
entity.HasOne(d => d.Hospital)
.WithMany(p => p.Users)
.HasForeignKey(d => d.HospitalId)
.HasConstraintName("FK_Reference_14");
});
modelBuilder.Entity<Userrole>(entity =>
{
entity.ToTable("userrole");
entity.HasIndex(e => e.RoleId, "FK_Reference_1");
entity.HasIndex(e => e.UserId, "FK_Reference_2");
entity.HasOne(d => d.Role)
.WithMany(p => p.Userroles)
.HasForeignKey(d => d.RoleId)
.HasConstraintName("FK_Reference_1");
entity.HasOne(d => d.User)
.WithMany(p => p.Userroles)
.HasForeignKey(d => d.UserId)
.HasConstraintName("FK_Reference_2");
});
OnModelCreatingPartial(modelBuilder);
}
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
}
}

@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
#nullable disable
namespace QualityControlPlatform.Models.DbContext
{
public partial class Report
{
public int ReportId { get; set; }
public int? DiseasesId { get; set; }
public int? ReportTemplateId { get; set; }
public int? UserId { get; set; }
public string ReportContent { get; set; }
public DateTime? ReportTime { get; set; }
public virtual Disease Diseases { get; set; }
public virtual Reporttemplate ReportTemplate { get; set; }
public virtual User User { get; set; }
}
}

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
#nullable disable
namespace QualityControlPlatform.Models.DbContext
{
public partial class Reporttemplate
{
public Reporttemplate()
{
Reports = new HashSet<Report>();
}
public int ReportTemplateId { get; set; }
public int? DiseasesId { get; set; }
public string Question { get; set; }
public ulong? IfMust { get; set; }
public string Type { get; set; }
public virtual Disease Diseases { get; set; }
public virtual ICollection<Report> Reports { get; set; }
}
}

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
#nullable disable
namespace QualityControlPlatform.Models.DbContext
{
public partial class Role
{
public Role()
{
Rolemenus = new HashSet<Rolemenu>();
Userroles = new HashSet<Userrole>();
}
public int RoleId { get; set; }
public string RoleName { get; set; }
public string RoleCode { get; set; }
public string Description { get; set; }
public virtual ICollection<Rolemenu> Rolemenus { get; set; }
public virtual ICollection<Userrole> Userroles { get; set; }
}
}

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
#nullable disable
namespace QualityControlPlatform.Models.DbContext
{
public partial class Rolemenu
{
public int RoleMenuId { get; set; }
public int? RoleId { get; set; }
public int? MenuId { get; set; }
public virtual Menu Menu { get; set; }
public virtual Role Role { get; set; }
}
}

@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
#nullable disable
namespace QualityControlPlatform.Models.DbContext
{
public partial class User
{
public User()
{
Attacheds = new HashSet<Attached>();
News = new HashSet<News>();
Reports = new HashSet<Report>();
Userroles = new HashSet<Userrole>();
}
public int UserId { get; set; }
public int? HospitalId { get; set; }
public string UserName { get; set; }
public string UserCode { get; set; }
public string Password { get; set; }
public string Phone { get; set; }
public string Department { get; set; }
public string DepartCode { get; set; }
public virtual Hospital Hospital { get; set; }
public virtual ICollection<Attached> Attacheds { get; set; }
public virtual ICollection<News> News { get; set; }
public virtual ICollection<Report> Reports { get; set; }
public virtual ICollection<Userrole> Userroles { get; set; }
}
}

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
#nullable disable
namespace QualityControlPlatform.Models.DbContext
{
public partial class Userrole
{
public int UserRoleId { get; set; }
public int? RoleId { get; set; }
public int? UserId { get; set; }
public virtual Role Role { get; set; }
public virtual User User { get; set; }
}
}

@ -1,15 +0,0 @@
using System;
namespace QualityControlPlatform.Models
{
public class WeatherForecast
{
public DateTime Date { get; set; }
public int TemperatureC { get; set; }
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
public string Summary { get; set; }
}
}

@ -7,6 +7,13 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="3.1.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.15">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.5" />
<PackageReference Include="MySql.Data.EntityFrameworkCore" Version="8.0.22" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="5.0.4" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.3.0" />
</ItemGroup>

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save