개정판 473ee829
issue #0000
Project 정보 수정
ID2 Project DB의 정보를 ID2 Manager와 매핑
Change-Id: Idcc82a34b8027032529cbc43a62757ea6d48f586
ID2.Manager/ID2.Manager.Common/Informations.cs | ||
---|---|---|
38 | 38 |
return x.Code.Equals(ProjectCode); |
39 | 39 |
}).FirstOrDefault(); |
40 | 40 |
|
41 |
return proj == null ? string.Empty : proj.ID2Path; |
|
41 |
return proj == null ? string.Empty : proj.ID2Info.Path;
|
|
42 | 42 |
} |
43 | 43 |
|
44 | 44 |
private readonly List<string> _JobLevel = new List<string>() { "1", "2", "3", "4", "5" }; |
ID2.Manager/ID2.Manager.Controller/Controllers/ProjectController.cs | ||
---|---|---|
30 | 30 |
ID2Path = prjs?.Path ?? null, |
31 | 31 |
GroupID = mg.GroupID, |
32 | 32 |
GroupName = mg.GroupName, |
33 |
Level = mg.Level |
|
33 |
Level = mg.Level, |
|
34 |
ID2Info = prjs ?? new ID2ProjectInfo(), |
|
34 | 35 |
}; |
35 | 36 |
} |
36 | 37 |
} |
... | ... | |
43 | 44 |
var project = rep.GetProjectInfo(ProjectID); |
44 | 45 |
|
45 | 46 |
var id2 = id2Project.Where(x => x.Name.Equals(project.Code)).FirstOrDefault(); |
46 |
if (id2 != null) |
|
47 |
{ |
|
48 |
project.ID2Path = id2.Path; |
|
49 |
} |
|
47 |
project.ID2Path = id2?.Path ?? null; |
|
48 |
project.ID2Info = id2 ?? new ID2ProjectInfo(); |
|
50 | 49 |
|
51 | 50 |
return rep.GetProjectInfo(ProjectID); |
52 | 51 |
} |
ID2.Manager/ID2.Manager.Dapper/Repository/ID2Repository.cs | ||
---|---|---|
21 | 21 |
try |
22 | 22 |
{ |
23 | 23 |
string query = $@" |
24 |
SELECT p.* |
|
25 |
FROM Projects p |
|
26 |
INNER JOIN ( |
|
27 |
SELECT Min(Id) AS Id, Name |
|
28 |
FROM Projects pg |
|
29 |
WHERE ifnull(Name, '') <> '' |
|
30 |
GROUP BY Name |
|
31 |
) pg ON p.ID=pg.Id |
|
32 |
ORDER BY p.Id;"; |
|
24 |
select pj.Id, pj.ProjectID, pj.ProjectNo, pj.Name, pj.Desc, pj.Unit, pj.NPSUnit, pj.Path, pj.AreaName, pj.PlantName, pj.CreatedDate, pj.UpdatedDate |
|
25 |
,ty.UID as DBTypeID ,ty.Name as DBTypeName |
|
26 |
,db.Host, db.User, db.Password, db.FilePath as DBPath |
|
27 |
from ( |
|
28 |
select p.* |
|
29 |
from Projects p |
|
30 |
inner join |
|
31 |
( |
|
32 |
select Min(Id) as Id, Name |
|
33 |
from Projects |
|
34 |
where ifnull(Name, '') <> '' |
|
35 |
group by Name |
|
36 |
) g on p.Id=g.Id |
|
37 |
) pj |
|
38 |
inner join DBSettings db on pj.Id=db.Projects_UID |
|
39 |
inner join DBTypes ty on db.DBTypes_UID=ty.UID |
|
40 |
order by pj.Id;"; |
|
33 | 41 |
|
34 | 42 |
results = Query<ID2ProjectInfo>(query); |
35 | 43 |
} |
ID2.Manager/ID2.Manager.Dapper/Repository/ProjectRepository.cs | ||
---|---|---|
21 | 21 |
,Code |
22 | 22 |
,[Name] |
23 | 23 |
,isnull(Description,'') Description |
24 |
,isnull(ID2Path,'') ID2Path |
|
25 | 24 |
,isnull(ParentID,'') GroupID |
26 | 25 |
,convert(varchar(255),'') GroupName |
27 | 26 |
,1 [Level] |
... | ... | |
34 | 33 |
,p.Code |
35 | 34 |
,p.[Name] |
36 | 35 |
,p.Description |
37 |
,p.ID2Path |
|
38 | 36 |
,p.ParentID GroupID |
39 | 37 |
,pp.[Name] GroupName |
40 | 38 |
,pp.[Level]+1 [Level] |
... | ... | |
57 | 55 |
,Code |
58 | 56 |
,[Name] |
59 | 57 |
,isnull(Description,'') Description |
60 |
,isnull(ID2Path,'') ID2Path |
|
61 | 58 |
,isnull(ParentID,'') GroupID |
62 | 59 |
,convert(varchar(255),'') GroupName |
63 | 60 |
,1 [Level] |
... | ... | |
70 | 67 |
,p.Code |
71 | 68 |
,p.[Name] |
72 | 69 |
,p.Description |
73 |
,p.ID2Path |
|
74 | 70 |
,p.ParentID GroupID |
75 | 71 |
,pp.[Name] GroupName |
76 | 72 |
,pp.[Level]+1 [Level] |
... | ... | |
147 | 143 |
{ |
148 | 144 |
{ "ParentID", projectInfo.ProjectID }, |
149 | 145 |
{ "Name", prj.Name }, |
150 |
{ "Desc", prj.Desc }, |
|
151 |
{ "Path", prj.Path } |
|
146 |
{ "Desc", prj.Desc } |
|
152 | 147 |
}; |
153 | 148 |
|
154 | 149 |
query = $@" |
... | ... | |
156 | 151 |
begin |
157 | 152 |
update dbo.Projects |
158 | 153 |
set [Description]=@Desc |
159 |
,ID2Path=@Path |
|
160 | 154 |
where ParentID=@ParentID and Code=@Name |
161 | 155 |
end |
162 | 156 |
else |
... | ... | |
168 | 162 |
,Code |
169 | 163 |
,[Name] |
170 | 164 |
,[Description] |
171 |
,ID2Path |
|
172 | 165 |
) |
173 | 166 |
values |
174 | 167 |
( |
... | ... | |
177 | 170 |
,@Name |
178 | 171 |
,@Name |
179 | 172 |
,@Desc |
180 |
,@Path |
|
181 | 173 |
) |
182 | 174 |
end;"; |
183 | 175 |
base.Execute(query, parameters, transaction); |
ID2.Manager/ID2.Manager.Data/Models/ProjectInfo.cs | ||
---|---|---|
27 | 27 |
public string GroupName { get; set; } |
28 | 28 |
[DataMember] |
29 | 29 |
public int Level { get; set; } |
30 |
|
|
31 |
public ProjectInfo DeepCopy(ProjectInfo data) |
|
32 |
{ |
|
33 |
return new ProjectInfo() |
|
34 |
{ |
|
35 |
ProjectID = data.ProjectID, |
|
36 |
Code = data.Code, |
|
37 |
Name = data.Name, |
|
38 |
Description = data.Description, |
|
39 |
ID2Path = data.ID2Path, |
|
40 |
GroupID = data.GroupID, |
|
41 |
GroupName = data.GroupName, |
|
42 |
Level = data.Level |
|
43 |
}; |
|
44 |
} |
|
30 |
[DataMember] |
|
31 |
public ID2ProjectInfo ID2Info = null; |
|
45 | 32 |
} |
46 | 33 |
|
47 | 34 |
[DataContract] |
48 | 35 |
public class ID2ProjectInfo |
49 | 36 |
{ |
50 |
[DataMember] |
|
51 | 37 |
public bool Checked { get; set; } = false; |
52 | 38 |
[DataMember] |
53 | 39 |
public int Id { get; set; } |
... | ... | |
66 | 52 |
[DataMember] |
67 | 53 |
public string Path { get; set; } |
68 | 54 |
[DataMember] |
69 |
public string AreaNam { get; set; } |
|
55 |
public string AreaName { get; set; }
|
|
70 | 56 |
[DataMember] |
71 | 57 |
public string PlantName { get; set; } |
72 | 58 |
[DataMember] |
73 | 59 |
public string CreatedDate { get; set; } |
74 | 60 |
[DataMember] |
75 | 61 |
public string UpdatedDate { get; set; } |
62 |
[DataMember] |
|
63 |
public string DBTypeID { get; set; } |
|
64 |
[DataMember] |
|
65 |
public string DBTypeName { get; set; } |
|
66 |
[DataMember] |
|
67 |
public string Host { get; set; } |
|
68 |
[DataMember] |
|
69 |
public string User { get; set; } |
|
70 |
[DataMember] |
|
71 |
public string Password { get; set; } |
|
72 |
[DataMember] |
|
73 |
public string DBPath { get; set; } |
|
76 | 74 |
} |
77 | 75 |
} |
내보내기 Unified diff