From a8b475881959d4a88d821951a615f03e7d0d1725 Mon Sep 17 00:00:00 2001
From: sunpengfei <i@angelzzz.com>
Date: 星期四, 07 八月 2025 13:28:30 +0800
Subject: [PATCH] feat:字典优化

---
 FlexJobApi.Core/Entities/Users/UserInfo.cs |   68 ++++++++++++++++++++++++++++++---
 1 files changed, 61 insertions(+), 7 deletions(-)

diff --git a/FlexJobApi.Core/Entities/Users/UserInfo.cs b/FlexJobApi.Core/Entities/Users/UserInfo.cs
index b413c16..f13498f 100644
--- a/FlexJobApi.Core/Entities/Users/UserInfo.cs
+++ b/FlexJobApi.Core/Entities/Users/UserInfo.cs
@@ -1,5 +1,6 @@
 锘縰sing Furion.DatabaseAccessor;
 using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Metadata.Builders;
 using System;
 using System.Collections.Generic;
 using System.ComponentModel.DataAnnotations;
@@ -12,7 +13,7 @@
     /// <summary>
     /// 鐢ㄦ埛淇℃伅
     /// </summary>
-    public class UserInfo : CommonEntity, IEntitySeedData<UserInfo>
+    public class UserInfo : CommonEntity, IEntitySeedData<UserInfo>, IEntityTypeBuilder<UserInfo>
     {
         public UserInfo()
         {
@@ -48,6 +49,11 @@
         public Enterprise Enterprise { get; set; }
 
         /// <summary>
+        /// 澶村儚
+        /// </summary>
+        public string Avatar { get; set; }
+
+        /// <summary>
         /// 寰俊寮�鏀綢d
         /// </summary>
         [MaxLength(32)]
@@ -69,9 +75,9 @@
         public List<UserInfoDepartment> UserInfoDepartments { get; set; }
 
         /// <summary>
-        /// 韬唤Id
+        /// 韬唤缂栧彿
         /// </summary>
-        public Guid? PersonalIdentityId { get; set; }
+        public string PersonalIdentityCode { get; set; }
 
         /// <summary>
         /// 韬唤
@@ -79,9 +85,9 @@
         public DictionaryData PersonalIdentity { get; set; }
 
         /// <summary>
-        /// 瀛﹀巻Id
+        /// 瀛﹀巻缂栧彿
         /// </summary>
-        public Guid? EducationalBackgroundId { get; set; }
+        public string EducationalBackgroundCode { get; set; }
 
         /// <summary>
         /// 瀛﹀巻
@@ -89,9 +95,19 @@
         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>
         /// 甯搁┗鍩庡競
@@ -138,6 +154,44 @@
         /// </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>

--
Gitblit v1.9.1