개정판 e458a996
issue #0000 소스 복구
Change-Id: I3fbe27e09e119bac3f1ec3409ff77c58d7d2f13c
ID2.Manager/ID2.Manager.Dapper/Repository/DocumentRepository.cs | ||
---|---|---|
131 | 131 |
try |
132 | 132 |
{ |
133 | 133 |
string query = $@" |
134 |
select doc.*, datediff(SECOND, doc.ID2StartDate, doc.ID2EndDate) as ID2JobTime, |
|
135 |
|
|
136 |
( |
|
137 |
select markus.* |
|
138 |
from [markus_SEC].[dbo].[ViewMarkupData] markus where doc.DocumentNo = markus.DOCUMENT_ID |
|
139 |
FOR JSON PATH |
|
140 |
) as MarkupText |
|
141 |
from dbo.Documents doc |
|
142 |
where doc.IsDeleted=0 {sbWhere} |
|
143 |
order by doc.Seq |
|
134 |
select doc.*, datediff(SECOND, doc.ID2StartDate, doc.ID2EndDate) as ID2JobTime, |
|
135 |
markus.* |
|
136 |
from dbo.Documents doc |
|
137 |
LEFT OUTER JOIN |
|
138 |
(SELECT [PROJECT_NO] as PROJECT_NO |
|
139 |
,[DOCUMENT_ID] as DocumentNo |
|
140 |
,[MARKUP_DATA_ID] |
|
141 |
,[PAGENUMBER] |
|
142 |
,[Text] as TEXT |
|
143 |
,[CREATE_DATE] as CREATE_DATE |
|
144 |
,[NAME] as CREATE_USER |
|
145 |
FROM [markus_SEC].dbo.[ViewMarkupData]) markus |
|
146 |
ON doc.DocumentNo = markus.DocumentNo |
|
147 |
where doc.IsDeleted=0 {sbWhere} |
|
148 |
order by doc.Seq |
|
144 | 149 |
|
145 | 150 |
select @Total=count(*) from dbo.Documents doc where doc.IsDeleted=0 {sbTotalWhere} |
146 | 151 |
select @Total;"; |
... | ... | |
150 | 155 |
dynamicParameters.AddDynamicParams(parameters); |
151 | 156 |
} |
152 | 157 |
|
153 |
var ret = Query<Documents>(query, dynamicParameters); |
|
158 |
var docDictionary = new Dictionary<string, Documents>(); |
|
159 |
|
|
160 |
var ret = MultiQuery<Documents, MarkupText, Documents>(query, |
|
161 |
(document, markusText) => |
|
162 |
{ |
|
163 |
Documents doc; |
|
164 |
|
|
165 |
if (!docDictionary.TryGetValue(document.DocumentNo, out doc)) |
|
166 |
{ |
|
167 |
doc = document; |
|
168 |
doc.Markups = doc.Markups ?? new List<MarkupText>(); |
|
169 |
docDictionary.Add(doc.DocumentNo, doc); |
|
170 |
} |
|
171 |
|
|
172 |
doc.Markups.Add(markusText); |
|
173 |
return doc; |
|
174 |
|
|
175 |
}, dynamicParameters, splitOn: "DocumentNo").Distinct(); |
|
154 | 176 |
|
155 | 177 |
int totalCount = dynamicParameters.Get<int>("Total"); |
156 | 178 |
|
... | ... | |
457 | 479 |
update dbo.Documents |
458 | 480 |
set ModifiedDate=getdate() {sbSet} |
459 | 481 |
where [DocID]=@DocID;"; |
460 |
base.Execute(query, parameters, transaction);
|
|
482 |
base.Execute(query, parameters, transaction); |
|
461 | 483 |
} |
462 | 484 |
} |
463 | 485 |
} |
내보내기 Unified diff