| | |
| | | using Furion.DatabaseAccessor; |
| | | using Microsoft.EntityFrameworkCore; |
| | | using Microsoft.EntityFrameworkCore.Metadata.Builders; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.ComponentModel.DataAnnotations; |
| | |
| | | /// <summary> |
| | | /// 用户信息 |
| | | /// </summary> |
| | | public class UserInfo : CommonEntity, IEntitySeedData<UserInfo> |
| | | public class UserInfo : CommonEntity, IEntitySeedData<UserInfo>, IEntityTypeBuilder<UserInfo> |
| | | { |
| | | public UserInfo() |
| | | { |
| | |
| | | public Enterprise Enterprise { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 头像 |
| | | /// </summary> |
| | | public string Avatar { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 微信开放Id |
| | | /// </summary> |
| | | [MaxLength(32)] |
| | |
| | | public List<UserInfoDepartment> UserInfoDepartments { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 身份Id |
| | | /// 身份编号 |
| | | /// </summary> |
| | | public Guid? PersonalIdentityId { get; set; } |
| | | public string PersonalIdentityCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 身份 |
| | |
| | | public DictionaryData PersonalIdentity { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 学历Id |
| | | /// 学历编号 |
| | | /// </summary> |
| | | public Guid? EducationalBackgroundId { get; set; } |
| | | public string EducationalBackgroundCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 学历 |
| | |
| | | public DictionaryData EducationalBackground { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 常驻城市Id |
| | | /// 常驻省份编号 |
| | | /// </summary> |
| | | public Guid? CityId { get; set; } |
| | | public string ProvinceCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 常驻省份 |
| | | /// </summary> |
| | | public DictionaryData Province { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 常驻城市编号 |
| | | /// </summary> |
| | | public string CityCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 常驻城市 |
| | |
| | | /// </summary> |
| | | public int? Weight { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 备注 |
| | | /// </summary> |
| | | public string Remark { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 状态 |
| | | /// </summary> |
| | | public EnumUserInfoStatus Status { get; set; } |
| | | |
| | | public void Configure(EntityTypeBuilder<UserInfo> entityBuilder, DbContext dbContext, Type dbContextLocator) |
| | | { |
| | | entityBuilder |
| | | .HasOne(it => it.PersonalIdentity) |
| | | .WithMany() |
| | | .HasForeignKey(it => it.PersonalIdentityCode) |
| | | .HasPrincipalKey(it => it.Code) |
| | | .OnDelete(DeleteBehavior.Restrict); |
| | | entityBuilder |
| | | .HasOne(it => it.EducationalBackground) |
| | | .WithMany() |
| | | .HasForeignKey(it => it.EducationalBackgroundCode) |
| | | .HasPrincipalKey(it => it.Code) |
| | | .OnDelete(DeleteBehavior.Restrict); |
| | | entityBuilder |
| | | .HasOne(it => it.Province) |
| | | .WithMany() |
| | | .HasForeignKey(it => it.ProvinceCode) |
| | | .HasPrincipalKey(it => it.Code) |
| | | .OnDelete(DeleteBehavior.Restrict); |
| | | entityBuilder |
| | | .HasOne(it => it.City) |
| | | .WithMany() |
| | | .HasForeignKey(it => it.CityCode) |
| | | .HasPrincipalKey(it => it.Code) |
| | | .OnDelete(DeleteBehavior.Restrict); |
| | | } |
| | | |
| | | public IEnumerable<UserInfo> HasData(DbContext dbContext, Type dbContextLocator) |
| | | { |
| | | return new List<UserInfo> |