1
lixiaojun
2025-01-03 754a5cd2a8b2a76e1c00cc45c89457eeb74637bf
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
using Yw.CAL.HttpClient;
using Yw.Dto;
 
namespace HStation.CAL.HttpClient
{
    /// <summary>
    ///
    /// </summary>
    public class PhartDiagramRelation : BaseCAL_Paras_Flags_TagName_Sorter<AddPhartDiagramRelationInput, UpdatePhartDiagramRelationInput, PhartDiagramRelationDto>, IPhartDiagramRelation
    {
        protected override string Prefix
        {
            get { return $"{HStation.BLL.PhartRelation.ConfigHelper.HttpUrl}/PhartRelation/PhartDiagramRelation"; }
        }
        
        #region Query   
 
        /// <summary>
        /// 通过 ID 获取
        /// </summary> 
        public async Task<PhartDiagramRelationExtensionsDto> GetExByID(long ID)
        {
            var paras = new List<(string Name, object Value)>()
            {
                (nameof(ID),ID),
            };
            return await GetUrl("GetExByID@V1.0").Get<PhartDiagramRelationExtensionsDto>(paras);
        }
 
        /// <summary>
        /// 通过 Ids 获取
        /// </summary> 
        public async Task<List<PhartDiagramRelationExtensionsDto>> GetExByIds(List<long> Ids)
        {
            var paras = new List<(string Name, object Value)>()
            {
                (nameof(Ids),Ids),
            };
            return await GetUrl("GetExByIds@V1.0").Get<List<PhartDiagramRelationExtensionsDto>>(paras);
        } 
 
        /// <summary>
        /// 通过 ObjectType ObjectID 获取
        /// </summary>
        public async Task<List<PhartDiagramRelationExtensionsDto>> GetExByObjectTypeAndObjectID(string ObjectType, long ObjectID)
        {
            var paras = new List<(string Name, object Value)>()
            {
                (nameof(ObjectType),ObjectType),
                (nameof(ObjectID),ObjectID),
            };
            return await GetUrl("GetExByObjectTypeAndObjectID@V1.0").Get<List<PhartDiagramRelationExtensionsDto>>(paras);
        }
 
        /// <summary>
        /// 通过 ObjectType ObjectID 获取 Default
        /// </summary>
        public async Task<PhartDiagramRelationExtensionsDto> GetDefaultExByObjectTypeAndObjectID(string ObjectType, long ObjectID)
        {
            var paras = new List<(string Name, object Value)>()
            {
                (nameof(ObjectType),ObjectType),
                (nameof(ObjectID),ObjectID),
            };
            return await GetUrl("GetDefaultExByObjectTypeAndObjectID@V1.0").Get<PhartDiagramRelationExtensionsDto>(paras);
        }
 
        /// <summary>
        /// 获取最大排序码
        /// </summary>
        public async Task<int> GetMaxSortCode()
        {
            return await GetUrl("GetMaxSortCode@V1.0").Get<int>();
        }
 
        #endregion
 
        #region Insert
 
        /// <summary>
        /// 插入拓展
        /// </summary> 
        public async Task<long> InsertEx(PhartDiagramRelationDto relation, Yw.Dto.PhartDiagramDto diagram, List<Yw.Dto.PhartGraphDto> graphList)
        {
            var modelRelation = relation.Adapt<HStation.Model.PhartDiagramRelation>();
            var modelDiagram = diagram.Adapt<Yw.Model.PhartDiagram>();
            var modelGraphList = graphList.Adapt<List<Yw.Model.PhartGraph>>();
            var paras = new Dto.PhartDiagramRelationExtensionsDto(modelRelation, modelDiagram, modelGraphList);
            return await GetUrl("InsertEx@V1.0").Post<long>(paras);
        } 
 
 
        #endregion Insert
 
        #region Update
 
        /// <summary>
        /// 更新拓展
        /// </summary>
        public async Task<bool> UpdateEx(PhartDiagramRelationDto relation, Yw.Dto.PhartDiagramDto diagram, List<Yw.Dto.PhartGraphDto> graphList)
        {
            var modelRelation = relation.Adapt<HStation.Model.PhartDiagramRelation>();
            var modelDiagram = diagram.Adapt<Yw.Model.PhartDiagram>();
            var modelGraphList = graphList.Adapt<List<Yw.Model.PhartGraph>>();
            var paras = new Dto.PhartDiagramRelationExtensionsDto(modelRelation, modelDiagram, modelGraphList);
            return await GetUrl("UpdateEx@V1.0").Put<bool>(paras);
        } 
  
        /// <summary>
        /// 更新 OtherName
        /// </summary> 
        public async Task<bool> UpdateOtherName(long ID, string OtherName)
        {
            var paras = new { ID, OtherName };
            return await GetUrl("UpdateOtherName@V1.0").Put<bool>(paras);
        }
 
        /// <summary>
        /// 更新 Importance
        /// </summary> 
        public async Task<bool> UpdateImportance(long ID, int Importance)
        {
            var paras = new { ID, Importance };
            return await GetUrl("UpdateImportance@V1.0").Put<bool>(paras);
        }
 
        /// <summary>
        /// 更新 Description
        /// </summary> 
        public async Task<bool> UpdateDescription(long ID, string Description)
        {
            var paras = new { ID, Description };
            return await GetUrl("UpdateDescription@V1.0").Put<bool>(paras);
        }
 
        #endregion Update
 
        #region Delete
           
 
        /// <summary>
        /// 通过 ObjectType ObjectID 删除
        /// </summary> 
        public async Task<bool> DeleteByObjectTypeAndObjectID(string ObjectType, long ObjectID)
        {
            var paras = new List<(string Name, object Value)>()
            {
                (nameof(ObjectType),ObjectType),
                (nameof(ObjectID),ObjectID),
            };
            return await GetUrl("DeleteByObjectTypeAndObjectID@V1.0").Delete<bool>(paras);
        }
 
 
        /// <summary>
        /// 通过 DiagramID 删除所有映射、图表、图形
        /// </summary> 
        public async Task<bool> DeleteByDiagramID(long DiagramID)
        {
            var paras = new List<(string Name, object Value)>()
            {
                (nameof(DiagramID),DiagramID), 
            };
            return await GetUrl("DeleteByDiagramID@V1.0").Delete<bool>(paras);
        }
          
 
        #endregion
 
 
 
    }
}