개정판 1abdd7c3
issue #0000
프로젝트 정보 수정
ID2Path 는 로컬의 Id2 DB에서 가져오도록 수정
Change-Id: I92a2876b06b0d5e04f92013850601c0def98ce20
ID2.Manager/ID2.Manager.Controller/Controllers/ProjectController.cs | ||
---|---|---|
15 | 15 |
{ |
16 | 16 |
using (ProjectRepository rep = new ProjectRepository(this._DbConnectionStr)) |
17 | 17 |
{ |
18 |
return rep.GetAllProjectList(); |
|
19 |
} |
|
20 |
} |
|
18 |
var id2Project = new ID2Controller().GetID2ProjectList(); |
|
19 |
var allProject = rep.GetAllProjectList(); |
|
21 | 20 |
|
22 |
public IEnumerable<ProjectInfo> GetProjectGroupList() |
|
23 |
{ |
|
24 |
using (ProjectRepository rep = new ProjectRepository(this._DbConnectionStr)) |
|
25 |
{ |
|
26 |
return rep.GetProjectGroupList(); |
|
27 |
} |
|
28 |
} |
|
29 |
|
|
30 |
public IEnumerable<ProjectInfo> GetProjectList(string ProjectID, bool IsGroup) |
|
31 |
{ |
|
32 |
using (ProjectRepository rep = new ProjectRepository(this._DbConnectionStr)) |
|
33 |
{ |
|
34 |
return rep.GetProjectList(ProjectID, IsGroup); |
|
21 |
return from mg in allProject |
|
22 |
join id2 in id2Project on mg.Code equals id2.Name into gj |
|
23 |
from prjs in gj.DefaultIfEmpty() |
|
24 |
select new ProjectInfo() |
|
25 |
{ |
|
26 |
ProjectID = mg.ProjectID, |
|
27 |
Code = mg.Code, |
|
28 |
Name = mg.Name, |
|
29 |
Description = mg.Description, |
|
30 |
ID2Path = prjs?.Path ?? null, |
|
31 |
GroupID = mg.GroupID, |
|
32 |
GroupName = mg.GroupName, |
|
33 |
Level = mg.Level |
|
34 |
}; |
|
35 | 35 |
} |
36 | 36 |
} |
37 | 37 |
|
... | ... | |
39 | 39 |
{ |
40 | 40 |
using (ProjectRepository rep = new ProjectRepository(this._DbConnectionStr)) |
41 | 41 |
{ |
42 |
var id2Project = new ID2Controller().GetID2ProjectList(); |
|
43 |
var project = rep.GetProjectInfo(ProjectID); |
|
44 |
|
|
45 |
var id2 = id2Project.Where(x => x.Name.Equals(project.Code)).FirstOrDefault(); |
|
46 |
if (id2 != null) |
|
47 |
{ |
|
48 |
project.ID2Path = id2.Path; |
|
49 |
} |
|
50 |
|
|
42 | 51 |
return rep.GetProjectInfo(ProjectID); |
43 | 52 |
} |
44 | 53 |
} |
ID2.Manager/ID2.Manager.Dapper/Repository/ID2Repository.cs | ||
---|---|---|
17 | 17 |
public IEnumerable<ID2ProjectInfo> GetID2ProjectList() |
18 | 18 |
{ |
19 | 19 |
string query = $@" |
20 |
SELECT * FROM Projects WHERE ifnull(Name, '') <> '' ORDER BY Id"; |
|
20 |
SELECT p.* |
|
21 |
FROM Projects p |
|
22 |
INNER JOIN ( |
|
23 |
SELECT Min(Id) AS Id, Name |
|
24 |
FROM Projects pg |
|
25 |
WHERE ifnull(Name, '') <> '' |
|
26 |
GROUP BY Name |
|
27 |
) pg ON p.ID=pg.Id |
|
28 |
ORDER BY p.Id;"; |
|
29 |
|
|
21 | 30 |
return Query<ID2ProjectInfo>(query); |
22 | 31 |
} |
23 | 32 |
} |
ID2.Manager/ID2.Manager.Dapper/Repository/ProjectRepository.cs | ||
---|---|---|
45 | 45 |
from prj |
46 | 46 |
order by [Level], [Name];"; |
47 | 47 |
|
48 |
return Query<ProjectInfo>(query); |
|
49 |
} |
|
50 | 48 |
|
51 |
public IEnumerable<ProjectInfo> GetProjectGroupList() |
|
52 |
{ |
|
53 |
string query = $@" |
|
54 |
select ProjectID |
|
55 |
,Code |
|
56 |
,[Name] |
|
57 |
,isnull(Description,'') Description |
|
58 |
,isnull(ID2Path,'') ID2Path |
|
59 |
,isnull(ParentID,'') GroupID |
|
60 |
,convert(varchar(255),'') GroupName |
|
61 |
,1 [Level] |
|
62 |
from dbo.Projects |
|
63 |
where ParentID is null |
|
64 |
order by [Name];"; |
|
65 | 49 |
|
66 | 50 |
return Query<ProjectInfo>(query); |
67 | 51 |
} |
68 | 52 |
|
69 |
public IEnumerable<ProjectInfo> GetProjectList(string ProjectID, bool IsGroup) |
|
70 |
{ |
|
71 |
string query = $@" |
|
72 |
;with Prj as |
|
73 |
( |
|
74 |
select ProjectID |
|
75 |
,Code |
|
76 |
,[Name] |
|
77 |
,isnull(Description,'') Description |
|
78 |
,isnull(ID2Path,'') ID2Path |
|
79 |
,isnull(ParentID,'') GroupID |
|
80 |
,convert(varchar(255),'') GroupName |
|
81 |
,1 [Level] |
|
82 |
from dbo.Projects |
|
83 |
where ParentID is null and ProjectID=@ProjectID |
|
84 |
|
|
85 |
UNION ALL |
|
86 |
|
|
87 |
select p.ProjectID |
|
88 |
,p.Code |
|
89 |
,p.[Name] |
|
90 |
,p.Description |
|
91 |
,p.ID2Path |
|
92 |
,p.ParentID GroupID |
|
93 |
,pp.[Name] GroupName |
|
94 |
,pp.[Level]+1 [Level] |
|
95 |
FROM dbo.Projects p |
|
96 |
inner join Prj pp ON p.ParentID=pp.ProjectID)"; |
|
97 |
if (IsGroup) |
|
98 |
{ |
|
99 |
query += $@" |
|
100 |
select * |
|
101 |
from prj |
|
102 |
order by [Level], [Name];"; |
|
103 |
} |
|
104 |
else |
|
105 |
{ |
|
106 |
query += $@" |
|
107 |
select * |
|
108 |
from prj |
|
109 |
where ProjectID <> @ProjectID |
|
110 |
order by [Level], [Name];"; |
|
111 |
} |
|
112 |
|
|
113 |
return Query<ProjectInfo>(query, new { ProjectID }); |
|
114 |
} |
|
115 |
|
|
116 | 53 |
public ProjectInfo GetProjectInfo(string ProjectID) |
117 | 54 |
{ |
118 | 55 |
string query = $@" |
내보내기 Unified diff