From 32288af3e5f12bc48d8360114c872fde5d9ff4a8 Mon Sep 17 00:00:00 2001
From: sunpengfei <i@angelzzz.com>
Date: 星期五, 08 八月 2025 09:09:08 +0800
Subject: [PATCH] pref:优化

---
 FlexJobApi.Core/Entities/Users/Enterprise.cs |   90 +++++++++++++++++++++++++++++++++++++-------
 1 files changed, 75 insertions(+), 15 deletions(-)

diff --git a/FlexJobApi.Core/Entities/Users/Enterprise.cs b/FlexJobApi.Core/Entities/Users/Enterprise.cs
index 035e637..421f20c 100644
--- a/FlexJobApi.Core/Entities/Users/Enterprise.cs
+++ b/FlexJobApi.Core/Entities/Users/Enterprise.cs
@@ -1,4 +1,7 @@
-锘縰sing System;
+锘縰sing Furion.DatabaseAccessor;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Metadata.Builders;
+using System;
 using System.Collections.Generic;
 using System.ComponentModel.DataAnnotations;
 using System.Linq;
@@ -10,18 +13,13 @@
     /// <summary>
     /// 浼佷笟
     /// </summary>
-    public class Enterprise : CommonEntity
+    public class Enterprise : CommonEntity, IEntityTypeBuilder<Enterprise>
     {
         public Enterprise()
         {
-            UserInfos = [];
+            Users = [];
             Departments = [];
         }
-
-        /// <summary>
-        /// 浼佷笟璁よ瘉Id
-        /// </summary>
-        public Guid EnterpriseAuthId { get; set; }
 
         /// <summary>
         /// 浼佷笟璁よ瘉
@@ -29,9 +27,40 @@
         public EnterpriseAuth EnterpriseAuth { get; set; }
 
         /// <summary>
-        /// 鎵�鍦ㄧ渷浠絀d
+        /// 浼佷笟鍏ㄧО
         /// </summary>
-        public Guid? ProvinceId { get; set; }
+        [Required]
+        [MaxLength(128)]
+        public string EnterpriseName { get; set; }
+
+        /// <summary>
+        /// 缁熶竴绀句細淇$敤浠g爜
+        /// </summary>
+        [Required]
+        [MaxLength(18)]
+        public string SocietyCreditCode { get; set; }
+
+        /// <summary>
+        /// 钀ヤ笟鎵х収鐓х墖
+        /// </summary>
+        public string LicenseImage { get; set; }
+
+        /// <summary>
+        /// 娉曚汉濮撳悕
+        /// </summary>
+        [MaxLength(32)]
+        public string LegalPerson { get; set; }
+
+        /// <summary>
+        /// 娉曚汉韬唤璇佸彿
+        /// </summary>
+        [MaxLength(18)]
+        public string LegalIdentity { get; set; }
+
+        /// <summary>
+        /// 鎵�鍦ㄧ渷浠界紪鍙�
+        /// </summary>
+        public string ProvinceCode { get; set; }
 
         /// <summary>
         /// 鎵�鍦ㄧ渷浠�
@@ -39,9 +68,9 @@
         public DictionaryData Province { get; set; }
 
         /// <summary>
-        /// 鎵�鍦ㄥ煄甯侷d
+        /// 鎵�鍦ㄥ煄甯傜紪鍙�
         /// </summary>
-        public Guid? CityId { get; set; }
+        public string CityCode { get; set; }
 
         /// <summary>
         /// 鎵�鍦ㄥ煄甯�
@@ -49,9 +78,9 @@
         public DictionaryData City { get; set; }
 
         /// <summary>
-        /// 鎵�灞炶涓欼d
+        /// 鎵�灞炶涓氱紪鍙�
         /// </summary>
-        public Guid? IndustryTypeId { get; set; }
+        public string IndustryTypeCode { get; set; }
 
         /// <summary>
         /// 鎵�灞炶涓�
@@ -137,6 +166,11 @@
         public decimal SmsCost { get; set; }
 
         /// <summary>
+        /// 鏄惁瀹炲悕
+        /// </summary>
+        public bool IsReal { get; set; }
+
+        /// <summary>
         /// 閮ㄩ棬
         /// </summary>
         public List<Department> Departments { get; set; }
@@ -144,6 +178,32 @@
         /// <summary>
         /// 鐢ㄦ埛淇℃伅
         /// </summary>
-        public List<UserInfo> UserInfos { get; set; }
+        public List<User> Users { get; set; }
+
+        public void Configure(EntityTypeBuilder<Enterprise> entityBuilder, DbContext dbContext, Type dbContextLocator)
+        {
+            entityBuilder
+                .HasOne(it => it.EnterpriseAuth)
+                .WithOne(it => it.Enterprise)
+                .HasForeignKey<EnterpriseAuth>(it => it.Id);
+            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);
+            entityBuilder
+                .HasOne(it => it.IndustryType)
+                .WithMany()
+                .HasForeignKey(it => it.IndustryTypeCode)
+                .HasPrincipalKey(it => it.Code)
+                .OnDelete(DeleteBehavior.Restrict);
+        }
     }
 }

--
Gitblit v1.9.1