sunpengfei
2025-08-07 59e73ad4283491cd407854874879e0ddc8dafaba
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
using Furion.DatabaseAccessor;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace FlexJobApi.Core
{
    /// <summary>
    /// 任务信息
    /// </summary>
    public class TaskInfo : CommonEntity, IEntityTypeBuilder<TaskInfo>
    {
        public TaskInfo()
        {
            Benefits = [];
            CredentialLimits = [];
        }
 
        /// <summary>
        /// 企业Id
        /// </summary>
        public Guid EnterpriseId { get; set; }
 
        /// <summary>
        /// 企业
        /// </summary>
        public Enterprise Enterprise { get; set; }
 
        /// <summary>
        /// 任务名称
        /// </summary>
        [Required]
        public string Name { get; set; }
 
        /// <summary>
        /// 计费方式
        /// </summary>
        public EnumBillingMethod BillingMethod { get; set; }
 
        /// <summary>
        /// 服务费
        /// </summary>
        public decimal ServiceFee { get; set; }
 
        /// <summary>
        /// 结算方式
        /// </summary>
        public EnumSettlementCycle SettlementCycle { get; set; }
 
        /// <summary>
        /// 福利
        /// </summary>
        public List<TaskInfoBenefit> Benefits { get; set; }
 
        /// <summary>
        /// 年龄范围最小
        /// </summary>
        public int AgeMinLimit { get; set; }
 
        /// <summary>
        /// 年龄范围大
        /// </summary>
        public int AgeMaxLimit { get; set; }
 
        /// <summary>
        /// 性别要求
        /// </summary>
        public EnumUserGender GenderLimit { get; set; }
 
        /// <summary>
        /// 资格证书
        /// </summary>
        public List<TaskInfoCredentialLimit> CredentialLimits { get; set; }
 
        /// <summary>
        /// 任务地点所属省份编号
        /// </summary>
        public string ProvinceCode { get; set; }
 
        /// <summary>
        /// 任务地点所属省份
        /// </summary>
        public DictionaryData Province { get; set; }
 
        /// <summary>
        /// 任务地点所属城市编号
        /// </summary>
        public string CityCode { get; set; }
 
        /// <summary>
        /// 任务地点所属城市
        /// </summary>
        public DictionaryData City { get; set; }
 
        /// <summary>
        /// 任务地点详细地址
        /// </summary>
        public string Address { get; set; }
 
        /// <summary>
        /// 任务开始时间
        /// </summary>
        public DateTime BeginTime { get; set; }
 
        /// <summary>
        /// 任务结束时间
        /// </summary>
        public DateTime EndTime { get; set; }
 
        public void Configure(EntityTypeBuilder<TaskInfo> entityBuilder, DbContext dbContext, Type dbContextLocator)
        {
            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);
        }
    }
}