|
@@ -8,4 +8,97 @@
|
8
|
8
|
|
9
|
9
|
|
10
|
10
|
|
11
|
|
-解决思路是:当在总部运营后台,解除项目和模块关系的那一刻,在现在的处理逻辑上再加上:把模块和线路标记为物理删除。在办公楼版中,需要把`macs`、`breakers`、`breakerdatas`中的相关模块或线路设置为物理删除。然后在显示的时候,把标记为逻辑删除的模块和线路排除。
|
|
11
|
+解决思路是:当在总部运营后台,解除项目和模块关系的那一刻,在现在的处理逻辑上再加上:把项目数据库的模块和线路标记为物理删除。在办公楼版中,需要把`macs`、`breakers`、`breakerdatas`中的相关模块或线路设置为物理删除。然后在显示的时候,把标记为逻辑删除的模块和线路排除。
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+具体步骤大致是:
|
|
16
|
+
|
|
17
|
+1. 总部运营后台根据`ProjectId`获取办公楼版的上下文。
|
|
18
|
+2. 再获取办公楼版的某个仓储
|
|
19
|
+
|
|
20
|
+类似如下:
|
|
21
|
+
|
|
22
|
+```
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+ public class TestRequestHandler : IRequestHandler<TestRequest, DDResponseWrapper<TestRequestDto>>
|
|
26
|
+ {
|
|
27
|
+ private readonly DDOfficeDbHelper _officeHelper;//获取办公楼版上下文的帮助类
|
|
28
|
+ private ICompanyRepository _companyRepo;//办公楼版的某个仓储
|
|
29
|
+
|
|
30
|
+ public TestRequestHandler(DDOfficeDbHelper officeHelper)
|
|
31
|
+ {
|
|
32
|
+ _officeHelper = officeHelper;
|
|
33
|
+ }
|
|
34
|
+ public async Task<DDResponseWrapper<TestRequestDto>> Handle(TestRequest request, CancellationToken cancellationToken)
|
|
35
|
+ {
|
|
36
|
+ var result = new DDResponseWrapper<TestRequestDto>();
|
|
37
|
+ var dto = new TestRequestDto();
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+ var ef = await _officeHelper.GetOfficeContextByProjectIdAsync("4");//根据ProjectId获取办公楼版的上下文
|
|
41
|
+ _companyRepo = new CompanyRepository(ef);//实例化办公楼版的某个仓储
|
|
42
|
+
|
|
43
|
+ var company = _companyRepo.GetAll().FirstOrDefault();
|
|
44
|
+ dto.Message = company.Name;
|
|
45
|
+
|
|
46
|
+ result.data = dto;
|
|
47
|
+ return await Task.FromResult(result);
|
|
48
|
+ }
|
|
49
|
+ }
|
|
50
|
+
|
|
51
|
+ public class TestRequest : IRequest<DDResponseWrapper<TestRequestDto>>
|
|
52
|
+ {
|
|
53
|
+ }
|
|
54
|
+
|
|
55
|
+ public class TestRequestDto
|
|
56
|
+ {
|
|
57
|
+ public string Message { get; set; }
|
|
58
|
+ }
|
|
59
|
+```
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+基础设施层的版本如下:
|
|
64
|
+
|
|
65
|
+```
|
|
66
|
+DD.Libs 1.0.93
|
|
67
|
+DD.Infra1.0.74
|
|
68
|
+```
|
|
69
|
+
|
|
70
|
+办公楼版有哪些仓储呢?
|
|
71
|
+
|
|
72
|
+```
|
|
73
|
+services.AddScoped<ICompanyRepository, CompanyRepository>();
|
|
74
|
+services.AddScoped<ICompanyUserRepository, CompanyUserRepository>();
|
|
75
|
+services.AddScoped<IElectricBoxRepository, ElectricBoxRepository>();
|
|
76
|
+services.AddScoped<IMacRepository, MacRepository>();
|
|
77
|
+services.AddScoped<IBreakerRepository, BreakerRepository>();
|
|
78
|
+services.AddScoped<ILocationRepository, LocationRepository>();
|
|
79
|
+services.AddScoped<IOperationRepository, OperationRepository>();
|
|
80
|
+services.AddScoped<IDateJobRepository, DateJobRepository>();
|
|
81
|
+services.AddScoped<IJobRepository, JobRepository>();
|
|
82
|
+services.AddScoped<IJobBreakerRepository, JobBreakerRepository>();
|
|
83
|
+services.AddScoped<IProjectSettingRepository, ProjectSettingRepository>();
|
|
84
|
+services.AddScoped<IPowerRepository, PowerRepository>();
|
|
85
|
+services.AddScoped<IRealWarningRepository, RealWarningRepository>();
|
|
86
|
+services.AddScoped<IRealWarningDataRepository, RealWarningDataRepository>();
|
|
87
|
+services.AddScoped<IWarningHistoryRepository, WarningHistoryRepository>();
|
|
88
|
+services.AddScoped<IWarningHistoryDataRepository, WarningHistoryDataRepository>();
|
|
89
|
+services.AddScoped<IBreakerDataRepository, BreakerDataRepository>();
|
|
90
|
+services.AddScoped<INotiRepository, NotiRepository>();
|
|
91
|
+services.AddScoped<ITestPowerRepository, TestPowerRepository>();
|
|
92
|
+services.AddScoped<IBreakerWarningPolicyRepository, BreakerWarningPolicyRepository>();
|
|
93
|
+services.AddScoped<IMockBreakerDataRepository, MockBreakerDataRepository>();
|
|
94
|
+services.AddScoped<IElectricFeeRepository, ElectricFeeRepository>();
|
|
95
|
+```
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|